Telegram AI chatbot with document-based answers using OpenAI and PGVector RAG
Needs changesNeeds 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 to replace before upgrading
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) RAG AI Agent (v1.6) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (18)
- OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Google Drive
n8n-nodes-base.googleDrive - Google Drive Trigger
n8n-nodes-base.googleDriveTrigger - Extract from File
n8n-nodes-base.extractFromFile - Edit Fields (Set)
n8n-nodes-base.set - AI Agent
@n8n/n8n-nodes-langchain.agent - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Recursive Character Text Splitter
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - Code
n8n-nodes-base.code - Split Out
n8n-nodes-base.splitOut - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Postgres PGVector Store
@n8n/n8n-nodes-langchain.vectorStorePGVector - Postgres
n8n-nodes-base.postgres - Execute Workflow Trigger
n8n-nodes-base.executeWorkflowTrigger - Postgres Chat Memory
@n8n/n8n-nodes-langchain.memoryPostgresChat
What it does
π€ AI Q&A Chatbot Workflow β Build Your Own AI Agent Trained on Private Documents This powerful AI automation add-on upgrades your Telegram Bot Starter Template by integrating a fully functional AI chatbot and a context-aware AI agent that answers user questions using your internal documents. Unlike generic bots, this chatbot uses your own data to respond with deeply personalized, context-relevant information β perfect for support, onboarding, internal knowledge access, and client-facing interactions. It connects to any PostgreSQL database β including Neon.tech, Supabase, or a self-hosted Postgres setup β allowing you to build custom AI-powered FAQ assistants, internal support bots, or knowledge-based customer service tools. --- π§ Why It Works: Contextual Retrieval The secret is Contextual Retrieval β a powerful technique where your documents are stored in a way that preserves meaning and context. This allows the AI to fetch highly relevant, source-backed responses, eliminating hallucinations and guesswork. > Data is embedded, chunked, and saved in a vector database (Postgres + PGVector), enabling smart semantic search tailored to your needs. π Learn more about this approach in this article by Anthropic β --- β¨ Key Features - Chat with your internal documents: Uses your content to answer questions with precision - Built-in document vectorization: Pre-configured Google Drive ingestion flow (Notion, Airtable, Dropbox available separately) - Contextual memory: Past chats stored in PostgreSQL for personalized conversations - Plug-and-play architecture: Connect Supabase, OpenAI, custom APIs via n8nβs interface --- π€ Who Can Use This Workflow? - Entrepreneurs & startups building branded AI chatbots without code - Customer support teams automating answers using documentation - Ops teams creating internal FAQ bots for onboarding and training - No-code developers using n8n to build Telegram bots with AI features --- βοΈ Setup Instructions You'll find step-by-step instructions inside the workflow. Quick Setup Overview: 1. Import the workflow into n8n (cloud or self-hosted) 2. Add your Telegram Bot credentials 3. Connect your PostgreSQL DB (Neon, Supabase, etc.) 4. Set up document ingestion from Google Drive 5. Activate the workflow and start chatting --- π§© Extensibility This workflow is modular and ready to expand. Build powerful assistants by connecting additional workflows: - Vectorization modules for Notion, Airtable, Dropbox, and others - Any vector DB: Neon.tech, Supabase, or self-hosted PGVector - βπ» Telegram User Registration Module β - π΅ Telegram Payment, Invoicing & Refund Module β --- π§ More Smart AI Agents Explore more AI workflows and agents on my Gumroad β - π Agent: Find in the Internet β fetches live info from the web - π Agent: Search Internal Docs β queries Notion, Google Drive, etc. - π¦ Agent: Check Order Status β reads status from Airtable or CRM - π° Agent: Calculate Cost or Quote β builds pricing logic from inputs π¨ Submit your idea here for a custom AI agent β