How to set up a supplier-invoice approval pipeline from Gmail with n8n
The problem
Supplier invoices arrive by email and each one needs data extraction, duplicate and supplier checks, approval for larger amounts and an accounting entry.
Tools needed
- n8n (queue mode)
- PostgreSQL
- Redis
- Docker
- Gmail
- OCR
- OpenAI
- Slack
Step-by-step recipe
- Run n8n in queue mode with PostgreSQL, Redis and a worker in Docker.
- Create tables for suppliers, invoices and an audit log, and add Gmail, OpenAI, Postgres and Slack credentials.
- Plan the flow: Gmail, then OCR, then AI extraction.
- Then duplicate and supplier checks, classification, and approval routing for high-value invoices.
- Finally create the journal entry and schedule the payment.
Copyable prompt
Classify this supplier invoice for accounts payable. Return JSON:
{"supplier_name": "...", "supplier_vat_id": "..."|null, "invoice_number": "...", "invoice_date": "YYYY-MM-DD", "due_date": "YYYY-MM-DD"|null, "net": number, "tax": number|null, "gross": number, "currency": "...", "expense_category": one of [CATEGORIES], "needs_approval": true if gross > [THRESHOLD]}
Use null when a value is not on the document.
Text: {{ocr_text}}Original template written by AgentRecipes, not copied from the source. Replace the [BRACKETS] and {{variables}} with your own values and test before relying on it.
What the builder reported
This is part 1 of a three-part series and covers the infrastructure only. It ends with the stack and schema running; extraction, validation, approval and accounting are left to later parts. No results yet.
These are the source author's own claims. AgentRecipes has not tested or verified them.
Watch out for
- Queue mode can retry stalled jobs, so every step must be idempotent; duplicate detection is essential.
- Back up the n8n encryption key, or you lose access to stored credentials.
Source
Original write-up: Medium ↗
Found via Agent Use Cases: “Process supplier invoices from Gmail through approval and payment”. This recipe summarises the source in our own words; read the original for the full details. Link last checked 2026-10-15.
More finance & invoicing recipes
New agent recipes in your inbox
A short email with the newest automation recipes, each linked to its real-world source. No spam, unsubscribe anytime.