AI Agents

Reply to Telegram messages using an AI agent powered by OpenAI

48 nodes 285 141 Webhook
Download

Workflow Description

Receive messages from Telegram, route them to an intelligent agent powered by OpenAI, maintain conversation context in a database, and deliver smart responses back to Telegram in real time based on stored memory and message history.

How it works

  1. 1.Capture incoming Telegram message via webhook and store sender details
  2. 2.Process the message through an OpenAI-powered intelligent agent with database access
  3. 3.Return the AI-generated response directly to the Telegram conversation and save context
  4. 4.Extract and classify relevant content from documents when needed
  5. 5.Maintain conversation memory in Postgres to improve future responses

Use cases

  • Customer support team answering client inquiries automatically on Telegram with contextual awareness
  • Smart assistant for businesses handling routine employee questions on Telegram
  • Research application extracting information from documents and answering queries intelligently via Telegram

Requirements

  • Active OpenAI account with a valid API key
  • Telegram bot registered with a valid API token
  • Postgres or Baserow database to store conversations and context
  • Permission to access files and documents for information extraction when needed

Service Value

Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.

Apps Used

OpenAI Telegram AI Agent Postgres Tool Baserow Memory

Details

Trigger Webhook
Nodes 48
Apps 7
Views 285
Downloads 141

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 (48)

/

Sticky Note7

Sticky Note

#1

Sticky Note8

Sticky Note

#2

Sticky Note9

Sticky Note

#3

gpt-4o-mini

OpenAI

#4

Chat Response

Set

#5

Sticky Note

Sticky Note

#6

Telegram Response

Set

#7

Sticky Note1

Sticky Note

#8

Sticky Note2

Sticky Note

#9

AI Tools Agent

Agent

#10

Sticky Note10

Sticky Note

#11

Sticky Note11

Sticky Note

#12

Aggregate

Aggregate

#13

Merge

Merge

#14

Sticky Note5

Sticky Note

#15

Sticky Note3

Sticky Note

#16

Get Audio File

Set

#17

Analyze Image

OpenAI

#18

Transcribe Recording

OpenAI

#19

Edit Fields

Set

#20

Convert to Image File

Convert To File

#21

Extract from File to Base64

Extract From File

#22

Sticky Note12

Sticky Note

#23

Sticky Note6

Sticky Note

#24

Message Router

Switch

#25

Image Schema1

Set

#26

caption

Split Out

#27

Merge1

Merge

#28

Get Image

Set

#29

Edit Fields1

Set

#30

Sticky Note13

Sticky Note

#31

Sticky Note14

Sticky Note

#32

Postgres Chat Memory

Memory Postgres Chat

#33

Save Note Tool

Baserow Tool

#34

Save Memory

Baserow Tool

#35

Listen for Telegram Events

Webhook

#36

Validation

Set

#37

Check User & Chat ID

If

#38

Sticky Note15

Sticky Note

#39

Error message

Set

#40

Baserow Retrieve Memories

Baserow

#41

Baserow Retrieve Notes

Baserow

#42

Window Memory (Easy Mode)

Memory Buffer Window

#43

Sticky Note4

Sticky Note

#44

Sticky Note16

Sticky Note

#45

Sticky Note17

Sticky Note

#46

Sticky Note18

Sticky Note

#47

Sticky Note19

Sticky Note

#48