Let the model read the invoice, not approve it: an n8n pattern for AP automation
Описание и применение
Модель извлекает данные из счета, но не принимает решения о платеже. Рабочий процесс в n8n проверяет данные, применяет правила и направляет счета на автоматическое одобрение, ручное утверждение в Slack или удержание с объяснением.
Задача
Automating accounts payable requires decisions beyond invoice extraction; models should not approve invoices, and fraud or errors must be caught before payment.
Результат
The pattern separates extraction from decision logic, normalises data, applies comprehensive checks (vendor, bank, arithmetic, duplicates, PO), and routes invoices appropriately, improving accuracy and auditability.
Рабочий процесс
- Trigger on Gmail email with PDF
- Execute workflow per email
- Store PDF in Google Drive
- Claude call to extract JSON with fixed schema and confidence
- Code node normalises fields and runs checks
- Route to auto_approve, approve, or hold
- Create QuickBooks bill for approved invoices
- Send Slack message for approvals or holds
- Log all actions in Google Sheet
- Label Gmail thread with status
Доказательства
The model never approves anything. This post walks through the pattern, with the actual checks we run.
If one batch run handles five invoices and the third one throws, you get a half-processed mess. One execution per invoice means one red run you can retry.
The extraction prompt asks for a fixed schema: vendor name, tax ID, invoice number, dates, currency, subtotal, tax, total, PO number, bank details, line items, plus two fields that do a lot of work: is_invoice and confidence.
We also run a regex over the email body and the model's notes for phrases like "updated bank details" or "remit to our new account".
- Дата записи: 2026-10-07T10:41:02.617Z