AI Agents

Process Telegram messages with semantic search and structured RAG

20 nodes 305 148 Automatic trigger
Download

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. 1.Receive user message through Telegram trigger
  2. 2.Convert message to semantic representation using Ollama Embeddings
  3. 3.Search Vector Store for relevant documents and information
  4. 4.Process retrieved data through an OpenAI-powered AI agent
  5. 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

Telegram Split In Batches Chat Trigger Vector Store Tool Embeddings Memory AI Agent OpenAI

Details

Trigger Automatic trigger
Nodes 20
Apps 9
Views 305
Downloads 148

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (20)

/

Telegram Trigger

Set

#1

Loop Over Items

Split In Batches

#2

Came from Telegram?

If

#3

When chat message received

Chat Trigger

#4

Postgres PGVector Store

Vector Store P G Vector

#5

Call the SQL composer Workflow

Tool Workflow

#6

Embeddings Ollama

Embeddings Ollama

#7

Beautify chat response

Set

#8

Split text into chunks

Code

#9

Respond on Telegram in batches

Set

#10

Escape Markdown

Code

#11

No Operation, do nothing

No Op

#12

Sticky Note

Sticky Note

#13

Sticky Note1

Sticky Note

#14

Sticky Note2

Sticky Note

#15

Sticky Note3

Sticky Note

#16

Simple Memory

Memory Buffer Window

#17

AI Agent

Agent

#18

OpenAI Chat Model

OpenAI

#19

Generate session id

Set

#20