Process, validate, and approve invoices with OpenAI GPT-4o and Google Sheets
Needs changesWhat this workflow does
This AI workflow has 27 nodes and runs when an HTTP POST request hits its webhook URL (plus 1 other trigger). Along the way it connects OpenAI Chat Model, Gmail and Google Sheets.
How it runs
Trigger: When an HTTP POST request hits its webhook URL (plus 1 other trigger).
- Set - Prepare Invoice Metadata (Edit Fields (Set)): sets 4 fields: vendorNameSubmitted, vendorEmailSubmitted, receivedAt…
- Send Email - Notify Administrator (Gmail): uses Gmail
- Extract from File: extracts data from a file (pdf)
- AI - Extract Invoice Data (AI Agent): runs an AI agent, with model: AI - Extract Invoice Data - Chat Model; output parser: AI - Extract Invoice Data - Output Parser
- Code: runs custom JavaScript code
- Code: runs custom JavaScript code
- If: checks a condition and branches into true / false
- Google Sheets: uses Google Sheets
- Send Email - Request Missing Info (Gmail): uses Gmail
- If: checks a condition and branches into true / false
…plus 11 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in AI - Extract Invoice Data (v1.7), AI - Analyze and Categorize Invoice (v1.7): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI - Extract Invoice Data (v1.7), AI - Analyze and Categorize Invoice (v1.7) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (13)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Extract from File
n8n-nodes-base.extractFromFile - 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 - If
n8n-nodes-base.if - Gmail
n8n-nodes-base.gmail - Google Sheets
n8n-nodes-base.googleSheets - Switch
n8n-nodes-base.switch - Wait
n8n-nodes-base.wait - Error Trigger
n8n-nodes-base.errorTrigger
From the author
Quick overview This workflow receives invoice PDFs via a webhook, extracts and validates invoice data with OpenAI, checks for duplicates in Google Sheets, and routes invoices for automatic or manual approval while notifying vendors and finance via Gmail. How…