Process email invoices with OCR, GPT-4, Slack, QuickBooks and Google Sheets
Ready for 3.0What this workflow does
This AI workflow has 20 nodes and runs on Gmail events. Along the way it connects Gmail, OpenAI Chat Model, Slack and QuickBooks Online and 1 more.
How it runs
Trigger: On Gmail events.
- Workflow Configuration (Edit Fields (Set)): sets 5 fields: ocrApiUrl, validationTolerance, confidenceThreshold…
- Capture Invoice Metadata (Edit Fields (Set)): sets 4 fields: invoiceSource, receivedTimestamp, fileHash…
- Check File Type (If): checks a condition and branches into true / false
- Extract Text from PDF (Extract from File): extracts data from a file (pdf)
- OCR for Images (HTTP Request): calls an HTTP API (POST)
- Merge: merges the data from its input branches
- AI Invoice Extractor (AI Agent): runs an AI agent, with model: OpenAI GPT-; output parser: Invoice Schema Parser
- Validate and Recalculate Totals (Code): runs custom JavaScript code
- Mask PII Data (Code): runs custom JavaScript code
- Check if Review Needed (If): checks a condition and branches into true / false
…plus 6 more steps. See the full node list below.
Services it uses
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) (Invoice Email Trigger).
Nodes used (14)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Extract from File
n8n-nodes-base.extractFromFile - HTTP Request
n8n-nodes-base.httpRequest - Merge
n8n-nodes-base.merge - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Code
n8n-nodes-base.code - Wait
n8n-nodes-base.wait - Slack
n8n-nodes-base.slack - QuickBooks Online
n8n-nodes-base.quickbooks - Google Sheets
n8n-nodes-base.googleSheets
From the author
Overview This workflow automates invoice processing directly from your email inbox. It captures invoice attachments, extracts structured data using OCR and AI, validates totals, and securely processes invoices. If issues are detected, it routes them for human…