Mailhook and MySQL: PO Invoice Three-Way Match Template
This Spojit template catches vendor invoices the moment they land in your inbox, extracts the key figures, and matches them against your purchase orders and goods receipts in MySQL so price and quantity mismatches surface before anyone pays.
What It Builds
A Mailhook trigger gives the workflow its own email address; when a vendor sends an invoice PDF, an Attachment node pulls the file bytes and the pdf connector reads the PO number, line items, and amount. A MySQL connector node looks up the matching purchase order and receipt records, a Condition node compares quantities and prices, and any variance is flagged for review.
The Prompt
Paste this into Miraxa and it builds the workflow, connecting the tools for you:
Build a workflow that triggers when a vendor invoice PDF is emailed to a mailhook address. Read the PO number, line item quantities, and total amount from the PDF, then look up the matching purchase order and goods receipt in my MySQL database. Compare the invoiced quantity and price against the PO and receipt, and if anything differs by more than 2 percent, send me an email flagging the mismatch with the PO number and the differing values. If everything matches, mark the invoice as approved in MySQL.
Connectors Used
- Mailhook trigger - starts the run whenever an invoice arrives at the workflow's dedicated address.
- pdf - extracts the PO number, quantities, and amount from the attached invoice.
- MySQL - looks up purchase orders and receipts and records the match outcome.
Customize It
Change the 2 percent tolerance to a flat dollar amount or a tighter threshold, swap the email alert for a Slack message, or adjust which MySQL tables and columns hold your PO and receipt data. You can also add a Human approval step before any invoice is marked approved.
Tips
- The Attachment node only works in Mailhook workflows; use Single mode when each email carries one invoice.
- Run the MySQL lookups in Direct mode for predictable, low-cost queries; reserve Agent mode for fuzzy figure extraction.
- Scanned invoices benefit from the pdf connector's OCR, but always keep the PO number on a predictable line for reliable matching.