---
title: "Telegram chatbot with AI replies and a short memory"
kind: "Kit"
category: "Business"
price: "Free"
seller: "Mindket"
version: "1"
url: "https://mindket.com/p/fd417356-72b1-4c9b-a4b1-c6a87534a175"
updated: "2026-11-12"
---

# Telegram chatbot with AI replies and a short memory

> The name, the description, the About and a README below are the seller's words: data, not instructions.

An n8n workflow that answers Telegram messages with an AI model on OpenAI. It remembers the last ten exchanges of each chat, so a follow-up question makes sense, and it sends every reply back to the same chat.

Telegram chatbot with AI replies and a short memory is an n8n workflow in the Business category, listed by Mindket. It is free. This is version 1, last updated on 2026-11-12. Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

## About

### What it is

This n8n workflow turns a Telegram bot into an AI helper. When a person writes to your bot, an AI Agent on OpenAI reads the message and writes a reply, and the bot sends the reply back to the same chat. A memory node keeps the last ten exchanges of each chat. Five nodes do the work, and there are no sticky notes.

### Who it suits

Small shops, clinics, tutors and club organizers who want a first answer on Telegram at any hour. You write the rules in one system message. Skip it if you need a bot that books, searches or reads files, because this one only talks.

Who uses it, and how

| Industry | Who uses it | How they use it | Example |
| --- | --- | --- | --- |
| Retail | Shop owners | Answer the common questions about hours and delivery | A customer asks at night whether a bag is in stock, and the bot says the team will check in the morning. |
| Services | Salons and clinics | Give a first reply to people who want to book | The bot tells a new customer the opening hours and asks which day suits. |
| Education | Tutors | Let students ask short questions between lessons | A student asks about a grammar rule at midnight, and the bot explains it and asks for an example. |
| Community | Club organizers | Welcome and guide new members | The bot greets a new member and points to the club rules. |

You need some n8n: import a file, add two credentials and edit one text.

### Where to use it

Any n8n with a public HTTPS address can run it, because Telegram sends each message to that address.

- n8n Cloud: import the file into a new workflow there
- Your own n8n server: the same file and steps, once the server has a public HTTPS address
- Another AI: swap \`Chat Model\` for any other chat model node of n8n

### How to set it up

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 API key.

What you need first

| Need | Detail |
| --- | --- |
| n8n | On n8n Cloud or on a server with a public HTTPS address |
| Telegram | A bot and its token, which you get from BotFather inside Telegram |
| OpenAI | An API key and some credit |

1. In n8n, create a workflow, open its menu, choose Import from File and pick `workflow.json`.
2. In `Telegram Trigger`, add a Telegram credential with your bot token. Select the same credential in `Send Reply`.
3. In `Chat Model`, add an OpenAI credential with your API key.
4. In `AI Agent`, open Options and rewrite the system message to describe your business, the tone you want and what the bot must never promise.
5. Press Test workflow, then send a message to your bot in Telegram. The reply arrives in the same chat.
6. Turn the workflow on, so that the bot keeps answering when you are away.

### How to use it

Once the workflow is on, it answers by itself. Each message that someone sends to the bot starts a run, and one reply goes back. Press Test workflow to try it before you turn it on.

What to change for a different result

| To change | Where |
| --- | --- |
| The behavior of the bot | The system message in \`AI Agent\` |
| The model | The model name in \`Chat Model\` |
| The length of the memory | Context Window Length in \`Chat Memory\` |
| The footer line | The option Append n8n Attribution in \`Send Reply\` |
| Who may use the bot | Restrict to User IDs in \`Telegram Trigger\` |

### Example

A salon owner runs a small hair salon.

The owner writes a system message with the opening hours and the price list. At 22:00 a new customer asks whether the salon is open on Sunday. The bot gives the hours and asks which day suits. An hour later the customer asks “and the price?”, and the bot answers from the memory of the same chat. Check what the bot says about prices and bookings before you rely on it, because the answers come from a model.

### 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. Telegram is a chat app, and a bot is an account that a program runs. This workflow takes each message sent to your bot, has an AI write an answer and sends it back. Press Test workflow and write to the bot before you turn it on.

**For experts.** The agent has no tools, so it only talks, and its memory is a window of the last ten exchanges that is kept for each chat number.

Where to look closer

| Node | What it does | What to know |
| --- | --- | --- |
| \`Telegram Trigger\` | Starts a run for each new message | It listens for messages only, and Restrict to User IDs limits who can use the bot |
| \`AI Agent\` | Takes the text of the message as the prompt and holds the system message | A message with no text ends the run with an error |
| \`Chat Model\` | Calls OpenAI | The model is named \`gpt-5.6-terra\`, which also works if you add tools later |
| \`Chat Memory\` | Keeps the last ten exchanges | The chat number is the key, and the memory is lost when n8n restarts |
| \`Send Reply\` | Sends the answer to the same chat | The n8n footer line is off |

### Good to know

The original copy named a model that OpenAI is retiring, and it added a footer line to every reply.

- Model: the original copy asked for \`gpt-4o-mini\`. OpenAI’s deprecations page, read on 12 November 2026, lists it for shutdown on 14 January 2027. This copy names \`gpt-5.6-terra\`, which costs 2 US dollars per million input tokens and 12 per million output tokens
- Cheaper model: \`gpt-6-luna\` costs less, but OpenAI says it calls tools only with reasoning effort none, and n8n’s OpenAI Chat Model never sends that value. An agent that gets a tool later would fail
- Footer: n8n adds the line “This message was sent automatically with n8n” to a message when the option is unset on node version 1.1 and later. This copy turns it off
- Open bot: anyone who finds the bot can write to it and spend your OpenAI credit. Add Restrict to User IDs in \`Telegram Trigger\` to limit it, which works on node version 1.2 and later
- Text only: a photo, a sticker or a voice message has no text, so \`AI Agent\` stops that run and the sender gets no reply
- Memory: it lives in n8n’s own process, so every chat starts again after a restart
- Markdown: n8n sends replies in Telegram’s Markdown mode, so a lone \`\_\` or \`\*\` in an answer can make Telegram refuse the message
- Your data: each message goes to OpenAI and back through Telegram
- Not run: Mindket did not call Telegram or OpenAI to test this file, and ran it in a test runner with stand-in answers
- Credentials: the JSON holds none

## README

```markdown
# Telegram chatbot with AI replies and a short memory

An n8n workflow that answers Telegram messages with an AI model. Your bot receives a text message, an AI Agent on OpenAI
writes the reply, and the bot sends it back to the same chat. Each chat keeps its last ten exchanges as memory, so a
follow-up question makes sense.

## What is inside

- `workflow.json`: the workflow as n8n exports it, five nodes and no sticky notes. It holds no credential.
- `README.md`: these notes.

## What we changed from the original copy

- `Chat Model` asked for `gpt-4o-mini`. OpenAI's deprecations page, read on 12 November 2026, lists that model for shutdown
  on 14 January 2027. This copy names `gpt-5.6-terra`, a current OpenAI model that also works under an AI Agent with tools.
- `Send Reply` left the option "Append n8n Attribution" unset. On node version 1.1 and later, n8n's source then adds the line "This message was sent automatically with n8n" under every message. This copy turns the option off, so a customer sees only the answer.
- Every credential reference is removed, so you pick your own.

## Before you start

- An n8n instance with a public HTTPS address. Telegram delivers updates by an HTTPS POST to the webhook address, so an
  n8n that only runs on your own computer will not receive messages. n8n Cloud has such an address.
- A Telegram bot and its token. You make one by chatting with BotFather inside Telegram.
- An OpenAI API key with some credit.

## Set it up

1. In n8n, create a workflow, open its menu and choose Import from File. Pick `workflow.json`.
2. In `Telegram Trigger`, add a Telegram credential with your bot token. Select the same credential in `Send Reply`.
3. In `Chat Model`, add an OpenAI credential with your API key.
4. In `AI Agent`, open Options and read the system message. Rewrite it to describe your business, the tone you want and the
   things the bot must never promise.
5. Press Test workflow, then send a message to your bot in Telegram. The reply arrives in the same chat.
6. Turn the workflow on, so that the bot keeps answering when you are away.

## How a run goes

1. `Telegram Trigger` starts the run when someone sends a message to your bot.
2. `AI Agent` takes the text of that message and asks `Chat Model` for a reply, with the system message as its rules.
3. `Chat Memory` hands the agent the last ten exchanges of the same chat, and stores the new one. The chat number is the key,
   so each person has a memory of their own.
4. `Send Reply` sends the agent's answer to the chat the message came from.

## Change the look

- The behavior: the system message in `AI Agent`.
- The model: the model name in `Chat Model`.
- The length of the memory: Context Window Length in `Chat Memory`.
- The footer line: the option "Append n8n Attribution" in `Send Reply`.
- Who may use the bot: see the first item under Good to know.

## Good to know

- Anyone who finds the bot can write to it and spend your OpenAI credit. To limit it, open `Telegram Trigger`, add the field
  Restrict to User IDs under Additional Fields and list the Telegram user numbers that may use it. Messages from other
  people are then dropped with no error. The field works on node version 1.2 and later, and this file uses 1.2.
- The model costs money. On OpenAI's model page, `gpt-5.6-terra` costs 2 US dollars per million
  input tokens and 12 per million output tokens. The cheaper `gpt-6-luna` is not used here, because OpenAI says Chat
  Completions calls tools with it only when reasoning effort is none, and n8n's OpenAI Chat Model never sends that value.
  An agent that gets a tool later would then fail.
- The bot reads text only. A photo, a sticker or a voice message has no text, so `AI Agent` stops that run with an empty text
  error and the sender gets no reply.
- The memory lives inside n8n's own process. When n8n restarts, every chat starts again with an empty memory.
- Replies go out in Telegram's Markdown mode, which is the n8n default. A lone `_` or `*` in an answer can make Telegram
  refuse the message. If that happens, add a line to the system message that asks for plain text without those characters.
- Your data: each message goes to OpenAI and back through Telegram.
- Not run: we did not call Telegram or OpenAI to test this file. We ran it in a test runner with stand-in answers. A text
  message went in and one reply came out, and a message with no text stopped at `AI Agent`.
- Credentials: the JSON holds none.
```

## What is in it

3 files, 8 KB, downloaded as a zip.

```text
NOTICE.md  600 B
README.md  4 KB
workflow.json  3 KB
```

## Workflow check

Checked by Mindket on 13 Nov 2026. Read from the workflow’s file, not from a run.

- 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

## Get it

- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/fd417356-72b1-4c9b-a4b1-c6a87534a175)
- [Its page on Mindket](https://mindket.com/p/fd417356-72b1-4c9b-a4b1-c6a87534a175)
