Automatically create invoices from Gmail labels with GPT-4O + QuickBooks
Needs changesWhat this workflow does
This AI workflow has 12 nodes and runs on a schedule (every hour). Along the way it connects QuickBooks Online, Gmail and OpenAI Chat Model.
How it runs
Trigger: On a schedule (every hour).
- Get Messages w/ Invoice Needed Label (Gmail): get many
- Combine all Messages in a Thread (Code): runs custom JavaScript code
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; output parser: Structured Output Parser
- Add Client to QBO (QuickBooks Online): create
- Find Existing Customer (QuickBooks Online): get many
- Create A New Invoice (QuickBooks Online): create (invoice)
- Download Invoice (QuickBooks Online): work with invoice
- Write Draft Reply to Client (Gmail): work with draft
- Remove Invoice Needed Label (Gmail): remove labels (thread)
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 Agent: Extract Customer & Invoice Details (v1.9): 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 Agent: Extract Customer & Invoice Details (v1.9) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (7)
- QuickBooks Online
n8n-nodes-base.quickbooks - Gmail
n8n-nodes-base.gmail - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Schedule Trigger
n8n-nodes-base.scheduleTrigger - AI Agent
@n8n/n8n-nodes-langchain.agent - Code
n8n-nodes-base.code
From the author
What It Does This workflow reads Gmail threads labeled Invoice Needed, extracts invoice and client details using an AI agent, and creates a draft invoice in QuickBooks Online. It then downloads the invoice as a PDF and drafts a reply email with the invoice…