<p>Forums may be created either by invoking <ahref="/method/channels.createChannel">channels.createChannel</a> with the <code>forum</code> flag set, or by converting an existing <ahref="/api/channel">supergroup</a> into a forum using <ahref="/method/channels.toggleForum">channels.toggleForum</a> with <code>enabled=true</code>.<br>
If the group is a <ahref="/api/channel#basic-groups">basic group</a>, it should be <ahref="/api/channel#migration">upgraded to a supergroup</a> before converting it into a forum. </p>
<p>Forums can also be converted back to <ahref="/api/channel">supergroups</a> using <ahref="/method/channels.toggleForum">channels.toggleForum</a> with <code>enabled=false</code>. </p>
<p>Note that the <ahref="/method/channels.toggleForum">channels.toggleForum</a> method can only be invoked by admins with owner rights.</p>
<p>Forums have the <ahref="/constructor/channel">channel</a>.<code>forum</code> flag set, and conversation happens in distinct <ahref="#forum-topics">forum topics</a>.</p>
<p>Forums can have multiple topics where users may interact. </p>
<p>To fetch the topic list of a forum, use <ahref="/method/channels.getForumTopics">channels.getForumTopics</a>; the same method can be used to search topics by their name.<br>
To fetch information about one or more topics by their ID, use <ahref="/method/channels.getForumTopicsByID">channels.getForumTopicsByID</a>. </p>
<p>Every forum has a non-deletable "General" topic, with <code>id=1</code>; other topics will have other IDs, equal to the <ahref="/constructor/messageActionTopicCreate">messageActionTopicCreate</a> service message that created the topic. </p>
<p>To send messages to the "General" topic, just use <ahref="/method/messages.sendMessage">messages.sendMessage</a> as usual, as if you were writing to a normal supergroup.<br>
On the other hand, topics with <code>id != 1</code> are just the <ahref="/api/threads">message thread</a> of the <ahref="/constructor/messageActionTopicCreate">messageActionTopicCreate</a> service message that created that topic.<br>
This means that topics should be treated similarly to <ahref="/api/threads">message threads</a> by the client.<br>
To send messages to these topics, pass the topic ID to the <code>reply_to_msg_id</code> parameter of <ahref="/constructor/inputReplyToMessage">inputReplyToMessage</a>, passed to <code>reply_to</code> when invoking <ahref="/method/messages.sendMessage">messages.sendMessage</a>, <ahref="/method/messages.sendMedia">messages.sendMedia</a> et cetera. </p>
<p>To reply to messages within a topic, pass the ID of the message to reply to to <ahref="/constructor/inputReplyToMessage">inputReplyToMessage</a>.<code>reply_to_msg_id</code>, and, unless we're replying to a message in the "General" topic, pass the topic ID to <ahref="/constructor/inputReplyToMessage">inputReplyToMessage</a>.<code>top_msg_id</code>.<br>
Note that when replying to messages in a topic, the <ahref="/constructor/inputReplyToMessage">inputReplyToMessage</a>.<code>top_msg_id</code> field must contain the topic ID <strong>if and only if</strong> we're replying to messages in <ahref="/api/forum#forum-topics">forum topics</a> different from the "General" topic (i.e. <code>reply_to_msg_id</code> is set and <code>reply_to_msg_id != topicID</code> and <code>topicID != 1</code>): this way, if the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic.<br>
Also note that since <ahref="/api/threads">message threads</a> can't have nested message threads, topics (except for the "General" topic) also can't have message threads (so replies to messages within topics won't generate further message threads). </p>
<p>Topics have a name (<code>title</code>) and an icon: the icon can be a <ahref="/api/custom-emoji">custom emoji</a> specified by the <code>icon_emoji_id</code>, or a default chat icon if <code>icon_emoji_id</code> is not set, filled with the color specified in <code>icon_color</code>.<br>
Topics can be temporarily <code>closed</code>, preventing further messages from being sent to the topic.<br>
Additionally, (only) the "General" topic may also be <code>hidden</code>.<br>
All topics except for the "General" topic can be deleted by invoking <ahref="/method/channels.deleteTopicHistory">channels.deleteTopicHistory</a>, with the topic ID. </p>
<p>Topics can be created by using the <ahref="/method/channels.createForumTopic">channels.createForumTopic</a> method, and may be modified with the <ahref="/method/channels.editForumTopic">channels.editForumTopic</a> method: these actions require <ahref="/api/rights"><code>manage_topics</code> rights</a>, and will generate <ahref="/constructor/messageActionTopicCreate">messageActionTopicCreate</a>/<ahref="/constructor/messageActionTopicEdit">messageActionTopicEdit</a> service messages. </p>
<p>Note that <ahref="/api/premium">Telegram Premium</a> users can pass any custom emoji to <code>icon_emoji_id</code>, while other users can only use the custom emojis contained in the <ahref="/constructor/inputStickerSetEmojiDefaultTopicIcons">inputStickerSetEmojiDefaultTopicIcons</a> emoji pack.<br>
If the default chat icon is used, its color cannot be modified after creating the topic. </p>
<p>Topics may be pinned or unpinned using <ahref="/method/channels.updatePinnedForumTopic">channels.updatePinnedForumTopic</a>; use <ahref="/method/channels.reorderPinnedForumTopics">channels.reorderPinnedForumTopics</a> to reorder pinned topics.<br>
You can pin at most <code>topics_pinned_limit</code> topics per forum, as specified by the <ahref="/api/config#client-configuration">client configuration parameters »</a>.</p>
<p>Users may also choose to display messages from all topics as if they were sent to a normal group, using a "View as messages" setting in the local client.<br>
This setting only affects the current account, and is synced to other logged in sessions using the <ahref="/method/channels.toggleViewForumAsMessages">channels.toggleViewForumAsMessages</a> method; invoking this method will update the value of the <code>view_forum_as_messages</code> flag of <ahref="/constructor/channelFull">channelFull</a> or <ahref="/constructor/dialog">dialog</a> and emit an <ahref="/constructor/updateChannelViewForumAsMessages">updateChannelViewForumAsMessages</a>.</p></div>