Draft Gmail replies with OpenAI and OpenRouter for an inbox-zero workflow
Needs changesWhat this workflow does
This AI workflow has 15 nodes and runs on Gmail events. Along the way it connects Gmail, OpenAI Chat Model, Vector Store Question Answer and Embeddings OpenAI and 3 more.
How it runs
Trigger: On Gmail events.
- Set Content (Edit Fields (Set)): sets 3 fields: emailBody, threadID, from
- Client/Prospect Related? (Basic LLM Chain): sends a prompt to an LLM, with model: OpenRouter Chat Model; output parser: Structured Output Parser
- Customer Support? (Switch): routes items into 2 branches
- Email Draft Agent (AI Agent): runs an AI agent, with model: OpenAI Chat Model; 2 tools (createDraft, Vector Store Tool)
- Response Not Customer Support (Telegram): uses Telegram
- Response (Telegram): uses Telegram
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 Email Draft Agent (v1.7): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
- Also check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll).
- Also check Always Output Data on multi-output nodes (If/Switch) now adds an empty item only when every output is empty.
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) Email Draft Agent (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)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Vector Store Question Answer Tool
@n8n/n8n-nodes-langchain.toolVectorStore - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Gmail Tool
n8n-nodes-base.gmailTool - Telegram
n8n-nodes-base.telegram - Switch
n8n-nodes-base.switch - OpenRouter Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenRouter - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase - AI Agent
@n8n/n8n-nodes-langchain.agent
From the author
Automatically draft email replies using AI. This workflow monitors your Gmail inbox, filters out automated emails (newsletters, receipts, notifications), and uses AI to create draft responses only for emails that genuinely need your attention. Who is this…