Skip to content
AI Agents

Telegram AI Bot with Memory-Based Customer Replies

5 nodes 37 6 Manual trigger
Download

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. 1.Telegram Trigger receives incoming customer messages.
  2. 2.The AI Agent processes the message text with a system message enforcing concise, friendly behavior.
  3. 3.The gpt-4o-mini chat model generates the response based on the conversation context.
  4. 4.The buffer window memory stores the last 10 exchanges keyed by the Telegram chat ID.
  5. 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

  1. Send a text message to the bot and verify a reply under 120 words arrives
  2. Ask about prices or business hours and confirm the bot says it will check with the team
  3. Message the bot in another language and verify the reply matches that language
  4. 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

Telegram AI Agent OpenAI Memory

Details

Trigger Manual trigger
Nodes 5
Apps 4
Views 37
Downloads 6

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

Telegram Trigger

Set

#1

AI Agent

Agent

#2

Chat Model

OpenAI

#3

Chat Memory

Memory Buffer Window

#4

Send Reply

Set

#5

Source and license

Sticky Note

#6
Stay in the loop

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

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime