Telegram AI Bot with Memory-Based Customer Replies
Loading workflow…
Workflow Description
This workflow listens for incoming Telegram messages, passes the message text to an AI Agent powered by the OpenAI gpt-4o-mini chat model, and maintains a rolling window of the last 10 messages per chat using the chat ID as the session key. A system message instructs the agent to be friendly, keep answers under 120 words, reply in the customer's language, and defer business-specific facts to the team. The agent's output is sent back to the same Telegram chat.
How it works
- 1.Telegram Trigger receives incoming customer messages.
- 2.The AI Agent processes the message text with a system message enforcing concise, friendly behavior.
- 3.The gpt-4o-mini chat model generates the response based on the conversation context.
- 4.The buffer window memory stores the last 10 exchanges keyed by the Telegram chat ID.
- 5.The Telegram node sends the agent's output back to the originating chat.
Use cases
- Lightweight first-line customer support for a small business on Telegram
- Automated replies to general questions while deferring pricing and policy details
- Multilingual chat assistant that mirrors the customer's language
Requirements
- A Telegram bot token created via BotFather configured in the Telegram trigger and sender credentials
- Valid OpenAI credentials with access to the gpt-4o-mini model
- The workflow must be activated for the trigger to receive messages automatically
Setup and testing in n8n
- Send a text message to the bot and verify a reply under 120 words arrives
- Ask about prices or business hours and confirm the bot says it will check with the team
- Message the bot in another language and verify the reply matches that language
- Send several follow-up messages to confirm memory of the prior conversation within 10 messages
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 (5)
Telegram Trigger
Set
AI Agent
Agent
Chat Model
OpenAI
Chat Memory
Memory Buffer Window
Send Reply
Set
Source and license
Sticky Note
Fresh workflows, straight to your inbox
Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.
- New workflows
- Clear overviews
- Setup guides