Flowgrammer

n8n Invoice Automation

Hash the invoice, wait for a person, and write one draft. No payment.

— Craig Major

Direct answer

An n8n invoice workflow takes a labelled-text invoice, hashes the source bytes, and stops a duplicate on SHA-256 or vendor plus invoice number before anyone reviews it. Extract From File is not OCR. A named person must approve before a draft accounting handoff. The destination writes once. A timeout retries the same idempotency key. Payment, bank, and force-post stay blocked.

Use this page when n8n already hosts document intake and the job is supplier invoices to a reviewed draft. Start with Invoice Processing Automation for the shared control plane, or n8n Document Processing Workflow for the generic labelled-text starter. QuickBooks mapping lives on QuickBooks Invoice Processing Automation.

Who this is for

Use this when you already run n8n Cloud or self-hosted n8n, you have one invoice intake channel, and a named reviewer can approve or reject.

Prerequisites:

  • One n8n instance you already operate
  • A destination that can create a draft and honour an Idempotency-Key header or an equivalent lookup
  • A duplicate store larger than a demo Data Table when volume grows
  • Fictional or approved files before any live write

This page does not replace Invoice Tracker. A status register is a different job.

Extract From File is not OCR

Official n8n docs describe Extract From File as a format extract: supported binaries, including a text-layer PDF, become JSON for later nodes. That is not a scan-OCR product. An image-only PDF needs an external adapter. Information Extractor structures text that already exists. It is also not OCR.

The five fixtures in the paired package are labelled text reused from the live Invoice Processing Test Pack. They prove workflow gates. They do not measure OCR accuracy.

Worked example

Cedar and Quay Fabrication Ltd is a fictional Toronto buyer. Ridgemont Industrial Supply Co sends INV-TP-2401 dated 8 September 2026. Safety vests, clipboards, and fastener bins. Subtotal CAD 400.00, HST CAD 52.00, total CAD 452.00. Purchase order PO-CQ-188.

The invoice workflow hashes the source bytes with the official Crypto node. It also builds a business key from normalized vendor plus invoice number. Validation passes. Status becomes pending_review. Avery Chen, the named human gate, approves in Slack Approvals or by posting decision=approve to a Wait resume URL. One draft accounting handoff is written. write_count is 1.

If the same bytes arrive again as the duplicate fixture, the workflow stops. Review does not open. The destination is not called.

If the destination writes INV-TP-2405 and then loses its response, the retry uses the same idempotency key. Attempts can be 2. Writes stay 1.

Those companies and amounts are fictional. They are not customer results.

Workflow

  1. Intake. Manual Trigger for fixtures, or a Webhook that accepts labelled-text JSON. Form, Gmail, Drive, and similar sources are later swaps. The default does not read Raw body or binaries.
  2. File check. Allow text/plain and .txt in the offline harness. A later Extract From File swap can accept a text-layer PDF. Image-only files fail closed unless you add an OCR adapter.
  3. Duplicate check. SHA-256 of source bytes, plus normalize(vendor)|invoice_no when the number exists. Either hit becomes duplicate. Review is skipped.
  4. Extract. Default Code parses labelled text. That adapter is not OCR. Swap Extract From File only for a text-layer PDF.
  5. Validate. Required: vendor, invoice number, date, total. Subtotal plus tax must match the printed total within 0.011.
  6. Payment wall. If a node or payload asks for payment, bank write, refund, or force-post, the workflow records payment_path_blocked and stops. No draft.
  7. Human approve. The importable JSON uses Prepare Reviewer Handoff and Wait For Explicit Approve. A person POSTs decision=approve or decision=reject. Empty or automatic resume stays pending_review. It does not reject. Slack Approvals is the preferred later production swap because it can capture who responded. That Slack node is not in the default JSON so credentials cannot ship.
  8. Draft write. After approve, post one draft. n8n has no native Idempotency node. Send an application Idempotency-Key.
  9. Retry. A timeout or ambiguous response retries the same key. Case 05 expects write_count=1.
  10. Error path. A dedicated Error Trigger workflow must not write a draft.

Decision table

Condition Automatic Review Human-only
Clean labelled invoice, unique hash and invoice number Hash, validate, open review Avery Chen approves or rejects Confirm vendor and tax before the destination
Same bytes or same vendor plus invoice number Stop as duplicate None Override policy, if you ever add one
Missing invoice number or conflicting total Flag exception Reviewer rejects or asks for a better file Do not invent a number
Destination timeout after approve Retry same key Confirm only one draft exists Do not create a second Bill
Payment, bank, or force-post requested Block None Person decides any payment outside this workflow
Image-only PDF with no OCR adapter Fail closed None Choose an adapter later

Human gates

A named person approves or rejects every non-duplicate. A person confirms vendor match, tax, and destination. A person never lets this workflow pay, change a bank, refund, or force-post. The importable path is Wait. Slack Approvals is preferred later, after credentials live only in n8n Credentials.

Failure paths

  • Missing invoice number: status stays in review or rejected. No draft.
  • Conflicting total: exception flagged. No auto-write.
  • Duplicate bytes or business key: stop before review.
  • Destination timeout: retry same idempotency key. Prove write_count=1.
  • Missing approval or Wait timeout: stay pending_review.
  • Payment or bank node attempted: payment_path_blocked.
  • Image-only PDF without an OCR adapter: unsupported_type or unreadable extract.
  • Secrets in exported JSON: fail the public-package scan. Credentials stay in n8n Credentials.

Test cases

Reuse the five labelled-text cases. They do not measure OCR.

Case Input Expected Acceptance
Clean INV-TP-2401 Unique labelled invoice pending_review, then one draft after approve write_count=1
Duplicate Same bytes as clean duplicate, zero review, zero writes Hash or vendor|invoice_no matched
Missing number Invoice number blank Exception, no draft Reviewer sees missing_invoice_no
Conflicting total Printed total does not match lines Exception, no draft Reviewer sees conflicting_total
Timeout INV-TP-2405 Destination writes then loses the response Two attempts, one write Same idempotency key

The offline harness is not a live n8n Cloud run. This research and this draft did not execute a live invoice workflow.

Cost and measurement

n8n Cloud prices and concurrency quotas change. Check the current n8n pricing page for the plan you already buy. Do not treat Data Tables (default about 200 MiB) as a records program. Default binary memory mode can crash on large files. Queue mode does not support filesystem binary storage. Those are official product limits accessed 9 September 2026, not Flowgrammer load tests. Care Plan price stays unpublished.

Asset instructions

The paired original package is published as the Flowgrammer n8n Invoice Processing Workflow. Import workflows/flowgrammer-invoice-processing.json. That graph hashes source bytes, blocks payment markers, stops duplicates, waits for an explicit approve, writes one draft, and retries the same idempotency key. Run python3 tests/validate_workflows.py and python3 tests/run_offline_harness.py. Confirm Wait is connected and unused nodes are not left in the approve path. Confirm exported JSON has no tokens. Slack Approvals is a later swap, not the default import. Community template 17806 is architecture reference only. License on that template was null on 9 September 2026. Do not copy or republish it.

This asset is not a /resources/ page. Do not invent a resources URL.

Next step

If the reviewer, duplicate store, and draft destination are already named, book a fit call for an AI Automation Systems Invoice Intake-to-Accounting System build. If owners or destinations are still missing, start with an AI Success Audit. Use Book a fit call when you are ready to talk.

Sources