AI Invoice Processing with PO Match and Fraud Checks in n8n by Dmitri KharitonovAI Invoice Processing with PO Match and Fraud Checks in n8n by Dmitri Kharitonov

AI Invoice Processing with PO Match and Fraud Checks in n8n

Portfolio project
Dmitri Kharitonov
The problem. In a lot of finance teams people still type supplier invoices in by hand, check totals with a calculator and spot duplicates from memory. That is how double payments, wrong tax and changed bank details get through.
What I built. An accounts payable pipeline in n8n, 7 workflows in total.
Intake: a dedicated mailbox label plus an HMAC-signed upload endpoint. It accepts PDFs, scans and phone photos. Small images like logos in email signatures are skipped.
Duplicates: every file gets a SHA-256 hash, and the vendor tax ID plus invoice number are normalized, so "LS-2026-1187" and "ls 2026 1187" count as the same invoice.
Extraction: one multimodal AI call returns a strict JSON schema with a confidence score for every field. The schema has no fields for decisions, so the AI only reads.
Checks in code: line items plus tax must equal the total to the cent, the vendor must be on the approved list, the IBAN must match the verified one (checksum included), and the PO must exist and stay within budget with a 5% tolerance.
Routing: confident, clean invoices under €1,500 are posted automatically. Everything else goes to a Telegram approval card with Approve, Reject and Freeze vendor buttons. That includes math errors, changed bank details, unknown vendors, budget overruns, negative amounts, 0% tax, foreign currency and low confidence.
Posting: the PO budget is updated, a note is added to the related CRM deal, and the file is saved under a normalized name.
Fraud and security.
The payment record always uses the verified IBAN on file. A new IBAN on an invoice cannot replace it, neither by a button nor by the AI.
Invoices from unknown vendors can only be rejected. New vendors are onboarded separately.
Instructions hidden in a PDF (white text, metadata, file name, email subject, in English or German) are treated as data, and a separate check without AI scans the PDF text layer. In tests they never changed a decision.
Every action (who, when, file hash) goes into an audit log where each row is chained to the previous one by a hash, and the chain is verified every night.
Only clicks from authorized people count. Webhooks use secrets, uploads are signed and rate limited, and full IBANs are masked in the ledger, the audit log, approval cards and CRM notes.
Tested. A set of forged and edge case invoices (scan, crooked photo, math error, changed IBAN, hidden instructions, duplicates, unknown vendor, over budget, credit note, a 46-line invoice, €1,499.99 vs €1,500.00, +5.00% vs +5.01% budget), an independent QA run, a security review and live approvals in Telegram.
Stack: n8n, a multimodal AI model (provider-agnostic), HubSpot for CRM notes, Telegram Bot API, IMAP/SMTP.

0 likes · 0 views · Nov 16, 2026

AI reads invoices into strict JSON. Code checks the math, duplicates, PO budget and IBAN. Anything suspicious goes to Telegram for approval.

Tags