How We Built a Bank SMS Auto-Accounting System

A full walkthrough of the n8n pipeline, the parsing logic, the reconciliation rules and the GPT agent that answers questions by voice.
The client ran a growing retail business across three bank accounts and two payment gateways. Every month-end meant an evening of scrolling through SMS messages and typing numbers into a spreadsheet — roughly twelve hours of work, and a running disagreement about which figures were correct.
The requirement
Every incoming transaction should be recorded automatically within a minute, categorised, reconciled against the gateway settlements, and queryable in plain English — including by voice note, because the owner is usually driving.
Step 1 — Capture
An always-on Android device with an SMS forwarding app posts every bank message to an n8n webhook as JSON: sender, body, timestamp. It is the least glamorous part of the system and the one that had to be made bulletproof, with a heartbeat check that alerts if no message arrives from a normally busy account within twelve hours.
Step 2 — Parsing
Each bank formats its SMS differently, and the same bank changes format without warning. We wrote one regex-based parser per bank that extracts amount, direction (debit or credit), balance, counterparty and date. When a message does not match any known pattern, it goes to a fallback: a language model prompted to return strict JSON, plus a flag marking the row as machine-guessed.
That fallback is important. The naive design — send everything to the model — is slower, more expensive, and less deterministic than regex on the 95% of messages that follow a known shape.
Step 3 — Normalisation and deduplication
Amounts arrive with different thousand separators and inconsistent currency formatting (comma vs period decimals). Everything is normalised to a single integer in euro cents. Each transaction gets a hash of account plus amount plus timestamp so that a message re-delivered by the phone never creates a duplicate row.
Step 4 — Categorisation
Categorisation is rules-first: a lookup table of known counterparties maps directly to a category. Anything unmatched goes to a model with the last twenty categorised examples as context, and its output is written with a confidence field. Rows below the confidence threshold appear in a weekly review sheet where a human corrects them — and every correction is added to the lookup table, so the rule set gets better and the model gets used less over time.
Step 5 — Reconciliation
Gateway settlements arrive as a daily batch that rarely matches individual transactions one-to-one because of fees and grouping. A matching routine pairs settlement batches with transaction groups within a tolerance window, and unmatched items surface in a dedicated tab rather than being quietly absorbed.
Step 6 — Storage and reporting
Every transaction becomes one row in Google Sheets — deliberately, because the client's accountant already lives there. A scheduled workflow pushes a daily digest to Telegram: total in, total out, top three categories, and any flagged rows needing review.
Step 7 — The question-answering agent
On top sits a GPT-4o-mini agent in a Telegram bot. It receives text or voice notes; voice is transcribed with Whisper. The agent does not see the whole ledger — it has tools to query the sheet by date range, category or counterparty, and it answers from the returned rows only.
"How much did we spend on packaging last month?" becomes a filtered query, a sum, and a one-line answer with the row count so the owner can verify it.
What broke in production
One bank silently changed its SMS wording, which the fallback caught but flagged 40 rows for review in a day — the alert on flag volume is what surfaced it.
The forwarding phone lost connectivity for six hours; the heartbeat check caught it, and a backfill run re-imported from the phone's local log.
Early on, decimal handling on differently formatted EUR messages produced a factor-of-ten error. Now every parser is covered by a fixture test with real historical messages.
Results
Month-end reconciliation went from about twelve hours to under thirty minutes of reviewing flagged rows. Categorisation accuracy sits above 97% without human input. And the owner gets an answer to a financial question in ten seconds from a voice note, which turned out to be the feature that made the system actually get used.
The lesson
The AI is the smallest part of this system. Reliable capture, deterministic parsing, deduplication, monitoring and a human review path are what make it trustworthy. The model is a convenience layer on top of a boring, well-engineered pipeline — and it should be.