2022-02-23 16:30:26 +01:00
<!DOCTYPE html>
< html class = "" >
< head >
< meta charset = "utf-8" >
< title > Threads< / title >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
2022-11-15 01:03:58 +01:00
< meta property = "description" content = "Telegram allows commenting on a channel post or on a generic supergroup message, thanks to message threads." >
2022-02-23 16:30:26 +01:00
< meta property = "og:title" content = "Threads" >
< meta property = "og:image" content = "" >
2022-11-15 01:03:58 +01:00
< meta property = "og:description" content = "Telegram allows commenting on a channel post or on a generic supergroup message, thanks to message threads." >
2022-04-21 15:52:36 +02:00
< link rel = "icon" type = "image/svg+xml" href = "/img/website_icon.svg?4" >
< link rel = "apple-touch-icon" sizes = "180x180" href = "/img/apple-touch-icon.png" >
< link rel = "icon" type = "image/png" sizes = "32x32" href = "/img/favicon-32x32.png" >
< link rel = "icon" type = "image/png" sizes = "16x16" href = "/img/favicon-16x16.png" >
< link rel = "alternate icon" href = "/img/favicon.ico" type = "image/x-icon" / >
2022-02-23 16:30:26 +01:00
< link href = "/css/bootstrap.min.css?3" rel = "stylesheet" >
2023-03-20 12:08:32 +01:00
< link href = "/css/telegram.css?236" rel = "stylesheet" media = "screen" >
2022-02-23 16:30:26 +01:00
< style >
< / style >
< / head >
< body class = "preload" >
< div class = "dev_page_wrap" >
< div class = "dev_page_head navbar navbar-static-top navbar-tg" >
< div class = "navbar-inner" >
< div class = "container clearfix" >
< ul class = "nav navbar-nav navbar-right hidden-xs" > < li class = "navbar-twitter" > < a href = "https://twitter.com/telegram" target = "_blank" data-track = "Follow/Twitter" onclick = "trackDlClick(this, event)" > < i class = "icon icon-twitter" > < / i > < span > Twitter< / span > < / a > < / li > < / ul >
< ul class = "nav navbar-nav" >
< li > < a href = "//telegram.org/" > Home< / a > < / li >
< li class = "hidden-xs" > < a href = "//telegram.org/faq" > FAQ< / a > < / li >
< li class = "hidden-xs" > < a href = "//telegram.org/apps" > Apps< / a > < / li >
< li class = "active" > < a href = "/api" > API< / a > < / li >
< li class = "" > < a href = "/mtproto" > Protocol< / a > < / li >
< li class = "" > < a href = "/schema" > Schema< / a > < / li >
< / ul >
< / div >
< / div >
< / div >
< div class = "container clearfix" >
< div class = "dev_page" >
< div id = "dev_page_content_wrap" class = " " >
< div class = "dev_page_bread_crumbs" > < ul class = "breadcrumb clearfix" > < li > < a href = "/api" > API< / a > < / li > < i class = "icon icon-breadcrumb-divider" > < / i > < li > < a href = "/api/threads" > Threads< / a > < / li > < / ul > < / div >
< h1 id = "dev_page_title" > Threads< / h1 >
< div id = "dev_page_content" > <!-- scroll_nav -->
< p > Telegram allows commenting on a < a href = "/api/channel" > channel post< / a > or on a generic < a href = "/api/channel" > supergroup message< / a > , thanks to message threads.< / p >
< h3 > < a class = "anchor" href = "#message-threads" id = "message-threads" name = "message-threads" > < i class = "anchor-icon" > < / i > < / a > Message threads< / h3 >
< p > Schema:< / p >
2023-05-22 14:54:47 +02:00
< pre > < code > < a href = '/constructor/messageReplyHeader' > messageReplyHeader< / a > #a6d57763 flags:< a href = '/type/%23' > #< / a > reply_to_scheduled:flags.2?< a href = '/constructor/true' > true< / a > forum_topic:flags.3?< a href = '/constructor/true' > true< / a > reply_to_msg_id:< a href = '/type/int' > int< / a > reply_to_peer_id:flags.0?< a href = '/type/Peer' > Peer< / a > reply_to_top_id:flags.1?< a href = '/type/int' > int< / a > = < a href = '/type/MessageReplyHeader' > MessageReplyHeader< / a > ;
2022-02-23 16:30:26 +01:00
< a href = '/constructor/messageReplies' > messageReplies< / a > #83d60fc2 flags:< a href = '/type/%23' > #< / a > comments:flags.0?< a href = '/constructor/true' > true< / a > replies:< a href = '/type/int' > int< / a > replies_pts:< a href = '/type/int' > int< / a > recent_repliers:flags.1?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/Peer' > Peer< / a > > channel_id:flags.0?< a href = '/type/long' > long< / a > max_id:flags.2?< a href = '/type/int' > int< / a > read_max_id:flags.3?< a href = '/type/int' > int< / a > = < a href = '/type/MessageReplies' > MessageReplies< / a > ;
2022-03-10 21:15:11 +01:00
< a href = '/constructor/message' > message< / a > #38116ee0 flags:< a href = '/type/%23' > #< / a > out:flags.1?< a href = '/constructor/true' > true< / a > mentioned:flags.4?< a href = '/constructor/true' > true< / a > media_unread:flags.5?< a href = '/constructor/true' > true< / a > silent:flags.13?< a href = '/constructor/true' > true< / a > post:flags.14?< a href = '/constructor/true' > true< / a > from_scheduled:flags.18?< a href = '/constructor/true' > true< / a > legacy:flags.19?< a href = '/constructor/true' > true< / a > edit_hide:flags.21?< a href = '/constructor/true' > true< / a > pinned:flags.24?< a href = '/constructor/true' > true< / a > noforwards:flags.26?< a href = '/constructor/true' > true< / a > id:< a href = '/type/int' > int< / a > from_id:flags.8?< a href = '/type/Peer' > Peer< / a > peer_id:< a href = '/type/Peer' > Peer< / a > fwd_from:flags.2?< a href = '/type/MessageFwdHeader' > MessageFwdHeader< / a > via_bot_id:flags.11?< a href = '/type/long' > long< / a > reply_to:flags.3?< a href = '/type/MessageReplyHeader' > MessageReplyHeader< / a > date:< a href = '/type/int' > int< / a > message:< a href = '/type/string' > string< / a > media:flags.9?< a href = '/type/MessageMedia' > MessageMedia< / a > reply_markup:flags.6?< a href = '/type/ReplyMarkup' > ReplyMarkup< / a > entities:flags.7?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/MessageEntity' > MessageEntity< / a > > views:flags.10?< a href = '/type/int' > int< / a > forwards:flags.10?< a href = '/type/int' > int< / a > replies:flags.23?< a href = '/type/MessageReplies' > MessageReplies< / a > edit_date:flags.15?< a href = '/type/int' > int< / a > post_author:flags.16?< a href = '/type/string' > string< / a > grouped_id:flags.17?< a href = '/type/long' > long< / a > reactions:flags.20?< a href = '/type/MessageReactions' > MessageReactions< / a > restriction_reason:flags.22?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/RestrictionReason' > RestrictionReason< / a > > ttl_period:flags.25?< a href = '/type/int' > int< / a > = < a href = '/type/Message' > Message< / a > ;
2022-02-23 16:30:26 +01:00
---functions---
< a href = '/method/messages.search' > messages.search< / a > #a0fda762 flags:< a href = '/type/%23' > #< / a > peer:< a href = '/type/InputPeer' > InputPeer< / a > q:< a href = '/type/string' > string< / a > from_id:flags.0?< a href = '/type/InputPeer' > InputPeer< / a > top_msg_id:flags.1?< a href = '/type/int' > int< / a > filter:< a href = '/type/MessagesFilter' > MessagesFilter< / a > min_date:< a href = '/type/int' > int< / a > max_date:< a href = '/type/int' > int< / a > offset_id:< a href = '/type/int' > int< / a > add_offset:< a href = '/type/int' > int< / a > limit:< a href = '/type/int' > int< / a > max_id:< a href = '/type/int' > int< / a > min_id:< a href = '/type/int' > int< / a > hash:< a href = '/type/long' > long< / a > = < a href = '/type/messages.Messages' > messages.Messages< / a > ;< / code > < / pre >
< p > Threads are usually automatically created when replying to any message in a group.< br >
For example, all replies to a message with ID < code > 420< / code > are associated to thread with ID < code > 420< / code > , unique to this group; this thread ID is contained in the < code > reply_to_top_id< / code > field of < code > reply_to< / code > < a href = "/constructor/messageReplyHeader" > messageReplyHeader< / a > , along with an eventual < code > reply_to_msg_id< / code > , for replies to messages within a thread.< br >
Replies to messages in a thread are part of the same thread, and do not spawn new threads. < / p >
< p > When receiving a < a href = "/constructor/message" > message< / a > from a group that is also the top of a thread (the message with ID < code > 420< / code > ), the < code > replies< / code > optional field will contain a < a href = "/constructor/messageReplies" > messageReplies< / a > constructor, containing the message ID and < a href = "/api/updates" > PTS< / a > of the latest reply in the thread, and the message ID of the latest read thread reply, along with the total number of replies in the thread. < / p >
< p > Replies to a thread can also be manually fetched using < a href = "/method/messages.search" > messages.search< / a > , providing to < code > top_msg_id< / code > the thread ID. < / p >
< h3 > < a class = "anchor" href = "#channel-comments" id = "channel-comments" name = "channel-comments" > < i class = "anchor-icon" > < / i > < / a > Channel comments< / h3 >
< pre > < code > < a href = '/constructor/messageReplies' > messageReplies< / a > #83d60fc2 flags:< a href = '/type/%23' > #< / a > comments:flags.0?< a href = '/constructor/true' > true< / a > replies:< a href = '/type/int' > int< / a > replies_pts:< a href = '/type/int' > int< / a > recent_repliers:flags.1?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/Peer' > Peer< / a > > channel_id:flags.0?< a href = '/type/long' > long< / a > max_id:flags.2?< a href = '/type/int' > int< / a > read_max_id:flags.3?< a href = '/type/int' > int< / a > = < a href = '/type/MessageReplies' > MessageReplies< / a > ;< / code > < / pre >
< p > The same < a href = "/constructor/messageReplies" > messageReplies< / a > constructor seen above will also be contained in channel posts, this time containing information about the comment section of a specific channel post.< br >
2022-11-15 01:03:58 +01:00
The comment section of a channel post is simply the < a href = "#message-threads" > message thread< / a > of the automatically forwarded channel message in the < a href = "/api/discussion" > linked discussion supergroup< / a > ; the ID of the linked discussion supergroup will be contained in the < code > messageReplies.channel_id< / code > field. < / p >
2022-02-23 16:30:26 +01:00
< p > For channel posts, the < code > recent_repliers< / code > field will also contain information about the last few comment posters for a specific thread, to show a small list of commenter profile pictures in client previews.< / p >
< h4 > < a class = "anchor" href = "#replies" id = "replies" name = "replies" > < i class = "anchor-icon" > < / i > < / a > @replies< / h4 >
< pre > < code > < a href = '/constructor/messageFwdHeader' > messageFwdHeader< / a > #5f777dce flags:< a href = '/type/%23' > #< / a > imported:flags.7?< a href = '/constructor/true' > true< / a > from_id:flags.0?< a href = '/type/Peer' > Peer< / a > from_name:flags.5?< a href = '/type/string' > string< / a > date:< a href = '/type/int' > int< / a > channel_post:flags.2?< a href = '/type/int' > int< / a > post_author:flags.3?< a href = '/type/string' > string< / a > saved_from_peer:flags.4?< a href = '/type/Peer' > Peer< / a > saved_from_msg_id:flags.4?< a href = '/type/int' > int< / a > psa_type:flags.6?< a href = '/type/string' > string< / a > = < a href = '/type/MessageFwdHeader' > MessageFwdHeader< / a > ;
2023-05-22 14:54:47 +02:00
< a href = '/constructor/messageReplyHeader' > messageReplyHeader< / a > #a6d57763 flags:< a href = '/type/%23' > #< / a > reply_to_scheduled:flags.2?< a href = '/constructor/true' > true< / a > forum_topic:flags.3?< a href = '/constructor/true' > true< / a > reply_to_msg_id:< a href = '/type/int' > int< / a > reply_to_peer_id:flags.0?< a href = '/type/Peer' > Peer< / a > reply_to_top_id:flags.1?< a href = '/type/int' > int< / a > = < a href = '/type/MessageReplyHeader' > MessageReplyHeader< / a > ;
2022-02-23 16:30:26 +01:00
2022-03-10 21:15:11 +01:00
< a href = '/constructor/message' > message< / a > #38116ee0 flags:< a href = '/type/%23' > #< / a > out:flags.1?< a href = '/constructor/true' > true< / a > mentioned:flags.4?< a href = '/constructor/true' > true< / a > media_unread:flags.5?< a href = '/constructor/true' > true< / a > silent:flags.13?< a href = '/constructor/true' > true< / a > post:flags.14?< a href = '/constructor/true' > true< / a > from_scheduled:flags.18?< a href = '/constructor/true' > true< / a > legacy:flags.19?< a href = '/constructor/true' > true< / a > edit_hide:flags.21?< a href = '/constructor/true' > true< / a > pinned:flags.24?< a href = '/constructor/true' > true< / a > noforwards:flags.26?< a href = '/constructor/true' > true< / a > id:< a href = '/type/int' > int< / a > from_id:flags.8?< a href = '/type/Peer' > Peer< / a > peer_id:< a href = '/type/Peer' > Peer< / a > fwd_from:flags.2?< a href = '/type/MessageFwdHeader' > MessageFwdHeader< / a > via_bot_id:flags.11?< a href = '/type/long' > long< / a > reply_to:flags.3?< a href = '/type/MessageReplyHeader' > MessageReplyHeader< / a > date:< a href = '/type/int' > int< / a > message:< a href = '/type/string' > string< / a > media:flags.9?< a href = '/type/MessageMedia' > MessageMedia< / a > reply_markup:flags.6?< a href = '/type/ReplyMarkup' > ReplyMarkup< / a > entities:flags.7?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/MessageEntity' > MessageEntity< / a > > views:flags.10?< a href = '/type/int' > int< / a > forwards:flags.10?< a href = '/type/int' > int< / a > replies:flags.23?< a href = '/type/MessageReplies' > MessageReplies< / a > edit_date:flags.15?< a href = '/type/int' > int< / a > post_author:flags.16?< a href = '/type/string' > string< / a > grouped_id:flags.17?< a href = '/type/long' > long< / a > reactions:flags.20?< a href = '/type/MessageReactions' > MessageReactions< / a > restriction_reason:flags.22?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/RestrictionReason' > RestrictionReason< / a > > ttl_period:flags.25?< a href = '/type/int' > int< / a > = < a href = '/type/Message' > Message< / a > ;
2022-02-23 16:30:26 +01:00
< a href = '/constructor/updateNewMessage' > updateNewMessage< / a > #1f2b0afd message:< a href = '/type/Message' > Message< / a > pts:< a href = '/type/int' > int< / a > pts_count:< a href = '/type/int' > int< / a > = < a href = '/type/Update' > Update< / a > ;
< a href = '/constructor/updateNewChannelMessage' > updateNewChannelMessage< / a > #62ba04d9 message:< a href = '/type/Message' > Message< / a > pts:< a href = '/type/int' > int< / a > pts_count:< a href = '/type/int' > int< / a > = < a href = '/type/Update' > Update< / a > ;
---functions---
< a href = '/method/contacts.blockFromReplies' > contacts.blockFromReplies< / a > #29a8962c flags:< a href = '/type/%23' > #< / a > delete_message:flags.0?< a href = '/constructor/true' > true< / a > delete_history:flags.1?< a href = '/constructor/true' > true< / a > report_spam:flags.2?< a href = '/constructor/true' > true< / a > msg_id:< a href = '/type/int' > int< / a > = < a href = '/type/Updates' > Updates< / a > ;
< a href = '/method/contacts.resolveUsername' > contacts.resolveUsername< / a > #f93ccba3 username:< a href = '/type/string' > string< / a > = < a href = '/type/contacts.ResolvedPeer' > contacts.ResolvedPeer< / a > ;< / code > < / pre >
< p > Since a user can comment in channel posts without joining the actual < a href = "/api/discussion" > discussion supergroup< / a > , there must be a way for them to receive notifications about replies in comment sections.< br >
For this reason, a special < code > @replies< / code > username is provided.
Its ID for main and testing endpoints can be seen in the < a href = "https://github.com/tdlib/td/blob/34cf869c02583c23b023f725dca30cd18efc82a3/td/telegram/ContactsManager.cpp#L4418" > tdlib sources< / a > . < / p >
< p > When someone replies to one of our messages in the comment section of a channel post, and the user is not subscribed to the discussion group, the client will receive two updates:< / p >
< ul >
< li > An < a href = "/constructor/updateNewChannelMessage" > updateNewChannelMessage< / a > from the discussion group itself, structured just like any other update coming from a subscribed group, with:< ul >
< li > < code > id< / code > set to the ID of the reply< / li >
< li > < code > from_id< / code > set to the peer that replied to us< / li >
< li > < code > peer_id< / code > set to the peer of the < a href = "/api/discussion" > discussion group< / a > < / li >
< li > < code > reply_to.reply_to_msg_id< / code > set to the ID of our message< / li >
< li > < code > reply_to.reply_to_top_id< / code > set to the < a href = "/api/threads" > thread ID< / a > . < / li >
< / ul >
< / li >
< li > An < a href = "/constructor/updateNewMessage" > updateNewMessage< / a > < ul >
< li > < code > id< / code > set to the common ID sequence for users< / li >
< li > < code > from_id< / code > set to the peer of < code > @replies< / code > < / li >
< li > < code > peer_id< / code > set to our own peer< / li >
< li > < code > fwd_from.saved_from_msg_id< / code > set to the ID of the reply< / li >
2023-05-22 14:54:47 +02:00
< li > < code > fwd_from.from_id< / code > set to the peer that replied to us< / li >
2022-02-23 16:30:26 +01:00
< li > < code > reply_to.reply_to_peer_id< / code > set to the peer of the < a href = "/api/discussion" > discussion group< / a > < / li >
< li > < code > reply_to.reply_to_msg_id< / code > set to the ID of our message< / li >
< li > < code > reply_to.reply_to_top_id< / code > set to the < a href = "/api/threads" > thread ID< / a > < / li >
< / ul >
< / li >
< / ul >
2022-11-15 01:03:58 +01:00
< p > Clients should display messages coming from < code > @replies< / code > as a read-only supergroup, with each reply displayed as a separate message from the author of the reply, with a "View in chat" button like for channel comments.< / p > < / div >
2022-02-23 16:30:26 +01:00
< / div >
< / div >
< / div >
< div class = "footer_wrap" >
< div class = "footer_columns_wrap footer_desktop" >
< div class = "footer_column footer_column_telegram" >
< h5 > Telegram< / h5 >
< div class = "footer_telegram_description" > < / div >
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/faq" > About< / a > < / h5 >
< ul >
< li > < a href = "//telegram.org/faq" > FAQ< / a > < / li >
2022-09-09 12:10:24 +02:00
< li > < a href = "//telegram.org/privacy" > Privacy< / a > < / li >
2022-09-09 23:58:59 +02:00
< li > < a href = "//telegram.org/press" > Press< / a > < / li >
2022-02-23 16:30:26 +01:00
< / ul >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/apps#mobile-apps" > Mobile Apps< / a > < / h5 >
< ul >
< li > < a href = "//telegram.org/dl/ios" > iPhone/iPad< / a > < / li >
2022-09-09 23:58:59 +02:00
< li > < a href = "//telegram.org/android" > Android< / a > < / li >
< li > < a href = "//telegram.org/dl/web" > Mobile Web< / a > < / li >
2022-02-23 16:30:26 +01:00
< / ul >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/apps#desktop-apps" > Desktop Apps< / a > < / h5 >
< ul >
< li > < a href = "//desktop.telegram.org/" > PC/Mac/Linux< / a > < / li >
< li > < a href = "//macos.telegram.org/" > macOS< / a > < / li >
< li > < a href = "//telegram.org/dl/web" > Web-browser< / a > < / li >
< / ul >
< / div >
< div class = "footer_column footer_column_platform" >
< h5 > < a href = "/" > Platform< / a > < / h5 >
< ul >
< li > < a href = "/api" > API< / a > < / li >
< li > < a href = "//translations.telegram.org/" > Translations< / a > < / li >
< li > < a href = "//instantview.telegram.org/" > Instant View< / a > < / li >
< / ul >
< / div >
< / div >
< div class = "footer_columns_wrap footer_mobile" >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/faq" > About< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/blog" > Blog< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/apps" > Apps< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "/" > Platform< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "https://twitter.com/telegram" target = "_blank" data-track = "Follow/Twitter" onclick = "trackDlClick(this, event)" > Twitter< / a > < / h5 >
< / div >
< / div >
< / div >
< / div >
2022-12-10 23:50:15 +01:00
< script src = "/js/main.js?47" > < / script >
2022-02-23 16:30:26 +01:00
< script src = "/js/jquery.min.js?1" > < / script >
< script src = "/js/bootstrap.min.js?1" > < / script >
< script > w i n d o w . i n i t D e v P a g e N a v & & i n i t D e v P a g e N a v ( ) ;
backToTopInit("Go up");
removePreloadInit();
< / script >
< / body >
< / html >