Skip to content
GUIDES#Google Apps Script#n8n#credit card alerts

Automatic Daily Spending Summary: From Credit Alerts to an Evening Message with Google Apps Script and n8n

Every card transaction already sends a notification to your phone. All that's missing is something to collect them, add them up, skip the big purchase, and send you one line each evening. A free script inside your Google account does exactly that, with no spreadsheet and no paid app.

Yaakov Tzedek
Yaakov Tzedek · AI expert·9 min read
THE BOTTOM LINE
  • Turn credit card alerts into an automatic 24-hour spending summary delivered every evening at 9 PM, free, with Google Apps Script and n8n, including large-purchase exclusions.

To get a nightly summary of the past 24 hours of spending, you build a short pipeline: every credit alert that arrives on your phone is automatically sent to a free Google Apps Script, which extracts the amount and stores it. Once a day the script totals the transactions, skips any purchases you have flagged as exceptions or that exceeded a threshold you set, and sends you a single message. No spreadsheet, no paid app, no scrolling through transaction history.

A question came up recently in a Facebook AI group: how do you know every evening how much you spent today, without clicks, without spreadsheets, and without sitting in front of your wallet's transaction history with a calculator. The answer is surprisingly simple. The data is already coming to you. Every transaction sends a notification. All that is missing is something to collect them.

In short

QuestionShort answer
Where does the data come from?From the transaction alerts already arriving on your phone: SMS from the credit company or a push notification from the wallet app.
Who collects them?On iPhone: an automation in the Shortcuts app. On Android: MacroDroid.
Who does the calculation?A script in Google Apps Script, in your own Google account.
Who sends the summary?The script itself by email, or n8n to Telegram at a precise time.
How do you exclude a large purchase?An automatic threshold, plus a one-tap shortcut that marks the last transaction.
What does it cost?Zero, if you stay within Apps Script and a self-hosted n8n installation.

How it works: three stations

The system is built from three stations, each with exactly one job. Once you understand the division, any problem is easy to fix.

  1. The phone captures. A transaction alert arrives, and an automation on the phone sends its text to a private web address.
  2. The script stores. Apps Script receives the text, finds the amount in it, and saves it to the script's internal storage. There is no spreadsheet and no table you need to open.
  3. The summary goes out. Once a day, at the time you set, the script totals everything that came in over the last 24 hours and sends you a single line.

One important point before you start: do not rely on email from your credit company without checking first. I found no official confirmation that Israeli credit companies send email for every transaction individually. The notifications that are documented are SMS and push through the app. That is why this guide starts from the phone, where the alert definitely arrives. Check the personal area of your credit company to make sure transaction alerts are turned on.

Step 1: The script that receives, stores, and summarizes

This is the only part that requires copying code, and you do it once. Open script.google.com, create a new project, and paste the following:

const SECRET = 'replace-with-a-long-random-string';
const BIG = 500; // a transaction above this amount is shown separately and not counted

function doPost(e) {
  const body = JSON.parse(e.postData.contents);
  if (body.secret !== SECRET) return ContentService.createTextOutput('forbidden');
  const lock = LockService.getScriptLock();
  lock.waitLock(10000);
  const props = PropertiesService.getScriptProperties();
  const list = JSON.parse(props.getProperty('tx') || '[]');
  if (body.action === 'skip') {
    if (list.length) list[list.length - 1].skip = true;
  } else {
    const amount = parseAmount(body.text);
    if (amount !== null) list.push({ t: Date.now(), amount: amount, note: String(body.text).slice(0, 60) });
  }
  const keepFrom = Date.now() - 48 * 3600 * 1000;
  props.setProperty('tx', JSON.stringify(list.filter(x => x.t > keepFrom)));
  lock.releaseLock();
  return ContentService.createTextOutput('ok');
}

function parseAmount(text) {
  const s = String(text);
  const m = s.match(/(\d[\d,]*(?:\.\d{1,2})?)\s*(?:₪|ש"ח|ש״ח|ILS)/) ||
            s.match(/(?:₪|ILS)\s*(\d[\d,]*(?:\.\d{1,2})?)/);
  if (!m) return null;
  const amount = Number(m[1].replace(/,/g, ''));
  return /זיכוי|החזר/.test(s) ? -amount : amount;
}

function buildSummary() {
  const list = JSON.parse(PropertiesService.getScriptProperties().getProperty('tx') || '[]');
  const since = Date.now() - 24 * 3600 * 1000;
  const recent = list.filter(x => x.t > since);
  const counted = recent.filter(x => !x.skip && x.amount <= BIG);
  const excluded = recent.filter(x => x.skip || x.amount > BIG);
  const total = counted.reduce((sum, x) => sum + x.amount, 0);
  let msg = 'In the last 24 hours: ' + total.toFixed(2) + ' ILS across ' + counted.length + ' transactions.';
  if (excluded.length) msg += '\nNot counted: ' + excluded.map(x => x.amount + ' ILS').join(', ');
  return msg;
}

function dailySummary() {
  MailApp.sendEmail(Session.getEffectiveUser().getEmail(), 'How much did I spend today', buildSummary());
}

function doGet(e) {
  if (e.parameter.secret !== SECRET) return ContentService.createTextOutput('forbidden');
  return ContentService.createTextOutput(buildSummary());
}

Then four quick steps:

  1. Change SECRET to a long string that only you know. Without it, anyone who discovers the URL can send amounts to the script.
  2. Set the time zone. In the project settings, select Asia/Jerusalem, otherwise "21:00" will fire in a different timezone.
  3. Deploy as a web app. Following Google's documentation (checked on 2026-10-05), click Deploy, then New deployment, then Web app. Set the script to run as you (Execute as me) and set access to Anyone. The secret string is the guard. Copy the URL you receive.
  4. Add a daily trigger. In the Triggers menu, select the dailySummary function, type Time-driven, timer Daily, and a window of 21:00 to 22:00.

Two notes that save an hour of troubleshooting. First: every code change requires deploying a new version (Manage deployments, then New version), otherwise the URL keeps running the old code. Second: the pattern that extracts the amount is a starting point, not gospel. Notification wording varies from one company to another, so send the script one real notification from your own account and verify that the amount is captured correctly before you rely on it.

Step 2: The phone sends every transaction to the script

On iPhone: a "Message" automation in Shortcuts

According to Apple's official guide (checked on 2026-10-05), "Message" is one of the triggers that a personal automation can respond to, and some automations can run without asking for confirmation.

  1. Open Shortcuts, go to the Automation tab, and create a new automation of type Message.
  2. Select the sender for your credit company. If it does not appear in the list, use a "Message contains" condition with a word that appears in every transaction alert you receive.
  3. Enable Run Immediately.
  4. Add a Get Contents of URL action: paste the URL from the previous step, method POST, body type JSON, with two fields: secret containing your secret string, and text containing the message body.

Apple also has a trigger called Transaction that responds to a payment from the wallet. Note that it only sees payments from the wallet, not a purchase on a website or a swipe of a physical card. The SMS from the credit company sees all of them.

On Android: MacroDroid

According to the app's page on Google Play (checked on 2026-10-05), the free version allows up to 5 macros and shows ads. Two are enough for this process.

  1. Create a macro with an SMS Received trigger from your credit company's sender. If you pay through Google Wallet, you can use a Notification Received trigger instead and filter by app.
  2. Add an HTTP Request action: method POST, the script URL, and a JSON body with secret and the variable that holds the message text.
  3. Send yourself a test and confirm that the script returns ok.

The most common trap: the same purchase can arrive both as a notification from the wallet and as an SMS from the credit company. If both sources are connected, every purchase will be counted twice and the total will silently double. One source per card, always.

Step 3: Excluding a large purchase

The original question asked how to exclude "a specific expense," and there are two answers that complement each other.

Automatic exclusion, no tap required. The BIG variable at the top of the code sets a threshold. Any transaction above it is not included in the daily total, but it does appear in a separate "Not counted" line so it does not vanish from view. You choose the threshold based on your own habits; the 500 in the code is just an example.

Manual exclusion, with one tap. Sometimes the exceptional purchase is actually small: a gift, a payment you will get back from a friend, a work expense. For this you build a second shortcut, with no trigger, that sends the following body to the same URL:

{ "secret": "your-secret-string", "action": "skip" }

On iPhone, add it to your home screen. On Android, create a second macro triggered from a shortcut. After the exceptional purchase, tap once and the script marks the last transaction as "do not count." The code also handles refunds: a message containing the words "זיכוי" or "החזר" (credit or refund) is recorded as a negative amount and reduces the total. Here too, verify this against the actual wording of your credit company's notifications.

Step 4 (Optional): n8n for Exact Timing and Telegram

The Apps Script daily trigger is convenient, but it is not a Swiss watch. According to the Google ClockTriggerBuilder documentation (checked 2026-10-05), a trigger set for a specific hour runs at some point within that hour. In practice, the summary will arrive somewhere between 21:00 and 22:00, usually around the same minute each day.

If you want exactly 21:00, or you prefer to receive the summary on Telegram, you can let n8n own the scheduling. The script keeps collecting and calculating; n8n just asks for the result and sends it:

  1. Schedule Trigger. According to the n8n documentation (checked 2026-10-05), you choose a day interval and set the hour and minute. The node uses the Workflow's time zone, or the server's time zone if none is configured. Set it to Asia/Jerusalem.
  2. HTTP Request. A GET request to the script's URL, with the secret in the URL parameter. The script returns the summary line.
  3. Telegram. Send the response to yourself via a bot you create through BotFather, per the Telegram documentation.
  4. Publish. The n8n documentation notes that a Workflow starting with a Schedule Trigger must be saved and published, otherwise it will not run.

Once you move the sending to n8n, delete the daily trigger in Apps Script so you do not receive two summaries. A full explanation of the tool itself is in the complete n8n guide.

Which path is right for you?

Apps Script aloneApps Script and n8n
Who schedulesGoogle daily triggern8n Schedule Trigger
Timing precisionWithin a one-hour windowThe exact hour and minute you set
Where the summary goesEmailTelegram, email, or any channel n8n connects
What you need to maintainJust a Google accountAlso a running n8n server, or a cloud subscription
CostFreeFree for self-hosting, paid in the cloud
Best forAlmost everyoneAnyone already running n8n

On the cost of n8n: according to the pricing page (checked 2026-10-05), the community edition is free for self-hosting, and the cloud Starter plan costs 20 euros per month on annual billing. If you do not already have n8n running, do not start here. Apps Script alone answers the question fully.

Limitations Worth Knowing

Everything here is free, but not without limits, and it is good to know them upfront. According to the Apps Script quotas page (checked 2026-10-05), on a regular Google account:

  • Emails: up to 100 recipients per day. One summary a day is nowhere near the limit.
  • Trigger runtime: up to 90 minutes total per day. The summary runs in seconds.
  • Internal storage: up to 9 KB per value and up to 500 KB for all storage combined. Because of this limit, the code retains only the last 48 hours of data, and each transaction takes up a short row.

There is also a non-technical limitation: the phone must be connected to the internet when the notification arrives. A transaction whose notification came while the phone was off or without signal will not be sent to the script. The summary is a daily awareness tool, not a replacement for your monthly billing statement.

Privacy: What Gets Stored and Where

Notifications are stored in the script's internal storage, within your Google account, and nowhere else. Three habits keep it clean:

  • A long secret string that does not appear in any screenshot you have shared.
  • Minimum data. The code stores only 60 characters from the message. You can trim that further, or store only the amount.
  • Rolling deletion. The code deletes each transaction after 48 hours, so no history accumulates.

Anyone who wants to extend this idea to more processes at home or in a business will find the principles in the strategic guide to business automation. And anyone working with Claude Code can reach a similar result through scheduled tasks in Claude Code.

The Bottom Line

The question sounded like a request for an app. In practice it was a request for a connection. The notifications are already arriving, the clock already exists, and the account is already yours. All that was missing was one script to connect them and two taps on the phone.

What is worth taking from this is short. One source per card, to avoid double-counting. An automatic threshold for large purchases, and one button for small overruns. And one test with a real notification of yours before trusting the number.

Want to learn how to build workflows like this in n8n step by step, including scheduling, connecting to services, and sending messages? There is an n8n (n8n) 2026 course: automation and AI agents running in production, for 9.90 ILS.

Sources

Frequently asked questions

Was this article helpful?
Share:WhatsAppLinkedInX
Yaakov Tzedek
WRITTEN BY

Yaakov Tzedek

An Israeli AI lecturer, consultant and implementer who has supported 100+ organizations in AI implementation and lectured for 200+. Official content partner of Meta, Google, Canva and TikTok, featured on Israel's Channel 13.

More about Yaakov →