Prerequisites: IMAP mailbox for supplier invoices; SQLite (or synced)
purchase_orders table with columns po_number, amount, vendor; SMTP for mismatch alerts. Desktop Studio on a machine that can reach the mailbox and DB file.
Automate the classic AP chore: when an invoice lands in email, extract fields, match it to a purchase order, and email AP only when the PO is missing or the amounts do not line up.
What this template does
- New Invoice Email — IMAP poll; saves PDF/image attachments.
- PDF or Image? — PDF →
pdf.extractText; image → Vision OCR. - Read Invoice + PO # — field extractor for supplier, invoice number, PO number, total.
- Lookup PO in Accounting — SQLite join against
purchase_orders; statusmatched/missing_po/amount_mismatch. - Branch — log OK, or email AP on mismatch.
Step 1 — Seed purchase orders
- Create the table once:
CREATE TABLE purchase_orders( po_number TEXT PRIMARY KEY, amount REAL, vendor TEXT ); - Insert a few real POs (or sync from your ERP into this file).
Step 2 — Load template #263
- Open Studio → Templates (or empty-canvas recipe When an invoice hits email…).
- Search
PO Matchingand load template #263.
Step 3 — IMAP, DB path, alert To
- Set IMAP host/credentials and attachment folder on New Invoice Email.
- Point Lookup PO in Accounting at your
purchase_orders.dbpath. - Set SMTP and the AP clerk address on both mismatch email nodes.
Step 4 — Dry-Run, then Activate
- Send a test invoice PDF with a known PO number to the mailbox.
- Use 🧪 Dry-Run first, then Activate. Watch Jobs → Schedule for the email trigger.
Related
- File Drop Automation — folder-watch variant.
- Document Approval & Archive (#92).
- Blog: Invoice → PO matching.
- Use case: Document & Invoice Processing.