Skip to content

reopenForumTopic

Returns: TrueOfficial docs ↗

Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

Parameters

chat_idIntegerStringRequired
Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
message_thread_idIntegerRequired
Unique identifier for the target message thread of the forum topic

Returns

On success, True is returned.

GramIO Usage

ts
// Context shorthand — reopens the topic the current message belongs to
// (chat_id and message_thread_id are injected automatically from the context)
bot
.
on
("forum_topic_closed", async (
ctx
) => {
await
ctx
.
reopenTopic
();
});
ts
// Direct API call with explicit chat_id and message_thread_id
await 
bot
.
api
.
reopenForumTopic
({
chat_id
: -1001234567890,
message_thread_id
: 42,
});
ts
// Reopen a specific topic from a command with the thread ID as argument
bot
.
command
("reopentopic", async (
ctx
) => {
const
threadId
=
Number
(
ctx
.
args
);
if (!
threadId
||
isNaN
(
threadId
)) return
ctx
.
reply
("Usage: /reopentopic <thread_id>");
await
bot
.
api
.
reopenForumTopic
({
chat_id
:
ctx
.
chat
.
id
,
message_thread_id
:
threadId
,
}); await
ctx
.
reply
(`Topic ${
threadId
} has been reopened.`);
});
ts
// Automatically reopen topics that were closed by a specific condition
bot.on("message", async (ctx) => {
  if (ctx.forumTopicClosed && ctx.chat.is_forum) {
    // ctx.messageThreadId holds the thread ID of the current message
    await ctx.reopenTopic();
  }
});

Errors

CodeErrorCause
400Bad Request: chat not foundchat_id is invalid or the bot is not a member of the chat
400Bad Request: message thread not foundmessage_thread_id doesn't exist in the target chat
400Bad Request: TOPIC_NOT_MODIFIEDThe topic is already open — no state change needed
400Bad Request: method is available only for supergroupsThe target chat is not a supergroup with forum mode enabled
403Forbidden: not enough rightsBot lacks can_manage_topics admin right and is not the topic creator
429Too Many Requests: retry after NRate limit hit — check retry_after and use the auto-retry plugin

Tips & Gotchas

  • Forum mode must be enabled. This method only works in supergroups where the "Topics" (forum) feature is turned on. Calling it in a regular group returns an error.
  • can_manage_topics is required unless the bot created the topic itself. Use promoteChatMember to grant this right if needed.
  • Context shorthand ctx.reopenTopic() automatically fills chat_id and message_thread_id from the current message context, which is the cleanest way to reopen the topic a message was sent in.
  • Check topic state before calling. Calling reopenForumTopic on an already-open topic returns TOPIC_NOT_MODIFIED. Use this call only when you know the topic is closed.
  • Does not automatically unhide. Unlike reopenGeneralForumTopic, this method does not unhide the topic — use editForumTopic if the topic also needs to be made visible.

See Also