Automate invoice processing: an invoice approval workflow from mailbox to data table
How to build an accounts payable workflow step by step: pick up invoices from a mailbox, read the PDF text, extract the fields with an AI step, check duplicates, thresholds and order numbers, route approvals with deadlines, store every case and measure throughput.
Summary
- An automated invoice process follows eight stages: receive, read, extract, validate, approve, record, notify and hand over to accounting. Each stage maps to one or two steps in a workflow.
- AI is useful for pulling supplier, amount, date and invoice number out of free-form PDF text, but its output must be checked by rules: required fields, duplicates, amount thresholds and a missing purchase order send a case to a person.
- The workflow prepares and routes invoices. Booking, payment and legally compliant archiving stay in your accounting system or archive, unless you connect them yourself through their API.
In many companies, incoming invoices still travel the same way: a PDF lands in a shared mailbox, someone opens it, types supplier, amount and invoice number into a spreadsheet or the accounting system, forwards it to the budget owner and chases the answer a week later. Nothing about this is difficult. It is just slow, easy to get wrong and hard to follow afterwards.
This guide shows how to automate invoice processing with a workflow: from the mailbox trigger to an invoice approval workflow with deadlines and a data table that records every case. It walks through the build node by node, lists the validation rules that matter and ends with common pitfalls and a checklist to start in 30 minutes.
What accounts payable automation covers
Accounts payable automation takes the repetitive work between "invoice received" and "invoice ready to book" out of people's hands: reading the document, capturing the fields, checking them, getting the approval and passing the result on. It does not replace your accounting system. The booking, the payment run and the legally required archive remain there. A workflow sits in front of it and makes sure only checked, approved and complete invoices arrive.
A realistic goal is not "no human touches an invoice". It is: clear cases run through on their own, unclear cases reach the right person with everything they need, and every step is traceable.
The invoice processing workflow at a glance
Most incoming invoice processes, whatever the company size, follow the same eight stages:
Mailbox (invoices@)
|
v
Read document ---- no text? ----------------------> Manual review
|
v
AI step: extract fields as JSON
|
v
Rules: required fields, duplicate, PO, amount -- fails --> Manual review
|
v
Approval (budget owner, deadline) -- rejected/expired --> Accounting informed
|
v
Write to table (status: approved)
|
+--> HTTP request to accounting/ERP (optional, your API)
+--> Send message to accounting channel
Build the invoice workflow step by step
The following walkthrough uses the step names of Obseria Workflow. A process template "invoices from a mailbox with AI extraction" contains the first steps already; it is a draft whose connections and channels you still fill in.
Step 1: Mailbox trigger
Create a dedicated mailbox such as invoices@ and ask suppliers to send invoices there. Add an IMAP connection for it (with an app password where two-factor authentication is on) and a Mailbox trigger. Set the filters: only mails with attachments, only unread mails, optionally subject contains "invoice". Turn on text extraction from PDF attachments. Once active, the mailbox is checked about once a minute and every new mail starts one run with sender, subject, date, text and attachments.
Step 2: Read document
The Read document step takes trigger.attachments and returns the text of every file, joined and per file. It reads PDFs with a text layer, plain text, CSV and JSON; XML attachments are read as plain text. Important limit: scanned PDFs are images and OCR is not included, so they return little or no text. Check that right away with a condition such as steps.document.text | length > 200 and send short results to manual review.
Step 3: AI step for invoice data extraction
The AI step sends a prompt to a language model. Insert the sender, subject and the document text (truncated to a sensible length) as placeholders, turn on JSON output and describe the exact keys you want. Fixed rules go into the instructions: date format, number format, "use null if a field is not in the document, never guess". A typical result looks like this (example data):
{
"supplier": "Example Supplies Ltd",
"invoiceNumber": "INV-2026-0412",
"issueDate": "2026-11-18",
"dueDate": "2026-12-02",
"total": 1785.00,
"net": 1500.00,
"tax": 285.00,
"currency": "EUR",
"orderNumber": null
}
The model reads text, it does not know your suppliers. Treat its output as a proposal that the next steps check, and keep personal data out of the prompt that the task does not need.
Step 4: Condition and Read table for validation
Now rules take over. A Read table step looks up earlier invoices in your invoices table with a filter such as item.invoiceNumber == steps.extract.json.invoiceNumber and item.supplier == steps.extract.json.supplier. A Condition then checks: required fields present, total greater than zero, no earlier row found, order number present. A Switch can route by amount band, for example up to 500, up to 5,000 and above.
Step 5: Approval with a deadline
The Approval step pauses the run. Give it a title such as "Approve invoice INV-2026-0412 – Example Supplies Ltd – 1,785.00 EUR", the details the approver needs and the approvers' e-mail addresses. Those can come from a cost-centre table read in an earlier step, with an organisation variable as fallback. Approvers get an e-mail with a link to the Workflow inbox, optionally also a channel message, and decide there with a note. Set an auto-reject timeout in hours so nothing waits forever.
Step 6: Write to table
Write to table stores the case in a Data table in Obseria Data: the extracted fields plus sender, received time, file name, decision, approver and note. Use upsert with the invoice number (or supplier plus invoice number) as key, so a re-run updates the row instead of duplicating it. Write rejected and manually reviewed cases too, with a status column, so the table shows the whole picture.
Step 7: Send message and hand over
A Send message step posts approved invoices to the accounting channel (Slack, Teams, e-mail or webhook). If your accounting or ERP system has an API, an HTTP request step can send the fields and the original PDF as a file upload, through a stored connection. Obseria does not book anything by itself: the booking only happens if you configure that call, and the booking logic stays in the target system.
Node table: the invoice approval workflow
| Step | Node type | What it does | Example setting |
|---|---|---|---|
| 1 | Mailbox | Starts a run per new mail | Only with attachments, only unread, PDF text on |
| 2 | Read document | Text from PDF, text, CSV, JSON, XML | Input trigger.attachments |
| 3 | AI step | Extracts fields as JSON | JSON output on, keys listed, "null instead of guessing" |
| 4 | Read table | Finds earlier invoices | Filter on supplier and invoice number |
| 5 | Condition / Switch | Applies rules, routes by amount | steps.extract.json.total > 0, bands 500 / 5,000 |
| 6 | Approval | Pauses until a person decides | Approvers from cost-centre table, timeout 72 h |
| 7 | Write to table | Records every case | Table invoices, upsert by invoice number |
| 8 | HTTP request | Hands over to accounting/ERP API | POST with fields and PDF upload (optional) |
| 9 | Send message | Informs accounting or reviewers | Channel "AP", title with supplier and amount |
Invoice validation rules that catch most problems
Put rules between extraction and approval; they are cheap, predictable and easy to explain:
| Rule | Check | If it fails |
|---|---|---|
| Required fields | Supplier, invoice number, date and total are present | Manual review with the mail and the extracted text |
| Duplicate | No earlier row with the same supplier and invoice number | Stop and inform accounting; never approve twice |
| Plausible amounts | Total greater than zero; net plus tax equals total | Manual review |
| Amount threshold | Above a limit, a second approval is needed | Route to a second Approval step |
| Missing PO | Purchase order number present where your policy requires one | Ask the requester or budget owner for the order |
| Known supplier | Sender address or supplier name in your supplier table | Review before anything else, as a protection against fake invoices |
| Bank details changed | IBAN differs from the one on file | Always a person, with a call-back to the supplier on a known number |
Designing the invoice approval workflow
Four decisions make an approval process work in practice:
- Who approves. Derive the approver from the invoice: cost centre, order number or supplier mapped to a budget owner in a small table. Keep a fallback address for accounting.
- Four-eyes principle. For high amounts, chain two Approval steps, for example budget owner first, then finance lead. One step waits for one decision by one of its listed approvers; it has no "all must agree" rule.
- Deadlines. Set the timeout with your payment terms and early-payment discounts in mind. After the timeout, the run takes the rejected path. Let that path inform accounting rather than the supplier, because "nobody answered" is not the same as "rejected". Reminders before the deadline and deputy rules are not built into the step; a separate message to the approver or a second approver address covers this.
- What the approver sees. Supplier, amount, due date, cost centre, order number, rule results and the file name of the original. If people regularly reject because information is missing, fix the message, not the people.
Our guide to approval workflow automation covers routing and escalation patterns in more detail, and the approval workflows feature page shows the step itself.
Exceptions and human review
Typical exception paths:
- No readable text: scanned PDF, image attachment or password-protected file. Send it to a review channel with the mail details.
- Not an invoice: reminders, credit notes, order confirmations. Ask the AI step for a document type and let a Switch route credit notes and reminders differently.
- Several invoices in one mail: Read document returns one text per file; a For each loop processes them one by one.
- Technical failures: an API that does not answer. Set retries per step and an error channel per workflow, and retry a failed run from the run history once the cause is fixed.
For review, keep one place where open cases live, for example the invoices table with status "review" and a channel message per case, so nobody has to search mailboxes.
Archiving, retention and GoBD in general terms
This section is general information, not legal or tax advice. In Germany, the GoBD describe how books and records must be kept in electronic form, including traceability, completeness and protection against changes. Incoming invoices are subject to statutory retention periods. Since 1 January 2025, businesses in Germany must be able to receive e-invoices in domestic B2B transactions, which makes structured formats such as XRechnung or ZUGFeRD more common in incoming mail.
For a workflow this means: keep the original file as received, in the system intended for it, and never treat the extracted text or the data table as a replacement for the original. Obseria is not an audit-proof archive. Hand the original to your archive or accounting system, for example via an HTTP request with file upload, and leave the mail in the mailbox. Discuss retention, procedure documentation and your setup with your tax advisor.
Measuring throughput and cycle time
Measure a few weeks before and after go-live rather than single days. Useful indicators:
- Cycle time: from receipt to decision, per amount band and approver.
- Straight-through rate: share of invoices that needed no manual correction.
- Exception reasons: no text, missing PO, duplicate, unknown supplier.
- Expired approvals per week and per approver.
- Failed runs and their causes.
The Workflow overview shows runs per day over the last 30 days and the success rate. For process figures, query the invoices table in Obseria Data with SQL along these lines and put the result on a dashboard:
-- Illustrative: median hours from receipt to decision, per week
SELECT toStartOfWeek(receivedAt) AS week,
count() AS invoices,
countIf(status = 'review') AS manual_reviews,
median(dateDiff('hour', receivedAt, decidedAt)) AS median_hours
FROM invoices
GROUP BY week
ORDER BY week
Common pitfalls
- Trusting the AI output blindly. Every extracted field that drives a decision needs a rule behind it.
- Using a personal inbox. Newsletters and replies start runs; a dedicated address with filters avoids that.
- No duplicate check. Suppliers resend invoices, and the same mail can be processed twice. Check before approval and write with upsert.
- Expecting scans to work. Without OCR, scanned PDFs return little text. Plan a manual path or ask suppliers for digital PDFs or e-invoices.
- Timeout equals rejection. An expired approval should go to accounting, not to the supplier as a rejection.
- Treating the table as the archive. It is a register of cases, not the legally relevant original.
- Going live without test runs. Run the workflow with real sample invoices from several suppliers first.
Checklist: start in 30 minutes
- Create or pick a dedicated invoices mailbox and an app password.
- Add the IMAP connection and a notification channel for accounting.
- Start from the invoice template or add Mailbox, Read document and AI step.
- Write the extraction prompt with fixed keys and "null instead of guessing".
- Add the text-length check and the required-fields condition.
- Add the duplicate lookup with Read table.
- Add one Approval step with a timeout and a fallback approver.
- Write every case to an invoices table with upsert and a status column.
- Run three to five test runs with real invoices, including one scan and one duplicate.
- Set an error channel, activate and review the first week's runs.
How Obseria helps
Obseria Workflow provides the building blocks used in this guide:
- Mailbox trigger: IMAP mailboxes checked about once a minute, filters on sender, subject and attachments, text from PDF attachments. See workflow triggers.
- Read document and data steps: text from PDFs with a text layer, text, CSV and JSON, plus Read table, Write to table with upsert and file creation. See data and document steps.
- AI step: prompts with placeholders, instructions and JSON output for extraction and classification. See AI workflow automation.
- Logic and approvals: conditions, switches and loops (conditions and loops), approvals by e-mail link and in the Workflow inbox with note and auto-reject timeout.
- Connections: any REST API with stored, encrypted credentials and file uploads, plus a connector catalog for common business software. See workflow connectors.
- Operations: run history with every step, retries per step, an error channel per workflow. See run history and templates.
Limits, stated plainly: Obseria is not an accounting system, ERP or audit-proof archive and does not book or pay invoices unless you configure an API call to a system that does. There is no OCR, so scanned PDFs need a manual path. AI extraction can be wrong and needs rules behind it. Approvals have no built-in reminders or deputy rules. Connections to services such as Microsoft 365 or Google use an access token or app password, not a guided sign-in. Costs are listed on the pricing page. To try the flow with your own invoices, start a free trial.
Frequently asked questions about invoice processing automation
Can I automate invoice processing without an AP software?
Yes, for the steps before booking: receive, read, extract, check, approve and record. Booking and payment stay in your accounting system, which the workflow can feed through its API if one exists.
How accurate is AI invoice extraction?
It depends on the document quality and the prompt, and it is never guaranteed. Ask for fixed keys, allow null for missing values and check every decision-relevant field with a rule.
Does Obseria read scanned invoices?
No. Read document needs a text layer, which digitally created PDFs have. Scans are images and would need OCR, which is not included.
How do I prevent paying an invoice twice?
Look up supplier and invoice number in your invoices table before approval, stop on a match and write cases with upsert by that key.
What happens if the approver does not respond?
With a timeout set, the approval is rejected automatically after the given number of hours and the run continues on the rejected path, which should inform accounting.
Is an automated invoice workflow GoBD-compliant?
Compliance depends on your whole setup and procedure documentation, not on one tool. Keep originals in a suitable archive and ask your tax advisor; this article is not legal advice.