Mindket

Telegram chat bot with memory run by an AI agent

Newversion 1 · updated

Overview

An n8n workflow that answers Telegram messages with an AI agent. The agent addresses each person by first name, remembers the last ten messages of the chat, and sends its reply back to the sender.

Telegram chat bot with memory run by an AI agent is an n8n workflow in the Productivity category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

At a glance

Runs in
  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file, behind a public HTTPS address
  • Another chat app: replace the two Telegram nodes with that app’s trigger and send nodes

Platform

Connects 2 apps

How it works

Trigger

Telegram message

It starts when someone messages the bot, and it needs:

  • A Telegram bot and its token
  • A text message sent to the bot

Actions

  1. The message text and the sender’s first name are read
  2. The last ten messages of the same chat are loaded from memory
  3. An AI agent writes an answer that addresses the sender by name
  4. The answer is sent back to the sender in Telegram

Result

A Telegram reply from the AI agent that takes the chat so far into account

Integrations

What you need before you start.

Telegram

Chat

Receives the messages and sends the replies.

NeedsTelegram bot token

OpenAI

Agent model

Writes each answer from the message and the recent chat.

NeedsOpenAI API key

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
3 steps, starting on a Telegram event
AI
1 step calls an AI model: AI Agent
Sign-ins
Signs in to: Telegram and OpenAI
API keys
No API key is left in the file
Step types
Mindket’s checker reads all 3 of its step types

Read from the workflow’s file, not from a run.

About

What it is

This n8n workflow turns a Telegram bot into a chat assistant. When someone messages the bot, an AI agent reads the text, addresses the person by first name and answers. It remembers the last ten messages of the same chat, so a follow-up question makes sense. The answer goes back to the sender in Telegram. Five nodes run it, beside one sticky note.

Who it suits

People who want an AI assistant inside Telegram, and builders who want a small agent to add tools to. Skip it if you need a bot that does tasks for you, because this copy only talks.

Who uses it, and how
IndustryWho uses itHow they use itExample
PersonalIndividualsAsk an assistant from the phoneA user asks the bot to explain a contract term while commuting.
Small businessShop ownersReword replies to customersA shop owner pastes a blunt answer and asks for a friendlier one.
EducationTutorsGive a student a patient practice partnerA tutor shares the bot so a student can keep asking questions after class.
DevelopmentBuildersStart from an agent with chat and memoryA developer connects a new tool to the agent node and tries it in Telegram.

You need a little n8n: import a file, add two credentials and create a Telegram bot.

Where to use it

Any n8n that can reach Telegram and OpenAI will run it. Telegram delivers each message to a web address over HTTPS, so your n8n must be reachable from the internet.

  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file, behind a public HTTPS address
  • Another chat app: replace the two Telegram nodes with that app’s trigger and send nodes

Setup

Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. You need a Telegram bot token and an OpenAI key.

What you need first
NeedDetail
n8nOn n8n Cloud or on a server with a public HTTPS address
TelegramA bot made with BotFather, and its token
OpenAIAn API key
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. Add a Telegram credential with your bot’s token and select it in Listen for incoming events and Send final reply.
  3. Add an OpenAI credential and select it in OpenAI Chat Model.
  4. Publish the workflow, so Telegram has an address to deliver messages to.
  5. Send your bot a text message in Telegram and wait for the reply.

How to use it

Chat with the bot as you would with any assistant. It addresses you by your first name, and a follow-up question sees the earlier messages of the same chat. Only text messages work.

What to change for a different result
To changeWhere
The bot’s role and mannerThe system message in AI Agent
How much it remembersThe context window length in Window Buffer Memory
The modelOpenAI Chat Model
What the bot can doAdd tool nodes to AI Agent
Which updates it readsUpdates in Listen for incoming events

Example

A user named Lena writes “What does force majeure mean?” to the bot. The agent reads the text and Lena’s first name from the message and replies with a plain explanation that addresses her by name. She then asks “Does that cover a strike?”, and the agent answers with her first question in view.

The memory holds the last ten messages of that chat, so the follow-up does not need to repeat the topic.

For newcomers and experts

If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. A Telegram bot is an account that a program controls. An AI agent is a node that lets a chat model decide what to do and which tools to call.

For experts. Window Buffer Memory keys each conversation as chat_with_ plus the chat ID. It keeps ten messages in the memory of the n8n process, not in a database. The reply goes to the sender’s user ID, which differs from the chat ID in a group chat.

Where to look closer
NodeWhat it doesWhat to know
Listen for incoming eventsReceives every kind of updateUpdates with no message make the next node fail
AI AgentAnswers the text of the messageVersion 1.7, with memory and no tools
Window Buffer MemoryRemembers ten messages per chatLives in the n8n process
Send final replySends the answerMarkdown unless you set a parse mode

Good to know

The original copy could also draw pictures. That part is gone, and a few other lines were repaired.

  • Pictures: the file gave the agent a DALL-E 3 tool and a Telegram tool to send the link. OpenAI’s page, read on 12 November 2026, shows dall-e-3 shut down on 12 May 2026. Mindket’s copy has no image tools
  • Model: OpenAI’s page shuts gpt-4o down on 14 January 2027 and names gpt-6-luna. That model supports function calling in Chat Completions only with reasoning effort set to none, so Mindket’s copy uses gpt-5.6-terra
  • Text only: a photo, a sticker or an edited message has no message.text, so that run fails
  • Markdown: Telegram’s page says _, *, the backtick and [ outside a formatted span must be escaped, so an answer that does not may be refused
  • Memory: it sits in the n8n process, so a restart clears it
  • Open bot: anyone who finds the bot can message it and use your OpenAI credit
  • Not run: Mindket read this copy against n8n’s source and did not run it on a live n8n or with a real bot
  • Your data: the messages go to OpenAI, and Telegram holds the chat
  • Credentials: the JSON holds none

README and files

README

Telegram chat bot with memory run by an AI agent

An n8n workflow that answers Telegram messages with an AI agent. When someone messages the bot, the agent reads the text, addresses the person by first name and replies. It remembers the last ten messages of the same chat, so a follow-up question makes sense.

What is inside

  • workflow.json: the workflow as n8n exports it, 6 nodes. Five of them run and one is a sticky note. It holds no credential.
  • README.md: these notes.

What we changed from the original copy

  • OpenAI Chat Model used gpt-4o with a temperature of 0.7 and a frequency penalty of 0.2. OpenAI's deprecation page, read on 12 November 2026, shuts gpt-4o down on 14 January 2027 and names gpt-6-luna. That model's page says Chat Completions supports function calling only with reasoning effort set to none, and n8n's chat model node offers only low, medium and high. The agent is a tools agent, so the node uses gpt-5.6-terra, whose page lists function calling without that limit. It has no temperature or penalty setting, because that page lists neither.
  • Generate image in Dalle and Send back an image are gone. The first called the DALL-E 3 image API, which OpenAI's page lists as shut down on 12 May 2026. The second sent the link that the first returned. The gpt-image models that replace DALL-E give back the picture itself and no link: n8n's own OpenAI node treats them that way. The second tool needed a link, so both tools went.
  • The last sentence of the system message in AI Agent, which told it to send the image link, is removed, since nothing can make a link now.
  • The sticky note was titled for the image feature. It now says what the workflow does.
  • The credential links are gone, and the file's name is ours.
  • Nothing else. The trigger, the memory, the agent's prompt and the reply node are as the file had them.

Mindket read this copy against n8n's source. It was not run on a live n8n and was not connected to a real Telegram bot.

Before you start

  • An n8n instance that can be reached from the internet over HTTPS. Telegram delivers each message to a web address.
  • A Telegram bot and its token. You make a bot by chatting with BotFather in Telegram.
  • An OpenAI API key.

Set it up

  1. In n8n, create a workflow, open its menu and choose Import from File. Pick workflow.json.
  2. Add a Telegram credential with your bot's token. Select it in Listen for incoming events and Send final reply.
  3. Add an OpenAI credential and select it in OpenAI Chat Model.
  4. Publish the workflow, so that Telegram has an address to deliver messages to.
  5. Send your bot a text message in Telegram and wait for the reply.

What happens in a run

  1. Listen for incoming events starts the run when Telegram delivers an update to the bot. It listens for every kind of update.
  2. AI Agent takes message.text as its prompt. Its system message says it is a helpful assistant talking to a user whose first name comes from the message, and that it should address the user by name every time.
  3. OpenAI Chat Model writes the answer. Window Buffer Memory supplies ten messages of the chat's history, stored under a key made of chat_with_ and the chat ID.
  4. Send final reply sends the agent's output to the sender's user ID, with the attribution line turned off.

What to change

  • The bot's role and manner: the system message in AI Agent.
  • How much it remembers: the context window length in Window Buffer Memory.
  • The model: OpenAI Chat Model.
  • What the bot can do: add tool nodes to AI Agent.
  • Which updates it reads: Updates in Listen for incoming events.
  • A different chat app: replace the two Telegram nodes.

Good to know

  • Only text works. A photo, a sticker or an edited message has no message.text, so that run fails.
  • Listen for incoming events is set to every update type. An update that carries no message, such as an edited message or a channel post, makes AI Agent fail.
  • Send final reply sends in Markdown unless you set a parse mode. Telegram's page says _, *, the backtick and [ outside a formatted span must be escaped, so an answer that does not may be refused. The reply node's error output leads nowhere.
  • Window Buffer Memory lives in the memory of the n8n process. A restart clears it, and it is not shared between n8n processes.
  • The reply goes to the sender's user ID. In a group chat that ID is not the chat ID, which is what the memory uses.
  • Anyone who finds the bot can message it and use your OpenAI credit.
  • Data: the messages go to OpenAI, and Telegram holds the chat.
  • Cost: one model call per message, billed by OpenAI.
Files
NOTICE.md  652 B
README.md  5 KB
workflow.json  4 KB

3 files, 9 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-12

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

anaksor-ocr

Sokheng · Kit

Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…

New

Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…

New

ACE-Step 1.5 XL SFT

ACE-Step · Kit

Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…

New

Similar in Productivity

See all in Productivity

Guizang PPT Skill

op7418 · Skill

Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…

New29.8k

Frontend Slides

zarazhangrui · Skill

Builds HTML presentations from scratch or from a PowerPoint file and shows visual style previews to pick from, for people who want web slides with no CSS or Ja…

New32.3k

IPTV

iptv-org · Kit

Collects publicly available live TV channels from many countries into playlists that any video player with live streaming can open. Made for viewers and for de…

New144k