Connect Telegram with OpenAI
Workflow Description
An advanced automation template connecting Telegram with OpenAI's intelligent models, enabling smart message processing through an AI agent with memory support, tool integration, and Postgres database persistence for conversation context tracking.
How it works
- 1.Receive Telegram messages via webhook and transform them into processing requests
- 2.Send messages to OpenAI intelligent agent with integrated tools and database access
- 3.Store conversation context in Postgres and return final response to the user
Use cases
- Smart Telegram chatbot answering customer inquiries using advanced natural language processing
- Automated support system maintaining conversation history and customer context across multiple sessions
Requirements
- Valid OpenAI API key and Telegram Bot token
- Postgres database configured to store memory and conversation contexts
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