n8n automation
AI Invoice Processing & Audit Agent - n8n Automation
- n8n
- 4 workflows
An n8n automation that reads supplier invoices from email or Google Drive, pulls out the details with AI, and runs the checks a bookkeeper would run. Clean invoices go straight through. Anything suspicious goes to a reviewer with the reasons spelled out and one-click Approve / Reject buttons. Nothing disappears silently.
Tested with 19 sample invoices I generated, each with a known expected result. Every screenshot uses sample (demo) data.
The problem
Accounts payable teams get invoices as PDFs and photos, by email and through shared folders. Someone has to type each one in, then check it: does the math add up, is the vendor approved, does it match the purchase order, have we paid it already? It's slow, repetitive work, and the mistakes that slip through (duplicate payments, wrong totals, unknown vendors) cost real money.
What it saves
- About 6 minutes of manual entry per invoice (estimate). Only problem invoices reach a person.
- Catches costly mistakes before payment: wrong totals, duplicates, unknown vendors, purchase order mismatches and invoices over the approval limit.
- Built to never lose an invoice: every AI, Gmail, Drive and database step retries 3 times; an unreadable file or an AI failure is flagged, not dropped; a sweep every 15 minutes picks up any file a trigger missed; and a separate crash-alert workflow emails me and logs the error if anything fails.
What it does
- Picks up invoices from a Gmail label and from a Google Drive folder. One email with several attachments becomes several invoices, and tiny logos in email signatures are skipped.
- Reads text PDFs directly and sends scanned PDFs and photos to the AI as images (OpenAI here; OpenRouter or any other LLM also works). The AI returns vendor, invoice number, dates, currency, PO number, line items, subtotal, tax, total and a confidence score for each field.
- Cleans the data: dates in one format, amounts as numbers, trimmed vendor names, USD by default.
- Runs the bookkeeper checks: required fields; line items vs subtotal; subtotal + tax vs total; due date before invoice date; duplicates; vendor on the approved list, with fuzzy matching so "ACME Corp." matches "Acme Corporation"; purchase order exists, belongs to the vendor and is within 2%; over the $5,000 approval limit; low AI confidence; and the AI's total and invoice number must actually appear in the PDF text.
- Saves every invoice to Supabase, moves the file to "Processed" or "Needs Review", and labels the email.
- Sends each flagged invoice to a reviewer by email with Approve / Reject buttons, and saves the decision and the time.
- Sends a weekly report email every Monday at 8 AM (Manila time), with a short AI-written summary.
What I saw when I tested it
- 19 sample invoices, 19 correct results: 8 clean (including a scanned photo and the "ACME Corp." spelling), 10 flagged with exactly the planted problem, and 1 email-signature logo skipped.
- Invoice 09 was flagged "Subtotal + tax = $640.00, but the total says $690.00". Invoice 16 was flagged "Total $1,180.00 is 18.0% off PO amount $1,000.00".
- An invoice sent by email went all the way through: copied to Drive, read, passed every check, moved to "Processed", and the email was labeled "Invoice-Processed".
- Approve and Reject from the review email both saved the decision and the time. The crash alert and the weekly report email were both tested.
Built with
Screenshots

The main workflow: Gmail and Google Drive in, AI extraction, bookkeeper checks, save, then clean or flagged. 
Weekly Report workflow: pulls the numbers from Supabase, compares them with last week and emails the report. 
A flagged invoice goes to a reviewer with the reasons spelled out and one-click Approve / Reject. 
Every Monday: invoices processed, clean rate, total amount, top flag reasons and hours saved, with a short AI summary. 
Every invoice is saved with its status and the exact reason it was flagged. 
Files are moved to Processed or Needs Review, so nothing disappears. 
Review Request workflow: one run per flagged invoice, so every review waits on its own. 
Crash Alerts workflow: logs every failure to Supabase and emails me right away. 
If any workflow fails, an alert email shows which step failed and why.