Extracting invoices from Gmail with n8n and Gemini, then checking the IBAN before anyone pays it
Описание и применение
Автоматизация обработки счетов из Gmail с использованием n8n и Gemini, дополненная проверкой IBAN через Cloudflare Worker, обеспечивает надёжное извлечение данных и предотвращает платежи по неверным банковским реквизитам.
Задача
LLMs can extract invoice data but may misread IBANs, leading to payment errors.
Результат
Invoices are reliably extracted, mathematically validated, and IBANs are checked before payment, reducing risk of incorrect payments.
Рабочий процесс
- Gmail Trigger polls unread emails labeled 'invoices' with PDF attachments
- Split PDF Attachments creates one item per PDF
- Extract From File reads PDF text layer
- Gemini + Structured Output Parser returns strict JSON with vendor, invoice number, PO number, dates, currency, subtotal, tax, total, line items and confidence
- Normalize Invoice cleans numbers, checks subtotal+tax=total, marks low-confidence rows as 'needs_review'
- Google Sheets appends row and marks email read
- HTTP Request node posts batch of identifiers to validation API
- API returns validation results; rows with valid=false or checked=false are flagged for review
Доказательства
Most invoice automations stop at extraction: an LLM pulls the vendor, total and bank details out of a PDF, and the numbers go straight into a spreadsheet or ledger.
Extraction confidence doesn't tell you whether an IBAN is real. The ISO 13616 mod-97 checksum does.
Up to 50 identifiers per batch request.
- Дата записи: 2026-10-18T17:56:14.481Z