Draft and approve Gmail replies and follow-ups with OpenAI
Ready for 3.0What this workflow does
This AI workflow has 31 nodes and runs on Gmail events (message received) (plus 1 other trigger). Along the way it connects Gmail and OpenAI Chat Model.
How it runs
Trigger: On Gmail events (message received) (plus 1 other trigger).
- Your settings (Edit Fields (Set)): sets 11 fields: ownerEmail, senderName, companyName…
- New email or weekly run? (If): checks a condition and branches into true / false
- Get all leads (Data table): get (row)
- Get your leads (Data table): get (row)
- Match each email to a lead (Code): runs custom JavaScript code
- Keep only quiet leads (Code): runs custom JavaScript code
- Sender is a lead? (If): checks a condition and branches into true / false
- Classify and draft a reply (Basic LLM Chain): sends a prompt to an LLM, with model: OpenAI model (replies)
- Search Gmail for replies (Gmail): get many (message)
- Mark the lead as replied (Data table): update (row)
…plus 16 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.
Nodes used (10)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Data table
n8n-nodes-base.dataTable - Code
n8n-nodes-base.code - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Gmail
n8n-nodes-base.gmail - No Operation, do nothing
n8n-nodes-base.noOp
From the author
Quick overview This workflow monitors your Gmail inbox for new unread messages, uses OpenAI to classify them and draft fact-based replies, and then emails the draft to an owner for approval before replying in the original Gmail thread. How it works 1.…