A build walkthrough of the Invoice Chaser workflow — also published on Dev.to and Hashnode.
A few weeks ago we published the invoice chaser we use ourselves: a Google Sheet of invoices, a daily n8n run, four reminder stages that get firmer as an invoice ages. It worked. Then we sat down and read it the way a client would receive it, and found the flaw in almost every chasing automation, including ours:
The robot treats every row in the sheet as equally true and equally urgent.
A typo'd email address in the sheet? The chaser cheerfully emails a stranger — or dies trying. The same invoice pasted onto two rows during a sheet cleanup? Two final notices. And the client who has paid you on time for two years, who happens to be 15 days late once because their accounts person is on holiday? They get the same day-14 final notice as the client who has never once paid on time. The automation can't tell the difference, because nobody taught it to check anything before it started chasing.
So we rebuilt it. Same four stages, same email templates — but with a safety layer in front of them. The workflow went from 9 working nodes to 21. Here's the build, including the parts worth stealing for any automation that sends email on your behalf.
The daily habit is unchanged: a Google Sheet with nine columns (Invoice ID, Client name, Client email, Amount, Currency, Due date, Status, Reminders sent, Last reminded), one new tab called Chase Log, and a run at 09:00. You add a row when you send an invoice; you flip Status to Paid when the money lands.
What changed is everything between "read the sheet" and "send the email": validate each staged row (bad rows go to the Chase Log and are never emailed), dedupe by invoice ID, route by stage to one of four Gmail nodes, write back only after a successful send, collect the day's high-value final notices into one alert email to you, and log every failed send with its error.
This is the node we now consider non-negotiable in anything that sends email from a spreadsheet. Spreadsheets are typed by humans at 11pm. Humans transpose digits in amounts and paste email addresses with a trailing space, or into the wrong row entirely.
// A staged row is only chased when ALL of these hold:
// - Client email is present and looks like a real address
// - Invoice ID (the invoice number) is present
// - Amount is a number and not negative
// Anything else is written to the Chase Log tab with the reason
// and never reaches Gmail.
const emailRe = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
const reasons = [];
const emailRaw = String(row['Client email'] || '').trim();
if (!emailRaw) reasons.push('Missing customer email');
else if (!emailRe.test(emailRaw)) reasons.push('Customer email format looks invalid: ' + emailRaw);
if (!String(row['Invoice ID'] || '').trim()) reasons.push('Missing invoice number (Invoice ID)');
const amount = parseFloat(String(row['Amount'] ?? '').replace(/[^0-9.\-]/g, ''));
if (isNaN(amount)) reasons.push('Amount is not a number');
else if (amount < 0) reasons.push('Amount is negative');
row.valid = reasons.length === 0;
row.invalid_reason = reasons.join('; ');
Two details matter. First, the amount parse strips currency symbols and commas, so $1,280.00 and 1280 both pass — the check is for garbage, not formatting pedantry. Second, a failed row isn't dropped silently: it's appended to the Chase Log with every reason found ("Customer email format looks invalid: david@northpeak" — you can see the missing .com immediately). Fix the row and the next daily run picks it up again. The log is the workflow's way of saying "these ones need a human."
Sheets accrete duplicate rows — a copy-paste during cleanup, an import that ran twice. In v1, a duplicated invoice got chased twice, which is exactly the kind of thing that makes a good client feel harassed by a robot. The dedupe node groups staged rows by Invoice ID within the run: the first row in sheet order is chased; every later row with the same number is logged as a duplicate and skipped. One invoice number gets at most one chase email per stage per day, no matter how messy the sheet gets.
| Stage | Sent when | Tone |
|---|---|---|
pre | Due date is exactly 3 days away | Friendly heads-up |
due | On the due date | Neutral, helpful |
overdue7 | Exactly 7 days overdue | Firmer, asks for a date |
final | 14+ days overdue | Final notice |
The guards still apply: only Status = Unpaid rows are ever considered (park a row as On hold or Disputed and it will never be chased), a maximum of 4 reminders per invoice, and at least 3 days between reminders so a manual re-run can't double-send.
The final notice is the email most likely to damage a relationship, and in v1 it just… went out. The obvious fix — email the owner every time — creates alert fatigue by Thursday. So the escalation collects instead: after the sends, one node gathers the day's final notices at or above a threshold (one constant, OWNER_ALERT_THRESHOLD = 500 — set it to whatever "big enough that I'd want to know" means in your business) and sends a single digest: invoice number, client, amount, due date, days overdue. The $80 invoice from the chronically late client still gets its final notice from the sequence. But the $2,100 final notice to the client who's never been late before lands in your inbox the same morning, while you can still pick up the phone and have the "is everything OK?" conversation instead of letting the robot have it.
Every Gmail node is set to continue on error. A failed send is appended to the Chase Log with the Gmail error message, and the invoice row is not marked as chased, because the write-back only runs after a successful send. One interaction worth knowing: the final stage covers every day from day 14 onward, so a failed final notice retries naturally on the next run. The exact-day stages can't retry — their day has passed — so a Chase Log entry for one of those is your cue to chase that one by hand. We'd rather say that here than let you discover it.
Paid and it will chase someone who has paid. The automation removes the writing-and-remembering work, not the two-second status update.The packaged version — the v2 workflow file, the sheet template, all four email templates in full, and a setup guide with the testing checklist — is the Invoice Chaser, $19 (also in n8n's official template library). Free workflows to borrow from live in our GitHub repository. And if you'd rather have a workflow like this built around your own invoicing setup, that's the Custom n8n Workflow Build — $99.
Either way: check your rows before you chase them. Your best clients will never know you did — which is rather the point.