What this workflow does
- New bill to approve is a webhook that accepts
{"billId": "145"}. It is protected with header authentication and handles one bill per call, because each call waits for one approver. - Config holds your QuickBooks company ID, the fallback approver and the price-jump threshold.
- QBO: get bill and QBO: vendor history load the bill and the vendor’s last 12 bills from QuickBooks Online.
- Read approval matrix reads your rules from Google Sheets: amount band, department (QuickBooks class), GL account, vendor, approver, delegate and optional second approver.
- Route and build brief picks the most specific matching rule, falls back to the AP lead when nothing matches, computes the average of prior bills and the change against it, sets flags (first bill from vendor, amount above usual, missing invoice number, due within five days, round amount, second approver required) and builds a fingerprint of vendor, amount and coding.
- Claude: write brief turns those facts into a two or three sentence brief with one note per flag. The prompt forbids new arithmetic and forbids recommending a decision.
- Build approval message formats the Slack message with a link to the bill. If the AI call fails, the approver still gets the facts and flags.
- Ask approver in Slack sends Approve and Reject buttons as a direct message and pauses the workflow for up to 24 hours.
- Record decision and Timed out? turn the response into approved, rejected or timed out. Timeouts go to Escalate to delegate in your AP channel.
- Append to approvals log writes the bill, approver, outcome, flags and fingerprint to the log tab.
Before you import
- A current n8n version. The Slack wait step needs a Slack app with a bot token and
chat:writescope. - A QuickBooks Online company and an Intuit developer app for the OAuth2 credential.
- A Google Sheet with two tabs, “Approval matrix” and “Approvals log”, with the column headers listed in the sticky note.
- An Anthropic API key, added as n8n’s built-in Anthropic credential.
Setup
- Import the JSON file and connect each credential. Create a Header Auth credential for the webhook and share the header name and value only with the system that calls it.
- In Config, replace
REPLACE_WITH_QBO_COMPANY_IDandREPLACE_WITH_AP_LEAD_SLACK_USER_ID. Usehttps://sandbox-quickbooks.api.intuit.comandhttps://app.sandbox.qbo.intuit.comwhile testing. - Replace
REPLACE_WITH_SHEET_IDin Read approval matrix and Append to approvals log. - Replace
REPLACE_WITH_AP_CHANNELin Escalate to delegate and Post AP exception. - Fill the matrix with Slack member IDs (not display names). Use
*or leave a cell blank for “any”.
Test it
Add two matrix rows, one general and one for a single department, and create a sandbox bill coded to that department. Activate the workflow and call the production webhook URL with the bill ID. You should get a direct message from the more specific rule’s approver. Click Reject and check the log row. Then lower the wait limit to a few minutes, send another bill, ignore it, and confirm the escalation reaches the channel.
Make it production-ready
- Error workflow. Set one in the workflow settings so failures after the wait step still alert AP.
- Second approver. Rules flagged
second_approver_requiredare only flagged here. Add a second Slack wait for those before the bill is released. - Segregation of duties. The bill this workflow reads from QuickBooks does not say who entered it. Pass the creator from the upstream system in the webhook body and block that person as approver.
- Payment runs. Build payment batches only from bill IDs logged as approved with an unchanged fingerprint.
- Retries and limits. Add retries to the QuickBooks nodes and keep the Slack wait limit shorter than your payment cycle.
- Shadow mode. Run beside your current process for two weeks and fix the matrix, not the code, when it picks the wrong person.
The AI invoice processing template can feed bills into this one. Read the full guide, how to automate accounts payable approvals, or talk to Lumeor about a production build.