Extract invoice data from Gmail to Airtable with Mistral OCR and GPT-4.1-mini
Ready for 3.0What this workflow does
This AI workflow has 16 nodes and runs on Gmail events. Along the way it connects OpenAI Chat Model, Gmail and Airtable. It also calls api.imgbb.com over HTTP.
How it runs
Trigger: On Gmail events.
- If: checks a condition and branches into true / false
- host image (HTTP Request): calls api.imgbb.com (POST)
- Search Existing Invoices (Airtable): search
- Check for Duplicates (Switch): routes items into branches
- Download Invoice (HTTP Request): calls an HTTP API
- Extract text (Mistral AI): uses Mistral AI
- Analyze Invoices (AI Agent): runs an AI agent, with model: OpenAI Chat Model; output parser: Structured Output Parser
- Validate Data (If): checks a condition and branches into true / false
- upload invoice & details (Airtable): create
- Invalid Data Handler (Edit Fields (Set)): sets 5 fields: error, step, invoiceSubject…
…plus 1 more step. See the full node list below.
Services it uses
HTTP calls to: api.imgbb.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) (Gmail Trigger).
Nodes used (12)
- OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Gmail Trigger
n8n-nodes-base.gmailTrigger - If
n8n-nodes-base.if - No Operation, do nothing
n8n-nodes-base.noOp - HTTP Request
n8n-nodes-base.httpRequest - Mistral AI
n8n-nodes-base.mistralAi - AI Agent
@n8n/n8n-nodes-langchain.agent - Airtable
n8n-nodes-base.airtable - Switch
n8n-nodes-base.switch - Edit Fields (Set)
n8n-nodes-base.set - Gmail
n8n-nodes-base.gmail
From the author
This n8n template demonstrates how to automatically process invoice attachments from email using OCR and AI. When an invoice is received in Gmail, the workflow extracts structured invoice data and stores it in Airtable while preventing duplicates. This…