Reply to Telegram messages using an AI agent powered by OpenAI
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.Capture incoming Telegram message via webhook and store sender details
- 2.Process the message through an OpenAI-powered intelligent agent with database access
- 3.Return the AI-generated response directly to the Telegram conversation and save context
- 4.Extract and classify relevant content from documents when needed
- 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
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 (48)
Sticky Note7
Sticky Note
Sticky Note8
Sticky Note
Sticky Note9
Sticky Note
gpt-4o-mini
OpenAI
Chat Response
Set
Sticky Note
Sticky Note
Telegram Response
Set
Sticky Note1
Sticky Note
Sticky Note2
Sticky Note
AI Tools Agent
Agent
Sticky Note10
Sticky Note
Sticky Note11
Sticky Note
Aggregate
Aggregate
Merge
Merge
Sticky Note5
Sticky Note
Sticky Note3
Sticky Note
Get Audio File
Set
Analyze Image
OpenAI
Transcribe Recording
OpenAI
Edit Fields
Set
Convert to Image File
Convert To File
Extract from File to Base64
Extract From File
Sticky Note12
Sticky Note
Sticky Note6
Sticky Note
Message Router
Switch
Image Schema1
Set
caption
Split Out
Merge1
Merge
Get Image
Set
Edit Fields1
Set
Sticky Note13
Sticky Note
Sticky Note14
Sticky Note
Postgres Chat Memory
Memory Postgres Chat
Save Note Tool
Baserow Tool
Save Memory
Baserow Tool
Listen for Telegram Events
Webhook
Validation
Set
Check User & Chat ID
If
Sticky Note15
Sticky Note
Error message
Set
Baserow Retrieve Memories
Baserow
Baserow Retrieve Notes
Baserow
Window Memory (Easy Mode)
Memory Buffer Window
Sticky Note4
Sticky Note
Sticky Note16
Sticky Note
Sticky Note17
Sticky Note
Sticky Note18
Sticky Note
Sticky Note19
Sticky Note