Library / RAG & Knowledge Bases
RAG & Knowledge Bases
Sync a Telegram RAG chatbot with Google Drive using OpenAI and Supabase
When something happens in a connected app, it answers questions from your own knowledge base with OpenAI / ChatGPT and OpenRouter using Postgres, Supabase, Google Drive, Telegram.
What it does
# Self-Updating RAG Chatbot # Synced from Google Drive ## Who's it for Teams and solo builders who maintain a living document library in Google Drive and want a chatbot that answers questions from it — without manually re-indexing every time a file changes. Upload a PDF, and the bot knows about it in seconds. Update a file, and the old knowledge is replaced. Delete a file, and it disappears from the bot's memory. Everything happens automatically. ## How it works The workflow has four independent parts that work together: - Part 1 — Chat: Always-on Telegram bot with AI Agent and memory. - Part 2 — Ingest new file: Downloads new PDFs, chunks, embeds, and saves to Supabase. - Part 3 — Update existing file: Wipes old vectors and re-indexes modified files. - Part 4 — Delete a file: Cleans up vectors when files are removed from Drive. ## How to set up 1. Create Supabase Table: Go to your Supabase project's SQL Editor and follow the official guide to set up the vector extension and documents table: Supabase LangChain Guide. 2. OpenAI Credentials: Add your OpenAI API key to n8n (used for embeddings). 3. Google Drive: Add your Google Drive credential and point the three Drive Trigger nodes to your target folder. 4. Supabase Credentials: Add your Supabase credential (URL + service key) to the Supabase nodes. 5. Telegram Bot: Create a bot via @BotFather, add your token as a credential, and set your chat ID. 6. Activate Workflows: Turn on all three sub-workflows (Ingest, Update, Delete) first, then activate the Chat workflow. 7. Test: Drop a PDF into your Google Drive folder and start chatting on Telegram! ## Requirements - OpenAI API key (for embeddings). - Supabase project with pgvector enabled. - Google account with Drive access. - Telegram bot token and chat ID. - OpenRouter (or any supported LLM). ## How to customize - Swap the OpenRouter model for GPT-4o, Claude, or Gemini in the AI Agent node. - Add a custom system prompt to give the bot a unique persona. - Filter Drive triggers by specific file types. --- Categories: AI, RAG, Knowledge Management, Productivity Nodes: 25
The steps
- Answer from knowledge base
- Language Model (OpenRouter)
- Search knowledge base
- Embed the query
- New PDF added to Drive folder
- Download the PDF
- Extract text from PDF
- Index into vector database
- PDF updated in Drive folder
- Remove outdated vectors
- Download updated PDF
- Extract text from updated PDF
- Tag with file ID and name 01
- Tag with file ID and name 02
25 steps in total.
Similar automations
RAG & Knowledge BasesRun a RAG Messenger chatbot with Facebook, Google Drive, Supabase, OpenAI and OpenRouter36 stepsRAG & Knowledge BasesReply to Facebook comments using RAG with Google Drive, Supabase, OpenAI and Postgres33 stepsRAG & Knowledge BasesRAG Chatbot on Telegram with Supabase and OpenRouter11 stepsRAG & Knowledge BasesChat with Supabase Vector Store and Postgres Memory12 steps