Back to Catalog

Templates by Zain Ali

Real-time email RAG assistant with Gmail, OpenAI GPT, and PGVector

🧠 Email real time RAG Assistant with Gmail, OpenAI & PGVector 📌 Who’s it for This workflow is ideal for: Professionals Project managers Sales and support teams Anyone managing high volumes of Gmail messages It enables fast and intelligent search through your email inbox using natural language queries. --- ⚙️ How it works / What it does Continuously monitors your Gmail inbox for new emails. Extracts email content and metadata (subject, body, sender, date). Converts email content into vector embeddings using OpenAI. Stores embeddings in a PostgreSQL database with PGVector. A conversational AI agent performs semantic search on your stored email history. Supports time-sensitive and context-aware responses via OpenAI Chat model. --- 🚀 How to set up Connect your Gmail account to the Gmail Trigger node (with API access enabled). Configure OpenAI credentials for the Embedding and Chat nodes. Set up a PostgreSQL database with the PGVector extension enabled. Import the workflow into your n8n instance (Cloud or Self-hosted). Customize parameters like polling frequency, embedding settings, or vector query depth. --- 📋 Requirements ✅ n8n instance (Self-hosted or Cloud) ✅ Gmail account with API access ✅ OpenAI API Key ✅ PostgreSQL database with PGVector extension installed --- 🛠️ How to customize the workflow Email Filtering: Change filters in the Gmail Trigger to watch specific labels or senders. Text Splitting Granularity: Adjust chunkSize and chunkOverlap in the text splitter node. Query Depth: Modify topK in the vector search node to retrieve more or fewer similar results. Prompt Tuning: Customize the system message or agent instructions in the RAG node. Workflow Extensions: Add notifications, error logging, Slack/Telegram alerts, or data exports.

Zain AliBy Zain Ali
3718

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 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 Trigger Gmail Trigger polls every minute for new messages. Fetch & Clean Get Mail Data pulls full message metadata and body. Code node normalizes the body (removes line breaks, collapses spaces). Embed & Store Embeddings OpenAI node computes vector embeddings. Qdrant Vector Store inserts embeddings + metadata into the emails_history collection. Batch Processing SplitInBatches handles large inbox loads in chunks of 50. RAG Interaction When chat message received → RAG Agent → uses Qdrant Email Vector Store as a tool to retrieve relevant email snippets before responding. Memory Simple Memory buffer ensures the agent retains recent context. --- 🛠️ How to set up n8n Instance Deploy n8n (self‑hosted or via Coolify/Docker). Credentials Create an OAuth2 credential in n8n for Gmail (with Gmail API scopes). Add your OpenAI API key in n8n credentials. Qdrant Stand up a Qdrant instance (self‑hosted or Qdrant Cloud). Note your host, port, and API key (if any). Import Workflow In n8n, go to Workflows → Import → paste the JSON you provided. Ensure each credential reference (Gmail & OpenAI) matches your n8n credential IDs. 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 emails_history --- 🎨 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.

Zain AliBy Zain Ali
1413

Create project summaries from meeting transcripts with GPT-4 and Google Docs

🧾 Generate Project Summary from meeting transcript Who’s it for 🤝 Project managers looking to automate client meeting summaries Client success teams needing structured deliverables from transcripts Agencies and consultants who want consistent, repeatable documentation How it works / What it does ⚙️ Trigger: Manual or webhook trigger kicks off the workflow. Get meeting transcript: Reads the raw transcript from a specified Google Docs file. Generate summary: Sends transcript + instructions to OpenAI (gpt-4.1-mini) to produce a structured project summary. Convert to HTML: Transforms the LLM-generated Markdown into styled HTML. Prepare request: Wraps HTML and metadata into a multipart request body. Create Google Doc: Uploads the new “Project Summary” document into your Drive folder. How to set up 🛠️ Credentials Google Docs & Drive OAuth2 credentials OpenAI API key (gpt-4.1-mini) Nodes configuration Manual Trigger / webhook node Google Docs “Get meeting transcript” node: set documentURL AI Chat Model node: select gpt-4.1-mini Markdown node: enable tables & emoji Google Drive “CreateGoogleDoc” node: set target folder ID Paste in your IDs Update documentURL to your transcript doc Update googledrivefolder_id in the Set node Execute Click “Execute Workflow” or call via webhook Requirements 📋 n8n Google OAuth2 scopes for Docs & Drive OpenAI account with GPT-4.1-mini access A Google Drive folder to store summaries How to customize ✨ Output format: Edit the Markdown prompt in the ChainLlm node to adjust headings or tone Timeline section: Extend LLM prompt template with your own phase table Styling: Tweak inline CSS in the Code node (Prepare_Request) for fonts or margins Trigger: Swap Manual Trigger for HTTP/Webhook trigger to integrate with other tools Language model: Upgrade to a different model by changing model.value in the AI node

Zain AliBy Zain Ali
567

Google Drive workflow with nested folder support

👤 Who’s it for Anyone who needs to recursively fetch all files from a specific Google Drive folder, including files inside all its nested (child) folders. Ideal for automation builders, admins, and integrators who want to process, move, list, or report on all files in a complex folder tree. --- ⚙️ How it works / What it does This workflow will: Accept a Google Drive Folder ID as an input (from another workflow or trigger). Recursively discover all child folders starting from the parent, no matter how many levels deep. Collect all file IDs & names from every folder (parent + all descendants). Return a clean list of all found files (with IDs and names) for further automation, downloading, or processing. Key features: 💡 Works recursively (handles any depth of nested folders). 🏷️ Outputs file ID & file name for each discovered file. 🔄 Can be triggered by other workflows (great for modular automation). --- 🛠️ How to set up Google Drive Credentials Make sure you’ve set up a Google Drive OAuth2 credential in n8n. Connect this credential to all Google Drive nodes in the workflow. Parent Folder ID Input the Google Drive folder ID you want to start from. How to pass it: If running standalone: update the When Executed by Another Workflow node with your folder ID. If called from another workflow: pass the folder ID as an input named id. Check Set Nodes There are two Set nodes (Return parent and Return parent1) and one trigger (When Executed by Another Workflow) where you might want to update the hardcoded folder ID. ⚠️ Change these IDs to match your use case. Run the Workflow Start the workflow (or execute it via another workflow). The result will be a flat list of files in all subfolders. --- ✅ Requirements 🟢 n8n instance 🟢 Google Drive OAuth2 credentials connected in n8n 🟢 A valid Google Drive folder ID to start from --- 🧑‍💻 How to customize Return Extra Data: Add fields in the “Search files” node options to return more Google Drive file metadata (e.g., size, webViewLink). Filter by File Type: Adjust the search query or add a filter node to only include certain file types (e.g., PDFs, Docs). Change Output Format: Edit the “Edit Fields” Set node to structure your output differently. Integrate Further: Add new nodes after the Loop to, for example, download, email, or sync files as needed. --- 🚨 Notes & Tips Performance: This workflow is optimized for up to hundreds of folders. For very large Drive accounts (thousands of folders/files), consider pagination or batching. Credential Security: Always use n8n’s built-in credential manager—never hard-code sensitive data. Static IDs: As noted in the sticky note, make sure to update all hardcoded folder IDs for your production use. --- 🗂️ Node Overview When Executed by Another Workflow: Accepts a folder ID (entry point). Google Drive – Get children folders: Lists subfolders of the given folder. If: Checks if the folder contains any subfolders. Execute Workflow: Handles recursion (calls itself on child folders). Code: Flattens all discovered folder IDs for next step. Loop Over Items: Iterates over all folders to process files. Google Drive – Search files: Finds all files in each folder. Edit Fields (Set): Structures file data for output. Sticky Note: Documentation and reminders inside your workflow. --- 🔄 Example Output json [ { "file_id": "1A2B3C...", "file_name": "MyDoc.pdf" }, { "file_id": "2B3C4D...", "file_name": "Presentation.pptx" } ]

Zain AliBy Zain Ali
198

Match medical symptoms to products with OpenAI, Qdrant & Google Sheets RAG

🧠 RAG AI Medical Agent – n8n Workflow 👥 Who’s it for This workflow is perfect for: Healthcare ecommerce businesses that want to automate product recommendations. Founders or developers building an AI assistant using retrieval-augmented generation (RAG) with product data. Anyone wanting to combine OpenAI, Qdrant vector search, and Google Sheets to power intelligent medical queries. --- ⚙️ How it works / What it does This RAG-based workflow allows users to ask medical questions related to hair or scalp issues (e.g., hair loss, thinning). It: Retrieves product info from a Google Sheet. Converts product data into text embeddings using OpenAI. Stores those embeddings in a Qdrant vector database. On chat message trigger, performs a vector similarity search to match user symptoms with relevant products. Uses an AI agent to respond with top 3 matching products from your catalog. --- 🛠️ How to set up Step 1: 🗂 Get your data Make sure your Google Sheet contains the following columns: Product Name Symptoms Involved Product Description ForeverBetty Product Page Link Category (optional but recommended) Step 2: 🔐 Connect your accounts Add your Google Sheets OAuth2 credentials in the "Get all products" node. Add your OpenAI API key in the embedding nodes. Add your Qdrant credentials in the vector store nodes. Step 3: 🧠 Populate the Vector DB Click “Execute workflow” manually. This pulls data from the Google Sheet. Each row is: Formatted properly into a vector-friendly string. Converted into an embedding using OpenAI. Stored into Qdrant. Step 4: 💬 Enable Chat Interface Use the ChatTrigger to receive user queries. The agent searches Qdrant for relevant vectors. Replies with product suggestions via LangChain's LLM agent. --- 📋 Requirements 🧠 n8n 📄 A Google Sheet with product data. 🔐 Google Sheets OAuth2 credentials. 🧠 OpenAI API key (for embeddings + chat LLM). 🗃️ Qdrant Vector DB instance (Cloud or self-hosted). --- 🧩 How to customize it 🔄 Change the data structure Update the "Set Data Properly in vector database" node to modify what fields are embedded. Example: handlebars --- Product: {{ $json['Product Name '] }} Use-case: {{ $json['Symptoms Involved'] }} Link: {{ $json['ForeverBetty Product Page Link '] }}

Zain AliBy Zain Ali
146
All templates loaded