Match vendor invoices to PO and GRN with OpenAI, Gmail, Sheets and Slack
Ready for 3.0What this workflow does
This AI workflow has 37 nodes and runs on Gmail events (plus 2 other triggers). Along the way it connects Gmail, Google Drive, Google Sheets and Slack and 1 more. It also calls api.openai.com over HTTP.
How it runs
Trigger: On Gmail events (plus 2 other triggers).
- Split Invoice Attachments (Code): runs custom JavaScript code
- Look Up Ledger Entry (Google Sheets): uses Google Sheets
- Read AP Ledger (Payables) (Google Sheets): uses Google Sheets
- Archive Invoice to Drive (Google Drive): uses Google Drive
- Prepare AI Extraction (Code): runs custom JavaScript code
- Validate Approval Token (Code): runs custom JavaScript code
- Read Vendor Bank Details (Google Sheets): uses Google Sheets
- AI Extract Invoice Fields (HTTP Request): calls api.openai.com (POST)
- Token Valid? (If): checks a condition and branches into true / false
- Build Payment Batch (Code): runs custom JavaScript code
…plus 24 more steps. See the full node list below.
Services it uses
Other Google Sheets + Gmail templates (2,102) · Other OpenAI + Google Sheets templates (2,011) · Other OpenAI + Gmail templates (1,623)
HTTP calls to: api.openai.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (On New Invoice Email).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (14)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Code
n8n-nodes-base.code - Google Drive
n8n-nodes-base.googleDrive - HTTP Request
n8n-nodes-base.httpRequest - Google Sheets
n8n-nodes-base.googleSheets - Switch
n8n-nodes-base.switch - Slack
n8n-nodes-base.slack - OpenAI
@n8n/n8n-nodes-langchain.openAi - Gmail
n8n-nodes-base.gmail - Webhook
n8n-nodes-base.webhook - If
n8n-nodes-base.if - Respond to Webhook
n8n-nodes-base.respondToWebhook - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Convert to File
n8n-nodes-base.convertToFile
From the author
Quick overview This workflow ingests vendor invoices from Gmail, uses OpenAI to extract invoice fields, matches invoices against Purchase Orders and GRNs stored in Google Sheets, and routes approvals via Slack, while archiving files to Google Drive and…