Approve supplier invoices from Gmail with GPT-4o-mini, Google Sheets and Telegram
Ready for 3.0What this workflow does
This AI workflow has 38 nodes and runs on Gmail events (plus 1 other trigger). Along the way it connects Gmail, OpenAI Chat Model, Telegram and Google Sheets.
How it runs
Trigger: On Gmail events (plus 1 other trigger).
- Keep Emails with a PDF Attachment (Filter): keeps only the items that match a condition
- Read Bills for Payment Run (Google Sheets): uses Google Sheets
- Set Email Fields (Edit Fields (Set)): sets 9 fields: gmail_id, thread_id, from_email…
- Keep Approved Unpaid Bills (Filter): keeps only the items that match a condition
- Extract Text from PDF (Extract from File): extracts data from a file (pdf)
- Build Payment Run (Code): runs custom JavaScript code
- Read Invoice with GPT-4o-mini (AI Agent): runs an AI agent, with model: GPT-4o-mini Chat Model; output parser: Enforce Invoice JSON Schema
- Email Payment Run (Gmail): uses Gmail
- Split Out: splits a list into separate items
- Set Invoice Fields (Edit Fields (Set)): sets 21 fields: gmail_id, thread_id, from_email…
…plus 23 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) (Watch Inbox for Supplier Emails).
Nodes used (17)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Filter
n8n-nodes-base.filter - 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 - Telegram
n8n-nodes-base.telegram - Google Sheets
n8n-nodes-base.googleSheets - Merge
n8n-nodes-base.merge - Switch
n8n-nodes-base.switch - If
n8n-nodes-base.if - No Operation, do nothing
n8n-nodes-base.noOp - Gmail
n8n-nodes-base.gmail - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Code
n8n-nodes-base.code - Split Out
n8n-nodes-base.splitOut
From the author
Quick Overview This workflow monitors unread Gmail messages with PDF attachments, extracts invoice details with OpenAI GPT-4o-mini, checks vendors and duplicates in Google Sheets, and routes approvals via Telegram. It records outcomes in a Bills sheet, alerts…