# Telegram forum topics: message_thread_id and createForumTopic

> Read message_thread_id, reply in the right Telegram forum topic, create and close topics with can_manage_topics, and use topics in private chats.

Published 2026-11-04. Z-API Omni team.

In a forum supergroup, every message posted in a topic other than General arrives with `message_thread_id` and `is_topic_message: true`. To answer in the same topic, pass that `message_thread_id` to `sendMessage`. `createForumTopic` makes a new topic and returns a `ForumTopic` whose `message_thread_id` you send to. In a supergroup the bot must be an administrator with the `can_manage_topics` right. Since Bot API 9.3 (December 31, 2025) and 9.4 (February 9, 2026), bots can also use topics in their private chats ([Bot API changelog](https://core.telegram.org/bots/api-changelog), accessed 2026-11-04). This post follows Bot API 10.3 (August 24, 2026). Telegram's reference has no JSON samples for these methods, so the payloads below are assembled from its field tables.

## Tell a forum topic from a reply thread

A forum is a supergroup with topics turned on. Its `Chat` object has `type: "supergroup"` and `is_forum: true`, "True, if the supergroup chat is a forum (has topics enabled)" ([Chat](https://core.telegram.org/bots/api#chat), accessed 2026-11-04).

`message_thread_id` alone doesn't prove the message is in a topic. The `Message` reference defines it as the identifier "of a message thread or forum topic to which the message belongs; for supergroups and private chats only" ([Message](https://core.telegram.org/bots/api#message)). Our reading is that a reply thread in an ordinary supergroup can carry it too. `is_topic_message` is the field that settles it: "True, if the message is sent to a topic in a forum supergroup or a private chat with the bot". Branch on `is_topic_message`, or on `chat.is_forum`, before you treat the ID as a topic.

## Reply in the topic the message came from

`sendMessage` takes `message_thread_id` as the "Unique identifier for the target message thread (topic) of a forum". It applies only "for forum supergroups and private chats of bots with forum topic mode enabled" ([sendMessage](https://core.telegram.org/bots/api#sendmessage)). Copy it from the incoming message when `is_topic_message` is true, and leave it out otherwise.

```javascript
// Parameters that send a reply to the same chat and topic as `message`.
export function replyTarget(message) {
  const target = { chat_id: message.chat.id };
  if (message.is_topic_message) target.message_thread_id = message.message_thread_id;
  return target;
}

// Usage: await call('sendMessage', { ...replyTarget(message), text: 'Got it' });
```

`call` is the request helper from the [Node.js bot](/academy/articles/telegram-bot-nodejs-getting-started/). The same function works in a bot's private chat with topic mode on, because `is_topic_message` covers both cases. `sendChatAction` has taken `message_thread_id` since Bot API 6.4, so pass it there too. The typing indicator then shows in the right topic.

## The General topic

The Bot API reference has dedicated methods and service messages for the General topic, such as `editGeneralForumTopic` and `general_forum_topic_hidden`. It doesn't say how messages in General look to a bot. Telegram's client API documentation, a separate API from the Bot API, states that "Every forum has a non-deletable "General" topic, with `id=1`". To post there, a client sends "as if you were writing to a normal supergroup". Messages from other topics carry a topic flag, and General's don't ([MTProto forums](https://core.telegram.org/api/forum), accessed 2026-11-04).

Our inference: a message in a forum with no `is_topic_message` most likely sits in General, and a `sendMessage` without `message_thread_id` most likely posts there. The Bot API reference doesn't confirm either point, so test it in your own forum before you build routing on it.

## Create, edit, close and delete topics

| Method | Where it works | Right the bot needs in a supergroup | Returns |
| --- | --- | --- | --- |
| `createForumTopic` | Forum supergroup, private chat with a user | Admin with `can_manage_topics` | `ForumTopic` |
| `editForumTopic` | Supergroup, private chat | `can_manage_topics`, unless it created the topic | True |
| `closeForumTopic`, `reopenForumTopic` | Supergroup only | `can_manage_topics`, unless it created the topic | True |
| `deleteForumTopic` | Supergroup, private chat | `can_delete_messages` | True |
| `unpinAllForumTopicMessages` | Supergroup, private chat | `can_pin_messages` | True |
| General topic methods (edit, close, reopen, hide, unhide) | Supergroup only | `can_manage_topics` | True |

Source: the method entries in the [Bot API reference](https://core.telegram.org/bots/api#createforumtopic). `createForumTopic` needs `chat_id` and a `name` of 1 to 128 characters. `icon_color` must currently be one of six values: 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2) or 16478047 (0xFB6F5F). For a custom emoji icon, take an ID from `getForumTopicIconStickers`, which needs no parameters.

This script creates a topic in a forum and posts the first message into it. It runs on Node.js 26 LTS, also 22 and 24, with built-in `fetch`.

```javascript
// topic.mjs. Run: node --env-file=.env topic.mjs
// .env holds TELEGRAM_BOT_TOKEN=YOUR_TOKEN and FORUM_CHAT_ID=YOUR_SUPERGROUP_ID
const TOKEN = process.env.TELEGRAM_BOT_TOKEN;
if (!TOKEN) throw new Error('TELEGRAM_BOT_TOKEN is not set');
const API = `https://api.telegram.org/bot${TOKEN}/`;
const raw = process.env.FORUM_CHAT_ID ?? '';
if (!raw) throw new Error('FORUM_CHAT_ID is not set');
const CHAT_ID = /^-?\d+$/.test(raw) ? Number(raw) : raw; // numeric id or @username

async function call(method, params) {
  const res = await fetch(API + method, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(params),
    signal: AbortSignal.timeout(10_000),
  });
  const body = await res.json();
  if (!body.ok) throw new Error(`${method}: ${body.description}`);
  return body.result;
}

const topic = await call('createForumTopic', {
  chat_id: CHAT_ID,
  name: 'Order 1042',
  icon_color: 7322096, // 0x6FB9F0, one of the six allowed colors
});
console.log(`Created "${topic.name}" with message_thread_id ${topic.message_thread_id}`);

await call('sendMessage', {
  chat_id: CHAT_ID,
  message_thread_id: topic.message_thread_id,
  text: 'Ticket opened. Replies in this topic reach the support team.',
});
```

Store `topic.message_thread_id` next to your own record, such as the order or the ticket. It is the only handle you get back.

`editForumTopic` takes `chat_id` and `message_thread_id`, plus an optional `name` of 0 to 128 characters. An empty or missing `name` keeps the current one, and an empty `icon_custom_emoji_id` removes the icon. `closeForumTopic` closes an open topic, and `reopenForumTopic` opens it again. `deleteForumTopic` removes the topic "along with all its messages". Close a topic you might need again, and delete it only when you mean to drop its history. `hideGeneralForumTopic` closes General automatically if it was open.

Telegram doesn't document the error text for a missing right or for posting to a closed topic. Log `description` and check the bot's rights first.

## The admin rights behind each call

`can_manage_topics` on an administrator means the user can "create, rename, close, and reopen forum topics; for supergroups only" ([ChatAdministratorRights](https://core.telegram.org/bots/api#chatadministratorrights)). Deleting a topic needs `can_delete_messages` and unpinning needs `can_pin_messages`, so a bot that only has `can_manage_topics` can't do either. Ordinary members get their own `can_manage_topics` in `ChatPermissions`, which allows them to create topics and "defaults to the value of can_pin_messages" when omitted ([ChatPermissions](https://core.telegram.org/bots/api#chatpermissions)). The [group moderation guide](/academy/articles/telegram-bot-group-moderation-ban-restrict/) covers promoting the bot and setting member permissions with `restrictChatMember`.

An admin bot sees every message in every topic. Telegram's features page says privacy mode is on by default. The exception is "bots that were added to a group as admins (bot admins always receive all messages)" ([Bot features](https://core.telegram.org/bots/features), accessed 2026-11-04). A bot without admin rights in a forum gets, by default, only what [privacy mode](/academy/articles/telegram-bot-privacy-mode-group-messages/) lets through.

## Track topics from service messages

The Bot API reference, as of 10.5, has no method that lists a forum's topics. A bot learns them from its own `createForumTopic` results and from service messages: `forum_topic_created`, `forum_topic_edited`, `forum_topic_closed` and `forum_topic_reopened`. `ForumTopicClosed` and `ForumTopicReopened` "Currently holds no information". `ForumTopicCreated` has a name and icon but no ID field. Our reading is that the topic's ID comes from the `message_thread_id` of the message that carries it.

`ForumTopicCreated` gained `is_name_implicit` in Bot API 9.3, and `ForumTopic` has the same field. It is "True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot". When you see it, call `editForumTopic` with a name that describes the conversation.

## Topics in a bot's private chats

Bot API 9.3 added topic support to private chats with bots, and 9.4 "Allowed bots to create topics in private chats using the method createForumTopic". The features page gives the use case: "one topic for an order, another for technical support and a third for a recurring task". Topics there "need to be enabled for the bot via @BotFather", or, since Bot API 10.5, with `setMySettings`. The 9.4 changelog also mentions a BotFather Mini App setting that stops users from creating and deleting topics. Telegram doesn't document the exact steps beyond that.

Call `getMe` to read the current state. `has_topics_enabled` is true when topic mode is on in private chats. `allows_users_to_create_topics` is true when users may create and delete topics themselves. Both fields are on the BotFullInfo object that `getMe` returns since Bot API 10.5 ([BotFullInfo](https://core.telegram.org/bots/api#botfullinfo), accessed 2026-11-24). You can set both with `setMySettings` (`has_topics_enabled`, `allows_users_to_create_topics`), and 10.5 adds `has_topic_sidebar`. [Private chat topics](/academy/articles/telegram-private-chat-topics-bot-topic-wrong-home/) covers how they behave.

In a private chat, `createForumTopic` takes the user's chat ID. The administrator requirement is stated for supergroups only. `editForumTopic`, `deleteForumTopic` and `unpinAllForumTopicMessages` work there too. `closeForumTopic`, `reopenForumTopic` and every General method are supergroup-only. Telegram doesn't say whether a private chat with topics has a General topic.

`direct_messages_topic` and `direct_messages_topic_id` belong to channel direct messages, a separate feature from Bot API 9.2. Don't mix them up with forum topics.

*Z-API Omni team*
