Sync a Telegram RAG chatbot with Google Drive using OpenAI and Supabase
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.
Nodes used (13)
- AI Agent
@n8n/n8n-nodes-langchain.agent - OpenRouter Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenRouter - Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Google Drive Trigger
n8n-nodes-base.googleDriveTrigger - Google Drive
n8n-nodes-base.googleDrive - Extract from File
n8n-nodes-base.extractFromFile - Supabase
n8n-nodes-base.supabase - Edit Fields (Set)
n8n-nodes-base.set - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Telegram Trigger
n8n-nodes-base.telegramTrigger - Telegram
n8n-nodes-base.telegram - Postgres Chat Memory
@n8n/n8n-nodes-langchain.memoryPostgresChat
What it does
Quick overview This workflow runs a Telegram RAG chatbot that answers questions using PDFs synced from Google Drive into a Supabase vector store, automatically re-indexing when files are added or updated and removing knowledge when files are moved to a trash folder. How it works 1. Triggers when a user sends a Telegram message and passes the text to a LangChain AI Agent. 2. The agent uses an OpenRouter chat model, Postgres chat memory, and a Supabase vector store tool (with OpenAI embeddings) to retrieve relevant context and generate an answer. 3. Sends the generated response back to the user in Telegram. 4. Triggers when a new file is created in a watched Google Drive folder, downloads the PDF, extracts its text, chunks it, generates OpenAI embeddings, and inserts the vectors into a Supabase table. 5. Triggers when a file is updated in another watched Google Drive folder, deletes existing Supabase vectors that match the file name, then re-downloads the PDF, re-extracts/chunks it, embeds it with OpenAI, and re-inserts it into Supabase. 6. Triggers when a file appears in a designated Google Drive “trash” folder, deletes matching vectors from Supabase and deletes the file from Google Drive. Setup 1. Create a Telegram bot and add a Telegram credential in n8n. 2. Add credentials for Google Drive OAuth2, Supabase, OpenRouter, OpenAI (for embeddings), and Postgres (for chat memory). 3. In Supabase, create the documents table configured for vector search (pgvector) and match the table name in the Supabase vector store nodes. 4. Update the Google Drive trigger nodes to point at your source folder(s) (new files, updated files, and trash) and ensure the workflow has permission to download and delete files. 5. If you rely on file-name matching for deletes, ensure your chunk metadata includes fileName consistently so updates and removals target the correct vectors.