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…
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.
Telegram message
It starts when someone messages the bot, and it needs:
A Telegram reply from the AI agent that takes the chat so far into account
What you need before you start.
Chat
Receives the messages and sends the replies.
NeedsTelegram bot token
Agent model
Writes each answer from the message and the recent chat.
NeedsOpenAI API key
Checked by Mindket on 13 Nov 2026
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.
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.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Personal | Individuals | Ask an assistant from the phone | A user asks the bot to explain a contract term while commuting. |
| Small business | Shop owners | Reword replies to customers | A shop owner pastes a blunt answer and asks for a friendlier one. |
| Education | Tutors | Give a student a patient practice partner | A tutor shares the bot so a student can keep asking questions after class. |
| Development | Builders | Start from an agent with chat and memory | A 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.
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.
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.
| Need | Detail |
|---|---|
| n8n | On n8n Cloud or on a server with a public HTTPS address |
| Telegram | A bot made with BotFather, and its token |
| OpenAI | An API key |
workflow.json.Listen for incoming events and Send final reply.OpenAI Chat Model.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.
| To change | Where |
|---|---|
| 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 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.
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.
| Node | What it does | What to know |
|---|---|---|
Listen for incoming events | Receives every kind of update | Updates with no message make the next node fail |
AI Agent | Answers the text of the message | Version 1.7, with memory and no tools |
Window Buffer Memory | Remembers ten messages per chat | Lives in the n8n process |
Send final reply | Sends the answer | Markdown unless you set a parse mode |
The original copy could also draw pictures. That part is gone, and a few other lines were repaired.
dall-e-3 shut down on 12 May 2026. Mindket’s copy has no image toolsgpt-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-terramessage.text, so that run fails_, *, the backtick and [ outside a formatted span must be escaped, so an answer that does not may be refusedAn 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.
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.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.AI Agent, which told it to send the image link, is removed, since nothing can make a link now.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.
workflow.json.Listen for incoming events and Send final reply.OpenAI Chat Model.Listen for incoming events starts the run when Telegram delivers an update to the bot. It listens for every kind of update.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.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.Send final reply sends the agent's output to the sender's user ID, with the attribution line turned off.AI Agent.Window Buffer Memory.OpenAI Chat Model.AI Agent.Updates in Listen for incoming events.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.NOTICE.md 652 B README.md 5 KB workflow.json 4 KB
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…
Qwen · Kit
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…
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…
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…
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…
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…