Gmail assistant with full Gmail history RAG using OpenAI
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, and then enables a Retrieval‑Augmented‑Generation (RAG) agent to answer user queries against those stored emails. It’s designed for teams or bots that need conversational access to past emails. --- 🧑🤝🧑 Who’s it for - Support teams who want
At a glance
Gmail assistant with full Gmail history RAG using OpenAI is a ready-made n8n workflow you import as a workflow JSON file — no build required. It connects Gmail, Slack, Discord, OpenAI. It's free to download. Follow the 5-step import below to go live in minutes.
- Platform
- n8n
- Connects
- Gmail, Slack, Discord, OpenAI
- Modules
- 20
- Price
- Free
- Version
- v1.0

About this workflow
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, and then enables a Retrieval‑Augmented‑Generation (RAG) agent to answer user queries against those stored emails. It’s designed for teams or bots that need conversational access to past emails. --- 🧑🤝🧑 Who’s it for - Support teams who want to surface past customer emails in chatbots or help‑desk portals - Sales ops that need AI‑powered summaries and quick lookup of email histories - Developers building RAG agents over email archives --- ⚙️ How it works / What it does 1. Trigger - Gmail Trigger polls every minute for new messages. 2. Fetch & Clean - Get Mail Data pulls full message metadata and body. - Code node normalizes the body (removes line breaks, collapses spaces). 3. Embed & Store - Embeddings OpenAI node computes vector embeddings. - Qdrant Vector Store inserts embeddings + metadata into the emailshistory collection. 4. Batch Processing - SplitInBatches handles large inbox loads in chunks of 50. 5. RAG Interaction - When chat message received → RAG Agent → uses Qdrant Email Vector Store as a tool to retrieve relevant email snippets before responding. 6. Memory - Simple Memory buffer ensures the agent retains recent context. --- 🛠️ How to set up 1. n8n Instance - Deploy n8n (self‑hosted or via Coolify/Docker). 2. Credentials - Create an OAuth2 credential in n8n for Gmail (with Gmail API scopes). - Add your OpenAI API key in n8n credentials. 3. Qdrant - Stand up a Qdrant instance (self‑hosted or Qdrant Cloud). - Note your host, port, and API key (if any). 4. Import Workflow - In n8n, go to Workflows → Import → paste the JSON you provided. - Ensure each credential reference (Gmail & OpenAI) matches your n8n credential IDs. 5. Test - Click Execute Workflow or send a test email to your Gmail. - Monitor n8n logs: you should see new points in Qdrant and RAG responses. --- 📋 Requirements - n8n (Self-hosted or Cloud) - Gmail API enabled on a Google Cloud project - OpenAI API access (with Embedding & Chat endpoints) - Qdrant (hosted or cloud) with a collection named emailshistory --- 🎨 How to customize the workflow - Change Collection Name - Update the qdrantCollection.value in all Qdrant nodes if you prefer a different collection. - Adjust Polling Frequency - In the Gmail Trigger node, switch from everyMinute to everyFiveMinutes or a webhook‑style trigger. - Metadata Tags - In Enhanced Default Data Loader, tweak the metadataValues to tag by folder, label, or sender domain. - Batch Size - In SplitInBatches, change batchSize to suit your inbox volume. - RAG Agent Prompt - Customize the systemMessage in the RAG Agent node to set the assistant’s tone, instruct on date handling, or add additional tools. - Additional Tools - Chain other n8n nodes (e.g., Slack, Discord) after the RAG Agent to broadcast AI answers to team channels.
How to import this n8n workflow
- 1
Download the workflow JSON file after purchase.
- 2
Open n8n → click the menu → Import from File.
- 3
Select the downloaded JSON and import.
- 4
Set up credentials for each node that requires them.
- 5
Click Execute Workflow to test, then activate.
Setup guide
Setup guide included
Purchase to unlock the full step-by-step guide
Related N8n workflows
Upload Gmail attachment to Docparser
Automate marketing leads import from Google Sheets to Airtable CRM
Generate 100+ ad variations from one image with Fal.AI Nano Banana and GPT-5
Post Discord messages for new Incidents in ilert
Facebook Campaign Data to Airtable & Slack Integration
Send Slack messages when a new track is added to a Spotify playlist
Generate UGC promo videos with OpenAI, Sora 2 and Blotato for eCommerce
Generate and send AI news newsletters automatically with GPT & Gmail
Reviews
No reviews yet
Be the first to buy and share your experience.
Leave a review
Sign in to share your experience with this workflow.
Create a free account to purchase workflows.
- JSON blueprint — instant download
- Setup guide PDF included
- 5 downloads · valid 30 days
- Works with n8n
Need help setting this up?
Book a 3-hour live setup session with an Agility consultant.
- Configure live on Google Meet / Zoom
- Free follow-up if workflow has defects
- Platform expert assigned to you