Templates / Telegram AI chatbot with document-based answers using OpenAI and PGVector RAG

Telegram AI chatbot with document-based answers using OpenAI and PGVector RAG

Needs changes

by Victor Gold ✓ · 1,099 views · created 2025-06-08 · Support Chatbot, AI RAG

Needs 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 this workflow does

This AI workflow has 24 nodes and runs when a chat message arrives (plus 3 other triggers). Along the way it connects OpenAI Chat Model, Embeddings OpenAI, Google Drive and Postgres PGVector Store and 2 more.

How it runs

Trigger: When a chat message arrives (plus 3 other triggers).

  1. TestData (Edit Fields (Set)): sets or maps fields
  2. Loop Over Items (Loop Over Items (Split in Batches)): loops over the items in batches
  3. RAG AI Agent (AI Agent): runs an AI agent, with model: OpenAI Chat Model; 1 tool (Docs RAG Tool); memory: Chat Memory
  4. Set File ID (Edit Fields (Set)): sets or maps fields
  5. Delete Old Doc Records (Postgres): uses Postgres
  6. Download File (Google Drive): uses Google Drive
  7. Extract Document Text (Extract from File): extracts data from a file
  8. Create Chunks From Doc (Code): runs custom JavaScript code
  9. Chunks To List (Split Out): splits a list into separate items
  10. Generate Contextual Text (Basic LLM Chain): sends a prompt to an LLM, with model: OpenAI Chat Model

…plus 2 more steps. See the full node list below.

Services it uses

OpenAI Chat ModelEmbeddings OpenAIGoogle DrivePostgres PGVector StorePostgresPostgres Chat Memory

Before you upgrade to n8n 3.0

1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:

  • AI Agent v1 (old agent modes) in RAG AI Agent (v1.6): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).

Removed in 3.0Replace 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)

From the author

🤖 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…

Excerpt from Victor Gold's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.