Dev.to AI 🤖 Ai 👁 0 📖 5 min read

Paperwork Killer: photograph a letter, send it by WhatsApp, and the workflow handles deadline and filing

n8n · WhatsApp · Nextcloud · AI · build it yourself The letter has been on the pile for three weeks. Then the reminder arrives, with fees. Paperwork is rarely hard, it is tedious: read it, classify it, remember the dead

n8n · WhatsApp · Nextcloud · AI · build it yourself

The letter has been on the pile for three weeks. Then the reminder arrives, with fees. Paperwork is rarely hard, it is tedious: read it, classify it, remember the deadline, file it. This workflow does exactly that, and you do not have to learn anything new: photograph the letter, send it to a WhatsApp group, done.

What happens after the photo

  1. Read: an OCR model (LightOnOCR-2 on the IONOS AI Model Hub) reads the photo, even when it is a bit crooked. No Tesseract server needed. PDFs with text work too.
  2. Understand: a language model (Llama 3.3 70B) extracts sender, amount, IBAN, reference and deadline, and writes two sentences on what the sender wants and what to do now.
  3. Check: the model is not trusted blindly. Date and amount must appear in the text that was read, the IBAN must pass the checksum (modulo 97), and deadlines derived from rules are marked estimated.
  4. File: the photo lands in Nextcloud under Papierkram/2026/Rechnungen/, named after date, sender, type and amount. Next to it sits the full text as .txt so Nextcloud search finds the letter.
  5. Remind: the deadline becomes a Nextcloud task with a reminder three days before. Every morning at 8 you get a message if something is due soon.
  6. Answer: the group gets the summary with a traffic light: 🔴 today or overdue, 🟠 within 3 days, 🟡 within 14 days, 🟢 later.

Two commands in the group: /offen lists all open deadlines, /bezahlt 3 ticks off number 3. (The commands and the folder names are German, the replies can be set to German, Italian or English.)

Four runs with made-up letters

  • Electricity bill: €1,042.37, due 3 December 2026, IBAN recognised and validated, filed under invoices. Light 🟡.
  • Second reminder from a collection agency: €87.50, "within 7 days". The date is not in the letter, so the workflow calculates it (letter date plus 7 days) and adds estimated, please check. Light 🟠, risk: court dunning procedure.
  • Tax assessment without a deadline in the text: only the notice of appeal rights ("objection within one month"). The workflow sets letter date plus 33 days and marks it as estimated. That is a rule of thumb, not legal advice.
  • Supermarket flyer: type advertising, "nothing to do", no date, no task. It is still filed so nothing gets lost.

One rule paid off: a utility statement with a credit shows as 💰 +€214.30 instead of a payment. Without it a refund would look like a bill.

Build it yourself

You need n8n, Nextcloud, a server for WAHA and access to an OpenAI-compatible AI API. Setup takes about an hour.

1. Start WAHA

WAHA is an HTTP interface for WhatsApp (the free Core version is enough, it allows one session). WAHA and n8n must run in the same Docker network so they can reach each other by name.

services:
  waha:
    image: devlikeapro/waha:latest
    restart: unless-stopped
    environment:
      WAHA_API_KEY: "<long-random-key>"
      WHATSAPP_DEFAULT_ENGINE: NOWEB
      WHATSAPP_START_SESSION: default
      WHATSAPP_HOOK_URL: http://n8n:5678/webhook/papierkram
      WHATSAPP_HOOK_EVENTS: message.any
      WHATSAPP_DOWNLOAD_MEDIA: "true"
    ports: ["127.0.0.1:3000:3000"]
    volumes: ["./sessions:/app/.sessions"]

2. Pair and create the group

WAHA pairs with your own WhatsApp like a "linked device". For me the QR code was rejected ("could not link device"), the pairing code worked: in WhatsApp Linked devices → Link a device → Link with phone number.

# 1) Pair with a code (the QR code did not work for me)
curl -X POST http://localhost:3000/api/default/auth/request-code \
  -H "X-Api-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"phoneNumber":"49170XXXXXXX"}'

# 2) Create a group just for letters (returns the ID …@g.us)
curl -X POST http://localhost:3000/api/default/groups \
  -H "X-Api-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"name":"📄 Papierkram","participants":[]}'

A group just for letters is handier than the chat with yourself: family members can be added later and everyone sees the same archive. WAHA creates it fine with a single member.

3. Import the workflow

Download the workflow and import it in n8n (menu → Import from File). Create three credentials:

  • AI API (Header Auth): Authorization = Bearer <key>, for example from the IONOS AI Model Hub.
  • WAHA (Header Auth): X-Api-Key = the key from step 1.
  • Nextcloud (Basic Auth): user name and an app password (Settings → Security).

4. Adjust the configuration

Everything important is in the Konfiguration node: wahaUrl, nextcloudUrl, nextcloudUser, erlaubteChats (the group ID from step 2) and the language of the replies (de, it or en). The rest of the workflow stays untouched.

One pitfall: Nextcloud's default calendar personal only accepts events, not tasks. Create a new list "Papierkram" in the Nextcloud Tasks app and enter its name as kalender.

5. Activate and test

Activate the workflow and send a photo to the group. If nothing happens: WAHA must have the event message.any set, otherwise your own messages never arrive. To test without WhatsApp there is an upload webhook: curl -X POST …/webhook/papierkram-upload -H "x-token: …" -F [email protected] (the token is set in the Konfiguration node, without a token the webhook is blocked).

Privacy and limits

  • The text of every letter goes to the AI API you configure. With the IONOS AI Model Hub that is in German data centres. For a fully local setup use your own OpenAI-compatible API (for example Ollama or vLLM). The OCR model has to understand images.
  • WAHA is not an official WhatsApp interface. Automated use may break the terms of service, and in the worst case WhatsApp bans the number. If you do not want that risk, use a separate number just for the bot.
  • Access: the bot only reacts in the chats listed in erlaubteChats. In the group any member may send letters; conversation and other chats are ignored.
  • No legal or tax advice. The model can be wrong, it reads handwriting badly, and estimated deadlines are rules of thumb. Always check important deadlines against the original.

The workflow has 32 nodes and needs no database and no community nodes, only HTTP requests. If you extend it, for example for bookkeeping or receipts from email attachments, you change the nodes Auswerten and Zusatz ablegen.

Originally published at daniele-michelin.com. More guides, free checks (SPF, TLS, headers) and an error-message lexicon: daniele-michelin.com/en/.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.