PO-backed invoices auto-posted in under 90 seconds

Key Takeaways
- Fast wins where risk is lowest: Auto-post only PO-backed invoices that pass 3-way match within tolerance.
- Controls built-in: Duplicate check, vendor validation, line-level math, tolerance bands, complete audit trail.
- Human time where it counts: Exceptions land in Slack with context so approvers don’t dig.
- Ready to scale: The same spine powers non-PO routing, early-pay discount checks, and vendor scorecards.
Why this matters
Most AP teams still swivel-chair between inboxes, spreadsheets, and ERP screens. PO-backed invoices are the safest on-ramp to “zero-touch” because the PO encodes intent and the receipt encodes reality. When the math lines up, we post; when it doesn’t, we surface the discrepancy with all the breadcrumbs. The result: faster closes, fewer fires, happier vendors.
Architecture at a glance
- Intake: New emails to invoices@ (PDFs) land in n8n.
- Extraction: OCR pulls header + line-item fields (vendor, PO, dates, totals, taxes).
- Validation & Match: Hit ERP APIs for PO and receipts; compare quantities, prices, tax, freight.
- Decision: If within tolerance → auto-post vendor bill. Else → push to AP-Exceptions sheet + Slack.
- Controls: Duplicate check by vendor+invoice# + total; vendor must be active; values within configured bands.
- Audit: Persist raw OCR, normalized JSON, match diffs, and posting response IDs.
Step-by-step
- Email capture & attachment explosion
- Watch invoices@ and split each attachment into its own item. Keep the original message ID as a trace key.
- OCR & normalization
- Send PDFs to your OCR of choice (or skip if the PDF is machine-readable).
- Normalize into a canonical AP schema, for example: vendorId, vendorName, invoiceNumber, invoiceDate, dueDate, currency, poNumber, subtotal, tax, freight, total, lineItems.
- Sanity checks
- Ensure currency and total math reconcile.
- Block obvious duplicates (vendorId + invoiceNumber + total).
- Validate vendor is active and not on hold.
- 3-way match
- Pull PO and receipt lines; key on (PO, line#, item/sku).
- Compare quantities and prices; compute variance and tolerance per policy (e.g., 2% or $50, whichever is lower).
- Aggregate variances to a match score.
- Post or route
- Match passes: Create vendor bill in ERP; attach original PDF; tag with source=n8n-ap-mvp.
- Match fails: Append to AP-Exceptions (sheet or DB) and notify Slack with the mismatch summary + invoice PDF link.
- Telemetry & audit
- Persist every decision point (raw OCR, normalized JSON, variance calc, ERP response). You’ll thank yourself at month-end.
- Persist every decision point (raw OCR, normalized JSON, variance calc, ERP response). You’ll thank yourself at month-end.
Controls, risk, and audit
- Duplicate detection: vendorId + invoiceNumber (+ total) hash.
- Tolerance policy: separate materiality for price vs. qty; configurable per vendor class.
- Segregation of duties: no auto-post for new vendors or non-PO invoices.
- Retention: store OCR + normalized JSON + posting ID for ≥ 7 years (follow your policy).
What to measure (wire these into logs/metrics)
- % invoices auto-posted vs. total (goal: >60% for PO-backed).
- Cycle time (first seen → posted).
- Exception rate and top 5 causes.
- Duplicate attempts blocked.
- Early-pay discount capture (if enabled).
- Aging impact (invoices stuck in exceptions >48h).