Quick Overview
This workflow receives vendor invoices via a webhook, normalizes them into a fingerprint, checks Google Sheets for previously paid matches, and then blocks duplicates with Slack alerts and an audit log while registering unique invoices and optionally requesting manager approval via Gmail.
How it works
- Receives invoice data from a POST webhook endpoint.
- Parses and normalizes vendor, invoice number, and amount into a consistent fingerprint and drops incomplete invoices.
- Looks up the fingerprint in a Google Sheets register of paid invoices to detect whether a matching invoice already exists.
- If a duplicate is found, posts a blocked-payment alert to Slack and appends the incident to a Google Sheets “DuplicateLog” tab.
- If no duplicate is found, calculates an approval status based on the invoice amount and registers the invoice in the Google Sheets “PaidInvoices” tab.
- If the invoice exceeds the threshold, emails the approver via Gmail; otherwise it posts a cleared notice to Slack.
- Responds to the webhook caller with a JSON result indicating the invoice number and whether it was treated as a duplicate.
Setup
- Create a Google Sheets spreadsheet with “PaidInvoices” and “DuplicateLog” tabs and include a fingerprint column (and optional paid_date and payment_ref fields for match details).
- Add Google Sheets credentials in n8n and replace YOUR_GOOGLE_SHEET_ID in the lookup and append actions.
- Add Slack credentials and set YOUR_SLACK_CHANNEL_ID for both the duplicate alert and cleared notice messages.
- Add Gmail credentials, set YOUR_APPROVER_EMAIL, and confirm the amount threshold (currently 5000) used to require manager approval.
- Copy the webhook URL for /ap/invoice-intake and configure your AP system/OCR or intake form to POST invoice payloads to it.