Start a project
Back to work

Letter Automation

An n8n workflow that reads incoming post with AI and files it, tasks it, logs it and acknowledges it — from a scanned PDF to four updated systems without anyone opening the attachment.

Upload to GeminiPOSTRead back from GeminiPOSTShape the record
Fields extracted
17
Triggers
Email · webhook
Systems
4 updated
Per letter
~7s

Post still arrives. Invoices, notices, payment reminders, tax correspondence, letters from courts and authorities. It lands as a scanned PDF, and someone opens it, reads it, works out what it is and how urgent it is, renames it, files it, raises a task for whoever has to act, adds a row to a tracker, and replies to say it arrived.

That loop is the whole job, and it runs once per letter. It is not difficult work, which is exactly why it gets deferred — and deferred post is how a payment deadline gets missed by a fortnight.

This workflow does the loop end to end. A letter arrives, a model reads it and returns a typed record rather than a summary, and four systems are updated before anyone has opened the attachment. What arrives in a person's inbox is not the letter; it is a decision about the letter, colour-coded by how quickly it needs attention, with everything already filed.

It runs on German business correspondence, which is more tractable than it sounds: German letters follow a strongly conventional layout, and the prompt is written around where each field physically sits on the page rather than asking a model to read and hope. The screens here are shown in English for readability.

Intake

Two doors into one pipeline

A mailbox trigger picks up whatever arrives, and a webhook accepts scanned batches pushed from a scanner or another system, so paper that never passes through email still enters the same way. Both are normalised into a single shape before anything downstream runs, which means the extraction, the filing and the reporting are written once rather than twice — and adding a third intake later is a matter of matching that shape rather than duplicating the pipeline again.

Clean OutputGmail Triggeron new mailUpload to GeminiPOSTClean OutputMultiple attachmentsWebhookPOST
Extraction

One scan in, seventeen fields out

The model is handed the PDF and returns a typed record: sender name, full address, email and phone, letter date, category, subject, summary, whether an action is required and which kind, deadline and its status, priority, amount, IBAN, BIC and payment reference, plus any case or customer numbers worth keeping. The prompt describes the anatomy of a German business letter — where the sender sits versus the recipient, where reference numbers appear, how deadlines are usually phrased — so the model is locating fields rather than guessing them. Dates come back in one format and missing values come back null, never invented.

One scan in, seventeen fields out
Judgement

Priority is derived, not guessed

Urgency is a rule applied to extracted values, not a judgement the model is asked to make freehand. A deadline already passed, or a payment reminder or debt-collection notice, is urgent. A deadline inside seven days, or an amount over a thousand euros, is high. Inside thirty days, or anything requiring an action, is medium. No deadline and nothing to do is low, and is filed quietly. Because the rule is explicit it can be argued with and changed, which is not true of a model asked to decide what matters.

Priority is derived, not guessed
Fan-out

Four systems, written in order

The file is renamed from its own contents — date, category, sender and reference — and filed to Drive, so the folder is searchable without opening anything. A task is raised carrying the summary, the deadline and the payment details in a fixed structure, so every task reads the same way regardless of what the letter looked like. A row is appended to the tracking sheet. Only then is the acknowledgement sent, so nothing is ever confirmed to a person before it has actually been stored.

Four systems, written in order
Handling

Attachments are rarely tidy

One letter, several letters in one envelope, mixed file types, a covering email with the actual document attached to a forwarded message, or nothing attached at all. Splitting runs in code before the model is invoked, so a malformed batch fails on the one item that is wrong instead of taking down the run — and, just as importantly, so the expensive step is never called on something that was never a letter in the first place.

Attachments are rarely tidy

Want something like this?

We build internal tools, automation and AI systems like this one. Tell us what you are trying to ship.

Start a project