Templates / Gmail assistant with full Gmail history RAG using OpenAI

Gmail assistant with full Gmail history RAG using OpenAI

Needs changes

by Zain Ali ✓ · 2,006 views · created 2025-07-19 · Internal Wiki, AI RAG

Needs changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 20 nodes and runs when a chat message arrives (plus 2 other triggers). Along the way it connects OpenAI Chat Model, Embeddings OpenAI, Qdrant Vector Store and Gmail.

How it runs

Trigger: When a chat message arrives (plus 2 other triggers).

  1. RAG Agent (AI Agent): runs an AI agent, with model: OpenAI Chat Model; 1 tool (Qdrant Email Vector Store); memory: Simple Memory
  2. Get new Email Body (Gmail): get
  3. Get all emails (Gmail): get many
  4. Store Emails in Vector DB (Qdrant Vector Store): stores documents in the Qdrant vector store, with embeddings: Embeddings OpenAI; document loader: Set proper metadata
  5. Refactor Email Body data (Code): runs custom JavaScript code
  6. Loop over all emails (Loop Over Items (Split in Batches)): loops over the items in batches
  7. Store Emails in Vector DB (Qdrant Vector Store): stores documents in the Qdrant vector store, with embeddings: Embeddings OpenAI; document loader: Set proper metadata

Services it uses

OpenAI Chat ModelEmbeddings OpenAIQdrant Vector StoreGmail

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 RAG 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).
Removed in 3.0Replace with
AI Agent v1 (old agent modes)
RAG 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)

From the author

🧠 RAG with Full Gmail history + Real time email updates in RAG using OpenAI & Qdrant > Summary: > This workflow listens for new Gmail messages, extracts and cleans email content, generates embeddings via OpenAI, stores them in a Qdrant vector database,…

Excerpt from Zain Ali's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.