Urgent.News

What's breaking now, across thousands of outlets.

AI

Let the model read the invoice, not approve it: an n8n pattern for AP automation

Most "AI invoice automation" demos stop at the fun part: a model reads a PDF and spits out JSON. The hard part is what happens next. Who decides the invoice gets paid? What stops a fake "we changed our bank details" email from going straight through? We built an accounts payable workflow in n8n around one rule: the model reads the invoice, code decides what happens to it. The model never approves…

In this article, the author outlines a pattern for automating accounts payable (AP) processes using the n8n workflow platform. The key points are:

1. The model only reads invoice data, never making approval decisions. A separate code node handles routing decisions based on the extracted invoice information.

2. The workflow begins with a Gmail trigger that processes each email containing an attached PDF invoice as a separate execution, ensuring one run per invoice.

3. The PDF is stored in Google Drive, then processed by Claude to convert it into structured JSON fields using a custom extraction prompt.

4. The extracted fields are normalized through functions to account for inconsistencies in vendor names, invoice numbers, and IDs. This helps match the invoice to existing records accurately.

5. The routing logic determines the next steps based on various checks:

- If no holds or notes exist, the invoice either gets auto-approved, requires manual approval in Slack, or is held for further review.

- Holds can be triggered by vendor/sender mismatches, bank detail discrepancies, or phrases indicating potential fraud.

- Arithmetic checks ensure the invoice's subtotal plus tax equals the total, and line items sum correctly.

- Duplicates are identified through vendor, invoice number, and date comparisons.

- PO matches verify that the invoice aligns with an existing purchase order.

6. Approvals are handled via Slack, with automatic approval for small, PO-matched invoices without notes. Larger or more complex invoices require multi-level approvals, ensuring separation of duties between approvers.

7. Held invoices are categorized into three types: fraud risk (alerted to finance), fixable issues (requiring a corrected invoice), or other items needing manual review.

8. Gmail labels reflect the final outcome (approved, held, rejected), effectively turning the AP inbox into a visual status board for the process.

The article emphasizes the importance of separating data extraction from decision-making, handling each invoice as an individual execution, and implementing robust checks to prevent fraudulent or incorrect payments.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

AI Tool Calling: The Model Never Runs Your Code

A customer types one sentence into a food app's support chat: Where is order 4472? Cancel it if no rider is assigned yet. The app checks the order, cancels it, and replies. Here is the strange part.

  • Customer requests order cancellation via food app chat
  • AI model processes request without writing custom code
  • AI uses "tool calling" to delegate execution to app code

The Model Changed. My Skill Didn't. The Score Still Dropped.

What agent evals taught me about moving model floors, noisy LLM judges, and treating the evaluator as part of the instrument My rule for evaluating an agent skill is deliberately asymmetric: Test the…

  • The author emphasizes testing agent skills on the weakest model for consistent measurement.
  • A change in the LLM judge caused a significant drop in scores for the agent.

Zango AI to expand presence in Portugal

UK financial services AI company Zango AI is expanding its presence in Portugal, bringing together senior leaders from some of the country’s largest financial institutions for a new report on how AI…

More from Wednesday 7 October →