Process Telegram messages with semantic search and structured RAG
Workflow Description
Automation that receives messages via Telegram, analyzes them using an intelligent agent powered by OpenAI, retrieves relevant information from a Vector Store database using semantic RAG techniques, and sends tailored responses back to the user.
How it works
- 1.Receive user message through Telegram trigger
- 2.Convert message to semantic representation using Ollama Embeddings
- 3.Search Vector Store for relevant documents and information
- 4.Process retrieved data through an OpenAI-powered AI agent
- 5.Send generated response back to user via Telegram
Use cases
- Answer user queries based on a specific knowledge base
- Build an intelligent Telegram assistant that understands semantic intent behind questions
- Retrieve and summarize information from multiple documents in response to a single request
Requirements
- Active Telegram account with bot API token
- OpenAI API key for LLM model access
- PostgreSQL database with Vector Store extension enabled
- Pre-indexed documents or content available in Vector Store
Service Value
Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.
Apps Used
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (20)
Telegram Trigger
Set
Loop Over Items
Split In Batches
Came from Telegram?
If
When chat message received
Chat Trigger
Postgres PGVector Store
Vector Store P G Vector
Call the SQL composer Workflow
Tool Workflow
Embeddings Ollama
Embeddings Ollama
Beautify chat response
Set
Split text into chunks
Code
Respond on Telegram in batches
Set
Escape Markdown
Code
No Operation, do nothing
No Op
Sticky Note
Sticky Note
Sticky Note1
Sticky Note
Sticky Note2
Sticky Note
Sticky Note3
Sticky Note
Simple Memory
Memory Buffer Window
AI Agent
Agent
OpenAI Chat Model
OpenAI
Generate session id
Set