Generate Gmail reply drafts with GPT-4o, pgvector, and PostgreSQL
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
What this workflow does
This AI workflow has 22 nodes and runs on Gmail events. Along the way it connects OpenAI Chat Model, Postgres, OpenAI and Gmail.
How it runs
Trigger: On Gmail events.
- Parse & Validate (Code): runs custom JavaScript code
- If: checks a condition and branches into true / false
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; memory: Simple Memory
- Merge: merges the data from its input branches
- DB - Log Skipped (Postgres): uses Postgres
- Parse Classification (Code): runs custom JavaScript code
- Generate Email Embedding (HTTP Request): calls an HTTP API
- Extract Embedding (Code): runs custom JavaScript code
- DB - Fetch KB Data (Postgres): uses Postgres
- DB - Fetch Similar Corrections (Postgres): uses Postgres
…plus 9 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) (Gmail Trigger).
Nodes used (11)
- Code
n8n-nodes-base.code - If
n8n-nodes-base.if - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - AI Agent
@n8n/n8n-nodes-langchain.agent - Merge
n8n-nodes-base.merge - HTTP Request
n8n-nodes-base.httpRequest - Postgres
n8n-nodes-base.postgres - OpenAI
@n8n/n8n-nodes-langchain.openAi - Gmail
n8n-nodes-base.gmail - Gmail Trigger
n8n-nodes-base.gmailTrigger
From the author
Email Automation — AI Draft Generator n8n Workflow Template --- 📘 Description This workflow is the core of a three-part email automation system. It monitors your Gmail inbox in real time, classifies every inbound customer email with AI, retrieves…