Update content of files

This commit is contained in:
GitHub Action 2024-03-08 13:12:53 +00:00
parent 62af06d7f8
commit 6257a378a6
7 changed files with 1306 additions and 1325 deletions

View file

@ -47,27 +47,16 @@ To learn how to create…">
<div id="dev_page_content"><!-- scroll_nav -->
<blockquote>
<p>The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.<br>To learn how to create and set up a bot, please consult our <a href="https://core.telegram.org/bots"><strong>Introduction to Bots »</strong></a></p>
<p>The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
To learn how to create and set up a bot, please consult our <a href="https://core.telegram.org/bots"><strong>Introduction to Bots »</strong></a></p>
</blockquote>
<p>You will find all changes to our <a href="/bots/api"><strong>Bot API</strong></a> on this page.</p>
<h3><a class="anchor" name="recent-changes" href="#recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
<h3><a class="anchor" href="#recent-changes" id="recent-changes" name="recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
<blockquote>
<p>Subscribe to <a href="https://t.me/botnews">@BotNews</a> to be the first to know about the latest updates and join the discussion in <a href="https://t.me/bottalk">@BotTalk</a></p>
</blockquote>
<h3><a class="anchor" name="2024" href="#2024"><i class="anchor-icon"></i></a>2024</h3>
<h4><a class="anchor" name="february-16-2024" href="#february-16-2024"><i class="anchor-icon"></i></a>February 16, 2024</h4>
<p><strong>Bot API 7.1</strong></p>
<ul>
<li>Added support for the administrator rights <em>can_post_stories</em>, <em>can_edit_stories</em>, <em>can_delete_stories</em> in supergroups.</li>
<li>Added the class <a href="/bots/api#chatboostadded">ChatBoostAdded</a> and the field <em>boost_added</em> to the class <a href="/bots/api#message">Message</a> for service messages about a user boosting a chat.</li>
<li>Added the field <em>sender_boost_count</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Added the field <em>reply_to_story</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Added the fields <em>chat</em> and <em>id</em> to the class <a href="/bots/api#story">Story</a>.</li>
<li>Added the field <em>unrestrict_boost_count</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
<li>Added the field <em>custom_emoji_sticker_set_name</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
</ul>
<h3><a class="anchor" name="2023" href="#2023"><i class="anchor-icon"></i></a>2023</h3>
<h4><a class="anchor" name="december-29-2023" href="#december-29-2023"><i class="anchor-icon"></i></a>December 29, 2023</h4>
<h3><a class="anchor" href="#2023" id="2023" name="2023"><i class="anchor-icon"></i></a>2023</h3>
<h4><a class="anchor" href="#december-29-2023" id="december-29-2023" name="december-29-2023"><i class="anchor-icon"></i></a>December 29, 2023</h4>
<p><strong>Bot API 7.0</strong></p>
<p><strong>Reactions</strong></p>
<ul>
@ -96,9 +85,9 @@ To learn how to create…">
</ul>
<p><strong>Block Quotation</strong></p>
<ul>
<li>Added support for “blockquote” entities in received messages.</li>
<li>Added support for “blockquote” entity parsing in “MarkdownV2” and “HTML” parse modes.</li>
<li>Allowed to explicitly specify “blockquote” entities in formatted texts.</li>
<li>Added support for "blockquote" entities in received messages.</li>
<li>Added support for "blockquote" entity parsing in "MarkdownV2" and "HTML" parse modes.</li>
<li>Allowed to explicitly specify "blockquote" entities in formatted texts.</li>
</ul>
<p><strong>Multiple Message Actions</strong></p>
<ul>
@ -140,7 +129,7 @@ To learn how to create…">
<li>Added the class <a href="/bots/api#messageorigin">MessageOrigin</a> and replaced the fields <em>forward_from</em>, <em>forward_from_chat</em>, <em>forward_from_message_id</em>, <em>forward_signature</em>, <em>forward_sender_name</em>, and <em>forward_date</em> with the field <em>forward_origin</em> of type <a href="/bots/api#messageorigin">MessageOrigin</a> in the class <a href="/bots/api#message">Message</a>.</li>
<li>Improved documentation for the field <em>message</em> of the class <a href="/bots/api#callbackquery">callbackQuery</a> and the field <em>pinned_message</em> of the class <a href="/bots/api#message">Message</a> by adding the classes <a href="/bots/api#maybeinaccessiblemessage">MaybeInaccessibleMessage</a> and <a href="/bots/api#inaccessiblemessage">InaccessibleMessage</a>.</li>
</ul>
<h4><a class="anchor" name="september-22-2023" href="#september-22-2023"><i class="anchor-icon"></i></a>September 22, 2023</h4>
<h4><a class="anchor" href="#september-22-2023" id="september-22-2023" name="september-22-2023"><i class="anchor-icon"></i></a>September 22, 2023</h4>
<p><strong>Bot API 6.9</strong></p>
<ul>
<li>Added the new administrator privileges <em>can_post_stories</em>, <em>can_edit_stories</em> and <em>can_delete_stories</em> to the classes <a href="/bots/api#chatmemberadministrator">ChatMemberAdministrator</a> and <a href="/bots/api#chatadministratorrights">ChatAdministratorRights</a>.</li>
@ -152,7 +141,7 @@ To learn how to create…">
<li>Added the fields <em>from_request</em> and <em>from_attachment_menu</em> to the class <a href="/bots/api#writeaccessallowed">WriteAccessAllowed</a>.</li>
<li>Added the fields <em>added_to_attachment_menu</em> and <em>allows_write_to_pm</em> to the class <a href="/bots/webapps#webappuser">WebAppUser</a>.</li>
</ul>
<h4><a class="anchor" name="august-18-2023" href="#august-18-2023"><i class="anchor-icon"></i></a>August 18, 2023</h4>
<h4><a class="anchor" href="#august-18-2023" id="august-18-2023" name="august-18-2023"><i class="anchor-icon"></i></a>August 18, 2023</h4>
<p><strong>Bot API 6.8</strong></p>
<ul>
<li>Added the field <em>story</em> to the class <a href="/bots/api#message">Message</a> for messages with forwarded stories. Currently, it holds no information.</li>
@ -161,7 +150,7 @@ To learn how to create…">
<li>Added the method <a href="/bots/api#unpinallgeneralforumtopicmessages">unpinAllGeneralForumTopicMessages</a>.</li>
<li>Increased to 512 characters the maximum length of the <em>startapp</em> parameter in direct Web App links.</li>
</ul>
<h4><a class="anchor" name="april-21-2023" href="#april-21-2023"><i class="anchor-icon"></i></a>April 21, 2023</h4>
<h4><a class="anchor" href="#april-21-2023" id="april-21-2023" name="april-21-2023"><i class="anchor-icon"></i></a>April 21, 2023</h4>
<p><strong>Bot API 6.7</strong></p>
<ul>
<li>Added support for launching <a href="/bots/webapps">Web Apps</a> from inline query results by replacing the parameters <em>switch_pm_text</em> and <em>switch_pm_parameter</em> of the method <a href="/bots/api#answerinlinequery">answerInlineQuery</a> with the parameter <em>button</em> of type <a href="/bots/api#inlinequeryresultsbutton">InlineQueryResultsButton</a>.</li>
@ -170,10 +159,10 @@ To learn how to create…">
<li>Added the field <em>via_chat_folder_invite_link</em> to the class <a href="/bots/api#chatmemberupdated">ChatMemberUpdated</a>.</li>
<li>Added the ability to set different bot names for different user languages using the method <a href="/bots/api#setmyname">setMyName</a>.</li>
<li>Added the ability to get the current bot name in the given language as the class <a href="/bots/api#botname">BotName</a> using the method <a href="/bots/api#getmyname">getMyName</a>.</li>
<li>Added the ability to change bot settings from the bot&#39;s profile in official Telegram apps, including the ability to set animated profile photos.</li>
<li>Added the ability to change bot settings from the bot's profile in official Telegram apps, including the ability to set animated profile photos.</li>
<li>Added the ability to specify custom emoji entities using <a href="/bots/api#html-style">HTML</a> and <a href="/bots/api#markdownv2-style">MarkdownV2</a> formatting options for bots that purchased additional usernames on <a href="https://fragment.com">Fragment</a>.</li>
</ul>
<h4><a class="anchor" name="march-9-2023" href="#march-9-2023"><i class="anchor-icon"></i></a>March 9, 2023</h4>
<h4><a class="anchor" href="#march-9-2023" id="march-9-2023" name="march-9-2023"><i class="anchor-icon"></i></a>March 9, 2023</h4>
<p><strong>Bot API 6.6</strong></p>
<ul>
<li>Added the ability to set different bot descriptions for different user languages using the method <a href="/bots/api#setmydescription">setMyDescription</a>.</li>
@ -202,7 +191,7 @@ To learn how to create…">
<li>Renamed the field <em>thumb_url</em> in the classes <a href="/bots/api#inlinequeryresultphoto">InlineQueryResultPhoto</a> and <a href="/bots/api#inlinequeryresultvideo">InlineQueryResultVideo</a> to <em>thumbnail_url</em>.</li>
<li>Renamed the fields <em>thumb_url</em> and <em>thumb_mime_type</em> in the classes <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a>, and <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a> to <em>thumbnail_url</em> and <em>thumbnail_mime_type</em> respectively.</li>
</ul>
<h4><a class="anchor" name="february-3-2023" href="#february-3-2023"><i class="anchor-icon"></i></a>February 3, 2023</h4>
<h4><a class="anchor" href="#february-3-2023" id="february-3-2023" name="february-3-2023"><i class="anchor-icon"></i></a>February 3, 2023</h4>
<p><strong>Bot API 6.5</strong></p>
<ul>
<li>Added <a href="https://telegram.org/blog/profile-pics-emoji-translations#chat-selection-for-bots">requests for users and chats</a> and support for <a href="https://telegram.org/blog/profile-pics-emoji-translations#granular-media-permissions">granular media permissions</a>.</li>
@ -213,8 +202,8 @@ To learn how to create…">
<li>Added the parameter <em>use_independent_chat_permissions</em> to the methods <a href="/bots/api#restrictchatmember">restrictChatMember</a> and <a href="/bots/api#setchatpermissions">setChatPermissions</a>.</li>
<li>Added the field <em>user_chat_id</em> to the class <a href="/bots/api#chatjoinrequest">ChatJoinRequest</a>.</li>
</ul>
<h3><a class="anchor" name="2022" href="#2022"><i class="anchor-icon"></i></a>2022</h3>
<h4><a class="anchor" name="december-30-2022" href="#december-30-2022"><i class="anchor-icon"></i></a>December 30, 2022</h4>
<h3><a class="anchor" href="#2022" id="2022" name="2022"><i class="anchor-icon"></i></a>2022</h3>
<h4><a class="anchor" href="#december-30-2022" id="december-30-2022" name="december-30-2022"><i class="anchor-icon"></i></a>December 30, 2022</h4>
<p><strong>Bot API 6.4</strong></p>
<ul>
<li>Added the field <em>is_persistent</em> to the class <a href="/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a>, allowing to control when the keyboard is shown.</li>
@ -232,13 +221,13 @@ To learn how to create…">
<li>Added the methods <em>showScanQrPopup</em>, <em>closeScanQrPopup</em>, and <em>readTextFromClipboard</em> to the class <a href="/bots/webapps#initializing-web-apps">WebApp</a>.</li>
<li>Added the parameter <em>options</em> to the method <em>openLink</em> of the class <a href="/bots/webapps#initializing-web-apps">WebApp</a>.</li>
</ul>
<h4><a class="anchor" name="november-5-2022" href="#november-5-2022"><i class="anchor-icon"></i></a>November 5, 2022</h4>
<h4><a class="anchor" href="#november-5-2022" id="november-5-2022" name="november-5-2022"><i class="anchor-icon"></i></a>November 5, 2022</h4>
<p><strong>Bot API 6.3</strong></p>
<ul>
<li>Added support for <a href="https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups">Topics in Groups</a>.</li>
<li>Added the field <em>is_forum</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
<li>Added the fields <em>is_topic_message</em> and <em>message_thread_id</em> to the class <a href="/bots/api#message">Message</a> to allow detection of messages belonging to a forum topic and their message thread identifier.</li>
<li>Added the classes <a href="/bots/api#forumtopiccreated">ForumTopicCreated</a>, <a href="/bots/api#forumtopicclosed">ForumTopicClosed</a>, and <a href="/bots/api#forumtopicreopened">ForumTopicReopened</a> and the fields <em>forum_topic_created</em>, <em>forum_topic_closed</em>, and <em>forum_topic_reopened</em> to the class <a href="/bots/api#message">Message</a>. Note that service messages about forum topic creation can&#39;t be deleted with the <a href="/bots/api#deletemessage">deleteMessage</a> method.</li>
<li>Added the classes <a href="/bots/api#forumtopiccreated">ForumTopicCreated</a>, <a href="/bots/api#forumtopicclosed">ForumTopicClosed</a>, and <a href="/bots/api#forumtopicreopened">ForumTopicReopened</a> and the fields <em>forum_topic_created</em>, <em>forum_topic_closed</em>, and <em>forum_topic_reopened</em> to the class <a href="/bots/api#message">Message</a>. Note that service messages about forum topic creation can't be deleted with the <a href="/bots/api#deletemessage">deleteMessage</a> method.</li>
<li>Added the field <em>can_manage_topics</em> to the classes <a href="/bots/api#chatadministratorrights">ChatAdministratorRights</a>, <a href="/bots/api#chatpermissions">ChatPermissions</a>, <a href="/bots/api#chatmemberadministrator">ChatMemberAdministrator</a>, and <a href="/bots/api#chatmemberrestricted">ChatMemberRestricted</a>.</li>
<li>Added the parameter <em>can_manage_topics</em> to the method <a href="/bots/api#promotechatmember">promoteChatMember</a>.</li>
<li>Added the methods <a href="/bots/api#createforumtopic">createForumTopic</a>, <a href="/bots/api#editforumtopic">editForumTopic</a>, <a href="/bots/api#closeforumtopic">closeForumTopic</a>, <a href="/bots/api#reopenforumtopic">reopenForumTopic</a>, <a href="/bots/api#deleteforumtopic">deleteForumTopic</a>, <a href="/bots/api#unpinallforumtopicmessages">unpinAllForumTopicMessages</a>, and <a href="/bots/api#getforumtopiciconstickers">getForumTopicIconStickers</a> for forum topic management.</li>
@ -246,12 +235,12 @@ To learn how to create…">
<li>Added support for <a href="https://telegram.org/blog/topics-in-groups-collectible-usernames#collectible-usernames">Multiple Usernames</a> via the field <em>active_usernames</em> in the class <a href="/bots/api#chat">Chat</a>.</li>
<li>Added the field <em>emoji_status_custom_emoji_id</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
</ul>
<h4><a class="anchor" name="august-12-2022" href="#august-12-2022"><i class="anchor-icon"></i></a>August 12, 2022</h4>
<h4><a class="anchor" href="#august-12-2022" id="august-12-2022" name="august-12-2022"><i class="anchor-icon"></i></a>August 12, 2022</h4>
<p><strong>Bot API 6.2</strong></p>
<p><strong>Custom Emoji Support</strong></p>
<ul>
<li>Added the <a href="/bots/api#messageentity">MessageEntity</a> type “custom_emoji”.</li>
<li>Added the field <em>custom_emoji_id</em> to the class <a href="/bots/api#messageentity">MessageEntity</a> for “custom_emoji” entities.</li>
<li>Added the <a href="/bots/api#messageentity">MessageEntity</a> type "custom_emoji".</li>
<li>Added the field <em>custom_emoji_id</em> to the class <a href="/bots/api#messageentity">MessageEntity</a> for "custom_emoji" entities.</li>
<li>Added the method <a href="/bots/api#getcustomemojistickers">getCustomEmojiStickers</a>.</li>
<li>Added the fields <em>type</em> and <em>custom_emoji_id</em> to the class <a href="/bots/api#sticker">Sticker</a>.</li>
<li>Added the field <em>sticker_type</em> to the class <a href="/bots/api#stickerset">StickerSet</a>, describing the type of stickers in the set.</li>
@ -269,11 +258,11 @@ To learn how to create…">
<ul>
<li>Added the field <em>has_restricted_voice_and_video_messages</em> to the class <a href="/bots/api#chat">Chat</a> to support the <a href="https://telegram.org/blog/custom-emoji#privacy-settings-for-voice-messages">new setting</a>.</li>
</ul>
<h4><a class="anchor" name="june-20-2022" href="#june-20-2022"><i class="anchor-icon"></i></a>June 20, 2022</h4>
<h4><a class="anchor" href="#june-20-2022" id="june-20-2022" name="june-20-2022"><i class="anchor-icon"></i></a>June 20, 2022</h4>
<p><strong>Bot API 6.1</strong></p>
<p><strong>Media in Descriptions</strong></p>
<ul>
<li>Added support for photos and videos in the &#39;What can this bot do?&#39; section (shown on the bot&#39;s start screen). Use <a href="https://t.me/BotFather">BotFather</a> to set up media.</li>
<li>Added support for photos and videos in the 'What can this bot do?' section (shown on the bot's start screen). Use <a href="https://t.me/BotFather">BotFather</a> to set up media.</li>
</ul>
<p><strong>Web App Improvements</strong></p>
<ul>
@ -286,7 +275,7 @@ To learn how to create…">
<p><strong>Join Requests &amp; Payments</strong></p>
<ul>
<li>Added the fields <em>join_to_send_messages</em> and <em>join_by_request</em> to the class <a href="/bots/api#chat">Chat</a>.</li>
<li>Added the ability to process join requests which were created <a href="https://telegram.org/blog/700-million-and-premium#join-requests-for-public-groups">without an invite link</a>. Bots will receive a “chat_join_request” update as usual.</li>
<li>Added the ability to process join requests which were created <a href="https://telegram.org/blog/700-million-and-premium#join-requests-for-public-groups">without an invite link</a>. Bots will receive a "chat_join_request" update as usual.</li>
<li>Added the method <a href="/bots/api#createinvoicelink">createInvoiceLink</a> to generate an HTTP link for an invoice.</li>
</ul>
<p><strong>Telegram Premium Support</strong> (<a href="https://telegram.org/blog/700-million-and-premium#telegram-premium">more info</a>)</p>
@ -306,15 +295,15 @@ To learn how to create…">
<li>Added the parameter <em>secret_token</em> to the method <a href="/bots/api#setwebhook">setWebhook</a>.</li>
<li>As previously announced, only HTTPS links are now allowed in <em>login_url</em> inline keyboard buttons.</li>
</ul>
<h4><a class="anchor" name="april-16-2022" href="#april-16-2022"><i class="anchor-icon"></i></a>April 16, 2022</h4>
<h4><a class="anchor" href="#april-16-2022" id="april-16-2022" name="april-16-2022"><i class="anchor-icon"></i></a>April 16, 2022</h4>
<p><strong>Bot API 6.0</strong></p>
<ul>
<li>Added support for <strong>Web Apps</strong>, see the <a href="/bots/webapps">detailed manual here</a>. (<a href="https://telegram.org/blog/notifications-bots">blog announcement</a>)</li>
<li>Added the class <a href="/bots/api#webappinfo">WebAppInfo</a> and the fields <em>web_app</em> to the classes <a href="/bots/api#keyboardbutton">KeyboardButton</a> and <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a>.</li>
<li>Added the class <a href="/bots/api#sentwebappmessage">SentWebAppMessage</a> and the method <a href="/bots/api#answerwebappquery">answerWebAppQuery</a> for sending an answer to a Web App query, which originated from an inline button of the &#39;web_app&#39; type.</li>
<li>Added the class <a href="/bots/api#sentwebappmessage">SentWebAppMessage</a> and the method <a href="/bots/api#answerwebappquery">answerWebAppQuery</a> for sending an answer to a Web App query, which originated from an inline button of the 'web_app' type.</li>
<li>Added the class <a href="/bots/api#webappdata">WebAppData</a> and the field <em>web_app_data</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Added the class <a href="/bots/api#menubutton">MenuButton</a> and the methods <a href="/bots/api#setchatmenubutton">setChatMenuButton</a> and <a href="/bots/api#getchatmenubutton">getChatMenuButton</a> for managing the behavior of the bot&#39;s menu button in private chats.</li>
<li>Added the class <a href="/bots/api#chatadministratorrights">ChatAdministratorRights</a> and the methods <a href="/bots/api#setmydefaultadministratorrights">setMyDefaultAdministratorRights</a> and <a href="/bots/api#getmydefaultadministratorrights">getMyDefaultAdministratorRights</a> for managing the bot&#39;s default administrator rights.</li>
<li>Added the class <a href="/bots/api#menubutton">MenuButton</a> and the methods <a href="/bots/api#setchatmenubutton">setChatMenuButton</a> and <a href="/bots/api#getchatmenubutton">getChatMenuButton</a> for managing the behavior of the bot's menu button in private chats.</li>
<li>Added the class <a href="/bots/api#chatadministratorrights">ChatAdministratorRights</a> and the methods <a href="/bots/api#setmydefaultadministratorrights">setMyDefaultAdministratorRights</a> and <a href="/bots/api#getmydefaultadministratorrights">getMyDefaultAdministratorRights</a> for managing the bot's default administrator rights.</li>
<li>Added support for t.me links that can be used to add the bot to groups and channels as an administrator.</li>
<li>Added the field <em>last_synchronization_error_date</em> to the class <a href="/bots/api#webhookinfo">WebhookInfo</a>.</li>
<li>Renamed the field <em>can_manage_voice_chats</em> to <em>can_manage_video_chats</em> in the class <a href="/bots/api#chatmemberadministrator">ChatMemberAdministrator</a>. The old field will remain temporarily available.</li>
@ -323,30 +312,31 @@ To learn how to create…">
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After the next update, only HTTPS links will be allowed in <em>login_url</em> inline keyboard buttons.</p>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
After the next update, only HTTPS links will be allowed in <em>login_url</em> inline keyboard buttons.</p>
</blockquote>
<hr>
<h4><a class="anchor" name="january-31-2022" href="#january-31-2022"><i class="anchor-icon"></i></a>January 31, 2022</h4>
<h4><a class="anchor" href="#january-31-2022" id="january-31-2022" name="january-31-2022"><i class="anchor-icon"></i></a>January 31, 2022</h4>
<p><strong>Bot API 5.7</strong></p>
<ul>
<li>Added support for <a href="https://telegram.org/blog/video-stickers-better-reactions">Video Stickers</a>.</li>
<li>Added the field <em>is_video</em> to the classes <a href="/bots/api#sticker">Sticker</a> and <a href="/bots/api#stickerset">StickerSet</a>.</li>
<li>Added the parameter <em>webm_sticker</em> to the methods <a href="/bots/api#createnewstickerset">createNewStickerSet</a> and <a href="/bots/api#addstickertoset">addStickerToSet</a>.</li>
</ul>
<h3><a class="anchor" name="2021" href="#2021"><i class="anchor-icon"></i></a>2021</h3>
<h4><a class="anchor" name="december-30-2021" href="#december-30-2021"><i class="anchor-icon"></i></a>December 30, 2021</h4>
<h3><a class="anchor" href="#2021" id="2021" name="2021"><i class="anchor-icon"></i></a>2021</h3>
<h4><a class="anchor" href="#december-30-2021" id="december-30-2021" name="december-30-2021"><i class="anchor-icon"></i></a>December 30, 2021</h4>
<p><strong>Bot API 5.6</strong></p>
<ul>
<li>Improved support for <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#protected-content-in-groups-and-channels">Protected Content</a>.</li>
<li>Added the parameter <em>protect_content</em> to the methods <a href="/bots/api#sendmessage">sendMessage</a>, <a href="/bots/api#sendphoto">sendPhoto</a>, <a href="/bots/api#sendvideo">sendVideo</a>, <a href="/bots/api#sendanimation">sendAnimation</a>, <a href="/bots/api#sendaudio">sendAudio</a>, <a href="/bots/api#senddocument">sendDocument</a>, <a href="/bots/api#sendsticker">sendSticker</a>, <a href="/bots/api#sendvideonote">sendVideoNote</a>, <a href="/bots/api#sendvoice">sendVoice</a>, <a href="/bots/api#sendlocation">sendLocation</a>, <a href="/bots/api#sendvenue">sendVenue</a>, <a href="/bots/api#sendcontact">sendContact</a>, <a href="/bots/api#sendpoll">sendPoll</a>, <a href="/bots/api#senddice">sendDice</a>, <a href="/bots/api#sendinvoice">sendInvoice</a>, <a href="/bots/api#sendgame">sendGame</a>, <a href="/bots/api#sendmediagroup">sendMediaGroup</a>, <a href="/bots/api#copymessage">copyMessage</a>, <a href="/bots/api#forwardmessage">forwardMessage</a> to allow sending messages with protected content to any chat.</li>
<li>Added support for <a href="https://telegram.org/blog/reactions-spoilers-translations#spoilers">spoiler entities</a>, which will work in Telegram versions released after December 30, 2021. Older clients will display <em>unsupported message</em>.</li>
<li>Added new <a href="/bots/api#messageentity">MessageEntity</a> type “spoiler”.</li>
<li>Added new <a href="/bots/api#messageentity">MessageEntity</a> type "spoiler".</li>
<li>Added the ability to specify spoiler entities using <a href="/bots/api#html-style">HTML</a> and <a href="/bots/api#markdownv2-style">MarkdownV2</a> formatting options.</li>
</ul>
<h4><a class="anchor" name="december-7-2021" href="#december-7-2021"><i class="anchor-icon"></i></a>December 7, 2021</h4>
<h4><a class="anchor" href="#december-7-2021" id="december-7-2021" name="december-7-2021"><i class="anchor-icon"></i></a>December 7, 2021</h4>
<p><strong>Bot API 5.5</strong></p>
<ul>
<li>Bots are now allowed to contact users who sent a join request to a chat where the bot is an administrator with the <em>can_invite_users</em> administrator right even if the user never interacted with the bot before.</li>
<li>Bots are now allowed to contact users who sent a join request to a chat where the bot is an administrator with the <em>can_invite_users</em> administrator right  even if the user never interacted with the bot before.</li>
<li>Added support for mentioning users by their ID in inline keyboards. This will only work in Telegram versions released after December 7, 2021. Older clients will display <em>unsupported message</em>.</li>
<li>Added the methods <a href="/bots/api#banchatsenderchat">banChatSenderChat</a> and <a href="/bots/api#unbanchatsenderchat">unbanChatSenderChat</a> for banning and unbanning channel chats in supergroups and channels.</li>
<li>Added the field <em>has_private_forwards</em> to the class <a href="/bots/api#chat">Chat</a> for private chats, which can be used to check the possibility of mentioning the user by their ID.</li>
@ -356,7 +346,7 @@ To learn how to create…">
<p><strong>Note:</strong> After this update it will become impossible to forward messages from some chats. Use the fields <em>has_protected_content</em> in the classes <a href="/bots/api#message">Message</a> and <a href="/bots/api#chat">Chat</a> to check this.</p>
<p><strong>Note:</strong> After this update users are able to send messages on behalf of channels they own. Bots are expected to use the field <em>sender_chat</em> in the class <a href="/bots/api#message">Message</a> to correctly support such messages.</p>
<p><strong>Note:</strong> As previously announced, user identifiers can now have up to 52 significant bits and require a 64-bit integer or double-precision float type to be stored safely.</p>
<h4><a class="anchor" name="november-5-2021" href="#november-5-2021"><i class="anchor-icon"></i></a>November 5, 2021</h4>
<h4><a class="anchor" href="#november-5-2021" id="november-5-2021" name="november-5-2021"><i class="anchor-icon"></i></a>November 5, 2021</h4>
<p><strong>Bot API 5.4</strong></p>
<ul>
<li>Added the the parameter <code>creates_join_request</code> to the methods <a href="/bots/api#createchatinvitelink">createChatInviteLink</a> and <a href="/bots/api#editchatinvitelink">editChatInviteLink</a> for managing chat invite links that create join requests (read more about this on our <a href="https://telegram.org/blog/shared-media-scrolling-calendar-join-requests-and-more#join-requests-for-groups-and-channels">blog</a>).</li>
@ -368,10 +358,11 @@ To learn how to create…">
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>User identifiers will become bigger than <code>2^31 - 1</code> before the end of this year and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
User identifiers will become bigger than <code>2^31 - 1</code> before the end of this year and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
</blockquote>
<hr>
<h4><a class="anchor" name="june-25-2021" href="#june-25-2021"><i class="anchor-icon"></i></a>June 25, 2021</h4>
<h4><a class="anchor" href="#june-25-2021" id="june-25-2021" name="june-25-2021"><i class="anchor-icon"></i></a>June 25, 2021</h4>
<p><strong>Bot API 5.3</strong></p>
<p><strong>Personalized Commands</strong></p>
<ul>
@ -379,8 +370,8 @@ To learn how to create…">
<li>Added the class <a href="/bots/api#botcommandscope">BotCommandScope</a>, describing the scope to which bot commands apply.</li>
<li>Added the parameters <code>scope</code> and <code>language_code</code> to the method <a href="/bots/api#setmycommands">setMyCommands</a> to allow bots specify different commands for different chats and users.</li>
<li>Added the parameters <code>scope</code> and <code>language_code</code> to the method <a href="/bots/api#getmycommands">getMyCommands</a>.</li>
<li>Added the method <a href="/bots/api#deletemycommands">deleteMyCommands</a> to allow deletion of the bot&#39;s commands for the given scope and user language.</li>
<li>Improved visibility of bot commands in Telegram apps with the new &#39;Menu&#39; button in chats with bots, read more on the <a href="https://telegram.org/blog/animated-backgrounds#bot-menu">blog</a>.</li>
<li>Added the method <a href="/bots/api#deletemycommands">deleteMyCommands</a> to allow deletion of the bot's commands for the given scope and user language.</li>
<li>Improved visibility of bot commands in Telegram apps with the new 'Menu' button in chats with bots, read more on the <a href="https://telegram.org/blog/animated-backgrounds#bot-menu">blog</a>.</li>
</ul>
<p><strong>Custom Placeholders</strong></p>
<ul>
@ -395,35 +386,39 @@ To learn how to create…">
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After one of the upcoming Bot API updates, user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
After one of the upcoming Bot API updates, user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
</blockquote>
<hr>
<h4><a class="anchor" name="april-26-2021" href="#april-26-2021"><i class="anchor-icon"></i></a>April 26, 2021</h4>
<h4><a class="anchor" href="#april-26-2021" id="april-26-2021" name="april-26-2021"><i class="anchor-icon"></i></a>April 26, 2021</h4>
<p><strong>Bot API 5.2</strong></p>
<ul>
<li>Support for <a href="https://telegram.org/blog/payments-2-0-scheduled-voice-chats">Payments 2.0</a>, see <a href="https://core.telegram.org/bots/payments">this manual</a> for more details about the <strong>Bot Payments API</strong>.</li>
<li>Added the type <a href="/bots/api#inputinvoicemessagecontent">InputInvoiceMessageContent</a> to support sending invoices as inline query results.</li>
<li>Allowed sending invoices to group, supergroup and channel chats.</li>
<li>Added the fields <em>max_tip_amount</em> and <em>suggested_tip_amounts</em> to the method <a href="/bots/api#sendinvoice">sendInvoice</a> to allow adding optional tips to the payment.</li>
<li>The parameter <em>start_parameter</em> of the method <a href="/bots/api#sendinvoice">sendInvoice</a> became optional. If the parameter isn&#39;t specified, the invoice can be paid directly from forwarded messages.</li>
<li>The parameter <em>start_parameter</em> of the method <a href="/bots/api#sendinvoice">sendInvoice</a> became optional. If the parameter isn't specified, the invoice can be paid directly from forwarded messages.</li>
<li>Added the field <em>chat_type</em> to the class <a href="/bots/api#inlinequery">InlineQuery</a>, containing the type of the chat, from which the inline request was sent.</li>
<li>Added the type <a href="/bots/api#voicechatscheduled">VoiceChatScheduled</a> and the field <em>voice_chat_scheduled</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Fixed an error in <a href="/bots/api#sendchataction">sendChatAction</a> documentation to correctly mention “record_voice” and “upload_voice” instead of “record_audio” and “upload_audio” for related to voice note actions. Old action names will still work for backward compatibility.</li>
<li>Fixed an error in <a href="/bots/api#sendchataction">sendChatAction</a> documentation to correctly mention "record_voice" and "upload_voice" instead of "record_audio" and "upload_audio" for related to voice note actions. Old action names will still work for backward compatibility.</li>
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After the next Bot API update (Bot API 5.3) there will be a one-time change of the value of the field <code>file_unique_id</code> in objects of the type <a href="/bots/api#photosize">PhotoSize</a> and of the fields <code>small_file_unique_id</code> and <code>big_file_unique_id</code> in objects of the type <a href="/bots/api#chatphoto">ChatPhoto</a>.</p>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
After the next Bot API update (Bot API 5.3) there will be a one-time change of the value of the field <code>file_unique_id</code> in objects of the type <a href="/bots/api#photosize">PhotoSize</a> and of the fields <code>small_file_unique_id</code> and <code>big_file_unique_id</code> in objects of the type <a href="/bots/api#chatphoto">ChatPhoto</a>.</p>
</blockquote>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>Service messages about non-bot users joining the chat will be soon removed from large groups. We recommend using the “chat_member” update as a replacement.</p>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
Service messages about non-bot users joining the chat will be soon removed from large groups. We recommend using the "chat_member" update as a replacement.</p>
</blockquote>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After one of the upcoming Bot API updates, user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
After one of the upcoming Bot API updates, user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
</blockquote>
<hr>
<h4><a class="anchor" name="march-9-2021" href="#march-9-2021"><i class="anchor-icon"></i></a>March 9, 2021</h4>
<h4><a class="anchor" href="#march-9-2021" id="march-9-2021" name="march-9-2021"><i class="anchor-icon"></i></a>March 9, 2021</h4>
<p><strong>Bot API 5.1</strong></p>
<p><strong>Added two new update types</strong></p>
<ul>
@ -452,15 +447,16 @@ To learn how to create…">
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After one of the upcoming Bot API updates, some user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong>
After one of the upcoming Bot API updates, some user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
</blockquote>
<hr>
<h3><a class="anchor" name="2020" href="#2020"><i class="anchor-icon"></i></a>2020</h3>
<h4><a class="anchor" name="november-4-2020" href="#november-4-2020"><i class="anchor-icon"></i></a>November 4, 2020</h4>
<h3><a class="anchor" href="#2020" id="2020" name="2020"><i class="anchor-icon"></i></a>2020</h3>
<h4><a class="anchor" href="#november-4-2020" id="november-4-2020" name="november-4-2020"><i class="anchor-icon"></i></a>November 4, 2020</h4>
<p>Introducing <strong>Bot API 5.0</strong></p>
<p><strong>Run Your Own Bot API Server</strong></p>
<ul>
<li>Bot API source code is now available at <a href="https://github.com/tdlib/telegram-bot-api">telegram-bot-api</a>. You can now run your <strong>own Bot API server</strong> locally, boosting your bots&#39; performance.</li>
<li>Bot API source code is now available at <a href="https://github.com/tdlib/telegram-bot-api">telegram-bot-api</a>. You can now run your <strong>own Bot API server</strong> locally, boosting your bots' performance.</li>
<li>Added the method <a href="/bots/api#logout">logOut</a>, which can be used to log out from the cloud Bot API server before launching your bot locally. You <strong>must</strong> log out the bot before running it locally, otherwise there is no guarantee that the bot will receive all updates.</li>
<li>Added the method <a href="/bots/api#close">close</a>, which can be used to close the bot instance before moving it from one local server to another.</li>
</ul>
@ -476,7 +472,7 @@ To learn how to create…">
</ul>
<p><strong>Working with Groups</strong></p>
<ul>
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the user&#39;s bio for private chats if available.</li>
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the user's bio for private chats if available.</li>
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the identifier of the linked chat for supergroups and channels, i.e. the discussion group identifier for a channel and vice versa.</li>
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the location to which the supergroup is connected (see <a href="https://telegram.org/blog/contacts-local-groups">Local Groups</a>). Added the class <a href="/bots/api#chatlocation">ChatLocation</a> to represent the location.</li>
<li>Added the parameter <em>only_if_banned</em> to the method <a href="/bots/api#unbanchatmember">unbanChatMember</a> to allow safe unban.</li>
@ -499,7 +495,7 @@ To learn how to create…">
<p><strong>Live Locations</strong></p>
<ul>
<li>Added the field <em>live_period</em> to the class <a href="/bots/api#location">Location</a>, representing a maximum period for which the live location can be updated.</li>
<li>Added support for live location <a href="https://en.wikipedia.org/wiki/Heading_(navigation&#41;">heading</a>: added the field <em>heading</em> to the classes <a href="/bots/api#location">Location</a>, <a href="/bots/api#inlinequeryresultlocation">InlineQueryResultLocation</a>, <a href="/bots/api#inputlocationmessagecontent">InputLocationMessageContent</a> and the parameter <em>heading</em> to the methods <a href="/bots/api#sendlocation">sendLocation</a> and <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
<li>Added support for live location [heading](<a href="https://en.wikipedia.org/wiki/Heading_(navigation&amp;#41">https://en.wikipedia.org/wiki/Heading_(navigation&amp;#41</a>;): added the field <em>heading</em> to the classes <a href="/bots/api#location">Location</a>, <a href="/bots/api#inlinequeryresultlocation">InlineQueryResultLocation</a>, <a href="/bots/api#inputlocationmessagecontent">InputLocationMessageContent</a> and the parameter <em>heading</em> to the methods <a href="/bots/api#sendlocation">sendLocation</a> and <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
<li>Added support for proximity alerts in live locations: added the field <em>proximity_alert_radius</em> to the classes <a href="/bots/api#location">Location</a>, <a href="/bots/api#inlinequeryresultlocation">InlineQueryResultLocation</a>, <a href="/bots/api#inputlocationmessagecontent">InputLocationMessageContent</a> and the parameter <em>proximity_alert_radius</em> to the methods <a href="/bots/api#sendlocation">sendLocation</a> and <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
<li>Added the type <a href="/bots/api#proximityalerttriggered">ProximityAlertTriggered</a> and the field <em>proximity_alert_triggered</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Added possibility to specify the horizontal accuracy of a location. Added the field <em>horizontal_accuracy</em> to the classes <a href="/bots/api#location">Location</a>, <a href="/bots/api#inlinequeryresultlocation">InlineQueryResultLocation</a>, <a href="/bots/api#inputlocationmessagecontent">InputLocationMessageContent</a> and the parameter <em>horizontal_accuracy</em> to the methods <a href="/bots/api#sendlocation">sendLocation</a> and <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
@ -523,14 +519,14 @@ To learn how to create…">
<ul>
<li>Supported the new <strong>football</strong> and <strong>slot machine</strong> animations for the random <a href="/bots/api#dice">dice</a>. Choose between different animations (dice, darts, basketball, football, slot machine) by specifying the <em>emoji</em> parameter in the method <a href="/bots/api#senddice">sendDice</a>.</li>
</ul>
<h4><a class="anchor" name="june-4-2020" href="#june-4-2020"><i class="anchor-icon"></i></a>June 4, 2020</h4>
<h4><a class="anchor" href="#june-4-2020" id="june-4-2020" name="june-4-2020"><i class="anchor-icon"></i></a>June 4, 2020</h4>
<p><strong>Bot API 4.9</strong></p>
<ul>
<li>Added the new field <em>via_bot</em> to the <a href="/bots/api#message">Message</a> object. You can now know which bot was used to send a message.</li>
<li>Supported video thumbnails for inline <a href="/bots/api#inlinequeryresultgif">GIF</a> and <a href="/bots/api#inlinequeryresultmpeg4gif">MPEG4</a> animations.</li>
<li>Supported the new basketball animation for the random <a href="/bots/api#dice">dice</a>. Choose between different animations (dice, darts, basketball) by specifying the <em>emoji</em> parameter in the method <a href="/bots/api#senddice">sendDice</a>.</li>
</ul>
<h4><a class="anchor" name="april-24-2020" href="#april-24-2020"><i class="anchor-icon"></i></a>April 24, 2020</h4>
<h4><a class="anchor" href="#april-24-2020" id="april-24-2020" name="april-24-2020"><i class="anchor-icon"></i></a>April 24, 2020</h4>
<p><strong>Bot API 4.8</strong></p>
<ul>
<li>Supported explanations for <a href="https://telegram.org/blog/400-million#better-quizzes">Quizzes 2.0</a>. Add explanations by specifying the parameters <em>explanation</em> and <em>explanation_parse_mode</em> in the method <a href="/bots/api#sendpoll">sendPoll</a>.</li>
@ -540,19 +536,19 @@ To learn how to create…">
<li>Supported the new <a href="https://telegram.org/blog/400-million#bullseye">darts</a> animation for the dice mini-game. Choose between the default dice animation and darts animation by specifying the parameter <em>emoji</em> in the method <a href="/bots/api#senddice">sendDice</a>.</li>
<li>Added the field <em>emoji</em> to the <a href="/bots/api#dice">Dice</a> object.</li>
</ul>
<h4><a class="anchor" name="march-30-2020" href="#march-30-2020"><i class="anchor-icon"></i></a>March 30, 2020</h4>
<h4><a class="anchor" href="#march-30-2020" id="march-30-2020" name="march-30-2020"><i class="anchor-icon"></i></a>March 30, 2020</h4>
<p><strong>Bot API 4.7</strong></p>
<ul>
<li>Added the method <a href="/bots/api#senddice">sendDice</a> for sending a dice message, which will have a random value from 1 to 6. (Yes, we&#39;re aware of the <em>“proper”</em> singular of <em>die</em>. But it&#39;s awkward, and we decided to help it change. One dice at a time!)</li>
<li>Added the method <a href="/bots/api#senddice">sendDice</a> for sending a dice message, which will have a random value from 1 to 6. (Yes, we're aware of the <em>"proper"</em> singular of <em>die</em>. But it's awkward, and we decided to help it change. One dice at a time!)</li>
<li>Added the field <a href="/bots/api#dice">dice</a> to the <a href="/bots/api#message">Message</a> object.</li>
<li>Added the method <a href="/bots/api#getmycommands">getMyCommands</a> for getting the current list of the bot&#39;s commands.</li>
<li>Added the method <a href="/bots/api#setmycommands">setMyCommands</a> for changing the list of the bot&#39;s commands through the Bot API instead of <a href="https://t.me/botfather">@BotFather</a>.</li>
<li>Added the method <a href="/bots/api#getmycommands">getMyCommands</a> for getting the current list of the bot's commands.</li>
<li>Added the method <a href="/bots/api#setmycommands">setMyCommands</a> for changing the list of the bot's commands through the Bot API instead of <a href="https://t.me/botfather">@BotFather</a>.</li>
<li>Added the ability to create animated sticker sets by specifying the parameter <em>tgs_sticker</em> instead of <em>png_sticker</em> in the method <a href="/bots/api#createnewstickerset">createNewStickerSet</a>.</li>
<li>Added the ability to add animated stickers to sets created by the bot by specifying the parameter <em>tgs_sticker</em> instead of <em>png_sticker</em> in the method <a href="/bots/api#addstickertoset">addStickerToSet</a>.</li>
<li>Added the field <em>thumb</em> to the <a href="/bots/api#stickerset">StickerSet</a> object.</li>
<li>Added the ability to change thumbnails of sticker sets created by the bot using the method <a href="/bots/api#setstickersetthumb">setStickerSetThumb</a>.</li>
</ul>
<h4><a class="anchor" name="january-23-2020" href="#january-23-2020"><i class="anchor-icon"></i></a>January 23, 2020</h4>
<h4><a class="anchor" href="#january-23-2020" id="january-23-2020" name="january-23-2020"><i class="anchor-icon"></i></a>January 23, 2020</h4>
<p><strong>Bot API 4.6</strong></p>
<ul>
<li>Supported <a href="https://telegram.org/blog/polls-2-0-vmq">Polls 2.0</a>.</li>
@ -564,20 +560,20 @@ To learn how to create…">
<li>Added more information about the bot in response to the <a href="/bots/api#getme">getMe</a> request: added the fields <em>can_join_groups</em>, <em>can_read_all_group_messages</em> and <em>supports_inline_queries</em> to the <a href="/bots/api#user">User</a> object.</li>
<li>Added the optional field <em>language</em> to the <a href="/bots/api#messageentity">MessageEntity</a> object.</li>
</ul>
<h3><a class="anchor" name="2019" href="#2019"><i class="anchor-icon"></i></a>2019</h3>
<h4><a class="anchor" name="december-31-2019" href="#december-31-2019"><i class="anchor-icon"></i></a>December 31, 2019</h4>
<h3><a class="anchor" href="#2019" id="2019" name="2019"><i class="anchor-icon"></i></a>2019</h3>
<h4><a class="anchor" href="#december-31-2019" id="december-31-2019" name="december-31-2019"><i class="anchor-icon"></i></a>December 31, 2019</h4>
<p><strong>Bot API 4.5</strong></p>
<ul>
<li>Added support for two new <a href="/bots/api#messageentity">MessageEntity</a> types, <em>underline</em> and <em>strikethrough</em>.</li>
<li>Added support for nested <a href="/bots/api#messageentity">MessageEntity</a> objects. Entities can now contain other entities. If two entities have common characters then one of them is fully contained inside the other.</li>
<li>Added support for nested entities and the new tags <code>&lt;u&gt;/&lt;ins&gt;</code> (for underlined text) and <code>&lt;s&gt;/&lt;strike&gt;/&lt;del&gt;</code> (for strikethrough text) in parse mode HTML.</li>
<li>Added a new parse mode, <a href="/bots/api#markdownv2-style">MarkdownV2</a>, which supports nested entities and two new entities <code>__</code> (for underlined text) and <code>~</code> (for strikethrough text). Parse mode <a href="/bots/api#markdown-style">Markdown</a> remains unchanged for backward compatibility.</li>
<li>Added the field <em>file_unique_id</em> to the objects <a href="/bots/api#animation">Animation</a>, <a href="/bots/api#audio">Audio</a>, <a href="/bots/api#document">Document</a>, <a href="/bots/api#passportfile">PassportFile</a>, <a href="/bots/api#photosize">PhotoSize</a>, <a href="/bots/api#sticker">Sticker</a>, <a href="/bots/api#video">Video</a>, <a href="/bots/api#videonote">VideoNote</a>, <a href="/bots/api#voice">Voice</a>, <a href="/bots/api#file">File</a> and the fields <em>small_file_unique_id</em> and <em>big_file_unique_id</em> to the object <a href="/bots/api#chatphoto">ChatPhoto</a>. The new fields contain a unique file identifier, which is supposed to be the same over time and for different bots, but can&#39;t be used to download or reuse the file.</li>
<li>Added the field <em>file_unique_id</em> to the objects <a href="/bots/api#animation">Animation</a>, <a href="/bots/api#audio">Audio</a>, <a href="/bots/api#document">Document</a>, <a href="/bots/api#passportfile">PassportFile</a>, <a href="/bots/api#photosize">PhotoSize</a>, <a href="/bots/api#sticker">Sticker</a>, <a href="/bots/api#video">Video</a>, <a href="/bots/api#videonote">VideoNote</a>, <a href="/bots/api#voice">Voice</a>, <a href="/bots/api#file">File</a> and the fields <em>small_file_unique_id</em> and <em>big_file_unique_id</em> to the object <a href="/bots/api#chatphoto">ChatPhoto</a>. The new fields contain a unique file identifier, which is supposed to be the same over time and for different bots, but can't be used to download or reuse the file.</li>
<li>Added the field <em>custom_title</em> to the <a href="/bots/api#chatmember">ChatMember</a> object.</li>
<li>Added the new method <a href="/bots/api#setchatadministratorcustomtitle">setChatAdministratorCustomTitle</a> to manage the custom titles of administrators promoted by the bot.</li>
<li>Added the field <em>slow_mode_delay</em> to the <a href="/bots/api#chat">Chat</a> object.</li>
</ul>
<h4><a class="anchor" name="july-29-2019" href="#july-29-2019"><i class="anchor-icon"></i></a>July 29, 2019</h4>
<h4><a class="anchor" href="#july-29-2019" id="july-29-2019" name="july-29-2019"><i class="anchor-icon"></i></a>July 29, 2019</h4>
<p><strong>Bot API 4.4</strong></p>
<ul>
<li>Added support for <a href="https://telegram.org/blog/animated-stickers"><strong>animated stickers</strong></a>. New field <em>is_animated</em> in <a href="/bots/api#sticker">Sticker</a> and <a href="/bots/api#stickerset">StickerSet</a> objects, animated stickers can now be used in <a href="/bots/api#sendsticker">sendSticker</a> and <a href="/bots/api#inlinequeryresultcachedsticker">InlineQueryResultCachedSticker</a>.</li>
@ -585,50 +581,49 @@ To learn how to create…">
<li>The field <em>all_members_are_administrators</em> has been removed from the documentation for the <a href="/bots/api#chat">Chat</a> object. The field is still returned in the object for backward compatibility, but new bots should use the <em>permissions</em> field instead.</li>
<li>Added support for more permissions for group and supergroup members: added the new field <em>can_send_polls</em> to <a href="/bots/api#chatmember">ChatMember</a> object, added <em>can_change_info</em>, <em>can_invite_users</em>, <em>can_pin_messages</em> in <a href="/bots/api#chatmember">ChatMember</a> object for restricted users (previously available only for administrators).</li>
<li>The method <a href="/bots/api#restrictchatmember">restrictChatMember</a> now takes the new user permissions in a single argument of the type <a href="/bots/api#chatpermissions">ChatPermissions</a>. The old way of passing parameters will keep working for a while for backward compatibility.</li>
<li>Added <em>description</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group&#39;s chat_id to <a href="/bots/api#setchatdescription">setChatDescription</a> and receive the group&#39;s description in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
<li>Added <em>invite_link</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group&#39;s chat_id to <a href="/bots/api#exportchatinvitelink">exportChatInviteLink</a> and receive the group&#39;s invite link in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
<li>Added <em>description</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id to <a href="/bots/api#setchatdescription">setChatDescription</a> and receive the group's description in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
<li>Added <em>invite_link</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id to <a href="/bots/api#exportchatinvitelink">exportChatInviteLink</a> and receive the group's invite link in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
<li>File identifiers from the <a href="/bots/api#chatphoto">ChatPhoto</a> object are now invalidated and can no longer be used whenever the photo is changed.</li>
<li>All <strong>webhook requests</strong> from the Bot API are now coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won&#39;t need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
<li>All <strong>webhook requests</strong> from the Bot API are now coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks">https://core.telegram.org/bots/webhooks</a>.</li>
<li>As of the <strong>next Bot API</strong> update (<strong>version 4.5</strong>), nested <a href="/bots/api#messageentity">MessageEntity</a> objects will be allowed in message texts and captions. Please make sure that your code can correctly handle such entities.</li>
</ul>
<h4><a class="anchor" name="may-31-2019" href="#may-31-2019"><i class="anchor-icon"></i></a>May 31, 2019</h4>
<h4><a class="anchor" href="#may-31-2019" id="may-31-2019" name="may-31-2019"><i class="anchor-icon"></i></a>May 31, 2019</h4>
<p><strong>Bot API 4.3</strong></p>
<ul>
<li>Added support for <a href="https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots"><strong>Seamless Telegram Login</strong></a> on external websites.</li>
<li>Added the new object <a href="/bots/api#loginurl">LoginUrl</a> and the new field <em>login_url</em> to the <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a> object which allows to <strong>automatically authorize</strong> users before they go to a URL specified by the bot. Users will be asked to confirm authorization in their Telegram app (needs version 5.7 or higher) when they press the button:</li>
</ul>
<div class="blog_image_wrap">
<a href="/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c" target="_blank"><img src="/file/811140909/1631/20k1Z53eiyY.23995/c541e89b74253623d9" title="TITLE" alt="TITLE" srcset="/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c , 2x" /></a>
<a href="/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c" target="_blank"><img src="/file/811140909/1631/20k1Z53eiyY.23995/c541e89b74253623d9" title="TITLE" alt="TITLE" srcset="/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c , 2x"></a>
</div>
<p><strong>Also in this update:</strong></p>
<ul>
<li>Added the field <code>reply_markup</code> to the <a href="/bots/api#message">Message</a> object, containing the inline keyboard attached to the message.</li>
<li>If a message with an inline keyboard is forwarded, the forwarded message will now have an inline keyboard if the keyboard contained only <em>url</em> and <em>login_url</em> buttons or if the message was sent via a bot and the keyboard contained only <em>url</em>, <em>login_url</em>, <em>switch_inline_query</em> or <em>switch_inline_query_current_chat</em> buttons. In the latter case, <em>switch_inline_query_current_chat</em> buttons are replaced with <em>switch_inline_query</em> buttons.</li>
<li>Bots now receive the <em>edited_message</em> <a href="/bots/api#update">Update</a> even if only <em>Message.reply_markup</em> has changed.</li>
<li>Bots that have the <em>can_edit_messages</em> right in a channel can now use the method <a href="/bots/api#editmessagereplymarkup">editMessageReplyMarkup</a> for messages written by other administrators forever without the 48 hours limit.</li>
<li>Don&#39;t forget that starting in <strong>July 2019</strong>, <strong>webhook requests</strong> from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won&#39;t need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
<li>Don't forget that starting in <strong>July 2019</strong>, <strong>webhook requests</strong> from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks">https://core.telegram.org/bots/webhooks</a>.</li>
</ul>
<h4><a class="anchor" name="april-14-2019" href="#april-14-2019"><i class="anchor-icon"></i></a>April 14, 2019</h4>
<h4><a class="anchor" href="#april-14-2019" id="april-14-2019" name="april-14-2019"><i class="anchor-icon"></i></a>April 14, 2019</h4>
<p><strong>Bot API 4.2</strong></p>
<ul>
<li>Added support for native polls: added the object <a href="/bots/api#poll">Poll</a>, the methods <a href="/bots/api#sendpoll">sendPoll</a> and <a href="/bots/api#stoppoll">stopPoll</a> and the field <em>poll</em> in the <a href="/bots/api#message">Message</a> and <a href="/bots/api#update">Update</a> objects.</li>
<li>The method <a href="/bots/api#deletemessage">deleteMessage</a> can now be used to delete messages sent by a user to the bot in private chats within 48 hours.</li>
<li>Added support for pinned messages in basic groups in addition to supergroups and channel chats: you can pass group&#39;s chat_id to <a href="/bots/api#pinchatmessage">pinChatMessage</a> and <a href="/bots/api#unpinchatmessage">unpinChatMessage</a>, and receive the pinned group message in <a href="/bots/api#chat">Chat</a> object.</li>
<li>Added support for pinned messages in basic groups in addition to supergroups and channel chats: you can pass group's chat_id to <a href="/bots/api#pinchatmessage">pinChatMessage</a> and <a href="/bots/api#unpinchatmessage">unpinChatMessage</a>, and receive the pinned group message in <a href="/bots/api#chat">Chat</a> object.</li>
<li>Added the field <em>is_member</em> to the <a href="/bots/api#chatmember">ChatMember</a> object, which can be used to find whether a restricted user is a member of the chat.</li>
<li>Added the field <em>forward_sender_name</em> to the <a href="/bots/api#message">Message</a> object, containing name of the sender who has opted to hide their account.</li>
<li>Starting in July 2019, webhook requests from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won&#39;t need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
<li>Starting in July 2019, webhook requests from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks">https://core.telegram.org/bots/webhooks</a>.</li>
<li>Document thumbnails now should be inscribed in a 320x320 square instead of 90x90.</li>
</ul>
<h3><a class="anchor" name="2018" href="#2018"><i class="anchor-icon"></i></a>2018</h3>
<h4><a class="anchor" name="august-27-2018" href="#august-27-2018"><i class="anchor-icon"></i></a>August 27, 2018</h4>
<h3><a class="anchor" href="#2018" id="2018" name="2018"><i class="anchor-icon"></i></a>2018</h3>
<h4><a class="anchor" href="#august-27-2018" id="august-27-2018" name="august-27-2018"><i class="anchor-icon"></i></a>August 27, 2018</h4>
<p><strong>Bot API 4.1</strong></p>
<ul>
<li>Added support for translated versions of documents in <a href="/passport">Telegram Passport</a>.</li>
<li>New field <em>translation</em> in <a href="/bots/api#encryptedpassportelement">EncryptedPassportElement</a>.</li>
<li>New errors: <a href="/bots/api#passportelementerrortranslationfile">PassportElementErrorTranslationFile</a> and <a href="/bots/api#passportelementerrortranslationfile">PassportElementErrorTranslationFiles</a> and <a href="/bots/api#passportelementerrorunspecified">PassportElementErrorUnspecified</a>.</li>
</ul>
<h4><a class="anchor" name="july-26-2018" href="#july-26-2018"><i class="anchor-icon"></i></a>July 26, 2018</h4>
<h4><a class="anchor" href="#july-26-2018" id="july-26-2018" name="july-26-2018"><i class="anchor-icon"></i></a>July 26, 2018</h4>
<p><strong>Bot API 4.0</strong>.</p>
<ul>
<li>Added support for <a href="https://telegram.org/blog/passport"><strong>Telegram Passport</strong></a>. See the official announcement on the <a href="https://telegram.org/blog">blog</a> and the <a href="https://core.telegram.org/passport">manual</a> for details.</li>
@ -640,36 +635,36 @@ To learn how to create…">
<li>Added the field <a href="/bots/api#animation">animation</a> to the <a href="/bots/api#message">Message</a> object. For backward compatibility, when this field is set, the <em>document</em> field will be also set.</li>
<li>Added two new <a href="/bots/api#messageentity">MessageEntity</a> types: <em>cashtag</em> and <em>phone_number</em>.</li>
<li>Added support for Foursquare venues: added the new field <em>foursquare_type</em> to the objects <a href="/bots/api#venue">Venue</a>, <a href="/bots/api#inlinequeryresultvenue">InlineQueryResultVenue</a> and <a href="/bots/api#inputvenuemessagecontent">InputVenueMessageContent</a>, and the parameter <em>foursquare_type</em> to the <a href="/bots/api#sendvenue">sendVenue</a> method.</li>
<li>You can now create inline mentions of users, who have pressed your bot&#39;s callback buttons.</li>
<li>You can now create inline mentions of users, who have pressed your bot's callback buttons.</li>
<li>You can now use the <code>Retry-After</code> response header to configure the delay after which the Bot API will retry the request after an unsuccessful response from a webhook.</li>
<li>If a webhook returns the HTTP error <code>410 Gone</code> for all requests for more than 23 hours successively, it can be automatically removed.</li>
<li>Added <a href="https://en.wikipedia.org/wiki/VCard">vCard</a> support when sharing contacts: added the field <em>vcard</em> to the objects <a href="/bots/api#contact">Contact</a>, <a href="/bots/api#inlinequeryresultcontact">InlineQueryResultContact</a>, <a href="/bots/api#inputcontactmessagecontent">InputContactMessageContent</a> and the method <a href="/bots/api#sendcontact">sendContact</a>.</li>
</ul>
<h4><a class="anchor" name="february-13-2018" href="#february-13-2018"><i class="anchor-icon"></i></a>February 13, 2018</h4>
<h4><a class="anchor" href="#february-13-2018" id="february-13-2018" name="february-13-2018"><i class="anchor-icon"></i></a>February 13, 2018</h4>
<p><strong>Bot API 3.6</strong>.</p>
<ul>
<li>Supported <a href="https://core.telegram.org/bots/api#formatting-options">text formatting</a> in media captions. Specify the desired <em>parse_mode</em> (<a href="https://core.telegram.org/bots/api#markdown-style">Markdown</a> or <a href="https://core.telegram.org/bots/api#html-style">HTML</a>) when you provide a caption.</li>
<li>In supergroups, if the bot receives a message that is a reply, it will also receive the message to which that message is replying even if the original message is inaccessible due to the bot&#39;s privacy settings. (In other words, replying to any message in a supergroup with a message that mentions the bot or features a command for it acts as forwarding the original message to the bot). </li>
<li>Added the new field <em>connected_website</em> to <a href="/bots/api#message">Message</a>. The bot will receive a message with this field in a private chat when a user logs in on the bot&#39;s connected website using the <a href="https://core.telegram.org/widgets/login">Login Widget</a> and allows sending messages from your bot.</li>
<li>In supergroups, if the bot receives a message that is a reply, it will also receive the message to which that message is replying even if the original message is inaccessible due to the bot's privacy settings. (In other words, replying to any message in a supergroup with a message that mentions the bot or features a command for it acts as forwarding the original message to the bot). </li>
<li>Added the new field <em>connected_website</em> to <a href="/bots/api#message">Message</a>. The bot will receive a message with this field in a private chat when a user logs in on the bot's connected website using the <a href="https://core.telegram.org/widgets/login">Login Widget</a> and allows sending messages from your bot.</li>
<li>Added the new parameter <em>supports_streaming</em> to the <a href="/bots/api#sendvideo">sendVideo</a> method and a field with the same name to the <a href="/bots/api#inputmediavideo">InputMediaVideo</a> object.</li>
</ul>
<h3><a class="anchor" name="2017" href="#2017"><i class="anchor-icon"></i></a>2017</h3>
<h4><a class="anchor" name="november-17-2017" href="#november-17-2017"><i class="anchor-icon"></i></a>November 17, 2017</h4>
<h3><a class="anchor" href="#2017" id="2017" name="2017"><i class="anchor-icon"></i></a>2017</h3>
<h4><a class="anchor" href="#november-17-2017" id="november-17-2017" name="november-17-2017"><i class="anchor-icon"></i></a>November 17, 2017</h4>
<p><strong>Bot API 3.5</strong>.</p>
<ul>
<li>Added the new method <a href="/bots/api#sendmediagroup">sendMediaGroup</a> and two kinds of <a href="/bots/api#inputmedia">InputMedia</a> objects to support the new <a href="https://telegram.org/blog/albums-saved-messages">albums feature</a>.</li>
<li>Added support for pinning messages in channels. <a href="/bots/api#pinchatmessage">pinChatMessage</a> and <a href="/bots/api#unpinchatmessage">unpinChatMessage</a> accept channels.</li>
<li>Added the new fields <em>provider_data</em>, <em>send_phone_number_to_provider</em>, <em>send_email_to_provider</em> to <a href="/bots/api#sendinvoice">sendInvoice</a> for sharing information about the invoice with the payment provider.</li>
</ul>
<h4><a class="anchor" name="october-11-2017" href="#october-11-2017"><i class="anchor-icon"></i></a>October 11, 2017</h4>
<h4><a class="anchor" href="#october-11-2017" id="october-11-2017" name="october-11-2017"><i class="anchor-icon"></i></a>October 11, 2017</h4>
<p><strong>Bot API 3.4</strong>.</p>
<ul>
<li>Bots can now send and receive <a href="https://telegram.org/blog/live-locations">Live Locations</a>. Added new field <em>live_period</em> to the <a href="/bots/api#sendlocation">sendLocation</a> method and the <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a> and <a href="/bots/api#stopmessagelivelocation">stopMessageLiveLocation</a> methods as well as the necessary objects for inline bots.</li>
<li>Bots can use the new <a href="/bots/api#setchatstickerset">setChatStickerSet</a> and <a href="/bots/api#deletechatstickerset">deleteChatStickerSet</a> methods to manage <a href="https://telegram.org/blog#stickers-of-the-group">group sticker sets</a>.</li>
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the group&#39;s sticker set for supergroups if available.</li>
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the group's sticker set for supergroups if available.</li>
<li>Bots now receive entities from media captions in the new field <em>caption_entities</em> in <a href="/bots/api#message">Message</a>.</li>
</ul>
<h4><a class="anchor" name="august-23-2017" href="#august-23-2017"><i class="anchor-icon"></i></a>August 23, 2017</h4>
<h4><a class="anchor" href="#august-23-2017" id="august-23-2017" name="august-23-2017"><i class="anchor-icon"></i></a>August 23, 2017</h4>
<p><strong>Bot API 3.3</strong>.</p>
<ul>
<li>Bots can now mention users via <a href="/bots/api#formatting-options">inline mentions</a>, without using usernames.</li>
@ -677,13 +672,13 @@ To learn how to create…">
<li>Added the new fields <em>author_signature</em> and <em>forward_signature</em> to the <a href="/bots/api#message">Message</a> object.</li>
<li>Added the new field <em>is_bot</em> to the <a href="/bots/api#user">User</a> object.</li>
</ul>
<h4><a class="anchor" name="july-21-2017" href="#july-21-2017"><i class="anchor-icon"></i></a>July 21, 2017</h4>
<h4><a class="anchor" href="#july-21-2017" id="july-21-2017" name="july-21-2017"><i class="anchor-icon"></i></a>July 21, 2017</h4>
<p><strong>Bot API 3.2</strong>. Teach your bot to handle <a href="/bots/api#stickers">stickers and sticker sets</a>.</p>
<ul>
<li>Added new methods for working with stickers: <a href="/bots/api#getstickerset">getStickerSet</a>, <a href="/bots/api#uploadstickerfile">uploadStickerFile</a>, <a href="/bots/api#createnewstickerset">createNewStickerSet</a>, <a href="/bots/api#addstickertoset">addStickerToSet</a>, <a href="/bots/api#setstickerpositioninset">setStickerPositionInSet</a>, and <a href="/bots/api#deletestickerfromset">deleteStickerFromSet</a>.</li>
<li>Added the fields <em>set_name</em> and <em>mask_position</em> to the <a href="/bots/api#sticker">Sticker</a> object, plus two new objects, <a href="/bots/api#stickerset">StickerSet</a>, and <a href="/bots/api#maskposition">MaskPosition</a>.</li>
</ul>
<h4><a class="anchor" name="june-30-2017" href="#june-30-2017"><i class="anchor-icon"></i></a>June 30, 2017</h4>
<h4><a class="anchor" href="#june-30-2017" id="june-30-2017" name="june-30-2017"><i class="anchor-icon"></i></a>June 30, 2017</h4>
<p><strong>Bot API 3.1</strong>. Build your own robotic police force for supergoups with these new methods for admin bots:</p>
<ul>
<li>Added new methods <a href="/bots/api#restrictchatmember">restrictChatMember</a> and <a href="/bots/api#promotechatmember">promoteChatMember</a> to manage users and admins, added new parameter <em>until_date</em> to <a href="/bots/api#kickchatmember">kickChatMember</a> for temporary bans.</li>
@ -691,10 +686,10 @@ To learn how to create…">
<li>Added the new fields <em>photo</em>, <em>description</em> and <em>invite_link</em> to the <a href="/bots/api#chat">Chat</a> object.</li>
<li>Added the new fields <em>until_date</em>, <em>can_be_edited</em>, <em>can_change_info</em>, <em>can_post_messages</em>, <em>can_edit_messages</em>, <em>can_delete_messages</em>, <em>can_invite_users</em>, <em>can_restrict_members</em>, <em>can_pin_messages</em>, <em>can_promote_members</em>, <em>can_send_messages</em>, <em>can_send_media_messages</em>, <em>can_send_other_messages</em> and <em>can_add_web_page_previews</em> to the <a href="/bots/api#chatmember">ChatMember</a> object.</li>
</ul>
<h4><a class="anchor" name="may-18-2017" href="#may-18-2017"><i class="anchor-icon"></i></a>May 18, 2017</h4>
<h4><a class="anchor" href="#may-18-2017" id="may-18-2017" name="may-18-2017"><i class="anchor-icon"></i></a>May 18, 2017</h4>
<p>Introducing <strong>Bot API 3.0</strong>.</p>
<p><strong>NEW Payment Platform</strong></p>
<p>See <a href="/bots/payments">Introduction to Bot Payments</a> for a brief overview. If you&#39;re not a developer, you may like <a href="https://telegram.org/blog/payments">this user-friendly blog post</a> better.</p>
<p>See <a href="/bots/payments">Introduction to Bot Payments</a> for a brief overview. If you're not a developer, you may like <a href="https://telegram.org/blog/payments">this user-friendly blog post</a> better.</p>
<ul>
<li>Your bot can now accept <a href="/bots/api#payments">payments</a> for goods and services via Telegram. </li>
<li>Added new kinds of <a href="/bots/api#update">updates</a>, <em>shipping_query</em> and <em>pre_checkout_query</em>, and new types of <a href="/bots/api#message">message</a> content, <em>invoice</em> and <em>successful_payment</em>.</li>
@ -708,7 +703,7 @@ To learn how to create…">
</ul>
<p><strong>NEW Multilingual Bots</strong></p>
<ul>
<li>The <a href="/bots/api#user">User</a> object now may have a <em>language_code</em> field that contains the <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a> of the user&#39;s language.</li>
<li>The <a href="/bots/api#user">User</a> object now may have a <em>language_code</em> field that contains the <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a> of the user's language.</li>
<li>Thanks to this, your bot can now offer localized responses to users that speak different languages.</li>
</ul>
<p><strong>More power to admin bots</strong></p>
@ -722,30 +717,45 @@ To learn how to create…">
<li><a href="https://core.telegram.org/bots/api#inlinekeyboardbutton">Inline keyboards</a> with <em>switch_inline_query</em> and <em>switch_inline_query_current_chat</em> can no longer be sent to channels because they are useless there.</li>
<li>New fields <em>gif_duration</em> in <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a> and <em>mpeg4_duration</em> in <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a>.</li>
</ul>
<h3><a class="anchor" name="2016" href="#2016"><i class="anchor-icon"></i></a>2016</h3>
<h4><a class="anchor" name="december-4-2016" href="#december-4-2016"><i class="anchor-icon"></i></a>December 4, 2016</h4>
<h3><a class="anchor" href="#2016" id="2016" name="2016"><i class="anchor-icon"></i></a>2016</h3>
<h4><a class="anchor" href="#december-4-2016" id="december-4-2016" name="december-4-2016"><i class="anchor-icon"></i></a>December 4, 2016</h4>
<p>Introducing <strong>Bot API 2.3.1</strong>, a nifty little update that will give you more control over how your bot gets its updates.</p>
<ul>
<li>Use the new field <em>max_connections</em> in <a href="/bots/api#setwebhook">setWebhook</a> to optimize your bot&#39;s server load</li>
<li>Use the new field <em>max_connections</em> in <a href="/bots/api#setwebhook">setWebhook</a> to optimize your bot's server load</li>
<li>Use <em>allowed_updates</em> in <a href="/bots/api#setwebhook">setWebhook</a> and <a href="/bots/api#getupdates">getUpdates</a> to selectively subscribe to updates of a certain type. Among other things, this allows you to stop getting updates about new posts in channels where your bot is an admin.</li>
<li><a href="/bots/api#deletewebhook">deleteWebhook</a> moved out of <a href="/bots/api#setwebhook">setWebhook</a> to get a whole separate method for itself.</li>
</ul>
<h4><a class="anchor" name="november-21-2016" href="#november-21-2016"><i class="anchor-icon"></i></a>November 21, 2016</h4>
<h4><a class="anchor" href="#november-21-2016" id="november-21-2016" name="november-21-2016"><i class="anchor-icon"></i></a>November 21, 2016</h4>
<p><strong>Bot API 2.3</strong></p>
<ul>
<li>Modified <a href="/bots/faq#what-messages-will-my-bot-get"><strong>bot privacy mode</strong></a> for the sake of consistency. </li>
<li><p>Your bot can now get <strong>updates about posts in channels</strong>. Added new fields <em>channel_post</em> and <em>edited_channel_post</em> to <a href="/bots/#update">Update</a>.</p>
<li>
<p>Modified <a href="/bots/faq#what-messages-will-my-bot-get"><strong>bot privacy mode</strong></a> for the sake of consistency. </p>
</li>
<li><p>You can now update high scores to a lower value by using the new <em>force</em> parameter in <a href="/bots/#setgamescore">setGameScore</a>. Handy for punishing <strong>cheaters</strong> or fixing errors in your game&#39;s High Score table.</p>
<li>
<p>Your bot can now get <strong>updates about posts in channels</strong>. Added new fields <em>channel_post</em> and <em>edited_channel_post</em> to <a href="/bots/#update">Update</a>.</p>
</li>
<li>
<p>You can now update high scores to a lower value by using the new <em>force</em> parameter in <a href="/bots/#setgamescore">setGameScore</a>. Handy for punishing <strong>cheaters</strong> or fixing errors in your game's High Score table.</p>
</li>
<li>
<p>Starting today, messages with high scores will be updated with new high scores by default. Use <em>disable_edit_message</em> in <a href="/bots/#setgamescore">setGameScore</a> if you don't want this.</p>
</li>
<li>
<p>The <em>edit_message</em> parameter from <a href="/bots/#setgamescore">setGameScore</a> is no longer in use. For backward compatibility, it will be taken into account for a while, unless <em>disable_edit_message</em> is passed explicitly.</p>
</li>
<li>
<p>Added the new field <em>forward_from_message_id</em> to <a href="/bots/#message">Message</a>.</p>
</li>
<li>
<p>Added the new parameter <em>cache_time</em> to <a href="/bots/#answercallbackquery">answerCallbackQuery</a>. Will eventually work in Telegram apps — somewhere after version 3.14, maybe 3.15.</p>
</li>
<li>
<p>Renamed <em>hide_keyboard</em> to <em>remove_keyboard</em> in <a href="/bots/#replykeyboardremove">ReplyKeyboardRemove</a> for clarity. <em>hide_keyboard</em> will still work for a while for backward compatibility.</p>
</li>
<li>Starting today, messages with high scores will be updated with new high scores by default. Use <em>disable_edit_message</em> in <a href="/bots/#setgamescore">setGameScore</a> if you don&#39;t want this.</li>
<li>The <em>edit_message</em> parameter from <a href="/bots/#setgamescore">setGameScore</a> is no longer in use. For backward compatibility, it will be taken into account for a while, unless <em>disable_edit_message</em> is passed explicitly.</li>
<li>Added the new field <em>forward_from_message_id</em> to <a href="/bots/#message">Message</a>.</li>
<li>Added the new parameter <em>cache_time</em> to <a href="/bots/#answercallbackquery">answerCallbackQuery</a>. Will eventually work in Telegram apps — somewhere after version 3.14, maybe 3.15.</li>
<li>Renamed <em>hide_keyboard</em> to <em>remove_keyboard</em> in <a href="/bots/#replykeyboardremove">ReplyKeyboardRemove</a> for clarity. <em>hide_keyboard</em> will still work for a while for backward compatibility.</li>
</ul>
<h4><a class="anchor" name="october-3-2016" href="#october-3-2016"><i class="anchor-icon"></i></a>October 3, 2016</h4>
<p><strong>Bot API 2.2.</strong> <a href="/bots/games">Introducing a new Gaming Platform!</a> See <a href="/bots/games">this introduction</a> for a brief overview.<br>If you&#39;re not a developer, you may like <a href="https://telegram.org/blog/games"><strong>this user-friendly blog post</strong></a> better.</p>
<h4><a class="anchor" href="#october-3-2016" id="october-3-2016" name="october-3-2016"><i class="anchor-icon"></i></a>October 3, 2016</h4>
<p><strong>Bot API 2.2.</strong> <a href="/bots/games">Introducing a new Gaming Platform!</a> See <a href="/bots/games">this introduction</a> for a brief overview.
If you're not a developer, you may like <a href="https://telegram.org/blog/games"><strong>this user-friendly blog post</strong></a> better.</p>
<ul>
<li>New tools for building <a href="/bots/api#games"><strong>HTML5 games</strong></a>.</li>
<li>New method <a href="/bots/api#sendgame">sendGame</a>, new object <a href="/bots/api#inlinequeryresultgame">InlineQueryResultGame</a>, new field <em>game</em> in <a href="/bots/api#message">Message</a>.</li>
@ -755,40 +765,50 @@ To learn how to create…">
</ul>
<p><strong>Other changes</strong></p>
<ul>
<li>Making life easier for webhook users. Added a detailed <a href="https://core.telegram.org/bots/webhooks"><strong>Guide to All Things Webhook</strong></a> that describes every pothole you can run into on the webhook road.</li>
<li><p>New method <a href="/bots/api#getwebhookinfo">getWebhookInfo</a> to check current webhook status.</p>
<li>
<p>Making life easier for webhook users. Added a detailed <a href="https://core.telegram.org/bots/webhooks"><strong>Guide to All Things Webhook</strong></a> that describes every pothole you can run into on the webhook road.</p>
</li>
<li><p>Added the option to specify an <strong>HTTP URL</strong> for a file in all methods where <a href="/bots/api#inputfile">InputFile</a> or <em>file_id</em> can be used (except voice messages). Telegram will get the file from the specified URL and send it to the user. Files must be smaller than 5 MB for photos and smaller than 20 MB for all other types of content.</p>
<li>
<p>New method <a href="/bots/api#getwebhookinfo">getWebhookInfo</a> to check current webhook status.</p>
</li>
<li>
<p>Added the option to specify an <strong>HTTP URL</strong> for a file in all methods where <a href="/bots/api#inputfile">InputFile</a> or <em>file_id</em> can be used (except voice messages). Telegram will get the file from the specified URL and send it to the user. Files must be smaller than 5 MB for photos and smaller than 20 MB for all other types of content.</p>
</li>
<li>
<p>Use the new <em>url</em> parameter in <a href="/bots/api#answercallbackquery">answerCallbackQuery</a> to create buttons that open your bot with user-specific parameters.</p>
</li>
<li>
<p>Added new field <em>switch_inline_query_current_chat</em> in <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a>.</p>
</li>
<li>
<p>Added <em>caption</em> fields to <a href="/bots/api#sendaudio">sendAudio</a>, <a href="/bots/api#sendvoice">sendVoice</a>, <a href="/bots/api#inlinequeryresultaudio">InlineQueryResultAudio</a>, <a href="/bots/api#inlinequeryresultvoice">InlineQueryResultVoice</a>, <a href="/bots/api#inlinequeryresultcachedaudio">InlineQueryResultCachedAudio</a>, and <a href="/bots/api#inlinequeryresultcachedvoice">InlineQueryResultCachedVoice</a>.</p>
</li>
<li>Use the new <em>url</em> parameter in <a href="/bots/api#answercallbackquery">answerCallbackQuery</a> to create buttons that open your bot with user-specific parameters.</li>
<li>Added new field <em>switch_inline_query_current_chat</em> in <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a>.</li>
<li>Added <em>caption</em> fields to <a href="/bots/api#sendaudio">sendAudio</a>, <a href="/bots/api#sendvoice">sendVoice</a>, <a href="/bots/api#inlinequeryresultaudio">InlineQueryResultAudio</a>, <a href="/bots/api#inlinequeryresultvoice">InlineQueryResultVoice</a>, <a href="/bots/api#inlinequeryresultcachedaudio">InlineQueryResultCachedAudio</a>, and <a href="/bots/api#inlinequeryresultcachedvoice">InlineQueryResultCachedVoice</a>.</li>
</ul>
<ul>
<li>New field <em>all_members_are_administrators</em> in the <a href="/bots/api#chat">Chat</a> object.</li>
<li>Certain server responses may now contain the new <a href="/bots/api#responseparameters"><em>parameters</em></a> field with expanded info on errors that occurred while processing your requests.</li>
</ul>
<h4><a class="anchor" name="may-25-2016" href="#may-25-2016"><i class="anchor-icon"></i></a>May 25, 2016</h4>
<h4><a class="anchor" href="#may-25-2016" id="may-25-2016" name="may-25-2016"><i class="anchor-icon"></i></a>May 25, 2016</h4>
<ul>
<li><a href="/bots/api#inlinekeyboardmarkup">Inline keyboards</a> may now be used in group chats. Channels coming soon.</li>
<li>Check out <a href="https://telegram.me/vote">@vote</a> and <a href="https://telegram.me/like">@like</a> for examples.</li>
</ul>
<h4><a class="anchor" name="may-22-2016" href="#may-22-2016"><i class="anchor-icon"></i></a>May 22, 2016</h4>
<h4><a class="anchor" href="#may-22-2016" id="may-22-2016" name="may-22-2016"><i class="anchor-icon"></i></a>May 22, 2016</h4>
<ul>
<li><strong>Bot API 2.1.</strong> Added more tools for group administrator bots. Your bot can now get a list of administrators and members count in a group, check a user&#39;s current status (administrator, creator, left the group, kicked from the group), and leave a group.</li>
<li><strong>Bot API 2.1.</strong> Added more tools for group administrator bots. Your bot can now get a list of administrators and members count in a group, check a user's current status (administrator, creator, left the group, kicked from the group), and leave a group.</li>
<li>Added new methods: <a href="/bots/api#getchat">getChat</a>, <a href="/bots/api#leavechat">leaveChat</a>, <a href="/bots/api#getchatadministrators">getChatAdministrators</a>, <a href="/bots/api#getchatmember">getChatMember</a>, <a href="/bots/api#getchatmemberscount">getChatMembersCount</a>.</li>
<li>Added support for <a href="https://telegram.org/blog/edit">edited messages</a> and <a href="https://telegram.org/blog/edit#new-mentions">new mentions</a> from Telegram v.3.9. New fields: <em>edited_message</em> in <a href="/bots/api#update">Update</a>, <em>edit_date</em> in <a href="/bots/api#message">Message</a>, <em>user</em> in <a href="/bots/api#messageentity">MessageEntity</a>. New value <em>text_mention</em> for the <em>type</em> field in <a href="/bots/api#messageentity">MessageEntity</a>.</li>
</ul>
<h4><a class="anchor" name="may-12-2016" href="#may-12-2016"><i class="anchor-icon"></i></a>May 12, 2016</h4>
<h4><a class="anchor" href="#may-12-2016" id="may-12-2016" name="may-12-2016"><i class="anchor-icon"></i></a>May 12, 2016</h4>
<ul>
<li>Added consistency to what messages bots get in groups and supergroups. <a href="/bots/faq#what-messages-will-my-bot-get">See updated FAQ for details »</a></li>
</ul>
<h4><a class="anchor" name="may-6-2016" href="#may-6-2016"><i class="anchor-icon"></i></a>May 6, 2016</h4>
<h4><a class="anchor" href="#may-6-2016" id="may-6-2016" name="may-6-2016"><i class="anchor-icon"></i></a>May 6, 2016</h4>
<ul>
<li>Added the field <em>emoji</em> to the <a href="/bots/api#sticker">Sticker</a> object. Your bot can now know the emoji a sticker corresponds to.</li>
<li>Added the field <em>forward_from_chat</em> to the <a href="/bots/api#message">Message</a> object for messages forwarded from channels.</li>
</ul>
<h4><a class="anchor" name="april-9-2016" href="#april-9-2016"><i class="anchor-icon"></i></a>April 9, 2016</h4>
<h4><a class="anchor" href="#april-9-2016" id="april-9-2016" name="april-9-2016"><i class="anchor-icon"></i></a>April 9, 2016</h4>
<p>Introducing <strong>Bot API 2.0</strong>. Check out <a href="/bots/2-0-intro">this page</a> for a review of this major update.</p>
<ul>
<li>New <a href="/bots/2-0-intro#new-inline-keyboards"><strong>inline keyboards</strong></a> with <strong>callback</strong> and <strong>URL buttons</strong>. Added new objects <a href="/bots/api#inlinekeyboardmarkup">InlineKeyboardMarkup</a>, <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a> and <a href="/bots/api#callbackquery">CallbackQuery</a>, added <em>reply_markup</em> fields to all <a href="/bots/api#inlinequeryresult">InlineQueryResult</a> objects. Added field <em>callback_query</em> to the <a href="/bots/api#update">Update</a> object, new method <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>.</li>
@ -808,72 +828,71 @@ To learn how to create…">
<li>Added fields <em>venue</em>, <em>pinned_message</em> and <em>entities</em> to the <a href="/bots/api#message">Message</a> object. Added new objects <a href="/bots/api#messageentity">MessageEntity</a> and <a href="/bots/api#venue">Venue</a>, new methods <a href="/bots/api#sendvenue">sendVenue</a> and <a href="/bots/api#sendcontact">sendContact</a>.</li>
<li>Renamed the fields <em>new_chat_participant</em> and <em>left_chat_participant</em> of the <a href="/bots/api#message">Message</a> object to <em>new_chat_member</em> and <em>left_chat_member</em>.</li>
</ul>
<h4><a class="anchor" name="february-20-2016" href="#february-20-2016"><i class="anchor-icon"></i></a>February 20, 2016</h4>
<h4><a class="anchor" href="#february-20-2016" id="february-20-2016" name="february-20-2016"><i class="anchor-icon"></i></a>February 20, 2016</h4>
<ul>
<li>Added the <em>disable_notification</em> parameter to all methods that send messages or any kind.</li>
<li>Removed backward compatibility from the method <a href="/bots/api#sendaudio">sendAudio</a>. Voice messages now must be sent using the method <a href="/bots/api#sendvoice">sendVoice</a>. There is no more need to specify a non-empty title or performer while sending the audio by <em>file_id</em>.</li>
</ul>
<h4><a class="anchor" name="january-20-2016" href="#january-20-2016"><i class="anchor-icon"></i></a>January 20, 2016</h4>
<h4><a class="anchor" href="#january-20-2016" id="january-20-2016" name="january-20-2016"><i class="anchor-icon"></i></a>January 20, 2016</h4>
<ul>
<li>By the way, you can use both HTML-style and markdown-style formatting in your bot&#39;s messages to send bold, italic or fixed-width text and inline links. All official Telegram clients support this. See <a href="/bots/api#formatting-options">Formatting options</a> for details.</li>
<li>By the way, you can use both HTML-style and markdown-style formatting in your bot's messages to send bold, italic or fixed-width text and inline links. All official Telegram clients support this. See <a href="/bots/api#formatting-options">Formatting options</a> for details.</li>
</ul>
<h4><a class="anchor" name="january-14-2016" href="#january-14-2016"><i class="anchor-icon"></i></a>January 14, 2016</h4>
<h4><a class="anchor" href="#january-14-2016" id="january-14-2016" name="january-14-2016"><i class="anchor-icon"></i></a>January 14, 2016</h4>
<ul>
<li>You can now <a href="/bots/inline#collecting-feedback">collect feedback</a> on which results provided by your inline bot get chosen by the users. Added the <code>setinlinefeedback</code> command for Botfather, new type <a href="/bots/api#choseninlineresult">ChosenInlineResult</a>, new field <em>chosen_inline_result</em> to the <a href="/bots/api#update">Update</a> object.</li>
</ul>
<h4><a class="anchor" name="january-4-2016" href="#january-4-2016"><i class="anchor-icon"></i></a>January 4, 2016</h4>
<h4><a class="anchor" href="#january-4-2016" id="january-4-2016" name="january-4-2016"><i class="anchor-icon"></i></a>January 4, 2016</h4>
<ul>
<li>Added support for <a href="/bots/inline">Inline Mode</a>, a new way for people to contact your bot by typing its username and a query in the text input field in any chat. Enable by sending <code>/setinline</code> to <a href="https://telegram.me/botfather">@BotFather</a>.</li>
<li>New optional field <em>inline_query</em> added to the <a href="/bots/api#update">Update</a> object.</li>
<li>Added new method <a href="/bots/api#answerinlinequery">answerInlineQuery</a> and new objects <a href="/bots/api#inlinequery">InlineQuery</a>, <a href="/bots/api#inlinequeryresultarticle">InlineQueryResultArticle</a>, <a href="/bots/api#inlinequeryresultphoto">InlineQueryResultPhoto</a>, <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a>, <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a> and <a href="/bots/api#inlinequeryresultvideo">InlineQueryResultVideo</a>.</li>
</ul>
<h3><a class="anchor" name="2015" href="#2015"><i class="anchor-icon"></i></a>2015</h3>
<h4><a class="anchor" name="november-2015" href="#november-2015"><i class="anchor-icon"></i></a>November, 2015</h4>
<h3><a class="anchor" href="#2015" id="2015" name="2015"><i class="anchor-icon"></i></a>2015</h3>
<h4><a class="anchor" href="#november-2015" id="november-2015" name="november-2015"><i class="anchor-icon"></i></a>November, 2015</h4>
<ul>
<li>Added support for <a href="https://telegram.org/blog/supergroups">supergroups</a>. The <em>Type</em> field in the <a href="/bots/api#chat">Chat</a> object can now contain &#39;supergroup&#39;.</li>
<li>Added support for <a href="https://telegram.org/blog/supergroups">supergroups</a>. The <em>Type</em> field in the <a href="/bots/api#chat">Chat</a> object can now contain 'supergroup'.</li>
<li>New optional fields added to the <a href="/bots/api#message">Message</a> object: <em>supergroup_chat_created</em>, <em>migrate_to_chat_id</em>, <em>migrate_from_chat_id</em> and <em>channel_chat_created</em>.</li>
</ul>
<h4><a class="anchor" name="october-8-2015" href="#october-8-2015"><i class="anchor-icon"></i></a>October 8, 2015</h4>
<h4><a class="anchor" href="#october-8-2015" id="october-8-2015" name="october-8-2015"><i class="anchor-icon"></i></a>October 8, 2015</h4>
<ul>
<li>Added initial channel support for bots (no Telegram clients support this at the moment, please wait for updates):</li>
<li>The <em>Chat</em> field in the <a href="/bots/api#message">Message</a> is now of the new type <a href="/bots/api#chat">Chat</a>.</li>
<li>You can now pass a channel username (in the format <code>@channelusername</code>) in the place of <em>chat_id</em> in all methods (and instead of <em>from_chat_id</em> in <a href="/bots/api#forwardmessage">forwardMessage</a>). For this to work, the bot must be an administrator in the channel (and that&#39;s exactly what Telegram clients don&#39;t support yet — adding bots as administrators coming soon).</li>
<li>You can now pass a channel username (in the format <code>@channelusername</code>) in the place of <em>chat_id</em> in all methods (and instead of <em>from_chat_id</em> in <a href="/bots/api#forwardmessage">forwardMessage</a>). For this to work, the bot must be an administrator in the channel (and that's exactly what Telegram clients don't support yet — adding bots as administrators coming soon).</li>
</ul>
<h4><a class="anchor" name="september-18-2015" href="#september-18-2015"><i class="anchor-icon"></i></a>September 18, 2015</h4>
<h4><a class="anchor" href="#september-18-2015" id="september-18-2015" name="september-18-2015"><i class="anchor-icon"></i></a>September 18, 2015</h4>
<ul>
<li>Bots can now download files and media sent by users.</li>
<li>Added <a href="/bots/api#getfile">getFile</a> and <a href="/bots/api#file">File</a>.</li>
</ul>
<h4><a class="anchor" name="september-7-2015" href="#september-7-2015"><i class="anchor-icon"></i></a>September 7, 2015</h4>
<h4><a class="anchor" href="#september-7-2015" id="september-7-2015" name="september-7-2015"><i class="anchor-icon"></i></a>September 7, 2015</h4>
<ul>
<li>You can now <a href="/bots/api#making-requests">pass parameters</a> using <em>application/json</em> (please note that this doesn&#39;t work for file uploads: use <em>multipart/form-data</em> to upload files).</li>
<li>You can now <a href="/bots/api#making-requests">pass parameters</a> using <em>application/json</em> (please note that this doesn't work for file uploads: use <em>multipart/form-data</em> to upload files).</li>
<li>Added very basic <a href="/bots/api#using-markdown">markdown support</a>. New field <em>parse_mode</em> added to <a href="/bots/api#sendmessage">sendMessage</a>. For the moment messages with markdown will be displayed correctly only in Telegram for <strong>Android</strong>. Other official apps will catch up soon.</li>
</ul>
<h4><a class="anchor" name="august-29-2015" href="#august-29-2015"><i class="anchor-icon"></i></a>August 29, 2015</h4>
<h4><a class="anchor" href="#august-29-2015" id="august-29-2015" name="august-29-2015"><i class="anchor-icon"></i></a>August 29, 2015</h4>
<ul>
<li>Added support for self-signed certificates: upload your certificate using the <em>certificate</em> parameter in the <a href="/bots/api#setwebhook">setWebhook</a> method.</li>
<li>You can now make <a href="/bots/api#making-requests-when-getting-updates">new requests</a> when responding to webhook updates.</li>
</ul>
<h4><a class="anchor" name="august-15-2015" href="#august-15-2015"><i class="anchor-icon"></i></a>August 15, 2015</h4>
<h4><a class="anchor" href="#august-15-2015" id="august-15-2015" name="august-15-2015"><i class="anchor-icon"></i></a>August 15, 2015</h4>
<ul>
<li>Added new type <strong><a href="/bots/api#voice">Voice</a></strong> and new method <a href="/bots/api#sendvoice"><strong>sendVoice</strong></a> for sending voice messages.</li>
<li>Earlier <strong><a href="/bots/api#audio">Audio</a></strong> and <strong><a href="/bots/api#sendaudio">sendAudio</a></strong> should now be used for sending music files. Telegram clients will show such files in the in-app music player. If you were using <a href="/bots/api#sendaudio"><strong>sendAudio</strong></a> for your bot to send voice messages, please use <a href="/bots/api#sendaudio"><strong>sendVoice</strong></a> instead.</li>
<li>Added optional fields <em>performer</em>, <em>title</em> to the <a href="/bots/api#audio"><strong>Audio</strong></a> object and <a href="/bots/api#sendaudio"><strong>sendAudio</strong></a> method.</li>
<li>Added optional field <em>voice</em> to the <a href="/bots/api#message"><strong>Message</strong></a> object.</li>
</ul>
<h4><a class="anchor" name="july-2015" href="#july-2015"><i class="anchor-icon"></i></a>July 2015</h4>
<h4><a class="anchor" href="#july-2015" id="july-2015" name="july-2015"><i class="anchor-icon"></i></a>July 2015</h4>
<ul>
<li>The <strong>thumb</strong> field is now optional for <a href="/bots/api#video">Video</a>, <a href="/bots/api#sticker">Sticker</a> and <a href="/bots/api#document">Document</a> objects</li>
<li>The API now supports both video and photo captions. The <strong>caption</strong> field has been removed from the <a href="/bots/api#video">Video</a> object and added to the <a href="/bots/api#message">Message</a> object instead. </li>
<li><strong>caption</strong> and <strong>duration</strong> optional fields have been added to the <a href="/bots/api#sendvideo">sendVideo</a> method.</li>
<li>Fixed typo: <strong>user_id</strong> in the Contact object is now correctly labeled as Integer, not String</li>
</ul>
<h4><a class="anchor" name="june-24-2015" href="#june-24-2015"><i class="anchor-icon"></i></a>June 24, 2015</h4>
<h4><a class="anchor" href="#june-24-2015" id="june-24-2015" name="june-24-2015"><i class="anchor-icon"></i></a>June 24, 2015</h4>
<p>The bot platform is <a href="https://telegram.org/blog/bot-revolution">officially launched</a>.</p>
<blockquote>
<p><strong><a href="/bots/api">Back to the Bot API Manual »</a></strong></p>
</blockquote>
</div>
</blockquote></div>
</div>

File diff suppressed because it is too large Load diff

View file

@ -49,22 +49,21 @@
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001434/100bf/eWprjdgzEbE.100386/644bbea83084f44c8f" style="max-width: 600px;" title="console.log('Vive la révolution')" alt="Bot Revolution">
<source src="/file/464001679/11aa9/KQx_BlPVXRo.4922145.mp4/c65433c8ac11a347a8" type="video/mp4">
</video>
</source></video>
</div>
<blockquote>
<p>To see a <strong>Mini App</strong> in action, try our sample <a href="https://t.me/durgerkingbot">@DurgerKingBot</a>.</p>
</blockquote>
<hr>
<h3><a class="anchor" name="recent-changes" href="#recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
<h4><a class="anchor" name="december-29-2023" href="#december-29-2023"><i class="anchor-icon"></i></a>December 29, 2023</h4>
<h3><a class="anchor" href="#recent-changes" id="recent-changes" name="recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
<h4><a class="anchor" href="#december-29-2023" id="december-29-2023" name="december-29-2023"><i class="anchor-icon"></i></a>December 29, 2023</h4>
<p><strong>Bot API 7.0</strong></p>
<ul>
<li>Added the field <em>SettingsButton</em> to the class <a href="#initializing-mini-apps">WebApp</a>.</li>
<li>Added the fields <em>header_bg_color</em>, <em>accent_text_color</em>, <em>section_bg_color</em>, <em>section_header_text_color</em>, <em>subtitle_text_color</em>, <em>destructive_text_color</em> to the class <a href="#themeparams">ThemeParams</a>.</li>
<li>Mini Apps no longer close when the method <em>WebApp.openTelegramLink</em> is called.</li>
</ul>
<h4><a class="anchor" name="september-22-2023" href="#september-22-2023"><i class="anchor-icon"></i></a>September 22, 2023</h4>
<h4><a class="anchor" href="#september-22-2023" id="september-22-2023" name="september-22-2023"><i class="anchor-icon"></i></a>September 22, 2023</h4>
<p><strong>Bot API 6.9</strong></p>
<ul>
<li>Added the field <em>CloudStorage</em> to the class <a href="#initializing-mini-apps">WebApp</a>.</li>
@ -73,26 +72,26 @@
<li>Added the events <em>writeAccessRequested</em> and <em>contactRequested</em>.</li>
<li>Added the ability to set any header color using the <em>setHeaderColor</em> method.</li>
</ul>
<h4><a class="anchor" name="april-21-2023" href="#april-21-2023"><i class="anchor-icon"></i></a>April 21, 2023</h4>
<h4><a class="anchor" href="#april-21-2023" id="april-21-2023" name="april-21-2023"><i class="anchor-icon"></i></a>April 21, 2023</h4>
<p><strong>Bot API 6.7</strong></p>
<ul>
<li>Added support for launching Mini Apps from inline query results and from a direct link.</li>
<li>Added the method <em>switchInlineQuery</em> to the class <a href="#initializing-mini-apps">WebApp</a>.</li>
</ul>
<h4><a class="anchor" name="december-30-2022" href="#december-30-2022"><i class="anchor-icon"></i></a>December 30, 2022</h4>
<h4><a class="anchor" href="#december-30-2022" id="december-30-2022" name="december-30-2022"><i class="anchor-icon"></i></a>December 30, 2022</h4>
<p><strong>Bot API 6.4</strong></p>
<ul>
<li>Added the field <em>platform</em>, the optional parameter <em>options</em> to the method <em>openLink</em> and the methods <em>showScanQrPopup</em>, <em>closeScanQrPopup</em>, <em>readTextFromClipboard</em> to the class <a href="#initializing-mini-apps">WebApp</a>.</li>
<li>Added the events <em>qrTextReceived</em>, <em>clipboardTextReceived</em>.</li>
</ul>
<h4><a class="anchor" name="august-12-2022" href="#august-12-2022"><i class="anchor-icon"></i></a>August 12, 2022</h4>
<h4><a class="anchor" href="#august-12-2022" id="august-12-2022" name="august-12-2022"><i class="anchor-icon"></i></a>August 12, 2022</h4>
<p><strong>Bot API 6.2</strong></p>
<ul>
<li>Added the field <em>isClosingConfirmationEnabled</em> and the methods <em>enableClosingConfirmation</em>, <em>disableClosingConfirmation</em>, <em>showPopup</em>, <em>showAlert</em>, <em>showConfirm</em> to the class <a href="#initializing-mini-apps">WebApp</a>.</li>
<li>Added the field <em>is_premium</em> to the class <a href="#webappuser">WebAppUser</a>.</li>
<li>Added the event <em>popupClosed</em>.</li>
</ul>
<h4><a class="anchor" name="june-20-2022" href="#june-20-2022"><i class="anchor-icon"></i></a>June 20, 2022</h4>
<h4><a class="anchor" href="#june-20-2022" id="june-20-2022" name="june-20-2022"><i class="anchor-icon"></i></a>June 20, 2022</h4>
<p><strong>Bot API 6.1</strong></p>
<ul>
<li>Added the ability to use bots added to the attachment menu in group, supergroup and channel chats.</li>
@ -104,19 +103,18 @@
<li>Added the <a href="#events-available-for-mini-apps">events</a> <em>backButtonClicked</em>, <em>settingsButtonClicked</em>, <em>invoiceClosed</em>.</li>
</ul>
<hr>
<h3><a class="anchor" name="designing-mini-apps" href="#designing-mini-apps"><i class="anchor-icon"></i></a>Designing Mini Apps</h3>
<h4><a class="anchor" name="color-schemes" href="#color-schemes"><i class="anchor-icon"></i></a>Color Schemes</h4>
<p>Mini Apps always receive data about the user&#39;s current <strong>color theme</strong> in real time, so you can adjust the appearance of your interfaces to match it. For example, when users switch between <strong>Day and Night</strong> modes or use various <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#global-chat-themes-on-android">custom themes</a>.</p>
<h3><a class="anchor" href="#designing-mini-apps" id="designing-mini-apps" name="designing-mini-apps"><i class="anchor-icon"></i></a>Designing Mini Apps</h3>
<h4><a class="anchor" href="#color-schemes" id="color-schemes" name="color-schemes"><i class="anchor-icon"></i></a>Color Schemes</h4>
<p>Mini Apps always receive data about the user's current <strong>color theme</strong> in real time, so you can adjust the appearance of your interfaces to match it. For example, when users switch between <strong>Day and Night</strong> modes or use various <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#global-chat-themes-on-android">custom themes</a>.</p>
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001576/10249/wikoQUNnrH4.112118/7b6c8d3366ada2615b" style="max-width: 600px;" title="" alt="Switching Colors">
<source src="/file/464001257/12087/QNQUbIi864k.909800.mp4/8ea7adad7db407388e" type="video/mp4">
</video>
</source></video>
</div>
<blockquote>
<p><a href="#themeparams">Jump to technical information</a></p>
</blockquote>
<h4><a class="anchor" name="design-guidelines" href="#design-guidelines"><i class="anchor-icon"></i></a>Design Guidelines</h4>
<h4><a class="anchor" href="#design-guidelines" id="design-guidelines" name="design-guidelines"><i class="anchor-icon"></i></a>Design Guidelines</h4>
<p>Telegram apps are known for being snappy, smooth and following a consistent cross-platform design. Your Mini App should ideally reflect these principles.</p>
<ul>
<li>All elements should be responsive and designed with a mobile-first approach.</li>
@ -126,13 +124,12 @@
<li>The app should deliver a seamless experience by monitoring the <a href="#color-schemes">dynamic theme-based colors</a> provided by the API and using them accordingly.</li>
</ul>
<hr>
<h3><a class="anchor" name="implementing-mini-apps" href="#implementing-mini-apps"><i class="anchor-icon"></i></a>Implementing Mini Apps</h3>
<p>Telegram currently supports six different ways of launching Mini Apps: from a <a href="#keyboard-button-mini-apps">keyboard button</a>, from an <a href="#inline-button-mini-apps">inline button</a>, from the <a href="#launching-mini-apps-from-the-menu-button">bot menu button</a>, via <a href="#inline-mode-mini-apps">inline mode</a>, from a <a href="#direct-link-mini-apps">direct link</a> and even from the <a href="#launching-mini-apps-from-the-attachment-menu">attachment menu</a>.</p>
<h3><a class="anchor" href="#implementing-mini-apps" id="implementing-mini-apps" name="implementing-mini-apps"><i class="anchor-icon"></i></a>Implementing Mini Apps</h3>
<p>Telegram currently supports six different ways of launching Mini Apps: from a <a href="#keyboard-button-mini-apps">keyboard button</a>, from an <a href="#inline-button-mini-apps">inline button</a>, from the <a href="#launching-mini-apps-from-the-menu-button">bot menu button</a>, via <a href="#inline-mode-mini-apps">inline mode</a>, from a <a href="#direct-link-mini-apps">direct link</a>  and even from the <a href="#launching-mini-apps-from-the-attachment-menu">attachment menu</a>.</p>
<div>
<a href="/file/464001388/10b1a/IYpn0wWfggw.1156850/fd9a32baa81dcecbe4" target="_blank"><img src="/file/464001388/10b1a/IYpn0wWfggw.1156850/fd9a32baa81dcecbe4" title="" alt="Types of buttons" class="dev_page_image" /></a>
<a href="/file/464001388/10b1a/IYpn0wWfggw.1156850/fd9a32baa81dcecbe4" target="_blank"><img src="/file/464001388/10b1a/IYpn0wWfggw.1156850/fd9a32baa81dcecbe4" title="" alt="Types of buttons" class="dev_page_image"></a>
</div>
<h4><a class="anchor" name="keyboard-button-mini-apps" href="#keyboard-button-mini-apps"><i class="anchor-icon"></i></a>Keyboard Button Mini Apps</h4>
<h4><a class="anchor" href="#keyboard-button-mini-apps" id="keyboard-button-mini-apps" name="keyboard-button-mini-apps"><i class="anchor-icon"></i></a>Keyboard Button Mini Apps</h4>
<blockquote>
<p><strong>TL;DR:</strong> Mini Apps launched from a <strong>web_app</strong> type <a href="/bots/api#keyboardbutton">keyboard button</a> can send data back to the bot in a <em>service message</em> using <a href="#initializing-mini-apps">Telegram.WebApp.sendData</a>. This makes it possible for the bot to produce a response without communicating with any external servers.</p>
</blockquote>
@ -141,84 +138,84 @@
<p>To transmit data from the user back to the bot, the Mini App can call the <a href="#initializing-mini-apps">Telegram.WebApp.sendData</a> method. Data will be transmitted to the bot as a String in a service message. The bot can continue communicating with the user after receiving it.</p>
<p><strong>Good for:</strong></p>
<ul>
<li><strong>Сustom data input interfaces</strong> (a personalized calendar for selecting dates; selecting data from a list with advanced search options; a randomizer that lets the user “spin a wheel” and chooses one of the available options, etc.)</li>
<li><strong>Сustom data input interfaces</strong> (a personalized calendar for selecting dates; selecting data from a list with advanced search options; a randomizer that lets the user "spin a wheel" and chooses one of the available options, etc.)</li>
<li><strong>Reusable components</strong> that do not depend on a particular bot.</li>
</ul>
<h4><a class="anchor" name="inline-button-mini-apps" href="#inline-button-mini-apps"><i class="anchor-icon"></i></a>Inline Button Mini Apps</h4>
<h4><a class="anchor" href="#inline-button-mini-apps" id="inline-button-mini-apps" name="inline-button-mini-apps"><i class="anchor-icon"></i></a>Inline Button Mini Apps</h4>
<blockquote>
<p><strong>TL;DR:</strong> For more interactive Mini Apps like <a href="https://t.me/durgerkingbot">@DurgerKingBot</a>, use a <strong>web_app</strong> type <a href="/bots/api#inlinekeyboardbutton">Inline KeyboardButton</a>, which gets basic user information and can be used to send a message on behalf of the user to the chat with the bot.</p>
</blockquote>
<p>If receiving text data alone is insufficient or you need a more advanced and personalized interface, you can open a Mini App using a <strong>web_app</strong> type <a href="/bots/api#inlinekeyboardbutton">Inline KeyboardButton</a>.</p>
<p>From the button, a Mini App will open with the URL specified in the button. In addition to the user&#39;s <a href="#color-schemes">theme settings</a>, it will receive basic user information (<code>ID</code>, <code>name</code>, <code>username</code>, <code>language_code</code>) and a unique identifier for the session, <strong>query_id</strong>, which allows messages on behalf of the user to be sent back to the bot.</p>
<p>From the button, a Mini App will open with the URL specified in the button. In addition to the user's <a href="#color-schemes">theme settings</a>, it will receive basic user information (<code>ID</code>, <code>name</code>, <code>username</code>, <code>language_code</code>) and a unique identifier for the session, <strong>query_id</strong>, which allows messages on behalf of the user to be sent back to the bot.</p>
<p>The bot can call the Bot API method <a href="/bots/api#answerwebappquery">answerWebAppQuery</a> to send an inline message from the user back to the bot and close the Mini App. After receiving the message, the bot can continue communicating with the user.</p>
<p><strong>Good for:</strong></p>
<ul>
<li>Fully-fledged web services and integrations of any kind.</li>
<li>The use cases are effectively <strong>unlimited</strong>.</li>
</ul>
<h4><a class="anchor" name="launching-mini-apps-from-the-menu-button" href="#launching-mini-apps-from-the-menu-button"><i class="anchor-icon"></i></a>Launching Mini Apps from the Menu Button</h4>
<h4><a class="anchor" href="#launching-mini-apps-from-the-menu-button" id="launching-mini-apps-from-the-menu-button" name="launching-mini-apps-from-the-menu-button"><i class="anchor-icon"></i></a>Launching Mini Apps from the Menu Button</h4>
<blockquote>
<p><strong>TL;DR:</strong> Mini Apps can be launched from a customized menu button. This simply offers a quicker way to access the app and is otherwise <strong>identical</strong> to <a href="#inline-button-mini-apps">launching a mini app from an inline button</a>.</p>
</blockquote>
<p>By default, chats with bots always show a convenient <strong>menu button</strong> that provides quick access to all listed <a href="/bots#commands">commands</a>. With <a href="https://core.telegram.org/bots/api-changelog#april-16-2022">Bot API 6.0</a>, this button can be used to <strong>launch a Mini App</strong> instead.</p>
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001829/12247/e6LoU12o4Ng.109921/1226afb8f18f8ea8c4
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001829/12247/e6LoU12o4Ng.109921/1226afb8f18f8ea8c4
" style="max-width: 600px;" title="" alt="Menu Button">
<source src="/file/464001838/10fa2/WrJmkuIMan0.1217917.mp4/e25a5f31bc4e6493f7" type="video/mp4">
</video>
</source></video>
</div>
<p>To configure the menu button, you must specify the text it should show and the Mini App URL. There are two ways to set these parameters:</p>
<ul>
<li>To customize the button for <strong>all users</strong>, use <a href="https://t.me/botfather">@BotFather</a> (the <code>/setmenubutton</code> command or <em>Bot Settings &gt; Menu Button</em>).</li>
<li>To customize the button for both <strong>all users</strong> and <strong>specific users</strong>, use the <a href="/bots/api#setchatmenubutton">setChatMenuButton</a> method in the Bot API. For example, change the button text according to the user&#39;s language, or show links to different Mini Apps based on a user&#39;s settings in your bot.</li>
<li>To customize the button for both <strong>all users</strong> and <strong>specific users</strong>, use the <a href="/bots/api#setchatmenubutton">setChatMenuButton</a> method in the Bot API. For example, change the button text according to the user's language, or show links to different Mini Apps based on a user's settings in your bot.</li>
</ul>
<p>Apart from this, Mini Apps opened via the menu button work in the exact same way as when <a href="#inline-button-mini-apps">using inline buttons</a>.</p>
<blockquote>
<p><a href="https://t.me/durgerkingbot">@DurgerKingBot</a> allows launching its Mini App both from an inline button and from the menu button.</p>
</blockquote>
<h4><a class="anchor" name="inline-mode-mini-apps" href="#inline-mode-mini-apps"><i class="anchor-icon"></i></a>Inline Mode Mini Apps</h4>
<h4><a class="anchor" href="#inline-mode-mini-apps" id="inline-mode-mini-apps" name="inline-mode-mini-apps"><i class="anchor-icon"></i></a>Inline Mode Mini Apps</h4>
<blockquote>
<p><strong>TL;DR:</strong> Mini Apps launched via <strong>web_app</strong> type <a href="/bots/api#inlinequeryresultsbutton">InlineQueryResultsButton</a> can be used anywhere in inline mode. Users can create content in a web interface and then seamlessly send it to the current chat via inline mode.</p>
</blockquote>
<p>You can use the <em>button</em> parameter in the <a href="/bots/api#answerinlinequery">answerInlineQuery</a> method to display a special &#39;Switch to Mini App&#39; button either above or in place of the inline results. This button will <strong>open a Mini App</strong> from the specified URL. Once done, you can call the <a href="#initializing-mini-apps">Telegram.WebApp.switchInlineQuery</a> method to send the user back to inline mode.</p>
<p>Inline Mini Apps have <strong>no access</strong> to the chat they can&#39;t read messages or send new ones on behalf of the user. To send messages, the user must be redirected to <strong>inline mode</strong> and actively pick a result.</p>
<p>You can use the <em>button</em> parameter in the <a href="/bots/api#answerinlinequery">answerInlineQuery</a> method to display a special 'Switch to Mini App' button either above or in place of the inline results. This button will <strong>open a Mini App</strong> from the specified URL. Once done, you can call the <a href="#initializing-mini-apps">Telegram.WebApp.switchInlineQuery</a> method to send the user back to inline mode.</p>
<p>Inline Mini Apps have <strong>no access</strong> to the chat they can't read messages or send new ones on behalf of the user. To send messages, the user must be redirected to <strong>inline mode</strong> and actively pick a result.</p>
<p><strong>Good for:</strong></p>
<ul>
<li>Fully-fledged web services and integrations in inline mode.</li>
</ul>
<h4><a class="anchor" name="direct-link-mini-apps" href="#direct-link-mini-apps"><i class="anchor-icon"></i></a>Direct Link Mini Apps</h4>
<h4><a class="anchor" href="#direct-link-mini-apps" id="direct-link-mini-apps" name="direct-link-mini-apps"><i class="anchor-icon"></i></a>Direct Link Mini Apps</h4>
<blockquote>
<p><strong>TL;DR:</strong> Mini App Bots can be launched from a direct link in any chat. They support a <em>startapp</em> parameter and are aware of the current chat context.</p>
</blockquote>
<p>You can use direct links to <strong>open a Mini App</strong> directly in the current chat. If a non-empty <em>startapp</em> parameter is included in the link, it will be passed to the Mini App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
<p>In this mode, Mini Apps can use the <em>chat_type</em> and <em>chat_instance</em> parameters to keep track of the current chat context. This introduces support for <strong>concurrent</strong> and <strong>shared</strong> usage by multiple chat members to create live whiteboards, group orders, multiplayer games and similar apps.</p>
<p>Mini Apps opened from a direct link have <strong>no access</strong> to the chat they can&#39;t read messages or send new ones on behalf of the user. To send messages, the user must be redirected to <strong>inline mode</strong> and actively pick a result.</p>
<p>Mini Apps opened from a direct link have <strong>no access</strong> to the chat they can't read messages or send new ones on behalf of the user. To send messages, the user must be redirected to <strong>inline mode</strong> and actively pick a result.</p>
<p><strong>Examples</strong></p>
<p><code>https://t.me/botusername/appname</code><br><code>https://t.me/botusername/appname?startapp=command</code></p>
<p><code>https://t.me/botusername/appname</code>
<code>https://t.me/botusername/appname?startapp=command</code></p>
<p><strong>Good for:</strong></p>
<ul>
<li>Fully-fledged web services and integrations that any user can open in one tap.</li>
<li>Cooperative, multiplayer or teamwork-oriented services within a chat context.</li>
<li>The use cases are effectively <strong>unlimited</strong>.</li>
</ul>
<h4><a class="anchor" name="launching-mini-apps-from-the-attachment-menu" href="#launching-mini-apps-from-the-attachment-menu"><i class="anchor-icon"></i></a>Launching Mini Apps from the Attachment Menu</h4>
<h4><a class="anchor" href="#launching-mini-apps-from-the-attachment-menu" id="launching-mini-apps-from-the-attachment-menu" name="launching-mini-apps-from-the-attachment-menu"><i class="anchor-icon"></i></a>Launching Mini Apps from the Attachment Menu</h4>
<blockquote>
<p><strong>TL;DR:</strong> Mini App Bots can request to be added directly to a user&#39;s attachment menu, allowing them to be quickly launched from any chat. To try this mode, open this <a href="https://t.me/durgerkingbot?startattach">attachment menu link</a> for <em>@DurgerKingBot</em>, then use the <img class="icon" src="/file/464001085/2/E4hNXSNQimQ.2503/bf6ffcab3cb3afd43d" alt="Attach"> menu in <strong>any type of chat</strong>.</p>
<p><strong>TL;DR:</strong> Mini App Bots can request to be added directly to a user's attachment menu, allowing them to be quickly launched from any chat. To try this mode, open this <a href="https://t.me/durgerkingbot?startattach">attachment menu link</a> for <em>@DurgerKingBot</em>, then use the <img src="/file/464001085/2/E4hNXSNQimQ.2503/bf6ffcab3cb3afd43d" alt="Attach"> menu in <strong>any type of chat</strong>.</p>
</blockquote>
<p>Mini App Bots can request to be added directly to a user&#39;s attachment menu, allowing them to be quickly launched from <strong>any type of chat</strong>. You can configure in which types of chats your mini app can be started from the attachment menu (private, groups, supergroups or channels).</p>
<p>Attachment menu integration is currently only available for major advertisers on the <a href="https://promote.telegram.org/basics">Telegram Ad Platform</a>. However, <strong>all bots</strong> can use it in the <a href="#using-bots-in-the-test-environment">test server environment</a>.</p>
<p>To enable this feature for your bot, open <a href="https://t.me/botfather">@BotFather</a> <a href="#using-bots-in-the-test-environment">from an account on the test server</a> and send the <code>/setattach</code> command or go to <em>Bot Settings &gt; Configure Attachment Menu</em>. Then specify the URL that will be opened to launch the bot&#39;s Mini App via its icon in the attachment menu.</p>
<p>You can add a &#39;Settings&#39; item to the context menu of your Mini App using <a href="https://t.me/botfather">@BotFather</a>. When users select this option from the menu, your bot will receive a <code>settingsButtonClicked</code> event.</p>
<p>In addition to the user&#39;s <a href="#color-schemes">theme settings</a>, the bot will receive basic user information (<code>ID</code>, <code>name</code>, <code>username</code>, <code>language_code</code>, <code>photo</code>), as well as public info about the chat partner (<code>ID</code>, <code>name</code>, <code>username</code>, <code>photo</code>) or the chat info (<code>ID</code>, <code>type</code>, <code>title</code>, <code>username</code>, <code>photo</code>) and a unique identifier for the web view session <strong>query_id</strong>, which allows messages of any type to be sent to the chat on behalf of the user that opened the bot.</p>
<p>Mini App Bots can request to be added directly to a user's attachment menu, allowing them to be quickly launched from <strong>any type of chat</strong>. You can configure in which types of chats your mini app can be started from the attachment menu (private, groups, supergroups or channels).</p>
<p>Attachment menu integration is currently only available for major advertisers on the <a href="https://promote.telegram.org/basics">Telegram Ad Platform</a>. However, <strong>all bots</strong> can use it in the <a href="#using-bots-in-the-test-environment">test server environment</a>.</p>
<p>To enable this feature for your bot, open <a href="https://t.me/botfather">@BotFather</a> <a href="#using-bots-in-the-test-environment">from an account on the test server</a> and send the <code>/setattach</code> command or go to <em>Bot Settings &gt; Configure Attachment Menu</em>. Then specify the URL that will be opened to launch the bot's Mini App via its icon in the attachment menu.</p>
<p>You can add a 'Settings' item to the context menu of your Mini App using <a href="https://t.me/botfather">@BotFather</a>. When users select this option from the menu, your bot will receive a <code>settingsButtonClicked</code> event.</p>
<p>In addition to the user's <a href="#color-schemes">theme settings</a>, the bot will receive basic user information (<code>ID</code>, <code>name</code>, <code>username</code>, <code>language_code</code>, <code>photo</code>), as well as public info about the chat partner (<code>ID</code>, <code>name</code>, <code>username</code>, <code>photo</code>) or the chat info (<code>ID</code>, <code>type</code>, <code>title</code>, <code>username</code>, <code>photo</code>) and a unique identifier for the web view session <strong>query_id</strong>, which allows messages of any type to be sent to the chat on behalf of the user that opened the bot.</p>
<p>The bot can call the Bot API method <a href="/bots/api#answerwebappquery">answerWebAppQuery</a>, which sends an inline message from the user via the bot to the chat where it was launched and closes the Mini App.</p>
<blockquote>
<p>You can read more about adding bots to the attachment menu <a href="#adding-bots-to-the-attachment-menu">here</a>.</p>
</blockquote>
<hr>
<h3><a class="anchor" name="initializing-mini-apps" href="#initializing-mini-apps"><i class="anchor-icon"></i></a>Initializing Mini Apps</h3>
<h3><a class="anchor" href="#initializing-mini-apps" id="initializing-mini-apps" name="initializing-mini-apps"><i class="anchor-icon"></i></a>Initializing Mini Apps</h3>
<p>To connect your Mini App to the Telegram client, place the script <a href="https://telegram.org/js/telegram-web-app.js">telegram-web-app.js</a> in the <code>&lt;head&gt;</code> tag before any other scripts, using this code:</p>
<pre><code>&lt;script src=&quot;https://telegram.org/js/telegram-web-app.js&quot;&gt;&lt;/script&gt;</code></pre>
<pre><code>&lt;script src="https://telegram.org/js/telegram-web-app.js"&gt;&lt;/script&gt;</code></pre>
<p>Once the script is connected, a <code>window.Telegram.WebApp</code> object will become available with the following fields:</p>
<table class="table">
<thead>
@ -232,27 +229,27 @@
<tr>
<td>initData</td>
<td>String</td>
<td>A string with raw data transferred to the Mini App, convenient for <a href="#validating-data-received-via-the-mini-app">validating data</a>.<br><strong>WARNING:</strong> <a href="#validating-data-received-via-the-mini-app">Validate data</a> from this field before using it on the bot&#39;s server.</td>
<td>A string with raw data transferred to the Mini App, convenient for <a href="#validating-data-received-via-the-mini-app">validating data</a>.<br><strong>WARNING:</strong> <a href="#validating-data-received-via-the-mini-app">Validate data</a> from this field before using it on the bot's server.</td>
</tr>
<tr>
<td>initDataUnsafe</td>
<td><a href="#webappinitdata">WebAppInitData</a></td>
<td>An object with input data transferred to the Mini App.<br><strong>WARNING:</strong> Data from this field should not be trusted. You should only use data from <em>initData</em> on the bot&#39;s server and only after it has been <a href="#validating-data-received-via-the-mini-app">validated</a>.</td>
<td>An object with input data transferred to the Mini App.<br><strong>WARNING:</strong> Data from this field should not be trusted. You should only use data from <em>initData</em> on the bot's server and only after it has been <a href="#validating-data-received-via-the-mini-app">validated</a>.</td>
</tr>
<tr>
<td>version</td>
<td>String</td>
<td>The version of the Bot API available in the user&#39;s Telegram app.</td>
<td>The version of the Bot API available in the user's Telegram app.</td>
</tr>
<tr>
<td>platform</td>
<td>String</td>
<td>The name of the platform of the user&#39;s Telegram app.</td>
<td>The name of the platform of the user's Telegram app.</td>
</tr>
<tr>
<td>colorScheme</td>
<td>String</td>
<td>The color scheme currently used in the Telegram app. Either “light” or “dark”.<br>Also available as the CSS variable <code>var(--tg-color-scheme)</code>.</td>
<td>The color scheme currently used in the Telegram app. Either “light” or “dark”. <br>Also available as the CSS variable <code>var(--tg-color-scheme)</code>.</td>
</tr>
<tr>
<td>themeParams</td>
@ -267,12 +264,12 @@
<tr>
<td>viewportHeight</td>
<td>Float</td>
<td>The current height of the visible area of the Mini App. Also available in CSS as the variable <code>var(--tg-viewport-height)</code>.<br><br>The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can “pull” the Mini App to its maximum height, while the bot can do the same by calling the <strong>expand()</strong> method. As the position of the Mini App changes, the current height value of the visible area will be updated in real time.<br><br>Please note that the refresh rate of this value is not sufficient to smoothly follow the lower border of the window. It should not be used to pin interface elements to the bottom of the visible area. It&#39;s more appropriate to use the value of the <code>viewportStableHeight</code> field for this purpose.</td>
<td>The current height of the visible area of the Mini App. Also available in CSS as the variable <code>var(--tg-viewport-height)</code>. <br><br>The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can "pull" the Mini App to its maximum height, while the bot can do the same by calling the <strong>expand()</strong> method. As the position of the Mini App changes, the current height value of the visible area will be updated in real time.<br><br>Please note that the refresh rate of this value is not sufficient to smoothly follow the lower border of the window. It should not be used to pin interface elements to the bottom of the visible area. It's more appropriate to use the value of the <code>viewportStableHeight</code> field for this purpose.</td>
</tr>
<tr>
<td>viewportStableHeight</td>
<td>Float</td>
<td>The height of the visible area of the Mini App in its last stable state. Also available in CSS as a variable <code>var(--tg-viewport-stable-height)</code>.<br><br>The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can “pull” the Mini App to its maximum height, while the bot can do the same by calling the <strong>expand()</strong> method. Unlike the value of <code>viewportHeight</code>, the value of <code>viewportStableHeight</code> does not change as the position of the Mini App changes with user gestures or during animations. The value of <code>viewportStableHeight</code> will be updated after all gestures and animations are completed and the Mini App reaches its final size.<br><br><em>Note the <a href="#events-available-for-mini-apps">event</a> <code>viewportChanged</code> with the passed parameter <code>isStateStable=true</code>, which will allow you to track when the stable state of the height of the visible area changes.</em></td>
<td>The height of the visible area of the Mini App in its last stable state. Also available in CSS as a variable <code>var(--tg-viewport-stable-height)</code>.<br><br>The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can "pull" the Mini App to its maximum height, while the bot can do the same by calling the <strong>expand()</strong> method. Unlike the value of <code>viewportHeight</code>, the value of <code>viewportStableHeight</code> does not change as the position of the Mini App changes with user gestures or during animations. The value of <code>viewportStableHeight</code> will be updated after all gestures and animations are completed and the Mini App reaches its final size.<br><br><em>Note the <a href="#events-available-for-mini-apps">event</a> <code>viewportChanged</code> with the passed parameter <code>isStateStable=true</code>, which will allow you to track when the stable state of the height of the visible area changes.</em></td>
</tr>
<tr>
<td>headerColor</td>
@ -300,7 +297,7 @@
<td>An object for controlling the main button, which is displayed at the bottom of the Mini App in the Telegram interface.</td>
</tr>
<tr>
<td>SettingsButton <sup><mark>NEW</mark></sup></td>
<td>SettingsButton ^==NEW==^</td>
<td><a href="#settingsbutton">SettingsButton</a></td>
<td>An object for controlling the Settings item in the context menu of the Mini App in the Telegram interface.</td>
</tr>
@ -317,27 +314,27 @@
<tr>
<td>isVersionAtLeast(version)</td>
<td>Function</td>
<td>Returns true if the user&#39;s app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.</td>
<td>Returns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.</td>
</tr>
<tr>
<td>setHeaderColor(color)</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method that sets the app header color in the <code>#RRGGBB</code> format. You can also use keywords <em>bg_color</em> and <em>secondary_bg_color</em>.<br><br>Up to <mark>Bot API 6.9</mark> You can only pass <em>Telegram.WebApp.themeParams.bg_color</em> or <em>Telegram.WebApp.themeParams.secondary_bg_color</em> as a color or <em>bg_color</em>, <em>secondary_bg_color</em> keywords.</td>
<td>==Bot API 6.1+== A method that sets the app header color in the <code>#RRGGBB</code> format. You can also use keywords <em>bg_color</em> and <em>secondary_bg_color</em>. <br><br>Up to ==Bot API 6.9== You can only pass <em>Telegram.WebApp.themeParams.bg_color</em> or <em>Telegram.WebApp.themeParams.secondary_bg_color</em> as a color or <em>bg_color</em>, <em>secondary_bg_color</em> keywords.</td>
</tr>
<tr>
<td>setBackgroundColor(color)</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method that sets the app background color in the <code>#RRGGBB</code> format. You can also use keywords <em>bg_color</em> and <em>secondary_bg_color</em>.</td>
<td>==Bot API 6.1+== A method that sets the app background color in the <code>#RRGGBB</code> format. You can also use keywords <em>bg_color</em> and <em>secondary_bg_color</em>.</td>
</tr>
<tr>
<td>enableClosingConfirmation()</td>
<td>Function</td>
<td><mark>Bot API 6.2+</mark> A method that enables a confirmation dialog while the user is trying to close the Mini App.</td>
<td>==Bot API 6.2+== A method that enables a confirmation dialog while the user is trying to close the Mini App.</td>
</tr>
<tr>
<td>disableClosingConfirmation()</td>
<td>Function</td>
<td><mark>Bot API 6.2+</mark> A method that disables the confirmation dialog while the user is trying to close the Mini App.</td>
<td>==Bot API 6.2+== A method that disables the confirmation dialog while the user is trying to close the Mini App.</td>
</tr>
<tr>
<td>onEvent(eventType, eventHandler)</td>
@ -357,67 +354,67 @@
<tr>
<td>switchInlineQuery(query[, choose_chat_types])</td>
<td>Function</td>
<td><mark>Bot API 6.7+</mark> A method that inserts the bot&#39;s username and the specified inline <em>query</em> in the current chat&#39;s input field. Query may be empty, in which case only the bot&#39;s username will be inserted. If an optional <em>choose_chat_types</em> parameter was passed, the client prompts the user to choose a specific chat, then opens that chat and inserts the bot&#39;s username and the specified inline query in the input field. You can specify which types of chats the user will be able to choose from. It can be one or more of the following types: <em>users</em>, <em>bots</em>, <em>groups</em>, <em>channels</em>.</td>
<td>==Bot API 6.7+== A method that inserts the bot's username and the specified inline <em>query</em> in the current chat's input field. Query may be empty, in which case only the bot's username will be inserted. If an optional <em>choose_chat_types</em> parameter was passed, the client prompts the user to choose a specific chat, then opens that chat and inserts the bot's username and the specified inline query in the input field. You can specify which types of chats the user will be able to choose from. It can be one or more of the following types: <em>users</em>, <em>bots</em>, <em>groups</em>, <em>channels</em>.</td>
</tr>
<tr>
<td>openLink(url[, options])</td>
<td>Function</td>
<td>A method that opens a link in an external browser. The Mini App will <em>not</em> be closed.<br><mark>Bot API 6.4+</mark> If the optional <em>options</em> parameter is passed with the field <em>try_instant_view=true</em>, the link will be opened in <a href="https://instantview.telegram.org/">Instant View</a> mode if possible.<br><br><em>Note that this method can be called only in response to user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button)</em></td>
<td>A method that opens a link in an external browser. The Mini App will <em>not</em> be closed. <br>==Bot API 6.4+== If the optional <em>options</em> parameter is passed with the field <em>try_instant_view=true</em>, the link will be opened in <a href="https://instantview.telegram.org/">Instant View</a> mode if possible. <br><br><em>Note that this method can be called only in response to user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button)</em></td>
</tr>
<tr>
<td>openTelegramLink(url)</td>
<td>Function</td>
<td>A method that opens a telegram link inside the Telegram app. The Mini App will <em>not</em> be closed after this method is called.<br><br>Up to <mark>Bot API 7.0</mark> The Mini App <em>will</em> be closed after this method is called.</td>
<td>A method that opens a telegram link inside the Telegram app. The Mini App will <em>not</em> be closed after this method is called. <br><br>Up to ==Bot API 7.0== The Mini App <em>will</em> be closed after this method is called.</td>
</tr>
<tr>
<td>openInvoice(url[, callback])</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method that opens an invoice using the link <em>url</em>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>invoiceClosed</em> when the invoice is closed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the invoice status will be passed as the first argument.</td>
<td>==Bot API 6.1+== A method that opens an invoice using the link <em>url</em>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>invoiceClosed</em> when the invoice is closed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the invoice status will be passed as the first argument.</td>
</tr>
<tr>
<td>showPopup(params[, callback])</td>
<td>Function</td>
<td><mark>Bot API 6.2+</mark> A method that shows a native popup described by the <em>params</em> argument of the type <a href="#popupparams">PopupParams</a>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>popupClosed</em> when the popup is closed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the field <em>id</em> of the pressed button will be passed as the first argument.</td>
<td>==Bot API 6.2+== A method that shows a native popup described by the <em>params</em> argument of the type <a href="#popupparams">PopupParams</a>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>popupClosed</em> when the popup is closed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the field <em>id</em> of the pressed button will be passed as the first argument.</td>
</tr>
<tr>
<td>showAlert(message[, callback])</td>
<td>Function</td>
<td><mark>Bot API 6.2+</mark> A method that shows <em>message</em> in a simple alert with a &#39;Close&#39; button. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called when the popup is closed.</td>
<td>==Bot API 6.2+== A method that shows <em>message</em> in a simple alert with a 'Close' button. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called when the popup is closed.</td>
</tr>
<tr>
<td>showConfirm(message[, callback])</td>
<td>Function</td>
<td><mark>Bot API 6.2+</mark> A method that shows <em>message</em> in a simple confirmation window with &#39;OK&#39; and &#39;Cancel&#39; buttons. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called when the popup is closed and the first argument will be a boolean indicating whether the user pressed the &#39;OK&#39; button.</td>
<td>==Bot API 6.2+== A method that shows <em>message</em> in a simple confirmation window with 'OK' and 'Cancel' buttons. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called when the popup is closed and the first argument will be a boolean indicating whether the user pressed the 'OK' button.</td>
</tr>
<tr>
<td>showScanQrPopup(params[, callback])</td>
<td>Function</td>
<td><mark>Bot API 6.4+</mark> A method that shows a native popup for scanning a QR code described by the <em>params</em> argument of the type <a href="#scanqrpopupparams">ScanQrPopupParams</a>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>qrTextReceived</em> every time the scanner catches a code with text data. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the text from the QR code will be passed as the first argument. Returning <em>true</em> inside this callback function causes the popup to be closed.</td>
<td>==Bot API 6.4+== A method that shows a native popup for scanning a QR code described by the <em>params</em> argument of the type <a href="#scanqrpopupparams">ScanQrPopupParams</a>. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>qrTextReceived</em> every time the scanner catches a code with text data. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the text from the QR code will be passed as the first argument. Returning <em>true</em> inside this callback function causes the popup to be closed.</td>
</tr>
<tr>
<td>closeScanQrPopup()</td>
<td>Function</td>
<td><mark>Bot API 6.4+</mark> A method that closes the native popup for scanning a QR code opened with the <em>showScanQrPopup</em> method. Run it if you received valid data in the <a href="#events-available-for-mini-apps">event</a> <em>qrTextReceived</em>.</td>
<td>==Bot API 6.4+== A method that closes the native popup for scanning a QR code opened with the <em>showScanQrPopup</em> method. Run it if you received valid data in the <a href="#events-available-for-mini-apps">event</a> <em>qrTextReceived</em>.</td>
</tr>
<tr>
<td>readTextFromClipboard([callback])</td>
<td>Function</td>
<td><mark>Bot API 6.4+</mark> A method that requests text from the clipboard. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>clipboardTextReceived</em>. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the text from the clipboard will be passed as the first argument.<br><br><em>Note: this method can be called only for Mini Apps launched from the attachment menu and only in response to a user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button).</em></td>
<td>==Bot API 6.4+== A method that requests text from the clipboard. The Mini App will receive the <a href="#events-available-for-mini-apps">event</a> <em>clipboardTextReceived</em>. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called and the text from the clipboard will be passed as the first argument.<br><br><em>Note: this method can be called only for Mini Apps launched from the attachment menu and only in response to a user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button).</em></td>
</tr>
<tr>
<td>requestWriteAccess([callback])</td>
<td>Function</td>
<td><mark>Bot API 6.9+</mark> A method that shows a native popup requesting permission for the bot to send messages to the user. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called when the popup is closed and the first argument will be a boolean indicating whether the user granted this access.</td>
<td>==Bot API 6.9+== A method that shows a native popup requesting permission for the bot to send messages to the user. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called when the popup is closed and the first argument will be a boolean indicating whether the user granted this access.</td>
</tr>
<tr>
<td>requestContact([callback])</td>
<td>Function</td>
<td><mark>Bot API 6.9+</mark> A method that shows a native popup prompting the user for their phone number. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called when the popup is closed and the first argument will be a boolean indicating whether the user shared its phone number.</td>
<td>==Bot API 6.9+== A method that shows a native popup prompting the user for their phone number. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called when the popup is closed and the first argument will be a boolean indicating whether the user shared its phone number.</td>
</tr>
<tr>
<td>ready()</td>
<td>Function</td>
<td>A method that informs the Telegram app that the Mini App is ready to be displayed.<br>It is recommended to call this method as early as possible, as soon as all essential interface elements are loaded. Once this method is called, the loading placeholder is hidden and the Mini App is shown.<br>If the method is not called, the placeholder will be hidden only when the page is fully loaded.</td>
<td>A method that informs the Telegram app that the Mini App is ready to be displayed. <br>It is recommended to call this method as early as possible, as soon as all essential interface elements are loaded. Once this method is called, the loading placeholder is hidden and the Mini App is shown. <br>If the method is not called, the placeholder will be hidden only when the page is fully loaded.</td>
</tr>
<tr>
<td>expand()</td>
@ -431,8 +428,8 @@
</tr>
</tbody>
</table>
<h4><a class="anchor" name="themeparams" href="#themeparams"><i class="anchor-icon"></i></a>ThemeParams</h4>
<p>Mini Apps can <a href="#color-schemes">adjust the appearance</a> of the interface to match the Telegram user&#39;s app in real time. This object contains the user&#39;s current theme settings:</p>
<h4><a class="anchor" href="#themeparams" id="themeparams" name="themeparams"><i class="anchor-icon"></i></a>ThemeParams</h4>
<p>Mini Apps can <a href="#color-schemes">adjust the appearance</a> of the interface to match the Telegram user's app in real time. This object contains the user's current theme settings:</p>
<table class="table">
<thead>
<tr>
@ -445,75 +442,74 @@
<tr>
<td>bg_color</td>
<td>String</td>
<td><em>Optional</em>. Background color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-bg-color)</code>.</td>
<td><em>Optional</em>. Background color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-bg-color)</code>.</td>
</tr>
<tr>
<td>text_color</td>
<td>String</td>
<td><em>Optional</em>. Main text color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-text-color)</code>.</td>
<td><em>Optional</em>. Main text color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-text-color)</code>.</td>
</tr>
<tr>
<td>hint_color</td>
<td>String</td>
<td><em>Optional</em>. Hint text color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-hint-color)</code>.</td>
<td><em>Optional</em>. Hint text color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-hint-color)</code>.</td>
</tr>
<tr>
<td>link_color</td>
<td>String</td>
<td><em>Optional</em>. Link color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-link-color)</code>.</td>
<td><em>Optional</em>. Link color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-link-color)</code>.</td>
</tr>
<tr>
<td>button_color</td>
<td>String</td>
<td><em>Optional</em>. Button color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-button-color)</code>.</td>
<td><em>Optional</em>. Button color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-button-color)</code>.</td>
</tr>
<tr>
<td>button_text_color</td>
<td>String</td>
<td><em>Optional</em>. Button text color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-button-text-color)</code>.</td>
<td><em>Optional</em>. Button text color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-button-text-color)</code>.</td>
</tr>
<tr>
<td>secondary_bg_color</td>
<td>String</td>
<td><em>Optional</em>. <mark>Bot API 6.1+</mark> Secondary background color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-secondary-bg-color)</code>.</td>
<td><em>Optional</em>. ==Bot API 6.1+== Secondary background color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-secondary-bg-color)</code>.</td>
</tr>
<tr>
<td>header_bg_color <sup><mark>NEW</mark></sup></td>
<td>header_bg_color ^==NEW==^</td>
<td>String</td>
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Header background color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-header-bg-color)</code>.</td>
<td><em>Optional</em>. ==Bot API 7.0+== Header background color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-header-bg-color)</code>.</td>
</tr>
<tr>
<td>accent_text_color <sup><mark>NEW</mark></sup></td>
<td>accent_text_color ^==NEW==^</td>
<td>String</td>
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Accent text color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-accent-text-color)</code>.</td>
<td><em>Optional</em>. ==Bot API 7.0+== Accent text color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-accent-text-color)</code>.</td>
</tr>
<tr>
<td>section_bg_color <sup><mark>NEW</mark></sup></td>
<td>section_bg_color ^==NEW==^</td>
<td>String</td>
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Background color for the section in the <code>#RRGGBB</code> format. It is recommended to use this in conjunction with <em>secondary_bg_color</em>.<br>Also available as the CSS variable <code>var(--tg-theme-section-bg-color)</code>.</td>
<td><em>Optional</em>. ==Bot API 7.0+== Background color for the section in the <code>#RRGGBB</code> format. It is recommended to use this in conjunction with <em>secondary_bg_color</em>. <br>Also available as the CSS variable <code>var(--tg-theme-section-bg-color)</code>.</td>
</tr>
<tr>
<td>section_header_text_color <sup><mark>NEW</mark></sup></td>
<td>section_header_text_color ^==NEW==^</td>
<td>String</td>
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Header text color for the section in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-section-header-text-color)</code>.</td>
<td><em>Optional</em>. ==Bot API 7.0+== Header text color for the section in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-section-header-text-color)</code>.</td>
</tr>
<tr>
<td>subtitle_text_color <sup><mark>NEW</mark></sup></td>
<td>subtitle_text_color ^==NEW==^</td>
<td>String</td>
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Subtitle text color in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-subtitle-text-color)</code>.</td>
<td><em>Optional</em>. ==Bot API 7.0+== Subtitle text color in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-subtitle-text-color)</code>.</td>
</tr>
<tr>
<td>destructive_text_color <sup><mark>NEW</mark></sup></td>
<td>destructive_text_color ^==NEW==^</td>
<td>String</td>
<td><em>Optional</em>. <mark>Bot API 7.0+</mark> Text color for destructive actions in the <code>#RRGGBB</code> format.<br>Also available as the CSS variable <code>var(--tg-theme-destructive-text-color)</code>.</td>
<td><em>Optional</em>. ==Bot API 7.0+== Text color for destructive actions in the <code>#RRGGBB</code> format. <br>Also available as the CSS variable <code>var(--tg-theme-destructive-text-color)</code>.</td>
</tr>
</tbody>
</table>
<div>
<a href="/file/464001695/11185/DAwyUjA7LNA.215601/26f4c8ebf862ae860d" target="_blank"><img src="/file/464001695/11185/DAwyUjA7LNA.215601/26f4c8ebf862ae860d" title="WebViewColors explained" class="dev_page_image" /></a>
<a href="/file/464001695/11185/DAwyUjA7LNA.215601/26f4c8ebf862ae860d" target="_blank"><img src="/file/464001695/11185/DAwyUjA7LNA.215601/26f4c8ebf862ae860d" title="WebViewColors explained" class="dev_page_image"></a>
</div>
<h4><a class="anchor" name="popupparams" href="#popupparams"><i class="anchor-icon"></i></a>PopupParams</h4>
<h4><a class="anchor" href="#popupparams" id="popupparams" name="popupparams"><i class="anchor-icon"></i></a>PopupParams</h4>
<p>This object describes the native popup.</p>
<table class="table">
<thead>
@ -537,11 +533,11 @@
<tr>
<td>buttons</td>
<td>Array of <a href="#popupbutton">PopupButton</a></td>
<td><em>Optional</em>. List of buttons to be displayed in the popup, 1-3 buttons. Set to <em>[{“type”:“close”}]</em> by default.</td>
<td><em>Optional</em>. List of buttons to be displayed in the popup, 1-3 buttons. Set to <em>[{"type":"close"}]</em> by default.</td>
</tr>
</tbody>
</table>
<h4><a class="anchor" name="scanqrpopupparams" href="#scanqrpopupparams"><i class="anchor-icon"></i></a>ScanQrPopupParams</h4>
<h4><a class="anchor" href="#scanqrpopupparams" id="scanqrpopupparams" name="scanqrpopupparams"><i class="anchor-icon"></i></a>ScanQrPopupParams</h4>
<p>This object describes the native popup for scanning QR codes.</p>
<table class="table">
<thead>
@ -555,11 +551,11 @@
<tr>
<td>text</td>
<td>String</td>
<td><em>Optional</em>. The text to be displayed under the &#39;Scan QR&#39; heading, 0-64 characters.</td>
<td><em>Optional</em>. The text to be displayed under the 'Scan QR' heading, 0-64 characters.</td>
</tr>
</tbody>
</table>
<h4><a class="anchor" name="popupbutton" href="#popupbutton"><i class="anchor-icon"></i></a>PopupButton</h4>
<h4><a class="anchor" href="#popupbutton" id="popupbutton" name="popupbutton"><i class="anchor-icon"></i></a>PopupButton</h4>
<p>This object describes the native popup button.</p>
<table class="table">
<thead>
@ -573,12 +569,12 @@
<tr>
<td>id</td>
<td>String</td>
<td><em>Optional</em>. Identifier of the button, 0-64 characters. Set to empty string by default.<br>If the button is pressed, its <em>id</em> is returned in the callback and the <em>popupClosed</em> event.</td>
<td><em>Optional</em>. Identifier of the button, 0-64 characters. Set to empty string by default. <br>If the button is pressed, its <em>id</em> is returned in the callback and the <em>popupClosed</em> event.</td>
</tr>
<tr>
<td>type</td>
<td>String</td>
<td><em>Optional</em>. Type of the button. Set to <em>default</em> by default.<br>Can be one of these values:<br>- <em>default</em>, a button with the default style,<br>- <em>ok</em>, a button with the localized text “OK”,<br>- <em>close</em>, a button with the localized text “Close”,<br>- <em>cancel</em>, a button with the localized text “Cancel”,<br>- <em>destructive</em>, a button with a style that indicates a destructive action (e.g. “Remove”, “Delete”, etc.).</td>
<td><em>Optional</em>. Type of the button. Set to <em>default</em> by default. <br>Can be one of these values: <br>- <em>default</em>, a button with the default style, <br>- <em>ok</em>, a button with the localized text "OK", <br>- <em>close</em>, a button with the localized text "Close", <br>- <em>cancel</em>, a button with the localized text "Cancel", <br>- <em>destructive</em>, a button with a style that indicates a destructive action (e.g. "Remove", "Delete", etc.).</td>
</tr>
<tr>
<td>text</td>
@ -587,7 +583,7 @@
</tr>
</tbody>
</table>
<h4><a class="anchor" name="backbutton" href="#backbutton"><i class="anchor-icon"></i></a>BackButton</h4>
<h4><a class="anchor" href="#backbutton" id="backbutton" name="backbutton"><i class="anchor-icon"></i></a>BackButton</h4>
<p>This object controls the <strong>back</strong> button, which can be displayed in the header of the Mini App in the Telegram interface.</p>
<table class="table">
<thead>
@ -606,27 +602,27 @@
<tr>
<td>onClick(callback)</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method that sets the button press event handler. An alias for <code>Telegram.WebApp.onEvent(&#39;backButtonClicked&#39;, callback)</code></td>
<td>==Bot API 6.1+== A method that sets the button press event handler. An alias for <code>Telegram.WebApp.onEvent('backButtonClicked', callback)</code></td>
</tr>
<tr>
<td>offClick(callback)</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method that removes the button press event handler. An alias for <code>Telegram.WebApp.offEvent(&#39;backButtonClicked&#39;, callback)</code></td>
<td>==Bot API 6.1+== A method that removes the button press event handler. An alias for <code>Telegram.WebApp.offEvent('backButtonClicked', callback)</code></td>
</tr>
<tr>
<td>show()</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method to make the button active and visible.</td>
<td>==Bot API 6.1+== A method to make the button active and visible.</td>
</tr>
<tr>
<td>hide()</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method to hide the button.</td>
<td>==Bot API 6.1+== A method to hide the button.</td>
</tr>
</tbody>
</table>
<p>All these methods return the BackButton object so they can be chained.</p>
<h4><a class="anchor" name="mainbutton" href="#mainbutton"><i class="anchor-icon"></i></a>MainButton</h4>
<h4><a class="anchor" href="#mainbutton" id="mainbutton" name="mainbutton"><i class="anchor-icon"></i></a>MainButton</h4>
<p>This object controls the main button, which is displayed at the bottom of the Mini App in the Telegram interface.</p>
<table class="table">
<thead>
@ -675,17 +671,17 @@
<tr>
<td>onClick(callback)</td>
<td>Function</td>
<td>A method that sets the button press event handler. An alias for <code>Telegram.WebApp.onEvent(&#39;mainButtonClicked&#39;, callback)</code></td>
<td>A method that sets the button press event handler. An alias for <code>Telegram.WebApp.onEvent('mainButtonClicked', callback)</code></td>
</tr>
<tr>
<td>offClick(callback)</td>
<td>Function</td>
<td>A method that removes the button press event handler. An alias for <code>Telegram.WebApp.offEvent(&#39;mainButtonClicked&#39;, callback)</code></td>
<td>A method that removes the button press event handler. An alias for <code>Telegram.WebApp.offEvent('mainButtonClicked', callback)</code></td>
</tr>
<tr>
<td>show()</td>
<td>Function</td>
<td>A method to make the button visible.<br><em>Note that opening the Mini App from the <a href="#launching-mini-apps-from-the-attachment-menu">attachment menu</a> hides the main button until the user interacts with the Mini App interface.</em></td>
<td>A method to make the button visible. <br><em>Note that opening the Mini App from the <a href="#launching-mini-apps-from-the-attachment-menu">attachment menu</a> hides the main button until the user interacts with the Mini App interface.</em></td>
</tr>
<tr>
<td>hide()</td>
@ -705,7 +701,7 @@
<tr>
<td>showProgress(leaveActive)</td>
<td>Function</td>
<td>A method to show a loading indicator on the button.<br>It is recommended to display loading progress if the action tied to the button may take a long time. By default, the button is disabled while the action is in progress. If the parameter <code>leaveActive=true</code> is passed, the button remains enabled.</td>
<td>A method to show a loading indicator on the button. <br>It is recommended to display loading progress if the action tied to the button may take a long time. By default, the button is disabled while the action is in progress. If the parameter <code>leaveActive=true</code> is passed, the button remains enabled.</td>
</tr>
<tr>
<td>hideProgress()</td>
@ -715,13 +711,13 @@
<tr>
<td>setParams(params)</td>
<td>Function</td>
<td>A method to set the button parameters. The <em>params</em> parameter is an object containing one or several fields that need to be changed:<br><strong>text</strong> - button text;<br><strong>color</strong> - button color;<br><strong>text_color</strong> - button text color;<br><strong>is_active</strong> - enable the button;<br><strong>is_visible</strong> - show the button.</td>
<td>A method to set the button parameters. The <em>params</em> parameter is an object containing one or several fields that need to be changed: <br><strong>text</strong> - button text; <br><strong>color</strong> - button color; <br><strong>text_color</strong> - button text color; <br><strong>is_active</strong> - enable the button; <br><strong>is_visible</strong> - show the button.</td>
</tr>
</tbody>
</table>
<p>All these methods return the MainButton object so they can be chained.</p>
<h4><a class="anchor" name="settingsbutton" href="#settingsbutton"><i class="anchor-icon"></i></a>SettingsButton</h4>
<p><sup><mark>NEW</mark></sup> This object controls the <strong>Settings</strong> item in the context menu of the Mini App in the Telegram interface.</p>
<h4><a class="anchor" href="#settingsbutton" id="settingsbutton" name="settingsbutton"><i class="anchor-icon"></i></a>SettingsButton</h4>
<p>^==NEW==^ This object controls the <strong>Settings</strong> item in the context menu of the Mini App in the Telegram interface.</p>
<table class="table">
<thead>
<tr>
@ -739,27 +735,27 @@
<tr>
<td>onClick(callback)</td>
<td>Function</td>
<td><mark>Bot API 7.0+</mark> A method that sets the press event handler for the Settings item in the context menu. An alias for <code>Telegram.WebApp.onEvent(&#39;settingsButtonClicked&#39;, callback)</code></td>
<td>==Bot API 7.0+== A method that sets the press event handler for the Settings item in the context menu. An alias for <code>Telegram.WebApp.onEvent('settingsButtonClicked', callback)</code></td>
</tr>
<tr>
<td>offClick(callback)</td>
<td>Function</td>
<td><mark>Bot API 7.0+</mark> A method that removes the press event handler from the Settings item in the context menu. An alias for <code>Telegram.WebApp.offEvent(&#39;settingsButtonClicked&#39;, callback)</code></td>
<td>==Bot API 7.0+== A method that removes the press event handler from the Settings item in the context menu. An alias for <code>Telegram.WebApp.offEvent('settingsButtonClicked', callback)</code></td>
</tr>
<tr>
<td>show()</td>
<td>Function</td>
<td><mark>Bot API 7.0+</mark> A method to make the Settings item in the context menu visible.</td>
<td>==Bot API 7.0+== A method to make the Settings item in the context menu visible.</td>
</tr>
<tr>
<td>hide()</td>
<td>Function</td>
<td><mark>Bot API 7.0+</mark> A method to hide the Settings item in the context menu.</td>
<td>==Bot API 7.0+== A method to hide the Settings item in the context menu.</td>
</tr>
</tbody>
</table>
<p>All these methods return the <a href="#settingsbutton">SettingsButton</a> object so they can be chained.</p>
<h4><a class="anchor" name="hapticfeedback" href="#hapticfeedback"><i class="anchor-icon"></i></a>HapticFeedback</h4>
<h4><a class="anchor" href="#hapticfeedback" id="hapticfeedback" name="hapticfeedback"><i class="anchor-icon"></i></a>HapticFeedback</h4>
<p>This object controls haptic feedback.</p>
<table class="table">
<thead>
@ -773,22 +769,22 @@
<tr>
<td>impactOccurred(style)</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method tells that an impact occurred. The Telegram app may play the appropriate haptics based on style value passed. Style can be one of these values:<br>- <em>light</em>, indicates a collision between small or lightweight UI objects,<br>- <em>medium</em>, indicates a collision between medium-sized or medium-weight UI objects,<br>- <em>heavy</em>, indicates a collision between large or heavyweight UI objects,<br>- <em>rigid</em>, indicates a collision between hard or inflexible UI objects,<br>- <em>soft</em>, indicates a collision between soft or flexible UI objects.</td>
<td>==Bot API 6.1+== A method tells that an impact occurred. The Telegram app may play the appropriate haptics based on style value passed. Style can be one of these values: <br>- <em>light</em>, indicates a collision between small or lightweight UI objects, <br>- <em>medium</em>, indicates a collision between medium-sized or medium-weight UI objects, <br>- <em>heavy</em>, indicates a collision between large or heavyweight UI objects, <br>- <em>rigid</em>, indicates a collision between hard or inflexible UI objects, <br>- <em>soft</em>, indicates a collision between soft or flexible UI objects.</td>
</tr>
<tr>
<td>notificationOccurred(type)</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method tells that a task or action has succeeded, failed, or produced a warning. The Telegram app may play the appropriate haptics based on type value passed. Type can be one of these values:<br>- <em>error</em>, indicates that a task or action has failed,<br>- <em>success</em>, indicates that a task or action has completed successfully,<br>- <em>warning</em>, indicates that a task or action produced a warning.</td>
<td>==Bot API 6.1+== A method tells that a task or action has succeeded, failed, or produced a warning. The Telegram app may play the appropriate haptics based on type value passed. Type can be one of these values: <br>- <em>error</em>, indicates that a task or action has failed, <br>- <em>success</em>, indicates that a task or action has completed successfully, <br>- <em>warning</em>, indicates that a task or action produced a warning.</td>
</tr>
<tr>
<td>selectionChanged()</td>
<td>Function</td>
<td><mark>Bot API 6.1+</mark> A method tells that the user has changed a selection. The Telegram app may play the appropriate haptics.<br><br><em>Do not use this feedback when the user makes or confirms a selection; use it only when the selection changes.</em></td>
<td>==Bot API 6.1+== A method tells that the user has changed a selection. The Telegram app may play the appropriate haptics. <br><br><em>Do not use this feedback when the user makes or confirms a selection; use it only when the selection changes.</em></td>
</tr>
</tbody>
</table>
<p>All these methods return the HapticFeedback object so they can be chained.</p>
<h4><a class="anchor" name="cloudstorage" href="#cloudstorage"><i class="anchor-icon"></i></a>CloudStorage</h4>
<h4><a class="anchor" href="#cloudstorage" id="cloudstorage" name="cloudstorage"><i class="anchor-icon"></i></a>CloudStorage</h4>
<p>This object controls the cloud storage. Each bot can store up to 1024 items per user in the cloud storage.</p>
<table class="table">
<thead>
@ -802,37 +798,37 @@
<tr>
<td>setItem(key, value[, callback])</td>
<td>Function</td>
<td><mark>Bot API 6.9+</mark> A method that stores a value in the cloud storage using the specified key. The key should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. The value should contain 0-4096 characters. You can store up to 1024 keys in the cloud storage. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the second argument will be a boolean indicating whether the value was stored.</td>
<td>==Bot API 6.9+== A method that stores a value in the cloud storage using the specified key. The key should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. The value should contain 0-4096 characters. You can store up to 1024 keys in the cloud storage. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the second argument will be a boolean indicating whether the value was stored.</td>
</tr>
<tr>
<td>getItem(key, callback)</td>
<td>Function</td>
<td><mark>Bot API 6.9+</mark> A method that receives a value from the cloud storage using the specified key. The key should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. In case of an error, the <em>callback</em> function will be called and the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the value will be passed as the second argument.</td>
<td>==Bot API 6.9+== A method that receives a value from the cloud storage using the specified key. The key should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. In case of an error, the <em>callback</em> function will be called and the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the value will be passed as the second argument.</td>
</tr>
<tr>
<td>getItems(keys, callback)</td>
<td>Function</td>
<td><mark>Bot API 6.9+</mark> A method that receives values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. In case of an error, the <em>callback</em> function will be called and the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the values will be passed as the second argument.</td>
<td>==Bot API 6.9+== A method that receives values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. In case of an error, the <em>callback</em> function will be called and the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the values will be passed as the second argument.</td>
</tr>
<tr>
<td>removeItem(key[, callback])</td>
<td>Function</td>
<td><mark>Bot API 6.9+</mark> A method that removes a value from the cloud storage using the specified key. The key should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the second argument will be a boolean indicating whether the value was removed.</td>
<td>==Bot API 6.9+== A method that removes a value from the cloud storage using the specified key. The key should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the second argument will be a boolean indicating whether the value was removed.</td>
</tr>
<tr>
<td>removeItems(keys[, callback])</td>
<td>Function</td>
<td><mark>Bot API 6.9+</mark> A method that removes values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the second argument will be a boolean indicating whether the values were removed.</td>
<td>==Bot API 6.9+== A method that removes values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only <code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. If an optional <em>callback</em> parameter was passed, the <em>callback</em> function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the second argument will be a boolean indicating whether the values were removed.</td>
</tr>
<tr>
<td>getKeys(callback)</td>
<td>Function</td>
<td><mark>Bot API 6.9+</mark> A method that receives the list of all keys stored in the cloud storage. In case of an error, the <em>callback</em> function will be called and the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the list of keys will be passed as the second argument.</td>
<td>==Bot API 6.9+== A method that receives the list of all keys stored in the cloud storage. In case of an error, the <em>callback</em> function will be called and the first argument will contain the error. In case of success, the first argument will be <em>null</em> and the list of keys will be passed as the second argument.</td>
</tr>
</tbody>
</table>
<p>All these methods return the <a href="#cloudstorage">CloudStorage</a> object, so they can be chained.</p>
<h4><a class="anchor" name="webappinitdata" href="#webappinitdata"><i class="anchor-icon"></i></a>WebAppInitData</h4>
<h4><a class="anchor" href="#webappinitdata" id="webappinitdata" name="webappinitdata"><i class="anchor-icon"></i></a>WebAppInitData</h4>
<p>This object contains data that is transferred to the Mini App when it is opened. It is empty if the Mini App was launched from a <a href="#keyboard-button-mini-apps">keyboard button</a> or from <a href="#inline-mode-mini-apps">inline mode</a>.</p>
<table class="table">
<thead>
@ -866,7 +862,7 @@
<tr>
<td>chat_type</td>
<td>String</td>
<td><em>Optional.</em> Type of the chat from which the Mini App was opened. Can be either “sender” for a private chat with the user opening the link, “private”, “group”, “supergroup”, or “channel”. Returned only for Mini Apps launched from direct links.</td>
<td><em>Optional.</em> Type of the chat from which the Mini App was opened. Can be either "sender" for a private chat with the user opening the link, "private", "group", "supergroup", or "channel". Returned only for Mini Apps launched from direct links.</td>
</tr>
<tr>
<td>chat_instance</td>
@ -876,7 +872,7 @@
<tr>
<td>start_param</td>
<td>String</td>
<td><em>Optional.</em> The value of the <em>startattach</em> parameter, passed <a href="#adding-bots-to-the-attachment-menu">via link</a>. Only returned for Mini Apps when launched from the attachment menu via link.<br><br>The value of the <code>start_param</code> parameter will also be passed in the GET-parameter <code>tgWebAppStartParam</code>, so the Mini App can load the correct interface right away.</td>
<td><em>Optional.</em> The value of the <em>startattach</em> parameter, passed <a href="#adding-bots-to-the-attachment-menu">via link</a>. Only returned for Mini Apps when launched from the attachment menu via link. <br><br>The value of the <code>start_param</code> parameter will also be passed in the GET-parameter <code>tgWebAppStartParam</code>, so the Mini App can load the correct interface right away.</td>
</tr>
<tr>
<td>can_send_after</td>
@ -895,7 +891,7 @@
</tr>
</tbody>
</table>
<h4><a class="anchor" name="webappuser" href="#webappuser"><i class="anchor-icon"></i></a>WebAppUser</h4>
<h4><a class="anchor" href="#webappuser" id="webappuser" name="webappuser"><i class="anchor-icon"></i></a>WebAppUser</h4>
<p>This object contains the data of the Mini App user.</p>
<table class="table">
<thead>
@ -934,7 +930,7 @@
<tr>
<td>language_code</td>
<td>String</td>
<td><em>Optional</em>. <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a> of the user&#39;s language. Returns in <em>user</em> field only.</td>
<td><em>Optional</em>. <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a> of the user's language. Returns in <em>user</em> field only.</td>
</tr>
<tr>
<td>is_premium</td>
@ -958,7 +954,7 @@
</tr>
</tbody>
</table>
<h4><a class="anchor" name="webappchat" href="#webappchat"><i class="anchor-icon"></i></a>WebAppChat</h4>
<h4><a class="anchor" href="#webappchat" id="webappchat" name="webappchat"><i class="anchor-icon"></i></a>WebAppChat</h4>
<p>This object represents a chat.</p>
<table class="table">
<thead>
@ -977,7 +973,7 @@
<tr>
<td>type</td>
<td>String</td>
<td>Type of chat, can be either “group”, “supergroup” or “channel”</td>
<td>Type of chat, can be either "group", "supergroup" or "channel"</td>
</tr>
<tr>
<td>title</td>
@ -996,19 +992,19 @@
</tr>
</tbody>
</table>
<h4><a class="anchor" name="validating-data-received-via-the-mini-app" href="#validating-data-received-via-the-mini-app"><i class="anchor-icon"></i></a>Validating data received via the Mini App</h4>
<p>To validate data received via the Mini App, one should send the data from the <em>Telegram.WebApp.initData</em> field to the bot&#39;s backend. The data is a query string, which is composed of a series of field-value pairs.</p>
<p>You can verify the integrity of the data received by comparing the received <em>hash</em> parameter with the hexadecimal representation of the <a href="https://en.wikipedia.org/wiki/Hash-based_message_authentication_code">HMAC-SHA-256</a> signature of the <strong>data-check-string</strong> with the secret key, which is the <a href="https://en.wikipedia.org/wiki/Hash-based_message_authentication_code">HMAC-SHA-256</a> signature of the <a href="/bots#creating-a-new-bot">bot&#39;s token</a> with the constant string <code>WebAppData</code> used as a key.</p>
<p><strong>Data-check-string</strong> is a chain of all received fields, sorted alphabetically, in the format <code>key=&lt;value&gt;</code> with a <a href="https://en.wikipedia.org/wiki/Newline">line feed</a> character (&#39;\n&#39;, 0x0A) used as separator e.g., <code>&#39;auth_date=&lt;auth_date&gt;\nquery_id=&lt;query_id&gt;\nuser=&lt;user&gt;&#39;</code>.</p>
<h4><a class="anchor" href="#validating-data-received-via-the-mini-app" id="validating-data-received-via-the-mini-app" name="validating-data-received-via-the-mini-app"><i class="anchor-icon"></i></a>Validating data received via the Mini App</h4>
<p>To validate data received via the Mini App, one should send the data from the <em>Telegram.WebApp.initData</em> field to the bot's backend. The data is a query string, which is composed of a series of field-value pairs.</p>
<p>You can verify the integrity of the data received by comparing the received <em>hash</em> parameter with the hexadecimal representation of the <a href="https://en.wikipedia.org/wiki/Hash-based_message_authentication_code">HMAC-SHA-256</a> signature of the <strong>data-check-string</strong> with the secret key, which is the <a href="https://en.wikipedia.org/wiki/Hash-based_message_authentication_code">HMAC-SHA-256</a> signature of the <a href="/bots#creating-a-new-bot">bot's token</a> with the constant string <code>WebAppData</code> used as a key.</p>
<p><strong>Data-check-string</strong> is a chain of all received fields, sorted alphabetically, in the format <code>key=&lt;value&gt;</code> with a <a href="https://en.wikipedia.org/wiki/Newline">line feed</a> character ('\n', 0x0A) used as separator e.g., <code>'auth_date=&lt;auth_date&gt;\nquery_id=&lt;query_id&gt;\nuser=&lt;user&gt;'</code>.</p>
<p>The full check might look like:</p>
<pre><code>data_check_string = ...
secret_key = HMAC_SHA256(&lt;bot_token&gt;, &quot;WebAppData&quot;)
secret_key = HMAC_SHA256(&lt;bot_token&gt;, "WebAppData")
if (hex(HMAC_SHA256(data_check_string, secret_key)) == hash) {
// data is from Telegram
}</code></pre>
<p>To prevent the use of outdated data, you can additionally check the <em>auth_date</em> field, which contains a Unix timestamp of when it was received by the Mini App.</p>
<p>Once validated, the data may be used on your server. Complex data types are represented as JSON-serialized objects.</p>
<h4><a class="anchor" name="events-available-for-mini-apps" href="#events-available-for-mini-apps"><i class="anchor-icon"></i></a>Events Available for Mini Apps</h4>
<h4><a class="anchor" href="#events-available-for-mini-apps" id="events-available-for-mini-apps" name="events-available-for-mini-apps"><i class="anchor-icon"></i></a>Events Available for Mini Apps</h4>
<p>The Mini App can receive events from the Telegram app, onto which a handler can be attached using the <code>Telegram.WebApp.onEvent(eventType, eventHandler)</code> method. Inside <code>eventHandler</code> the <em>this</em> object refers to <em>Telegram.WebApp</em>, the set of parameters sent to the handler depends on the event type. Below is a list of possible events:</p>
<table class="table">
<thead>
@ -1020,66 +1016,72 @@ if (hex(HMAC_SHA256(data_check_string, secret_key)) == hash) {
<tbody>
<tr>
<td><code>themeChanged</code></td>
<td>Occurs whenever theme settings are changed in the user&#39;s Telegram app (including switching to night mode).<br><em>eventHandler</em> receives no parameters, new theme settings and color scheme can be received via <em>this.themeParams</em> and <em>this.colorScheme</em> respectively.</td>
<td>Occurs whenever theme settings are changed in the user's Telegram app (including switching to night mode). <br><em>eventHandler</em> receives no parameters, new theme settings and color scheme can be received via <em>this.themeParams</em> and <em>this.colorScheme</em> respectively.</td>
</tr>
<tr>
<td><code>viewportChanged</code></td>
<td>Occurs when the visible section of the Mini App is changed.<br><em>eventHandler</em> receives an object with the single field <em>isStateStable</em>. If <em>isStateStable</em> is true, the resizing of the Mini App is finished. If it is false, the resizing is ongoing (the user is expanding or collapsing the Mini App or an animated object is playing). The current value of the visible sections height is available in <em>this.viewportHeight</em>.</td>
<td>Occurs when the visible section of the Mini App is changed. <br><em>eventHandler</em> receives an object with the single field <em>isStateStable</em>. If <em>isStateStable</em> is true, the resizing of the Mini App is finished. If it is false, the resizing is ongoing (the user is expanding or collapsing the Mini App or an animated object is playing). The current value of the visible sections height is available in <em>this.viewportHeight</em>.</td>
</tr>
<tr>
<td><code>mainButtonClicked</code></td>
<td>Occurs when the <a href="#mainbutton">main button</a> is pressed.<br><em>eventHandler</em> receives no parameters.</td>
<td>Occurs when the <a href="#mainbutton">main button</a> is pressed. <br><em>eventHandler</em> receives no parameters.</td>
</tr>
<tr>
<td><code>backButtonClicked</code></td>
<td><mark>Bot API 6.1+</mark> Occurrs when the <a href="#backbutton">back button</a> is pressed.<br><em>eventHandler</em> receives no parameters.</td>
<td>==Bot API 6.1+== Occurrs when the <a href="#backbutton">back button</a> is pressed. <br><em>eventHandler</em> receives no parameters.</td>
</tr>
<tr>
<td><code>settingsButtonClicked</code></td>
<td><mark>Bot API 6.1+</mark> Occurrs when the Settings item in context menu is pressed.<br><em>eventHandler</em> receives no parameters.</td>
<td>==Bot API 6.1+== Occurrs when the Settings item in context menu is pressed. <br><em>eventHandler</em> receives no parameters.</td>
</tr>
<tr>
<td><code>invoiceClosed</code></td>
<td><mark>Bot API 6.1+</mark> Occurrs when the opened invoice is closed.<br><em>eventHandler</em> receives an object with the two fields: <em>url</em> invoice link provided and <em>status</em> one of the invoice statuses:<br>- <strong>paid</strong> invoice was paid successfully,<br>- <strong>cancelled</strong> user closed this invoice without paying,<br>- <strong>failed</strong> user tried to pay, but the payment was failed,<br>- <strong>pending</strong> the payment is still processing. The bot will receive a service message about a <a href="https://core.telegram.org/bots/api#successfulpayment">successful payment</a> when the payment is successfully paid.</td>
<td>==Bot API 6.1+== Occurrs when the opened invoice is closed. <br><em>eventHandler</em> receives an object with the two fields: <em>url</em> invoice link provided and <em>status</em> one of the invoice statuses: <br>- <strong>paid</strong> invoice was paid successfully, <br>- <strong>cancelled</strong> user closed this invoice without paying, <br>- <strong>failed</strong> user tried to pay, but the payment was failed, <br>- <strong>pending</strong> the payment is still processing. The bot will receive a service message about a <a href="https://core.telegram.org/bots/api#successfulpayment">successful payment</a> when the payment is successfully paid.</td>
</tr>
<tr>
<td><code>popupClosed</code></td>
<td><mark>Bot API 6.2+</mark> Occurrs when the opened popup is closed.<br><em>eventHandler</em> receives an object with the single field <em>button_id</em> the value of the field <em>id</em> of the pressed button. If no buttons were pressed, the field <em>button_id</em> will be <em>null</em>.</td>
<td>==Bot API 6.2+== Occurrs when the opened popup is closed. <br><em>eventHandler</em> receives an object with the single field <em>button_id</em> the value of the field <em>id</em> of the pressed button. If no buttons were pressed, the field <em>button_id</em> will be <em>null</em>.</td>
</tr>
<tr>
<td><code>qrTextReceived</code></td>
<td><mark>Bot API 6.4+</mark> Occurs when the QR code scanner catches a code with text data.<br><em>eventHandler</em> receives an object with the single field <em>data</em> containing text data from the QR code.</td>
<td>==Bot API 6.4+== Occurs when the QR code scanner catches a code with text data. <br><em>eventHandler</em> receives an object with the single field <em>data</em> containing text data from the QR code.</td>
</tr>
<tr>
<td><code>clipboardTextReceived</code></td>
<td><mark>Bot API 6.4+</mark> Occurrs when the <code>readTextFromClipboard</code> method is called.<br><em>eventHandler</em> receives an object with the single field <em>data</em> containing text data from the clipboard. If the clipboard contains non-text data, the field <em>data</em> will be an empty string. If the Mini App has no access to the clipboard, the field <em>data</em> will be <em>null</em>.</td>
<td>==Bot API 6.4+== Occurrs when the <code>readTextFromClipboard</code> method is called. <br><em>eventHandler</em> receives an object with the single field <em>data</em> containing text data from the clipboard. If the clipboard contains non-text data, the field <em>data</em> will be an empty string. If the Mini App has no access to the clipboard, the field <em>data</em> will be <em>null</em>.</td>
</tr>
<tr>
<td><code>writeAccessRequested</code></td>
<td><mark>Bot API 6.9+</mark> Occurs when the write permission was requested.<br><em>eventHandler</em> receives an object with the single field <em>status</em> containing one of the statuses:<br>- <strong>allowed</strong> user granted write permission to the bot,<br>- <strong>cancelled</strong> user declined this request.</td>
<td>==Bot API 6.9+== Occurs when the write permission was requested. <br><em>eventHandler</em> receives an object with the single field <em>status</em> containing one of the statuses: <br>- <strong>allowed</strong> user granted write permission to the bot, <br>- <strong>cancelled</strong> user declined this request.</td>
</tr>
<tr>
<td><code>contactRequested</code></td>
<td><mark>Bot API 6.9+</mark> Occurrs when the user&#39;s phone number was requested.<br><em>eventHandler</em> receives an object with the single field <em>status</em> containing one of the statuses:<br>- <strong>sent</strong> user shared their phone number with the bot,<br>- <strong>cancelled</strong> user declined this request.</td>
<td>==Bot API 6.9+== Occurrs when the user's phone number was requested. <br><em>eventHandler</em> receives an object with the single field <em>status</em> containing one of the statuses: <br>- <strong>sent</strong> user shared their phone number with the bot, <br>- <strong>cancelled</strong> user declined this request.</td>
</tr>
</tbody>
</table>
<h4><a class="anchor" name="adding-bots-to-the-attachment-menu" href="#adding-bots-to-the-attachment-menu"><i class="anchor-icon"></i></a>Adding Bots to the Attachment Menu</h4>
<p>Attachment menu integration is currently only available for major advertisers on the <a href="https://promote.telegram.org/basics">Telegram Ad Platform</a>. However, <strong>all bots</strong> can use it in the <a href="#using-bots-in-the-test-environment">test server environment</a>. Talk to Botfather on the test server to <a href="#using-bots-in-the-test-environment">set up the integration</a>.</p>
<h4><a class="anchor" href="#adding-bots-to-the-attachment-menu" id="adding-bots-to-the-attachment-menu" name="adding-bots-to-the-attachment-menu"><i class="anchor-icon"></i></a>Adding Bots to the Attachment Menu</h4>
<p>Attachment menu integration is currently only available for major advertisers on the <a href="https://promote.telegram.org/basics">Telegram Ad Platform</a>. However, <strong>all bots</strong> can use it in the <a href="#using-bots-in-the-test-environment">test server environment</a>. Talk to Botfather on the test server to <a href="#using-bots-in-the-test-environment">set up the integration</a>.</p>
<p>A special link is used to add bots to the attachment menu:</p>
<p><code>https://t.me/botusername?startattach</code><br>or<br><code>https://t.me/botusername?startattach=command</code></p>
<p><code>https://t.me/botusername?startattach</code>
or
<code>https://t.me/botusername?startattach=command</code></p>
<blockquote>
<p>For example, open this <a href="https://t.me/durgerkingbot?startattach">attachment menu link</a> for <em>@DurgerKingBot</em>, then use the <img class="icon" src="/file/464001085/2/E4hNXSNQimQ.2503/bf6ffcab3cb3afd43d" alt="Attach"> menu in any <strong>private chat</strong>.</p>
<p>For example, open this <a href="https://t.me/durgerkingbot?startattach">attachment menu link</a> for <em>@DurgerKingBot</em>, then use the <img src="/file/464001085/2/E4hNXSNQimQ.2503/bf6ffcab3cb3afd43d" alt="Attach"> menu in any <strong>private chat</strong>.</p>
</blockquote>
<p>Opening the link prompts the user to add the bot to their attachment menu. If the bot has already been added, the attachment menu will open in the current chat and redirect to the bot there (if the link is opened from a 1-on-1 chat). If a non-empty <em>startattach</em> parameter was included in the link, it will be passed to the Mini App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
<p>The following link formats are also supported:</p>
<p><code>https://t.me/username?attach=botusername</code><br><code>https://t.me/username?attach=botusername&amp;startattach=command</code><br><code>https://t.me/+1234567890?attach=botusername</code><br><code>https://t.me/+1234567890?attach=botusername&amp;startattach=command</code></p>
<p>These links open the Mini App in the attachment menu in the chat with a specific user. If the bot wasn&#39;t already added to the attachment menu, the user will be prompted to do so. If a non-empty <em>startattach</em> parameter was included in the link, it will be passed to the Mini App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
<p><mark>Bot API 6.1+</mark> supports a new link format:</p>
<p><code>https://t.me/botusername?startattach&amp;choose=users+bots</code><br><code>https://t.me/botusername?startattach=command&amp;choose=groups+channels</code></p>
<p>Opening such a link prompts the user to choose a specific chat and opens the attachment menu in that chat. If the bot wasn&#39;t already added to the attachment menu, the user will be prompted to do so. You can specify which types of chats the user will be able to choose from. It can be one or more of the following types: <em>users</em>, <em>bots</em>, <em>groups</em>, <em>channels</em> separated by a <code>+</code> sign. If a non-empty <em>startattach</em> parameter was included in the link, it will be passed to the Mini App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
<h3><a class="anchor" name="testing-mini-apps" href="#testing-mini-apps"><i class="anchor-icon"></i></a>Testing Mini Apps</h3>
<h4><a class="anchor" name="using-bots-in-the-test-environment" href="#using-bots-in-the-test-environment"><i class="anchor-icon"></i></a>Using bots in the test environment</h4>
<p><code>https://t.me/username?attach=botusername</code>
<code>https://t.me/username?attach=botusername&amp;startattach=command</code>
<code>https://t.me/+1234567890?attach=botusername</code>
<code>https://t.me/+1234567890?attach=botusername&amp;startattach=command</code></p>
<p>These links open the Mini App in the attachment menu in the chat with a specific user. If the bot wasn't already added to the attachment menu, the user will be prompted to do so. If a non-empty <em>startattach</em> parameter was included in the link, it will be passed to the Mini App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
<p>==Bot API 6.1+== supports a new link format:</p>
<p><code>https://t.me/botusername?startattach&amp;choose=users+bots</code>
<code>https://t.me/botusername?startattach=command&amp;choose=groups+channels</code></p>
<p>Opening such a link prompts the user to choose a specific chat and opens the attachment menu in that chat. If the bot wasn't already added to the attachment menu, the user will be prompted to do so. You can specify which types of chats the user will be able to choose from. It can be one or more of the following types: <em>users</em>, <em>bots</em>, <em>groups</em>, <em>channels</em> separated by a <code>+</code> sign. If a non-empty <em>startattach</em> parameter was included in the link, it will be passed to the Mini App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
<h3><a class="anchor" href="#testing-mini-apps" id="testing-mini-apps" name="testing-mini-apps"><i class="anchor-icon"></i></a>Testing Mini Apps</h3>
<h4><a class="anchor" href="#using-bots-in-the-test-environment" id="using-bots-in-the-test-environment" name="using-bots-in-the-test-environment"><i class="anchor-icon"></i></a>Using bots in the test environment</h4>
<p>To log in to the test environment, use either of the following:</p>
<ul>
<li><strong>iOS:</strong> tap 10 times on the Settings icon &gt; Accounts &gt; Login to another account &gt; Test.</li>
@ -1092,7 +1094,7 @@ if (hex(HMAC_SHA256(data_check_string, secret_key)) == hash) {
<blockquote>
<p><strong>Note:</strong> When working with the test environment, you may use HTTP links without TLS to test your Mini App.</p>
</blockquote>
<h4><a class="anchor" name="debug-mode-for-mini-apps" href="#debug-mode-for-mini-apps"><i class="anchor-icon"></i></a>Debug Mode for Mini Apps</h4>
<h4><a class="anchor" href="#debug-mode-for-mini-apps" id="debug-mode-for-mini-apps" name="debug-mode-for-mini-apps"><i class="anchor-icon"></i></a>Debug Mode for Mini Apps</h4>
<p>Use these tools to find app-specific issues in your Mini App:</p>
<p><strong>Android</strong></p>
<ul>
@ -1110,10 +1112,9 @@ if (hex(HMAC_SHA256(data_check_string, secret_key)) == hash) {
<p><strong>Telegram macOS</strong></p>
<ul>
<li>Download and launch the <a href="https://telegram.org/dl/macos/beta">Beta Version</a> of Telegram macOS.</li>
<li>Quickly click 5 times on the Settings icon to open the debug menu and enable “Debug Mini Apps”.</li>
<li>Quickly click 5 times on the Settings icon to open the debug menu and enable "Debug Mini Apps".</li>
<li>Right click in the Mini App and choose <em>Inspect Element</em>.</li>
</ul>
</div>
</ul></div>
</div>

View file

@ -98,7 +98,7 @@ Then, payloads are wrapped in the following envelope:</p>
<p>To request a quick ACK from the server for an encrypted MTProto payload, use the following envelope for <em>outgoing</em> messages, instead of the one specified above.</p>
<p>If the packet length divided by four is smaller than 127:</p>
<ul>
<li>Length: payload length, divided by four, plus 128, and encoded as a single byte (<code>(length/2)+128</code> or <code>(length &gt;&gt; 2) | (1 &lt;&lt; 7)</code>); i.e. the most significant bit must be set.</li>
<li>Length: payload length, divided by four, plus 128, and encoded as a single byte (<code>(length/4)+128</code> or <code>(length &gt;&gt; 2) | (1 &lt;&lt; 7)</code>); i.e. the most significant bit must be set.</li>
<li>Payload: the MTProto payload</li>
</ul>
<p>If the packet length divided by four is bigger than or equal to 127, the following envelope must be used, instead:</p>

View file

@ -53,9 +53,9 @@
<h5><a class="anchor" href="#1-client-sends-query-to-server" id="1-client-sends-query-to-server" name="1-client-sends-query-to-server"><i class="anchor-icon"></i></a>1) Client sends query to server</h5>
<!-- start req_pq_multi -->
<p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 D4 72 06 00 50 3D C5 65
0010 | 14 00 00 00 F1 8E 7E BE 40 67 09 F6 12 FA DF BE
0020 | C3 F0 28 9D 0A A6 7E EF</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 18 1D 06 00 89 0C EB 65
0010 | 14 00 00 00 F1 8E 7E BE 6C 5D 01 83 C0 9B 3D 4C
0020 | 65 0C 7A 02 E4 D8 BD F8</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;</code></pre>
<table class="table">
@ -77,7 +77,7 @@
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>D4720600503DC565</code></td>
<td><code>181D0600890CEB65</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -95,7 +95,7 @@
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>406709F612FADFBEC3F0289D0AA67EEF</code></td>
<td><code>6C5D0183C09B3D4C650C7A02E4D8BDF8</code></td>
<td>Random number</td>
</tr>
</tbody>
@ -104,11 +104,11 @@
<h5><a class="anchor" href="#2-server-sends-response-of-the-form" id="2-server-sends-response-of-the-form" name="2-server-sends-response-of-the-form"><i class="anchor-icon"></i></a>2) Server sends response of the form</h5>
<!-- start resPQ -->
<p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 D8 31 75 50 3D C5 65
0010 | A8 00 00 00 63 24 16 05 40 67 09 F6 12 FA DF BE
0020 | C3 F0 28 9D 0A A6 7E EF E1 1D BC 3B C9 7D 91 A2
0030 | 61 54 F9 32 AF 01 99 43 08 25 65 95 ED B7 76 67
0040 | 97 00 00 00 15 C4 B5 1C 03 00 00 00 A5 B7 F7 09
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 B4 BF 94 89 0C EB 65
0010 | B0 00 00 00 63 24 16 05 6C 5D 01 83 C0 9B 3D 4C
0020 | 65 0C 7A 02 E4 D8 BD F8 F3 9F 03 F1 56 5D 6D 00
0030 | 28 51 C6 FC AC 8A CD 0D 08 22 0D C2 2C A4 0D 5C
0040 | A7 00 00 00 15 C4 B5 1C 03 00 00 00 A5 B7 F7 09
0050 | 35 5F C3 0B 21 6B E8 6C 02 2B B4 C3 85 FD 64 DE
0060 | 85 1D 9D D0</code></pre>
<p>Payload (de)serialization:</p>
@ -132,13 +132,13 @@
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>01D83175503DC565</code></td>
<td><code>01B4BF94890CEB65</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
<td>message_length</td>
<td>16, 4</td>
<td><code>A8000000</code> (168 in decimal)</td>
<td><code>B0000000</code> (176 in decimal)</td>
<td>Message body length</td>
</tr>
<tr>
@ -150,19 +150,19 @@
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>406709F612FADFBEC3F0289D0AA67EEF</code></td>
<td><code>6C5D0183C09B3D4C650C7A02E4D8BDF8</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>E11DBC3BC97D91A26154F932AF019943</code></td>
<td><code>F39F03F1565D6D002851C6FCAC8ACD0D</code></td>
<td>Server-generated random number</td>
</tr>
<tr>
<td>pq</td>
<td>56, 12</td>
<td><code>08256595EDB7766797000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2694724800268887959</td>
<td><code>08220DC22CA40D5CA7000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2453830868973477031</td>
<td>Single-byte prefix denoting length, an 8-byte string, and three bytes of padding</td>
</tr>
<tr>
@ -208,22 +208,22 @@
<h4><a class="anchor" href="#proof-of-work" id="proof-of-work" name="proof-of-work"><i class="anchor-icon"></i></a>Proof of work</h4>
<h5><a class="anchor" href="#3-client-decomposes-pq-into-prime-factors-such-that-p-lt-q" id="3-client-decomposes-pq-into-prime-factors-such-that-p-lt-q" name="3-client-decomposes-pq-into-prime-factors-such-that-p-lt-q"><i class="anchor-icon"></i></a>3) Client decomposes pq into prime factors such that p &lt; q.</h5>
<!-- start pq -->
<pre><code>pq = 2694724800268887959</code></pre>
<p>Decompose into 2 prime cofactors <code>p &lt; q</code>: <code>2694724800268887959 = 1513098571 * 1780931429</code></p>
<pre><code>p = 1513098571
q = 1780931429</code></pre>
<pre><code>pq = 2453830868973477031</code></pre>
<p>Decompose into 2 prime cofactors <code>p &lt; q</code>: <code>2453830868973477031 = 1343866633 * 1825948207</code></p>
<pre><code>p = 1343866633
q = 1825948207</code></pre>
<!-- end pq -->
<h4><a class="anchor" href="#presenting-proof-of-work-server-authentication" id="presenting-proof-of-work-server-authentication" name="presenting-proof-of-work-server-authentication"><i class="anchor-icon"></i></a>Presenting proof of work; Server authentication</h4>
<h5><a class="anchor" href="#4-encrypted-data-payload-generation" id="4-encrypted-data-payload-generation" name="4-encrypted-data-payload-generation"><i class="anchor-icon"></i></a>4) <code>encrypted_data</code> payload generation</h5>
<p>First of all, generate an <code>encrypted_data</code> payload as follows:</p>
<!-- start p_q_inner_data_dc -->
<p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 95 5F F5 A9 08 25 65 95 ED B7 76 67 97 00 00 00
0010 | 04 5A 30 0D 4B 00 00 00 04 6A 26 DB 65 00 00 00
0020 | 40 67 09 F6 12 FA DF BE C3 F0 28 9D 0A A6 7E EF
0030 | E1 1D BC 3B C9 7D 91 A2 61 54 F9 32 AF 01 99 43
0040 | A8 BB C8 49 51 2D AC 6C 67 B6 EF D9 15 7D 6C A7
0050 | 37 7A 17 76 30 7D 84 26 5C 6B E9 BD CF 80 2A C1
<pre><code>0000 | 95 5F F5 A9 08 22 0D C2 2C A4 0D 5C A7 00 00 00
0010 | 04 50 19 C7 09 00 00 00 04 6C D5 C2 2F 00 00 00
0020 | 6C 5D 01 83 C0 9B 3D 4C 65 0C 7A 02 E4 D8 BD F8
0030 | F3 9F 03 F1 56 5D 6D 00 28 51 C6 FC AC 8A CD 0D
0040 | 2D 1F 97 69 1A D9 39 B4 94 C3 01 53 E1 9A A2 61
0050 | FB 11 10 FF 51 D2 5D 56 06 34 70 CA D9 8B 7D 1D
0060 | 02 00 00 00</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data;</code></pre>
@ -246,37 +246,37 @@ q = 1780931429</code></pre>
<tr>
<td>pq</td>
<td>4, 12</td>
<td><code>08256595EDB7766797000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2694724800268887959</td>
<td><code>08220DC22CA40D5CA7000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2453830868973477031</td>
<td>Single-byte prefix denoting length, 8-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>p</td>
<td>16, 8</td>
<td><code>045A300D4B000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1513098571</td>
<td><code>045019C709000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1343866633</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>q</td>
<td>24, 8</td>
<td><code>046A26DB65000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1780931429</td>
<td><code>046CD5C22F000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1825948207</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>nonce</td>
<td>32, 16</td>
<td><code>406709F612FADFBEC3F0289D0AA67EEF</code></td>
<td><code>6C5D0183C09B3D4C650C7A02E4D8BDF8</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>48, 16</td>
<td><code>E11DBC3BC97D91A26154F932AF019943</code></td>
<td><code>F39F03F1565D6D002851C6FCAC8ACD0D</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>new_nonce</td>
<td>64, 32</td>
<td><code>A8BBC849512DAC6C67B6EFD9157D6CA7</code> <code>377A1776307D84265C6BE9BDCF802AC1</code></td>
<td><code>2D1F97691AD939B494C30153E19AA261</code> <code>FB1110FF51D25D56063470CAD98B7D1D</code></td>
<td>Client-generated random number</td>
</tr>
<tr>
@ -291,39 +291,39 @@ q = 1780931429</code></pre>
<p>The serialization of <em>P_Q_inner_data</em> produces <strong>data</strong>, which is used to generate <strong>encrypted_data</strong> as specified in <a href="/mtproto/auth_key">step 4.1</a>.<br>
These are the inputs to the algorithm specified in <a href="/mtproto/auth_key">step 4.1</a>:</p>
<!-- start p_q_inner_data_input -->
<pre><code>data = 955FF5A908256595EDB7766797000000045A300D4B000000046A26DB65000000406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF019943A8BBC849512DAC6C67B6EFD9157D6CA7377A1776307D84265C6BE9BDCF802AC102000000
random_padding_bytes = D944BB8347C876177FE03C2562BF4E87258EF147A7815D8853AA4B1065A5A385D0DA7E0B6100FAF55728D04DFC84E7E0D20006E07E1CB036730F5B3209CF85B2365B39DE2CBC56F40B725AD347835E5D1973567ECE8A02CF343D54F7</code></pre>
<pre><code>data = 955FF5A908220DC22CA40D5CA7000000045019C709000000046CD5C22F0000006C5D0183C09B3D4C650C7A02E4D8BDF8F39F03F1565D6D002851C6FCAC8ACD0D2D1F97691AD939B494C30153E19AA261FB1110FF51D25D56063470CAD98B7D1D02000000
random_padding_bytes = 4347A0F58FFA3C09FD35129D919DE5F28204BB1881B4DFD74F34E8D37F1B2B174B8080BDD94DB34876588957B1A27EB6A4772FF102569EF27B2E578F3EF0B687B25025A6F22D214797C028053702E7E327622A09BBFCE461F08E17AB</code></pre>
<!-- end p_q_inner_data_input -->
<p>And this is the output:</p>
<!-- start p_q_inner_data_output -->
<pre><code>encrypted_data = B80632B3F0D1AB28EFAE2CF974C4A2D51A77FCB6DEFD415E1EC284CAB2B5F88D5C4C5B19AFF5E940CE14CCB6A7F340EC88DF7C1F091FB6F7323B047C02DC63212D0DEBE4B3B7A0310E26DB1289CBA24112DF37506C90DEAB797623E4AFF4643D2A921891346BC176C4E1CCE14F64FA59526DD021EFFA428E8F8ACEEB96DBD4729E99BBB26DDDC744D584B732415DFFE20418953F4EAFC81DADE5C6606A1E7FAA3EDB90F36ECF405422C97C360CC31A444B1EEB6C33D62C5802165C72BBC85D1ADBCCD17988DE7F43DA0F340502744B52B196A78EF1ED1372C6EA1232603FDB9C28F7F8783F29098FFD0FE9B066C460ECBA0A2962B82398C1B32D3DCB3BC3A59E</code></pre>
<pre><code>encrypted_data = E29CDFF0C375F9AA616187FCD985672C5DC7854BEAF2DCF07B1BDF7E51DA27CB15CD1F5A8DA506C6C877334ED1A148B09D5322FA4F066B502996B4D483D56A2DA40F253CC65F3EE4B0D3D778CB716DA0E710D57EB9FF959A4D3D6A557329CC0E01F74127B7F6B99DAC0E63E44538CF6F3B7FD8B076DC13DDECF55CE62B33F7928B3301870860690F1E15541BBE3CE1F2995D91C6CA352BAB250D06B6FA0F2A095B07009379108B37FFF3BBF01E119449BADDADF175411DA2E5E33C849BE410DCAEF6CE325A33B9F602E064EE47EDDD1C083E17CF8E0465EA838C98535CFC5043C754BF3B1954DED2140FB28FA523C54727F1DEE9544673EB1B82ABB53F567A60</code></pre>
<!-- end p_q_inner_data_output -->
<p>The length of the final string is 256 bytes.</p>
<h5><a class="anchor" href="#5-send-req-dh-params-query-with-generated-encrypted-data" id="5-send-req-dh-params-query-with-generated-encrypted-data" name="5-send-req-dh-params-query-with-generated-encrypted-data"><i class="anchor-icon"></i></a>5) Send req_DH_params query with generated <code>encrypted_data</code></h5>
<!-- start req_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 D8 72 06 00 50 3D C5 65
0010 | 40 01 00 00 BE E4 12 D7 40 67 09 F6 12 FA DF BE
0020 | C3 F0 28 9D 0A A6 7E EF E1 1D BC 3B C9 7D 91 A2
0030 | 61 54 F9 32 AF 01 99 43 04 5A 30 0D 4B 00 00 00
0040 | 04 6A 26 DB 65 00 00 00 85 FD 64 DE 85 1D 9D D0
0050 | FE 00 01 00 B8 06 32 B3 F0 D1 AB 28 EF AE 2C F9
0060 | 74 C4 A2 D5 1A 77 FC B6 DE FD 41 5E 1E C2 84 CA
0070 | B2 B5 F8 8D 5C 4C 5B 19 AF F5 E9 40 CE 14 CC B6
0080 | A7 F3 40 EC 88 DF 7C 1F 09 1F B6 F7 32 3B 04 7C
0090 | 02 DC 63 21 2D 0D EB E4 B3 B7 A0 31 0E 26 DB 12
00A0 | 89 CB A2 41 12 DF 37 50 6C 90 DE AB 79 76 23 E4
00B0 | AF F4 64 3D 2A 92 18 91 34 6B C1 76 C4 E1 CC E1
00C0 | 4F 64 FA 59 52 6D D0 21 EF FA 42 8E 8F 8A CE EB
00D0 | 96 DB D4 72 9E 99 BB B2 6D DD C7 44 D5 84 B7 32
00E0 | 41 5D FF E2 04 18 95 3F 4E AF C8 1D AD E5 C6 60
00F0 | 6A 1E 7F AA 3E DB 90 F3 6E CF 40 54 22 C9 7C 36
0100 | 0C C3 1A 44 4B 1E EB 6C 33 D6 2C 58 02 16 5C 72
0110 | BB C8 5D 1A DB CC D1 79 88 DE 7F 43 DA 0F 34 05
0120 | 02 74 4B 52 B1 96 A7 8E F1 ED 13 72 C6 EA 12 32
0130 | 60 3F DB 9C 28 F7 F8 78 3F 29 09 8F FD 0F E9 B0
0140 | 66 C4 60 EC BA 0A 29 62 B8 23 98 C1 B3 2D 3D CB
0150 | 3B C3 A5 9E</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 F4 F2 09 00 89 0C EB 65
0010 | 40 01 00 00 BE E4 12 D7 6C 5D 01 83 C0 9B 3D 4C
0020 | 65 0C 7A 02 E4 D8 BD F8 F3 9F 03 F1 56 5D 6D 00
0030 | 28 51 C6 FC AC 8A CD 0D 04 50 19 C7 09 00 00 00
0040 | 04 6C D5 C2 2F 00 00 00 85 FD 64 DE 85 1D 9D D0
0050 | FE 00 01 00 E2 9C DF F0 C3 75 F9 AA 61 61 87 FC
0060 | D9 85 67 2C 5D C7 85 4B EA F2 DC F0 7B 1B DF 7E
0070 | 51 DA 27 CB 15 CD 1F 5A 8D A5 06 C6 C8 77 33 4E
0080 | D1 A1 48 B0 9D 53 22 FA 4F 06 6B 50 29 96 B4 D4
0090 | 83 D5 6A 2D A4 0F 25 3C C6 5F 3E E4 B0 D3 D7 78
00A0 | CB 71 6D A0 E7 10 D5 7E B9 FF 95 9A 4D 3D 6A 55
00B0 | 73 29 CC 0E 01 F7 41 27 B7 F6 B9 9D AC 0E 63 E4
00C0 | 45 38 CF 6F 3B 7F D8 B0 76 DC 13 DD EC F5 5C E6
00D0 | 2B 33 F7 92 8B 33 01 87 08 60 69 0F 1E 15 54 1B
00E0 | BE 3C E1 F2 99 5D 91 C6 CA 35 2B AB 25 0D 06 B6
00F0 | FA 0F 2A 09 5B 07 00 93 79 10 8B 37 FF F3 BB F0
0100 | 1E 11 94 49 BA DD AD F1 75 41 1D A2 E5 E3 3C 84
0110 | 9B E4 10 DC AE F6 CE 32 5A 33 B9 F6 02 E0 64 EE
0120 | 47 ED DD 1C 08 3E 17 CF 8E 04 65 EA 83 8C 98 53
0130 | 5C FC 50 43 C7 54 BF 3B 19 54 DE D2 14 0F B2 8F
0140 | A5 23 C5 47 27 F1 DE E9 54 46 73 EB 1B 82 AB B5
0150 | 3F 56 7A 60</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params;</code></pre>
<table class="table">
@ -345,7 +345,7 @@ random_padding_bytes = D944BB8347C876177FE03C2562BF4E87258EF147A7815D8853AA4B106
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>D8720600503DC565</code></td>
<td><code>F4F20900890CEB65</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -363,25 +363,25 @@ random_padding_bytes = D944BB8347C876177FE03C2562BF4E87258EF147A7815D8853AA4B106
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>406709F612FADFBEC3F0289D0AA67EEF</code></td>
<td><code>6C5D0183C09B3D4C650C7A02E4D8BDF8</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>E11DBC3BC97D91A26154F932AF019943</code></td>
<td><code>F39F03F1565D6D002851C6FCAC8ACD0D</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>p</td>
<td>56, 8</td>
<td><code>045A300D4B000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1513098571</td>
<td><code>045019C709000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1343866633</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>q</td>
<td>64, 8</td>
<td><code>046A26DB65000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1780931429</td>
<td><code>046CD5C22F000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1825948207</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
@ -393,7 +393,7 @@ random_padding_bytes = D944BB8347C876177FE03C2562BF4E87258EF147A7815D8853AA4B106
<tr>
<td>encrypted_data</td>
<td>80, 260</td>
<td><code>FE000100B80632B3F0D1AB28EFAE2CF9</code> <code>74C4A2D51A77FCB6DEFD415E1EC284CA</code> <code>B2B5F88D5C4C5B19AFF5E940CE14CCB6</code> <code>A7F340EC88DF7C1F091FB6F7323B047C</code> <code>02DC63212D0DEBE4B3B7A0310E26DB12</code> <code>89CBA24112DF37506C90DEAB797623E4</code> <code>AFF4643D2A921891346BC176C4E1CCE1</code> <code>4F64FA59526DD021EFFA428E8F8ACEEB</code> <code>96DBD4729E99BBB26DDDC744D584B732</code> <code>415DFFE20418953F4EAFC81DADE5C660</code> <code>6A1E7FAA3EDB90F36ECF405422C97C36</code> <code>0CC31A444B1EEB6C33D62C5802165C72</code> <code>BBC85D1ADBCCD17988DE7F43DA0F3405</code> <code>02744B52B196A78EF1ED1372C6EA1232</code> <code>603FDB9C28F7F8783F29098FFD0FE9B0</code> <code>66C460ECBA0A2962B82398C1B32D3DCB</code><br> <code>3BC3A59E</code></td>
<td><code>FE000100E29CDFF0C375F9AA616187FC</code> <code>D985672C5DC7854BEAF2DCF07B1BDF7E</code> <code>51DA27CB15CD1F5A8DA506C6C877334E</code> <code>D1A148B09D5322FA4F066B502996B4D4</code> <code>83D56A2DA40F253CC65F3EE4B0D3D778</code> <code>CB716DA0E710D57EB9FF959A4D3D6A55</code> <code>7329CC0E01F74127B7F6B99DAC0E63E4</code> <code>4538CF6F3B7FD8B076DC13DDECF55CE6</code> <code>2B33F7928B3301870860690F1E15541B</code> <code>BE3CE1F2995D91C6CA352BAB250D06B6</code> <code>FA0F2A095B07009379108B37FFF3BBF0</code> <code>1E119449BADDADF175411DA2E5E33C84</code> <code>9BE410DCAEF6CE325A33B9F602E064EE</code> <code>47EDDD1C083E17CF8E0465EA838C9853</code> <code>5CFC5043C754BF3B1954DED2140FB28F</code> <code>A523C54727F1DEE9544673EB1B82ABB5</code><br> <code>3F567A60</code></td>
<td>Value generated above</td>
</tr>
</tbody>
@ -402,47 +402,47 @@ random_padding_bytes = D944BB8347C876177FE03C2562BF4E87258EF147A7815D8853AA4B106
<h5><a class="anchor" href="#6-server-responds-with" id="6-server-responds-with" name="6-server-responds-with"><i class="anchor-icon"></i></a>6) Server responds with:</h5>
<!-- start server_DH_params_ok -->
<p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 4C 6E 1E 51 3D C5 65
0010 | C4 02 00 00 5C 07 E8 D0 40 67 09 F6 12 FA DF BE
0020 | C3 F0 28 9D 0A A6 7E EF E1 1D BC 3B C9 7D 91 A2
0030 | 61 54 F9 32 AF 01 99 43 FE 50 02 00 6A D7 DD 5D
0040 | 8B 25 26 C7 61 AB E5 0E 93 C8 2A 6F 33 1B 1E AE
0050 | 0A D0 11 89 3D A9 76 E3 77 1D 4A A4 52 09 D2 34
0060 | FE A6 56 42 98 53 86 B8 17 BF 89 80 F5 17 F6 D3
0070 | 2D BE B4 7E 34 53 45 56 F9 50 DD F9 60 DB 72 1A
0080 | 48 48 02 31 61 91 61 11 26 82 C6 04 6D 56 29 C7
0090 | 1C D1 EC 80 61 DF CD D7 04 70 3E C7 A8 AE BD CB
00A0 | D1 59 57 9F C8 88 6D 9F A5 1E 00 9A F4 9B 5A B9
00B0 | 0C 76 28 EB 81 C9 78 8A 2E B6 AC 0E 75 7A 7D EB
00C0 | E3 D9 49 F8 0A 99 0B ED B4 D2 DB AE 43 F0 03 28
00D0 | B8 2F 4D 8F C8 3A 9B 9C FE EF 46 7E 15 93 BB 45
00E0 | 79 EE 32 41 2F 16 7A 78 0C FA 51 76 50 BD 0E B5
00F0 | 1C BF B5 0E 3A FE 97 88 39 46 61 31 FC D9 56 71
0100 | 1E 63 61 4F 00 6A 55 ED 35 ED 2B 1F 83 3C 29 F4
0110 | FD 7A 84 F0 C8 F1 C1 0D FC 1A 1A AF 9A 8A 57 10
0120 | 8D EC F2 06 E3 96 84 06 F0 FB 25 E9 22 DF 15 4F
0130 | 49 7B 51 52 7E 48 34 20 2F AB 47 7A 13 7D 0A 99
0140 | D1 C3 47 19 6F BA 10 69 9F 52 EA 56 F0 1E F9 38
0150 | 29 B3 10 A5 C9 7D B9 5F D5 7E 64 41 7E 52 6E B9
0160 | 20 D2 61 15 7C 6E 38 79 1B DD 53 89 EE B7 44 E0
0170 | 75 D9 52 DB 33 A8 15 12 07 D0 AB 3C 62 9E 30 A7
0180 | 23 A5 20 5F 8F A1 83 98 93 7E D2 71 4A 4E 76 A5
0190 | F4 51 25 08 A4 BE 1B 4D 6A E4 6F D1 56 C6 F0 63
01A0 | 47 AF 5E 07 CE 49 27 91 95 13 3B 07 CC E4 BC 67
01B0 | 75 D8 8F 36 11 18 0D 23 C4 C7 09 46 61 9A D7 59
01C0 | AB 9F 18 3A 38 5C CF 9B F1 93 15 FA DB E8 A4 FD
01D0 | C7 48 AF 52 DF 93 03 45 90 9C 87 0D E4 B4 89 01
01E0 | E9 F9 0E 56 D7 4C A5 34 D8 E1 FE 3A 35 A9 2A 18
01F0 | D6 76 95 8E B8 FC 3D 82 F9 CE E3 08 DF 2A 9E 4C
0200 | CD 23 FF 89 EA 25 5B 9E ED BC 33 78 14 88 79 66
0210 | 6F FC 2E 19 A4 31 CB B5 7A E1 A0 10 FF E5 CB 39
0220 | AB F1 31 AD D9 E9 0B F9 69 A1 12 C4 35 50 9B 78
0230 | 96 0E 0B 20 03 1C 82 21 90 84 15 61 E8 39 04 46
0240 | 22 76 60 BB AC CF 3D 53 57 4B FB A3 3B F4 76 E3
0250 | BD C9 EB 68 0A A2 A1 7F D6 75 6F 65 27 25 ED 03
0260 | 13 E5 EB 0F D6 A9 C8 C9 49 EE FB E8 09 A8 93 11
0270 | BF 20 F4 00 55 CA 25 FD 16 9D C1 3E E1 4B 31 50
0280 | 92 FD E4 18 46 38 D8 49 68 2F D8 62</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 64 78 42 8A 0C EB 65
0010 | DC 02 00 00 5C 07 E8 D0 6C 5D 01 83 C0 9B 3D 4C
0020 | 65 0C 7A 02 E4 D8 BD F8 F3 9F 03 F1 56 5D 6D 00
0030 | 28 51 C6 FC AC 8A CD 0D FE 50 02 00 FC 5B 35 4A
0040 | 74 FF 07 4F 47 36 CD 0C 00 15 17 6F 2F 85 8D 3A
0050 | 2D FC 31 74 2A 4B DC 67 CD 55 FF 1E 0B 1C E7 5D
0060 | 39 2A F5 7B D8 C4 A0 B9 00 8C 9B 8D C2 20 B8 67
0070 | 53 0C CB C2 BB 5F 74 91 09 3C 3B CD 51 F2 7E 71
0080 | AD E0 10 ED 22 A4 F6 16 71 D3 5E AB 57 61 8C 0C
0090 | 1A 35 99 8F C1 4A 91 7C CD 6C 63 C8 3E A3 36 EA
00A0 | 9C 40 16 48 7D 9A 18 DB 4F DC 65 0C A8 DF F7 F3
00B0 | FC 8B 78 D5 0E DA FE 30 F2 01 52 AA 2F EB 0C 14
00C0 | C1 20 38 8E 0B 28 EC 8E 3D 4B 49 05 A7 96 64 FE
00D0 | 99 7C 8E 4A 43 52 32 9A E0 0B 62 84 F7 38 2C DA
00E0 | 1B 19 E5 36 EE 68 6E 90 3D 82 13 B5 D4 CD 8E 2B
00F0 | E0 2B 3E 98 83 92 A7 3B 7B F8 FB 7B 02 82 EA 85
0100 | 3F 5C EF 28 2C 8F 1B DB 7D 46 4C DC 09 54 63 B7
0110 | A7 E9 87 87 94 26 B3 E6 6E 8A 39 EE 8A 0A D5 94
0120 | AC 87 AD 5E 4A 38 E4 07 FE D3 E7 0E B5 30 0A AE
0130 | 05 87 4E 0E 81 F2 24 E2 F5 7C 37 0F 48 48 78 90
0140 | 5F 7A 04 35 EC 4F F0 6E 47 72 23 16 3D AA E0 7F
0150 | AE C5 FB 3B 64 48 AD 9C 38 90 FB E0 1A 95 7F 8C
0160 | DD 37 83 CD AF 78 AC 60 68 4E F4 C9 A0 7D E2 21
0170 | 1F F9 C1 86 5F 74 5E 4A 4A 2C 56 74 7E 49 63 47
0180 | 35 64 A1 98 40 C1 82 66 9C FE 84 63 A0 37 6E 3F
0190 | B5 FB B0 47 DA 0B 87 C1 88 A5 B3 26 33 CF 55 EE
01A0 | 1B D9 35 B5 6B F8 0E 44 77 B1 84 6A 9C B2 79 50
01B0 | 3E 6C 44 EB 00 91 B0 EC A1 08 0E ED 47 44 CF 55
01C0 | 89 B8 92 6C 5C 8B 6E 78 B2 14 B7 46 83 4E B0 7C
01D0 | DB 37 B3 F3 C3 7D E7 BD F7 28 65 5B 4C 6D 32 E7
01E0 | D9 F8 A2 84 05 62 29 9D 10 32 2C 29 D8 03 13 EA
01F0 | 17 A2 8B 0C 86 85 A4 26 F7 0E FE BA 8D 57 EE D1
0200 | B7 E6 0D 11 17 BF A3 F9 49 B1 10 CB E2 08 54 C2
0210 | F1 AB 4C 37 A0 91 60 08 AB 20 63 B6 75 E2 32 97
0220 | 9B D9 94 83 69 57 A1 86 1B CD 63 CE 8A C2 D1 EE
0230 | 99 97 DC 48 F5 4F 68 F4 C1 83 85 D4 47 A9 42 83
0240 | 91 A2 C7 77 13 FE 4C C7 5B 92 1C 7C 2E BA A2 80
0250 | 16 C5 40 12 8B 17 9B F5 63 27 90 27 3E F1 64 7F
0260 | AA 5B 98 27 DD 89 C2 9D 61 ED DD A7 68 E8 AF C4
0270 | F0 4F BA 8B 02 5E F4 B4 45 1C 71 DB 63 26 52 92
0280 | 84 27 BE 66 B6 F1 FE 0A 88 94 3B 2F</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;</code></pre>
<table class="table">
@ -464,13 +464,13 @@ random_padding_bytes = D944BB8347C876177FE03C2562BF4E87258EF147A7815D8853AA4B106
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>014C6E1E513DC565</code></td>
<td><code>016478428A0CEB65</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
<td>message_length</td>
<td>16, 4</td>
<td><code>C4020000</code> (708 in decimal)</td>
<td><code>DC020000</code> (732 in decimal)</td>
<td>Message body length</td>
</tr>
<tr>
@ -482,19 +482,19 @@ random_padding_bytes = D944BB8347C876177FE03C2562BF4E87258EF147A7815D8853AA4B106
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>406709F612FADFBEC3F0289D0AA67EEF</code></td>
<td><code>6C5D0183C09B3D4C650C7A02E4D8BDF8</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>E11DBC3BC97D91A26154F932AF019943</code></td>
<td><code>F39F03F1565D6D002851C6FCAC8ACD0D</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>encrypted_answer</td>
<td>56, 596</td>
<td><code>FE5002006AD7DD5D8B2526C761ABE50E</code> <code>93C82A6F331B1EAE0AD011893DA976E3</code> <code>771D4AA45209D234FEA65642985386B8</code> <code>17BF8980F517F6D32DBEB47E34534556</code> <code>F950DDF960DB721A4848023161916111</code> <code>2682C6046D5629C71CD1EC8061DFCDD7</code> <code>04703EC7A8AEBDCBD159579FC8886D9F</code> <code>A51E009AF49B5AB90C7628EB81C9788A</code> <code>2EB6AC0E757A7DEBE3D949F80A990BED</code> <code>B4D2DBAE43F00328B82F4D8FC83A9B9C</code> <code>FEEF467E1593BB4579EE32412F167A78</code> <code>0CFA517650BD0EB51CBFB50E3AFE9788</code> <code>39466131FCD956711E63614F006A55ED</code> <code>35ED2B1F833C29F4FD7A84F0C8F1C10D</code> <code>FC1A1AAF9A8A57108DECF206E3968406</code> <code>F0FB25E922DF154F497B51527E483420</code> <code>2FAB477A137D0A99D1C347196FBA1069</code> <code>9F52EA56F01EF93829B310A5C97DB95F</code> <code>D57E64417E526EB920D261157C6E3879</code> <code>1BDD5389EEB744E075D952DB33A81512</code> <code>07D0AB3C629E30A723A5205F8FA18398</code> <code>937ED2714A4E76A5F4512508A4BE1B4D</code> <code>6AE46FD156C6F06347AF5E07CE492791</code> <code>95133B07CCE4BC6775D88F3611180D23</code> <code>C4C70946619AD759AB9F183A385CCF9B</code> <code>F19315FADBE8A4FDC748AF52DF930345</code> <code>909C870DE4B48901E9F90E56D74CA534</code> <code>D8E1FE3A35A92A18D676958EB8FC3D82</code> <code>F9CEE308DF2A9E4CCD23FF89EA255B9E</code> <code>EDBC3378148879666FFC2E19A431CBB5</code> <code>7AE1A010FFE5CB39ABF131ADD9E90BF9</code> <code>69A112C435509B78960E0B20031C8221</code> <code>90841561E8390446227660BBACCF3D53</code> <code>574BFBA33BF476E3BDC9EB680AA2A17F</code> <code>D6756F652725ED0313E5EB0FD6A9C8C9</code> <code>49EEFBE809A89311BF20F40055CA25FD</code> <code>169DC13EE14B315092FDE4184638D849</code><br> <code>682FD862</code></td>
<td><code>FE500200FC5B354A74FF074F4736CD0C</code> <code>0015176F2F858D3A2DFC31742A4BDC67</code> <code>CD55FF1E0B1CE75D392AF57BD8C4A0B9</code> <code>008C9B8DC220B867530CCBC2BB5F7491</code> <code>093C3BCD51F27E71ADE010ED22A4F616</code> <code>71D35EAB57618C0C1A35998FC14A917C</code> <code>CD6C63C83EA336EA9C4016487D9A18DB</code> <code>4FDC650CA8DFF7F3FC8B78D50EDAFE30</code> <code>F20152AA2FEB0C14C120388E0B28EC8E</code> <code>3D4B4905A79664FE997C8E4A4352329A</code> <code>E00B6284F7382CDA1B19E536EE686E90</code> <code>3D8213B5D4CD8E2BE02B3E988392A73B</code> <code>7BF8FB7B0282EA853F5CEF282C8F1BDB</code> <code>7D464CDC095463B7A7E987879426B3E6</code> <code>6E8A39EE8A0AD594AC87AD5E4A38E407</code> <code>FED3E70EB5300AAE05874E0E81F224E2</code> <code>F57C370F484878905F7A0435EC4FF06E</code> <code>477223163DAAE07FAEC5FB3B6448AD9C</code> <code>3890FBE01A957F8CDD3783CDAF78AC60</code> <code>684EF4C9A07DE2211FF9C1865F745E4A</code> <code>4A2C56747E4963473564A19840C18266</code> <code>9CFE8463A0376E3FB5FBB047DA0B87C1</code> <code>88A5B32633CF55EE1BD935B56BF80E44</code> <code>77B1846A9CB279503E6C44EB0091B0EC</code> <code>A1080EED4744CF5589B8926C5C8B6E78</code> <code>B214B746834EB07CDB37B3F3C37DE7BD</code> <code>F728655B4C6D32E7D9F8A2840562299D</code> <code>10322C29D80313EA17A28B0C8685A426</code> <code>F70EFEBA8D57EED1B7E60D1117BFA3F9</code> <code>49B110CBE20854C2F1AB4C37A0916008</code> <code>AB2063B675E232979BD994836957A186</code> <code>1BCD63CE8AC2D1EE9997DC48F54F68F4</code> <code>C18385D447A9428391A2C77713FE4CC7</code> <code>5B921C7C2EBAA28016C540128B179BF5</code> <code>632790273EF1647FAA5B9827DD89C29D</code> <code>61EDDDA768E8AFC4F04FBA8B025EF4B4</code> <code>451C71DB632652928427BE66B6F1FE0A</code><br> <code>88943B2F</code></td>
<td>See below</td>
</tr>
</tbody>
@ -502,20 +502,20 @@ random_padding_bytes = D944BB8347C876177FE03C2562BF4E87258EF147A7815D8853AA4B106
<!-- end server_DH_params_ok -->
<p>Decrypt <code>encrypted_answer</code> using the reverse of the process specified in <a href="/mtproto/auth_key#6-server-responds-with">step 6</a>:</p>
<!-- start server_DH_inner_data_input -->
<pre><code>encrypted_answer = 6AD7DD5D8B2526C761ABE50E93C82A6F331B1EAE0AD011893DA976E3771D4AA45209D234FEA65642985386B817BF8980F517F6D32DBEB47E34534556F950DDF960DB721A48480231619161112682C6046D5629C71CD1EC8061DFCDD704703EC7A8AEBDCBD159579FC8886D9FA51E009AF49B5AB90C7628EB81C9788A2EB6AC0E757A7DEBE3D949F80A990BEDB4D2DBAE43F00328B82F4D8FC83A9B9CFEEF467E1593BB4579EE32412F167A780CFA517650BD0EB51CBFB50E3AFE978839466131FCD956711E63614F006A55ED35ED2B1F833C29F4FD7A84F0C8F1C10DFC1A1AAF9A8A57108DECF206E3968406F0FB25E922DF154F497B51527E4834202FAB477A137D0A99D1C347196FBA10699F52EA56F01EF93829B310A5C97DB95FD57E64417E526EB920D261157C6E38791BDD5389EEB744E075D952DB33A8151207D0AB3C629E30A723A5205F8FA18398937ED2714A4E76A5F4512508A4BE1B4D6AE46FD156C6F06347AF5E07CE49279195133B07CCE4BC6775D88F3611180D23C4C70946619AD759AB9F183A385CCF9BF19315FADBE8A4FDC748AF52DF930345909C870DE4B48901E9F90E56D74CA534D8E1FE3A35A92A18D676958EB8FC3D82F9CEE308DF2A9E4CCD23FF89EA255B9EEDBC3378148879666FFC2E19A431CBB57AE1A010FFE5CB39ABF131ADD9E90BF969A112C435509B78960E0B20031C822190841561E8390446227660BBACCF3D53574BFBA33BF476E3BDC9EB680AA2A17FD6756F652725ED0313E5EB0FD6A9C8C949EEFBE809A89311BF20F40055CA25FD169DC13EE14B315092FDE4184638D849682FD862
tmp_aes_key = 5EA702F743E850F5546E857F08B7D5337BBAEDF9B61248751594851BE2E8C297
tmp_aes_iv = 1CEF8E372A63D97EBFA805C0DBB018BC7C1E0931693FBCB1A1AFC0C0A8BBC849</code></pre>
<pre><code>encrypted_answer = FC5B354A74FF074F4736CD0C0015176F2F858D3A2DFC31742A4BDC67CD55FF1E0B1CE75D392AF57BD8C4A0B9008C9B8DC220B867530CCBC2BB5F7491093C3BCD51F27E71ADE010ED22A4F61671D35EAB57618C0C1A35998FC14A917CCD6C63C83EA336EA9C4016487D9A18DB4FDC650CA8DFF7F3FC8B78D50EDAFE30F20152AA2FEB0C14C120388E0B28EC8E3D4B4905A79664FE997C8E4A4352329AE00B6284F7382CDA1B19E536EE686E903D8213B5D4CD8E2BE02B3E988392A73B7BF8FB7B0282EA853F5CEF282C8F1BDB7D464CDC095463B7A7E987879426B3E66E8A39EE8A0AD594AC87AD5E4A38E407FED3E70EB5300AAE05874E0E81F224E2F57C370F484878905F7A0435EC4FF06E477223163DAAE07FAEC5FB3B6448AD9C3890FBE01A957F8CDD3783CDAF78AC60684EF4C9A07DE2211FF9C1865F745E4A4A2C56747E4963473564A19840C182669CFE8463A0376E3FB5FBB047DA0B87C188A5B32633CF55EE1BD935B56BF80E4477B1846A9CB279503E6C44EB0091B0ECA1080EED4744CF5589B8926C5C8B6E78B214B746834EB07CDB37B3F3C37DE7BDF728655B4C6D32E7D9F8A2840562299D10322C29D80313EA17A28B0C8685A426F70EFEBA8D57EED1B7E60D1117BFA3F949B110CBE20854C2F1AB4C37A0916008AB2063B675E232979BD994836957A1861BCD63CE8AC2D1EE9997DC48F54F68F4C18385D447A9428391A2C77713FE4CC75B921C7C2EBAA28016C540128B179BF5632790273EF1647FAA5B9827DD89C29D61EDDDA768E8AFC4F04FBA8B025EF4B4451C71DB632652928427BE66B6F1FE0A88943B2F
tmp_aes_key = D67A9AF27A626BEB5A05876F54041BEB5B740B5AD508AFF47098B475BFF245C9
tmp_aes_iv = 633E1706BCD8F7B53618C96E9156EA9D01C547EE97A967AFC46D7AF92D1F9769</code></pre>
<!-- end server_DH_inner_data_input -->
<p>Yielding:</p>
<!-- start server_DH_inner_data_output -->
<pre><code>answer_with_hash = 60026275CC91DDEC5371C67B10331C4C1D362585BA0D89B5406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF01994303000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001000A77200BDFF6E6C4C126A2C41DF310AB3A3BDBD698CD480749E1F3C64FB1CFC9DFC70AC6F1AA671019620A640055B2CF7D7D99CC86533645C0FA000954DE2987BAD68D7450CF134C9F0305F34C1BB285DA8233F65970A01C4BD3AFD5EA3CD5864B8F1DCB35D5E9737DF15063C54CF53048EF519A280498DDDAF23764F29FFB0C5813CAAD90C319BE8592B78C4BE815E65ADA7C62EA23754B5A2C5A86C4721872D0CC48E0F895C3EBE186E81E5F0E88A6B3F09101C409AF3410B64238FBF2A2095E3F3B7FFC7EB3A02A319B99A155647BC59958BCDFED8A1CC6EB7F13F8600E521D9D0247B0F639F2FA3B09F72987781F71C0E8AA950167DE5092380B4853E7F1513DC565C26F8049523E89D2
answer = BA0D89B5406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF01994303000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001000A77200BDFF6E6C4C126A2C41DF310AB3A3BDBD698CD480749E1F3C64FB1CFC9DFC70AC6F1AA671019620A640055B2CF7D7D99CC86533645C0FA000954DE2987BAD68D7450CF134C9F0305F34C1BB285DA8233F65970A01C4BD3AFD5EA3CD5864B8F1DCB35D5E9737DF15063C54CF53048EF519A280498DDDAF23764F29FFB0C5813CAAD90C319BE8592B78C4BE815E65ADA7C62EA23754B5A2C5A86C4721872D0CC48E0F895C3EBE186E81E5F0E88A6B3F09101C409AF3410B64238FBF2A2095E3F3B7FFC7EB3A02A319B99A155647BC59958BCDFED8A1CC6EB7F13F8600E521D9D0247B0F639F2FA3B09F72987781F71C0E8AA950167DE5092380B4853E7F1513DC565C26F8049523E89D2</code></pre>
<pre><code>answer_with_hash = 3CEEF63E6429077AC0AF699997900135D70CBADEBA0D89B56C5D0183C09B3D4C650C7A02E4D8BDF8F39F03F1565D6D002851C6FCAC8ACD0D03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001006039629EBA52516DC5B01C7C7F28BE83F751F923A88085CC05C25F388E6031FFBDC0821E95B2E859E0E1FB132F6CC448DF87D23823055E13B4F8A9F1656B71424521EE9C0B806CF8FEB8A3331BA08694FD538A92A50F6A15382ED36D15EB3DB939232FC8965BA089AC4A6E03F5187E5BB1E2E80B559B944B613A588A61F984C177D453EFA668B93F97AB8819018D937C9BFAFF671C115D710EC9784B2DD1F52628466E5B070E30A43CFF773713383359D49C41330AFC2A6EAB26393E72E102A5CDF6C7E26648D9902B75B39CD4CC4D2F6E2E9B38B54FFF23292894B6BD403EFE742A88EAF2742DD50234A8D2BE05E7D506174EB47E11EEA074A0FC226D4D9D358A0CEB6527AF3FBAABC99484
answer = BA0D89B56C5D0183C09B3D4C650C7A02E4D8BDF8F39F03F1565D6D002851C6FCAC8ACD0D03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001006039629EBA52516DC5B01C7C7F28BE83F751F923A88085CC05C25F388E6031FFBDC0821E95B2E859E0E1FB132F6CC448DF87D23823055E13B4F8A9F1656B71424521EE9C0B806CF8FEB8A3331BA08694FD538A92A50F6A15382ED36D15EB3DB939232FC8965BA089AC4A6E03F5187E5BB1E2E80B559B944B613A588A61F984C177D453EFA668B93F97AB8819018D937C9BFAFF671C115D710EC9784B2DD1F52628466E5B070E30A43CFF773713383359D49C41330AFC2A6EAB26393E72E102A5CDF6C7E26648D9902B75B39CD4CC4D2F6E2E9B38B54FFF23292894B6BD403EFE742A88EAF2742DD50234A8D2BE05E7D506174EB47E11EEA074A0FC226D4D9D358A0CEB6527AF3FBAABC99484</code></pre>
<!-- end server_DH_inner_data_output -->
<!-- start server_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | BA 0D 89 B5 40 67 09 F6 12 FA DF BE C3 F0 28 9D
0010 | 0A A6 7E EF E1 1D BC 3B C9 7D 91 A2 61 54 F9 32
0020 | AF 01 99 43 03 00 00 00 FE 00 01 00 C7 1C AE B9
<pre><code>0000 | BA 0D 89 B5 6C 5D 01 83 C0 9B 3D 4C 65 0C 7A 02
0010 | E4 D8 BD F8 F3 9F 03 F1 56 5D 6D 00 28 51 C6 FC
0020 | AC 8A CD 0D 03 00 00 00 FE 00 01 00 C7 1C AE B9
0030 | C6 B1 C9 04 8E 6C 52 2F 70 F1 3F 73 98 0D 40 23
0040 | 8E 3E 21 C1 49 34 D0 37 56 3D 93 0F 48 19 8A 0A
0050 | A7 C1 40 58 22 94 93 D2 25 30 F4 DB FA 33 6F 6E
@ -532,23 +532,23 @@ answer = BA0D89B5406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF01994
0100 | F4 7B F9 59 D9 56 85 0C E9 29 85 1F 0D 81 15 F6
0110 | 35 B1 05 EE 2E 4E 15 D0 4B 24 54 BF 6F 4F AD F0
0120 | 34 B1 04 03 11 9C D8 E3 B9 2F CC 5B FE 00 01 00
0130 | 0A 77 20 0B DF F6 E6 C4 C1 26 A2 C4 1D F3 10 AB
0140 | 3A 3B DB D6 98 CD 48 07 49 E1 F3 C6 4F B1 CF C9
0150 | DF C7 0A C6 F1 AA 67 10 19 62 0A 64 00 55 B2 CF
0160 | 7D 7D 99 CC 86 53 36 45 C0 FA 00 09 54 DE 29 87
0170 | BA D6 8D 74 50 CF 13 4C 9F 03 05 F3 4C 1B B2 85
0180 | DA 82 33 F6 59 70 A0 1C 4B D3 AF D5 EA 3C D5 86
0190 | 4B 8F 1D CB 35 D5 E9 73 7D F1 50 63 C5 4C F5 30
01A0 | 48 EF 51 9A 28 04 98 DD DA F2 37 64 F2 9F FB 0C
01B0 | 58 13 CA AD 90 C3 19 BE 85 92 B7 8C 4B E8 15 E6
01C0 | 5A DA 7C 62 EA 23 75 4B 5A 2C 5A 86 C4 72 18 72
01D0 | D0 CC 48 E0 F8 95 C3 EB E1 86 E8 1E 5F 0E 88 A6
01E0 | B3 F0 91 01 C4 09 AF 34 10 B6 42 38 FB F2 A2 09
01F0 | 5E 3F 3B 7F FC 7E B3 A0 2A 31 9B 99 A1 55 64 7B
0200 | C5 99 58 BC DF ED 8A 1C C6 EB 7F 13 F8 60 0E 52
0210 | 1D 9D 02 47 B0 F6 39 F2 FA 3B 09 F7 29 87 78 1F
0220 | 71 C0 E8 AA 95 01 67 DE 50 92 38 0B 48 53 E7 F1
0230 | 51 3D C5 65</code></pre>
0130 | 60 39 62 9E BA 52 51 6D C5 B0 1C 7C 7F 28 BE 83
0140 | F7 51 F9 23 A8 80 85 CC 05 C2 5F 38 8E 60 31 FF
0150 | BD C0 82 1E 95 B2 E8 59 E0 E1 FB 13 2F 6C C4 48
0160 | DF 87 D2 38 23 05 5E 13 B4 F8 A9 F1 65 6B 71 42
0170 | 45 21 EE 9C 0B 80 6C F8 FE B8 A3 33 1B A0 86 94
0180 | FD 53 8A 92 A5 0F 6A 15 38 2E D3 6D 15 EB 3D B9
0190 | 39 23 2F C8 96 5B A0 89 AC 4A 6E 03 F5 18 7E 5B
01A0 | B1 E2 E8 0B 55 9B 94 4B 61 3A 58 8A 61 F9 84 C1
01B0 | 77 D4 53 EF A6 68 B9 3F 97 AB 88 19 01 8D 93 7C
01C0 | 9B FA FF 67 1C 11 5D 71 0E C9 78 4B 2D D1 F5 26
01D0 | 28 46 6E 5B 07 0E 30 A4 3C FF 77 37 13 38 33 59
01E0 | D4 9C 41 33 0A FC 2A 6E AB 26 39 3E 72 E1 02 A5
01F0 | CD F6 C7 E2 66 48 D9 90 2B 75 B3 9C D4 CC 4D 2F
0200 | 6E 2E 9B 38 B5 4F FF 23 29 28 94 B6 BD 40 3E FE
0210 | 74 2A 88 EA F2 74 2D D5 02 34 A8 D2 BE 05 E7 D5
0220 | 06 17 4E B4 7E 11 EE A0 74 A0 FC 22 6D 4D 9D 35
0230 | 8A 0C EB 65</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data;</code></pre>
<table class="table">
@ -570,13 +570,13 @@ answer = BA0D89B5406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF01994
<tr>
<td>nonce</td>
<td>4, 16</td>
<td><code>406709F612FADFBEC3F0289D0AA67EEF</code></td>
<td><code>6C5D0183C09B3D4C650C7A02E4D8BDF8</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>20, 16</td>
<td><code>E11DBC3BC97D91A26154F932AF019943</code></td>
<td><code>F39F03F1565D6D002851C6FCAC8ACD0D</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
@ -594,13 +594,13 @@ answer = BA0D89B5406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF01994
<tr>
<td>g_a</td>
<td>300, 260</td>
<td><code>FE0001000A77200BDFF6E6C4C126A2C4</code> <code>1DF310AB3A3BDBD698CD480749E1F3C6</code> <code>4FB1CFC9DFC70AC6F1AA671019620A64</code> <code>0055B2CF7D7D99CC86533645C0FA0009</code> <code>54DE2987BAD68D7450CF134C9F0305F3</code> <code>4C1BB285DA8233F65970A01C4BD3AFD5</code> <code>EA3CD5864B8F1DCB35D5E9737DF15063</code> <code>C54CF53048EF519A280498DDDAF23764</code> <code>F29FFB0C5813CAAD90C319BE8592B78C</code> <code>4BE815E65ADA7C62EA23754B5A2C5A86</code> <code>C4721872D0CC48E0F895C3EBE186E81E</code> <code>5F0E88A6B3F09101C409AF3410B64238</code> <code>FBF2A2095E3F3B7FFC7EB3A02A319B99</code> <code>A155647BC59958BCDFED8A1CC6EB7F13</code> <code>F8600E521D9D0247B0F639F2FA3B09F7</code> <code>2987781F71C0E8AA950167DE5092380B</code><br> <code>4853E7F1</code></td>
<td><code>FE0001006039629EBA52516DC5B01C7C</code> <code>7F28BE83F751F923A88085CC05C25F38</code> <code>8E6031FFBDC0821E95B2E859E0E1FB13</code> <code>2F6CC448DF87D23823055E13B4F8A9F1</code> <code>656B71424521EE9C0B806CF8FEB8A333</code> <code>1BA08694FD538A92A50F6A15382ED36D</code> <code>15EB3DB939232FC8965BA089AC4A6E03</code> <code>F5187E5BB1E2E80B559B944B613A588A</code> <code>61F984C177D453EFA668B93F97AB8819</code> <code>018D937C9BFAFF671C115D710EC9784B</code> <code>2DD1F52628466E5B070E30A43CFF7737</code> <code>13383359D49C41330AFC2A6EAB26393E</code> <code>72E102A5CDF6C7E26648D9902B75B39C</code> <code>D4CC4D2F6E2E9B38B54FFF23292894B6</code> <code>BD403EFE742A88EAF2742DD50234A8D2</code> <code>BE05E7D506174EB47E11EEA074A0FC22</code><br> <code>6D4D9D35</code></td>
<td><code>g_a</code> diffie-hellman parameter</td>
</tr>
<tr>
<td>server_time</td>
<td>560, 4</td>
<td><code>513DC565</code> (1707425105 in decimal)</td>
<td><code>8A0CEB65</code> (1709902986 in decimal)</td>
<td>Server time</td>
</tr>
</tbody>
@ -609,34 +609,34 @@ answer = BA0D89B5406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF01994
<h5><a class="anchor" href="#7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message" id="7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message" name="7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message"><i class="anchor-icon"></i></a>7) Client computes random 2048-bit number <em>b</em> (using a sufficient amount of entropy) and sends the server a message</h5>
<p>First, generate a secure random 2048-bit number b:</p>
<!-- start b -->
<pre><code>b = 1376A5A6BF7A9F874B47028F3D5CFF0689FD52F58949BB0EE9BACDBE81DD1CED07101844EB6F2AE19E61120B84799431F445785E33A18141399821479AE96786E0F4E9C5C6C9E46BF562C21C96B0F8F7438C8CABA3DFCB3DD3B886C2A37B95ED804315335C0DDFFEB3A278243D89F964278BC734D1087D6D4B554C1F78397A414F440E38BA9A4F1211B20AE835437762F81A45FDB035BB2220D939693084B39A3C7BE2481309AB9AE378EAB8BB3A15A69EBA80BEF683582E2218FA604E823EABD111553D31DBB46B9383A0D8EEF615FFF9CF266C970800AA28AC5E962D20351311A815FFA7562989CA6D6323BF2B5AF40EF3F45021B7445664852D07B80172CE</code></pre>
<pre><code>b = 3926B53315738C46D2E423FFB79850E2E379B64D1C5B3C83CDA52239918B87012F35E0AAA6C2F8D49E400DCC9791422AF46EDE0981A4DD725D31D9EAB91C6339BFBCF932A05074ACE182A78F385A72BCD28FF6F83D6BC67CC578F20BDACC27F213D7002B8505D41F538D97DEF151582FEFD432499059672725C202781982214D50E85D6BC462B27991DD3F644BF615805B96AED7FC8E08AB2F64D6F72BCB237C7E615521AC6C6729557E295E40FEA37A20357FF8EAB9CB6E67878D25ABCE71461855F44C14F01142B7965507053E6CDC9AA9DF1523733D53999C6B0AB865D90E7629F26766B5BFFAC67560D5046B67A9A9200D137D9ECE173D6CEC464307FB3D</code></pre>
<!-- end b -->
<p>Then compute <code>g_b = pow(g, b) mod dh_prime</code></p>
<!-- start g_b -->
<pre><code>g_b = A215D057BC6648453D68C2F418A38D9D4F4FA47E5D520AC7EBC2ADC3B00075090C10A1E9D96A5DDA127317F2DDC165C5F6C8C2854648C106D0D9DF684DAE70B0E6021658806245B494B762B1979E8BD597B5CC8E43A80F96CA47FB0765C98D40529F3D94C82113AE32C603AA24411EF8B330565A1D66EA6B89C9D4F8AFFEEA397C4B247564215D147B6AD0DF7F3FB4499E89E34304531D87448B91967B5BD53093F09386C0F78940C1DD6AA7C8667E15857453E6AAD275F94CD386468CF49108FB7C54282596A4D0314DCE9EFED4066A6E072471439AEAAA74157DB7DD53F01982982534DEE8740610BA433BF459B3DFE38674561F31991CE007BA112DDA6718</code></pre>
<pre><code>g_b = 1DDC05FBEF7A9710530DAFAA636EA23AC840EF6E4568F46808A5C9C066BE1167EE71D5991672D79B803D6BE374076C3583B55143641F0347E0AD51DEA2C33C787915879FF333ED3BA33A2B58DF37E435910A5462C47F0CFAC658ABFA6020E36188719355D6D5477C93A69F9795EBEF0C43744E5E267579439E0ABC8D15365DE72709B19ECB516D148BB07836AA3BB3B05B4E0A226FC9DCDBE56CAF573D831D4384ECECB7529009E06996DE5F71A3CD1E2614467187C4569098571D90F5B6BD6A59214AD6F073E35A5D2436117F087FA67FC8BE53C1788338342990DE6AE9C08522CA490795B9D4E9E177D228BCDCDA2ABF27904917C2E22C36CD7746FA1F2C53</code></pre>
<!-- end g_b -->
<h6>7.1) generation of encrypted_data</h6>
<!-- start client_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 54 B6 43 66 40 67 09 F6 12 FA DF BE C3 F0 28 9D
0010 | 0A A6 7E EF E1 1D BC 3B C9 7D 91 A2 61 54 F9 32
0020 | AF 01 99 43 00 00 00 00 00 00 00 00 FE 00 01 00
0030 | A2 15 D0 57 BC 66 48 45 3D 68 C2 F4 18 A3 8D 9D
0040 | 4F 4F A4 7E 5D 52 0A C7 EB C2 AD C3 B0 00 75 09
0050 | 0C 10 A1 E9 D9 6A 5D DA 12 73 17 F2 DD C1 65 C5
0060 | F6 C8 C2 85 46 48 C1 06 D0 D9 DF 68 4D AE 70 B0
0070 | E6 02 16 58 80 62 45 B4 94 B7 62 B1 97 9E 8B D5
0080 | 97 B5 CC 8E 43 A8 0F 96 CA 47 FB 07 65 C9 8D 40
0090 | 52 9F 3D 94 C8 21 13 AE 32 C6 03 AA 24 41 1E F8
00A0 | B3 30 56 5A 1D 66 EA 6B 89 C9 D4 F8 AF FE EA 39
00B0 | 7C 4B 24 75 64 21 5D 14 7B 6A D0 DF 7F 3F B4 49
00C0 | 9E 89 E3 43 04 53 1D 87 44 8B 91 96 7B 5B D5 30
00D0 | 93 F0 93 86 C0 F7 89 40 C1 DD 6A A7 C8 66 7E 15
00E0 | 85 74 53 E6 AA D2 75 F9 4C D3 86 46 8C F4 91 08
00F0 | FB 7C 54 28 25 96 A4 D0 31 4D CE 9E FE D4 06 6A
0100 | 6E 07 24 71 43 9A EA AA 74 15 7D B7 DD 53 F0 19
0110 | 82 98 25 34 DE E8 74 06 10 BA 43 3B F4 59 B3 DF
0120 | E3 86 74 56 1F 31 99 1C E0 07 BA 11 2D DA 67 18</code></pre>
<pre><code>0000 | 54 B6 43 66 6C 5D 01 83 C0 9B 3D 4C 65 0C 7A 02
0010 | E4 D8 BD F8 F3 9F 03 F1 56 5D 6D 00 28 51 C6 FC
0020 | AC 8A CD 0D 00 00 00 00 00 00 00 00 FE 00 01 00
0030 | 1D DC 05 FB EF 7A 97 10 53 0D AF AA 63 6E A2 3A
0040 | C8 40 EF 6E 45 68 F4 68 08 A5 C9 C0 66 BE 11 67
0050 | EE 71 D5 99 16 72 D7 9B 80 3D 6B E3 74 07 6C 35
0060 | 83 B5 51 43 64 1F 03 47 E0 AD 51 DE A2 C3 3C 78
0070 | 79 15 87 9F F3 33 ED 3B A3 3A 2B 58 DF 37 E4 35
0080 | 91 0A 54 62 C4 7F 0C FA C6 58 AB FA 60 20 E3 61
0090 | 88 71 93 55 D6 D5 47 7C 93 A6 9F 97 95 EB EF 0C
00A0 | 43 74 4E 5E 26 75 79 43 9E 0A BC 8D 15 36 5D E7
00B0 | 27 09 B1 9E CB 51 6D 14 8B B0 78 36 AA 3B B3 B0
00C0 | 5B 4E 0A 22 6F C9 DC DB E5 6C AF 57 3D 83 1D 43
00D0 | 84 EC EC B7 52 90 09 E0 69 96 DE 5F 71 A3 CD 1E
00E0 | 26 14 46 71 87 C4 56 90 98 57 1D 90 F5 B6 BD 6A
00F0 | 59 21 4A D6 F0 73 E3 5A 5D 24 36 11 7F 08 7F A6
0100 | 7F C8 BE 53 C1 78 83 38 34 29 90 DE 6A E9 C0 85
0110 | 22 CA 49 07 95 B9 D4 E9 E1 77 D2 28 BC DC DA 2A
0120 | BF 27 90 49 17 C2 E2 2C 36 CD 77 46 FA 1F 2C 53</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data;</code></pre>
<table class="table">
@ -658,19 +658,19 @@ answer = BA0D89B5406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF01994
<tr>
<td>nonce</td>
<td>4, 16</td>
<td><code>406709F612FADFBEC3F0289D0AA67EEF</code></td>
<td><code>6C5D0183C09B3D4C650C7A02E4D8BDF8</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>20, 16</td>
<td><code>E11DBC3BC97D91A26154F932AF019943</code></td>
<td><code>F39F03F1565D6D002851C6FCAC8ACD0D</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>g_b</td>
<td>36, 260</td>
<td><code>FE000100A215D057BC6648453D68C2F4</code> <code>18A38D9D4F4FA47E5D520AC7EBC2ADC3</code> <code>B00075090C10A1E9D96A5DDA127317F2</code> <code>DDC165C5F6C8C2854648C106D0D9DF68</code> <code>4DAE70B0E6021658806245B494B762B1</code> <code>979E8BD597B5CC8E43A80F96CA47FB07</code> <code>65C98D40529F3D94C82113AE32C603AA</code> <code>24411EF8B330565A1D66EA6B89C9D4F8</code> <code>AFFEEA397C4B247564215D147B6AD0DF</code> <code>7F3FB4499E89E34304531D87448B9196</code> <code>7B5BD53093F09386C0F78940C1DD6AA7</code> <code>C8667E15857453E6AAD275F94CD38646</code> <code>8CF49108FB7C54282596A4D0314DCE9E</code> <code>FED4066A6E072471439AEAAA74157DB7</code> <code>DD53F01982982534DEE8740610BA433B</code> <code>F459B3DFE38674561F31991CE007BA11</code><br> <code>2DDA6718</code></td>
<td><code>FE0001001DDC05FBEF7A9710530DAFAA</code> <code>636EA23AC840EF6E4568F46808A5C9C0</code> <code>66BE1167EE71D5991672D79B803D6BE3</code> <code>74076C3583B55143641F0347E0AD51DE</code> <code>A2C33C787915879FF333ED3BA33A2B58</code> <code>DF37E435910A5462C47F0CFAC658ABFA</code> <code>6020E36188719355D6D5477C93A69F97</code> <code>95EBEF0C43744E5E267579439E0ABC8D</code> <code>15365DE72709B19ECB516D148BB07836</code> <code>AA3BB3B05B4E0A226FC9DCDBE56CAF57</code> <code>3D831D4384ECECB7529009E06996DE5F</code> <code>71A3CD1E2614467187C4569098571D90</code> <code>F5B6BD6A59214AD6F073E35A5D243611</code> <code>7F087FA67FC8BE53C1788338342990DE</code> <code>6AE9C08522CA490795B9D4E9E177D228</code> <code>BCDCDA2ABF27904917C2E22C36CD7746</code><br> <code>FA1F2C53</code></td>
<td>Single-byte prefix denoting length, a 256-byte (2048-bit) string, and zero bytes of padding</td>
</tr>
<tr>
@ -684,47 +684,47 @@ answer = BA0D89B5406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF01994
<!-- end client_DH_inner_data -->
<p>The serialization of <em>Client_DH_Inner_Data</em> produces a string <strong>data</strong>. This is used to generate <strong>encrypted_data</strong> as specified in <a href="#7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message">step 6</a>, using the following inputs:</p>
<!-- start client_DH_inner_data_input -->
<pre><code>data = 54B64366406709F612FADFBEC3F0289D0AA67EEFE11DBC3BC97D91A26154F932AF0199430000000000000000FE000100A215D057BC6648453D68C2F418A38D9D4F4FA47E5D520AC7EBC2ADC3B00075090C10A1E9D96A5DDA127317F2DDC165C5F6C8C2854648C106D0D9DF684DAE70B0E6021658806245B494B762B1979E8BD597B5CC8E43A80F96CA47FB0765C98D40529F3D94C82113AE32C603AA24411EF8B330565A1D66EA6B89C9D4F8AFFEEA397C4B247564215D147B6AD0DF7F3FB4499E89E34304531D87448B91967B5BD53093F09386C0F78940C1DD6AA7C8667E15857453E6AAD275F94CD386468CF49108FB7C54282596A4D0314DCE9EFED4066A6E072471439AEAAA74157DB7DD53F01982982534DEE8740610BA433BF459B3DFE38674561F31991CE007BA112DDA6718
padding = 74876952857BA6AAA495A20D
tmp_aes_key = 5EA702F743E850F5546E857F08B7D5337BBAEDF9B61248751594851BE2E8C297
tmp_aes_iv = 1CEF8E372A63D97EBFA805C0DBB018BC7C1E0931693FBCB1A1AFC0C0A8BBC849</code></pre>
<pre><code>data = 54B643666C5D0183C09B3D4C650C7A02E4D8BDF8F39F03F1565D6D002851C6FCAC8ACD0D0000000000000000FE0001001DDC05FBEF7A9710530DAFAA636EA23AC840EF6E4568F46808A5C9C066BE1167EE71D5991672D79B803D6BE374076C3583B55143641F0347E0AD51DEA2C33C787915879FF333ED3BA33A2B58DF37E435910A5462C47F0CFAC658ABFA6020E36188719355D6D5477C93A69F9795EBEF0C43744E5E267579439E0ABC8D15365DE72709B19ECB516D148BB07836AA3BB3B05B4E0A226FC9DCDBE56CAF573D831D4384ECECB7529009E06996DE5F71A3CD1E2614467187C4569098571D90F5B6BD6A59214AD6F073E35A5D2436117F087FA67FC8BE53C1788338342990DE6AE9C08522CA490795B9D4E9E177D228BCDCDA2ABF27904917C2E22C36CD7746FA1F2C53
padding = D1AB41649AEDE24CDBCA70A7
tmp_aes_key = D67A9AF27A626BEB5A05876F54041BEB5B740B5AD508AFF47098B475BFF245C9
tmp_aes_iv = 633E1706BCD8F7B53618C96E9156EA9D01C547EE97A967AFC46D7AF92D1F9769</code></pre>
<!-- end client_DH_inner_data_input -->
<p>Process:</p>
<pre><code>data_with_hash := SHA1(data) + data + padding (0-15 random bytes such that total length is divisible by 16)
encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);</code></pre>
<p>Output:</p>
<!-- start client_DH_inner_data_output -->
<pre><code>encrypted_data = 14D185E575255986C29BE3A0437D525BA22430CBA0CD755225945AD3A1ACEFB536518514F5086892E6E3FA84D1CBB644BC8F7BEBCDE74E31BA8A073F47623EBB6E7D94B3A676A4C1AFD4689C52D05F73D21C33F64FE6AEABD04273D9117CD064E467E1F8E6C887BCAE4679E0399AD35DB1302A80629618F8C8485248D89A4E3568B464FF7B608CBE24B51EEB81B65D76224B62A1669EAA48A99C122E5E8A778E13DD441DC52175160088A498F186A2B99C736FE8C5C3E274D804C629564A0F15DDABC5B449356A7990900652A7432AFB1499C7CE09246F6B29006425DF2926465B04F17C0077B6A336A50E46B675AD5607F05818F84EADEC1F4847BF311027E742F8B1E183C01810C4CE964F2A0F36E257849C144C9B0B93B4A7A9E57391DB0CCB0D757A2B7A77257C8FF55553D66B6E1D45E9D8CA88E5A47B16322FF2ED5F5ABE099E7006B2D29C829D746B704130B1</code></pre>
<pre><code>encrypted_data = C0C869F3A61EDF52A8B225272E29F60F285210BBF02753CEA722A48CF940F4E7E4060252F991B8EBC7F9F0BCDE9F061AD4CA836C2B72814BE43B740F4BAA645137DB09776DA20D31C22F50A00CE3F2258F59BACBA2EFFB8D42BEAE51CFD796261DE24CE486471FE7B8CE22E2EA3474019C973AFB610730F903B0A23F50DB7880A0C290F6F55FE00E34A406161150151B1967EBD4896933BD40BA93636F5C9AC89E98CE8B948812B6BBABAF5ABAF3E2C1C67D22DE739F852D578A98A0E23F6362EAC4709764E6F4C7EEFAA0FE3580F5D609E06CDC23B011BEF6D496374EB37BA44B4BDAAED57A25CDD48B59B19CDFA328660D58186DC45C3450DA3FD7DFAE686CDA17744DA85A885C03D084F607520B9A6E50B97F658DE0AA1CA39291B66D3600D880036D6BD09830F05768BB0923FCCA119128B88C1A4481451337915FFAF4905978E04CC7EE7B4C7F7A48BD61B04E44</code></pre>
<!-- end client_DH_inner_data_output -->
<p>The length of the final string is 336 bytes.</p>
<h6>7.2) set_client_DH_params query</h6>
<!-- start set_client_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 18 5C 07 00 51 3D C5 65
0010 | 78 01 00 00 1F 5F 04 F5 40 67 09 F6 12 FA DF BE
0020 | C3 F0 28 9D 0A A6 7E EF E1 1D BC 3B C9 7D 91 A2
0030 | 61 54 F9 32 AF 01 99 43 FE 50 01 00 14 D1 85 E5
0040 | 75 25 59 86 C2 9B E3 A0 43 7D 52 5B A2 24 30 CB
0050 | A0 CD 75 52 25 94 5A D3 A1 AC EF B5 36 51 85 14
0060 | F5 08 68 92 E6 E3 FA 84 D1 CB B6 44 BC 8F 7B EB
0070 | CD E7 4E 31 BA 8A 07 3F 47 62 3E BB 6E 7D 94 B3
0080 | A6 76 A4 C1 AF D4 68 9C 52 D0 5F 73 D2 1C 33 F6
0090 | 4F E6 AE AB D0 42 73 D9 11 7C D0 64 E4 67 E1 F8
00A0 | E6 C8 87 BC AE 46 79 E0 39 9A D3 5D B1 30 2A 80
00B0 | 62 96 18 F8 C8 48 52 48 D8 9A 4E 35 68 B4 64 FF
00C0 | 7B 60 8C BE 24 B5 1E EB 81 B6 5D 76 22 4B 62 A1
00D0 | 66 9E AA 48 A9 9C 12 2E 5E 8A 77 8E 13 DD 44 1D
00E0 | C5 21 75 16 00 88 A4 98 F1 86 A2 B9 9C 73 6F E8
00F0 | C5 C3 E2 74 D8 04 C6 29 56 4A 0F 15 DD AB C5 B4
0100 | 49 35 6A 79 90 90 06 52 A7 43 2A FB 14 99 C7 CE
0110 | 09 24 6F 6B 29 00 64 25 DF 29 26 46 5B 04 F1 7C
0120 | 00 77 B6 A3 36 A5 0E 46 B6 75 AD 56 07 F0 58 18
0130 | F8 4E AD EC 1F 48 47 BF 31 10 27 E7 42 F8 B1 E1
0140 | 83 C0 18 10 C4 CE 96 4F 2A 0F 36 E2 57 84 9C 14
0150 | 4C 9B 0B 93 B4 A7 A9 E5 73 91 DB 0C CB 0D 75 7A
0160 | 2B 7A 77 25 7C 8F F5 55 53 D6 6B 6E 1D 45 E9 D8
0170 | CA 88 E5 A4 7B 16 32 2F F2 ED 5F 5A BE 09 9E 70
0180 | 06 B2 D2 9C 82 9D 74 6B 70 41 30 B1</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 A0 58 07 00 8A 0C EB 65
0010 | 78 01 00 00 1F 5F 04 F5 6C 5D 01 83 C0 9B 3D 4C
0020 | 65 0C 7A 02 E4 D8 BD F8 F3 9F 03 F1 56 5D 6D 00
0030 | 28 51 C6 FC AC 8A CD 0D FE 50 01 00 C0 C8 69 F3
0040 | A6 1E DF 52 A8 B2 25 27 2E 29 F6 0F 28 52 10 BB
0050 | F0 27 53 CE A7 22 A4 8C F9 40 F4 E7 E4 06 02 52
0060 | F9 91 B8 EB C7 F9 F0 BC DE 9F 06 1A D4 CA 83 6C
0070 | 2B 72 81 4B E4 3B 74 0F 4B AA 64 51 37 DB 09 77
0080 | 6D A2 0D 31 C2 2F 50 A0 0C E3 F2 25 8F 59 BA CB
0090 | A2 EF FB 8D 42 BE AE 51 CF D7 96 26 1D E2 4C E4
00A0 | 86 47 1F E7 B8 CE 22 E2 EA 34 74 01 9C 97 3A FB
00B0 | 61 07 30 F9 03 B0 A2 3F 50 DB 78 80 A0 C2 90 F6
00C0 | F5 5F E0 0E 34 A4 06 16 11 50 15 1B 19 67 EB D4
00D0 | 89 69 33 BD 40 BA 93 63 6F 5C 9A C8 9E 98 CE 8B
00E0 | 94 88 12 B6 BB AB AF 5A BA F3 E2 C1 C6 7D 22 DE
00F0 | 73 9F 85 2D 57 8A 98 A0 E2 3F 63 62 EA C4 70 97
0100 | 64 E6 F4 C7 EE FA A0 FE 35 80 F5 D6 09 E0 6C DC
0110 | 23 B0 11 BE F6 D4 96 37 4E B3 7B A4 4B 4B DA AE
0120 | D5 7A 25 CD D4 8B 59 B1 9C DF A3 28 66 0D 58 18
0130 | 6D C4 5C 34 50 DA 3F D7 DF AE 68 6C DA 17 74 4D
0140 | A8 5A 88 5C 03 D0 84 F6 07 52 0B 9A 6E 50 B9 7F
0150 | 65 8D E0 AA 1C A3 92 91 B6 6D 36 00 D8 80 03 6D
0160 | 6B D0 98 30 F0 57 68 BB 09 23 FC CA 11 91 28 B8
0170 | 8C 1A 44 81 45 13 37 91 5F FA F4 90 59 78 E0 4C
0180 | C7 EE 7B 4C 7F 7A 48 BD 61 B0 4E 44</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;</code></pre>
<table class="table">
@ -746,7 +746,7 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>185C0700513DC565</code></td>
<td><code>A05807008A0CEB65</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -764,19 +764,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>406709F612FADFBEC3F0289D0AA67EEF</code></td>
<td><code>6C5D0183C09B3D4C650C7A02E4D8BDF8</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>E11DBC3BC97D91A26154F932AF019943</code></td>
<td><code>F39F03F1565D6D002851C6FCAC8ACD0D</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>encrypted_data</td>
<td>56, 340</td>
<td><code>FE50010014D185E575255986C29BE3A0</code> <code>437D525BA22430CBA0CD755225945AD3</code> <code>A1ACEFB536518514F5086892E6E3FA84</code> <code>D1CBB644BC8F7BEBCDE74E31BA8A073F</code> <code>47623EBB6E7D94B3A676A4C1AFD4689C</code> <code>52D05F73D21C33F64FE6AEABD04273D9</code> <code>117CD064E467E1F8E6C887BCAE4679E0</code> <code>399AD35DB1302A80629618F8C8485248</code> <code>D89A4E3568B464FF7B608CBE24B51EEB</code> <code>81B65D76224B62A1669EAA48A99C122E</code> <code>5E8A778E13DD441DC52175160088A498</code> <code>F186A2B99C736FE8C5C3E274D804C629</code> <code>564A0F15DDABC5B449356A7990900652</code> <code>A7432AFB1499C7CE09246F6B29006425</code> <code>DF2926465B04F17C0077B6A336A50E46</code> <code>B675AD5607F05818F84EADEC1F4847BF</code> <code>311027E742F8B1E183C01810C4CE964F</code> <code>2A0F36E257849C144C9B0B93B4A7A9E5</code> <code>7391DB0CCB0D757A2B7A77257C8FF555</code> <code>53D66B6E1D45E9D8CA88E5A47B16322F</code> <code>F2ED5F5ABE099E7006B2D29C829D746B</code><br> <code>704130B1</code></td>
<td><code>FE500100C0C869F3A61EDF52A8B22527</code> <code>2E29F60F285210BBF02753CEA722A48C</code> <code>F940F4E7E4060252F991B8EBC7F9F0BC</code> <code>DE9F061AD4CA836C2B72814BE43B740F</code> <code>4BAA645137DB09776DA20D31C22F50A0</code> <code>0CE3F2258F59BACBA2EFFB8D42BEAE51</code> <code>CFD796261DE24CE486471FE7B8CE22E2</code> <code>EA3474019C973AFB610730F903B0A23F</code> <code>50DB7880A0C290F6F55FE00E34A40616</code> <code>1150151B1967EBD4896933BD40BA9363</code> <code>6F5C9AC89E98CE8B948812B6BBABAF5A</code> <code>BAF3E2C1C67D22DE739F852D578A98A0</code> <code>E23F6362EAC4709764E6F4C7EEFAA0FE</code> <code>3580F5D609E06CDC23B011BEF6D49637</code> <code>4EB37BA44B4BDAAED57A25CDD48B59B1</code> <code>9CDFA328660D58186DC45C3450DA3FD7</code> <code>DFAE686CDA17744DA85A885C03D084F6</code> <code>07520B9A6E50B97F658DE0AA1CA39291</code> <code>B66D3600D880036D6BD09830F05768BB</code> <code>0923FCCA119128B88C1A448145133791</code> <code>5FFAF4905978E04CC7EE7B4C7F7A48BD</code><br> <code>61B04E44</code></td>
<td>Encrypted client_DH_inner_data generated previously, serialized as a TL byte string</td>
</tr>
</tbody>
@ -785,17 +785,17 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<h5><a class="anchor" href="#8-auth-key-generation" id="8-auth-key-generation" name="8-auth-key-generation"><i class="anchor-icon"></i></a>8) Auth key generation</h5>
<p>The client computes the auth_key using formula <code>g_a^b mod dh_prime</code>:</p>
<!-- start auth_key -->
<pre><code>auth_key = ACA2547BAA3B4B3E6AD9129ADEE796042FC4ACAAABA40DCE7A1196640595829E2BA85C5E68E5D2B7B713B28720CCD0E65DA3B80CD8A9282BDE895755B924F4CBBCED119DEE057D3066D7095C25771A53D9AD6EC3464EE0E7FE1A4D9851F17B6CC7D6E636E0BDEA7D66153CF37005835A528E65673C1F5ADAA27465964BA89AA6FD045108B25B1DC9AB2D979864858C9EACBFA4A399CDBF2154D2CC6743C5CAA40683343D80A36C7F1289DC5AC5EE585DEA1E1CD296444EA6CD8F6C3564B2D355B310A3C02608EEA5EC36D38E941BF811489AB7A24C069E44FF54714CB4A45EEE2F310FDDC0A1B08BD3DFF8801E27C8508EFD7AD51EF3C13EF1D9A02EE4601741</code></pre>
<pre><code>auth_key = 74C1BCCC199791B64A8A55CA88337D2072B99630263D6D8B84CD192860D90F764C4FC4782DA33326611B7606EB60A82552AEED09FBDA4EAF44FA57D36B22C1085110BCAB8FB0C6582E883E90A60F0CE02B4F249BC76CEBA166BA109AC35CC8317702460F4C64AEA5555963D660FBDEFACF415F08064D149DA32E0406CAC149B1D4B02F544966552D2BD5DAC78B946DEABBA890363350868AA4AF8EE572A8430616B5B977B9E5E79C1139EE0C3902D6533C5446853AA14DCB85C2FBD7BAA5FCD9FD2ED7F203935426BF6831B06C950B404016C430904F18D74A56E8CF3AA8C86E5A69E5429BB314F7A12C485D643A03F48759E4DEC722C1C6EFD698710E6B8003</code></pre>
<!-- end auth_key -->
<h5><a class="anchor" href="#9-final-server-reply" id="9-final-server-reply" name="9-final-server-reply"><i class="anchor-icon"></i></a>9) Final server reply</h5>
<p>The server verifies and confirms that auth_key_hash is unique: since it's unique, it replies with the following:</p>
<!-- start dh_gen_ok -->
<p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 00 BE 91 51 3D C5 65
0010 | 74 00 00 00 34 F7 CB 3B 40 67 09 F6 12 FA DF BE
0020 | C3 F0 28 9D 0A A6 7E EF E1 1D BC 3B C9 7D 91 A2
0030 | 61 54 F9 32 AF 01 99 43 11 42 87 13 52 16 5E 59
0040 | E1 12 40 36 B4 8B 97 D3</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 08 02 06 8B 0C EB 65
0010 | A4 00 00 00 34 F7 CB 3B 6C 5D 01 83 C0 9B 3D 4C
0020 | 65 0C 7A 02 E4 D8 BD F8 F3 9F 03 F1 56 5D 6D 00
0030 | 28 51 C6 FC AC 8A CD 0D A0 0A 66 F3 13 69 78 A2
0040 | 68 1E ED 6D E8 21 EF 13</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;</code></pre>
<table class="table">
@ -817,13 +817,13 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>0100BE91513DC565</code></td>
<td><code>010802068B0CEB65</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
<td>message_length</td>
<td>16, 4</td>
<td><code>74000000</code> (116 in decimal)</td>
<td><code>A4000000</code> (164 in decimal)</td>
<td>Message body length</td>
</tr>
<tr>
@ -835,19 +835,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>406709F612FADFBEC3F0289D0AA67EEF</code></td>
<td><code>6C5D0183C09B3D4C650C7A02E4D8BDF8</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>E11DBC3BC97D91A26154F932AF019943</code></td>
<td><code>F39F03F1565D6D002851C6FCAC8ACD0D</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>new_nonce_hash1</td>
<td>56, 16</td>
<td><code>1142871352165E59E1124036B48B97D3</code></td>
<td><code>A00A66F3136978A2681EED6DE821EF13</code></td>
<td>The 128 lower-order bits of SHA1 of the byte string derived from the <code>new_nonce</code> string by adding a single byte with the value of 1, 2, or 3, and followed by another 8 bytes with <code>auth_key_aux_hash</code>. Different values are required to prevent an intruder from changing server response dh_gen_ok into dh_gen_retry.</td>
</tr>
</tbody>

View file

@ -46,41 +46,42 @@ rpc_result#f35c6d01 req_msg_id:long…">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/mtproto" >Mobile Protocol</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/mtproto/service_messages" >Service Messages</a></li></ul></div>
<h1 id="dev_page_title">Service Messages</h1>
<div id="dev_page_content"><h4><a class="anchor" name="response-to-an-rpc-query" href="#response-to-an-rpc-query"><i class="anchor-icon"></i></a>Response to an RPC query</h4>
<div id="dev_page_content"><h4><a class="anchor" href="#response-to-an-rpc-query" id="response-to-an-rpc-query" name="response-to-an-rpc-query"><i class="anchor-icon"></i></a>Response to an RPC query</h4>
<p>A response to an RPC query is normally wrapped as follows:</p>
<pre><code>rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult;</code></pre>
<p>Here req_msg_id is the identifier of the message sent by the other party and containing an RPC query. This way, the recipient knows that the result is a response to the specific RPC query in question.<br>At the same time, this response serves as acknowledgment of the other party&#39;s receipt of the req_msg_id message.</p>
<p>Here req_msg_id is the identifier of the message sent by the other party and containing an RPC query. This way, the recipient knows that the result is a response to the specific RPC query in question.
At the same time, this response serves as acknowledgment of the other party's receipt of the req_msg_id message.</p>
<p>Note that the response to an RPC query must also be acknowledged. Most frequently, this coincides with the transmission of the next message (which may have a container attached to it carrying a service message with the acknowledgment).</p>
<h4><a class="anchor" name="rpc-error" href="#rpc-error"><i class="anchor-icon"></i></a>RPC Error</h4>
<h4><a class="anchor" href="#rpc-error" id="rpc-error" name="rpc-error"><i class="anchor-icon"></i></a>RPC Error</h4>
<p>The result field returned in response to any RPC query may also contain an error message in the following format:</p>
<pre><code>rpc_error#2144ca19 error_code:int error_message:string = RpcError;</code></pre>
<h4><a class="anchor" name="cancellation-of-an-rpc-query" href="#cancellation-of-an-rpc-query"><i class="anchor-icon"></i></a>Cancellation of an RPC Query</h4>
<p>In certain situations, the client does not want to receive a response to an already transmitted RPC query, for example because the response turns out to be long and the client has decided to do without it because of insufficient link capacity. Simply interrupting the TCP connection will not have any effect because the server would re-send the missing response at the first opportunity. Therefore, the client needs a way to cancel receipt of the RPC response message, actually acknowledging its receipt prior to it being in fact received, which will settle the server down and prevent it from re-sending the response. However, the client does not know the RPC response&#39;s msg_id prior to receiving the response; the only thing it knows is the req_msg_id. i. e. the msg_id of the relevant RPC query. Therefore, a special query is used:</p>
<h4><a class="anchor" href="#cancellation-of-an-rpc-query" id="cancellation-of-an-rpc-query" name="cancellation-of-an-rpc-query"><i class="anchor-icon"></i></a>Cancellation of an RPC Query</h4>
<p>In certain situations, the client does not want to receive a response to an already transmitted RPC query, for example because the response turns out to be long and the client has decided to do without it because of insufficient link capacity. Simply interrupting the TCP connection will not have any effect because the server would re-send the missing response at the first opportunity. Therefore, the client needs a way to cancel receipt of the RPC response message, actually acknowledging its receipt prior to it being in fact received, which will settle the server down and prevent it from re-sending the response. However, the client does not know the RPC response's msg_id prior to receiving the response; the only thing it knows is the req_msg_id. i. e. the msg_id of the relevant RPC query. Therefore, a special query is used:</p>
<pre><code>rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer;</code></pre>
<p>The response to this query returns as one of the following messages wrapped in rpc_result and requiring an acknowledgment: </p>
<pre><code>rpc_answer_unknown#5e2ad36e = RpcDropAnswer;
rpc_answer_dropped_running#cd78e586 = RpcDropAnswer;
rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer;</code></pre>
<p>The first version of the response is used if the server remembers nothing of the incoming req_msg_id (if it has already been responded to, for example). The second version is used if the response was canceled while the RPC query was being processed (where the RPC query itself was still fully processed); in this case, the same rpc_answer_dropped_running is also returned in response to the original query, and both of these responses require an acknowledgment from the client. The final version means that the RPC response was removed from the server&#39;s outgoing queue, and its msg_id, seq_no, and length in bytes are transmitted to the client.</p>
<p>Note that rpc_answer_dropped_running and rpc_answer_dropped serve as acknowledgments of the server&#39;s receipt of the original query (the same one, the response to which we wish to forget). In addition, same as for any RPC queries, any response to rpc_drop_answer is an acknowledgment for rpc_drop_answer itself.</p>
<p>The first version of the response is used if the server remembers nothing of the incoming req_msg_id (if it has already been responded to, for example). The second version is used if the response was canceled while the RPC query was being processed (where the RPC query itself was still fully processed); in this case, the same rpc_answer_dropped_running is also returned in response to the original query, and both of these responses require an acknowledgment from the client. The final version means that the RPC response was removed from the server's outgoing queue, and its msg_id, seq_no, and length in bytes are transmitted to the client.</p>
<p>Note that rpc_answer_dropped_running and rpc_answer_dropped serve as acknowledgments of the server's receipt of the original query (the same one, the response to which we wish to forget). In addition, same as for any RPC queries, any response to rpc_drop_answer is an acknowledgment for rpc_drop_answer itself.</p>
<p>As an alternative to using rpc_drop_answer, a new session may be created after the connection is reset and the old session is removed through destroy_session.</p>
<h4><a class="anchor" name="messages-associated-with-querying-changing-and-receiving-the-sta" href="#messages-associated-with-querying-changing-and-receiving-the-sta"><i class="anchor-icon"></i></a>Messages associated with querying, changing, and receiving the status of other messages</h4>
<h4><a class="anchor" href="#messages-associated-with-querying-changing-and-receiving-the-status-of-other-messages" id="messages-associated-with-querying-changing-and-receiving-the-status-of-other-messages" name="messages-associated-with-querying-changing-and-receiving-the-status-of-other-messages"><i class="anchor-icon"></i></a>Messages associated with querying, changing, and receiving the status of other messages</h4>
<p>See <a href="/mtproto/service_messages_about_messages">Mobile Protocol: Service Messages about Messages</a></p>
<h4><a class="anchor" name="request-for-several-future-salts" href="#request-for-several-future-salts"><i class="anchor-icon"></i></a>Request for several future salts</h4>
<h4><a class="anchor" href="#request-for-several-future-salts" id="request-for-several-future-salts" name="request-for-several-future-salts"><i class="anchor-icon"></i></a>Request for several future salts</h4>
<p>The client may at any time request from the server several (between 1 and 64) future server salts together with their validity periods. Having stored them in persistent memory, the client may use them to send messages in the future even if it changes sessions (a server salt is attached to the authorization key rather than being session-specific).</p>
<pre><code>get_future_salts#b921bd04 num:int = FutureSalts;
future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt;
future_salts#ae500895 req_msg_id:long now:int salts:vector&lt;future_salt&gt; = FutureSalts;</code></pre>
<p>The client must check to see that the response&#39;s req_msg_id in fact coincides with msg_id of the query for get_future_salts. The server returns a maximum of num future server salts (may return fewer). The response serves as the acknowledgment of the query and does not require an acknowledgment itself.</p>
<h4><a class="anchor" name="ping-messages-ping-pong" href="#ping-messages-ping-pong"><i class="anchor-icon"></i></a>Ping Messages (PING/PONG)</h4>
<p>The client must check to see that the response's req_msg_id in fact coincides with msg_id of the query for get_future_salts. The server returns a maximum of num future server salts (may return fewer). The response serves as the acknowledgment of the query and does not require an acknowledgment itself.</p>
<h4><a class="anchor" href="#ping-messages-ping-pong" id="ping-messages-ping-pong" name="ping-messages-ping-pong"><i class="anchor-icon"></i></a>Ping Messages (PING/PONG)</h4>
<pre><code>ping#7abe77ec ping_id:long = Pong;</code></pre>
<p>A response is usually returned to the same connection:</p>
<pre><code>pong#347773c5 msg_id:long ping_id:long = Pong;</code></pre>
<p>These messages do not require acknowledgments. A pong is transmitted only in response to a ping while a ping can be initiated by either side.</p>
<h4><a class="anchor" name="deferred-connection-closure-ping" href="#deferred-connection-closure-ping"><i class="anchor-icon"></i></a>Deferred Connection Closure + PING</h4>
<h4><a class="anchor" href="#deferred-connection-closure--ping" id="deferred-connection-closure--ping" name="deferred-connection-closure--ping"><i class="anchor-icon"></i></a>Deferred Connection Closure + PING</h4>
<pre><code>ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong;</code></pre>
<p>Works like ping. In addition, after this is received, the server starts a timer which will close the current connection disconnect_delay seconds later unless it receives a new message of the same type which automatically resets all previous timers. If the client sends these pings once every 60 seconds, for example, it may set disconnect_delay equal to 75 seconds. </p>
<h4><a class="anchor" name="request-to-destroy-session" href="#request-to-destroy-session"><i class="anchor-icon"></i></a>Request to Destroy Session</h4>
<h4><a class="anchor" href="#request-to-destroy-session" id="request-to-destroy-session" name="request-to-destroy-session"><i class="anchor-icon"></i></a>Request to Destroy Session</h4>
<p>Used by the client to notify the server that it may forget the data from a different session belonging to the same user (i. e. with the same auth_key_id). The result of this being applied to the current session is undefined.</p>
<pre><code>destroy_session_ok#e22045fc session_id:long = DestroySessionRes;
destroy_session_none#62d350c9 session_id:long = DestroySessionRes;
@ -88,33 +89,34 @@ destroy_session_none#62d350c9 session_id:long = DestroySessionRes;
---functions---
destroy_session#e7512126 session_id:long = DestroySessionRes;</code></pre>
<h4><a class="anchor" name="new-session-creation-notification" href="#new-session-creation-notification"><i class="anchor-icon"></i></a>New Session Creation Notification</h4>
<p>The server notifies the client that a new session (from the server&#39;s standpoint) had to be created to handle a client message. If, after this, the server receives a message with an even smaller msg_id within the same session, a similar notification will be generated for this msg_id as well. No such notifications are generated for high msg_id values.</p>
<h4><a class="anchor" href="#new-session-creation-notification" id="new-session-creation-notification" name="new-session-creation-notification"><i class="anchor-icon"></i></a>New Session Creation Notification</h4>
<p>The server notifies the client that a new session (from the server's standpoint) had to be created to handle a client message. If, after this, the server receives a message with an even smaller msg_id within the same session, a similar notification will be generated for this msg_id as well. No such notifications are generated for high msg_id values.</p>
<pre><code>new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession</code></pre>
<p>The unique_id parameter is generated by the server every time a session is (re-)created.</p>
<p>This notification must be acknowledged by the client. It is necessary, for instance, for the client to understand that there is, in fact, a “gap” in the stream of long poll notifications received from the server (the user may have failed to receive notifications during some period of time).</p>
<p>Notice that the server may unilaterally destroy (close) any existing client sessions with all pending messages and notifications, without sending any notifications. This happens, for example, if the session is inactive for a long time, and the server runs out of memory. If the client at some point decides to send new messages to the server using the old session, already forgotten by the server, such a “new session created” notification will be generated. The client is expected to handle such situations gracefully.</p>
<h3><a class="anchor" name="containers" href="#containers"><i class="anchor-icon"></i></a>Containers</h3>
<p>Notice that the server may unilaterally destroy (close) any existing client sessions with all pending messages and notifications, without sending any notifications. This happens, for example, if the session is inactive for a long time, and the server runs out of memory. If the client at some point decides to send new messages to the server using the old session, already forgotten by the server, such a "new session created" notification will be generated. The client is expected to handle such situations gracefully.</p>
<h3><a class="anchor" href="#containers" id="containers" name="containers"><i class="anchor-icon"></i></a>Containers</h3>
<p><em>Containers</em> are messages containing several other messages. Used for the ability to transmit several RPC queries and/or service messages at the same time, using HTTP or even TCP or UDP protocol. A container may only be accepted or rejected by the other party as a whole.</p>
<h4><a class="anchor" name="simple-container" href="#simple-container"><i class="anchor-icon"></i></a>Simple Container</h4>
<h4><a class="anchor" href="#simple-container" id="simple-container" name="simple-container"><i class="anchor-icon"></i></a>Simple Container</h4>
<p>A simple container carries several messages as follows:</p>
<pre><code>msg_container#73f1f8dc messages:vector message = MessageContainer;</code></pre>
<p>Here message refers to any message together with its length and msg_id:</p>
<pre><code>message msg_id:long seqno:int bytes:int body:Object = Message;</code></pre>
<p><code>bytes</code> is the number of bytes in the body serialization.<br>All messages in a container must have msg_id lower than that of the container itself. A container does not require an acknowledgment and may not carry other simple containers. When messages are re-sent, they may be combined into a container in a different manner or sent individually.</p>
<p><code>bytes</code> is the number of bytes in the body serialization.
All messages in a container must have msg_id lower than that of the container itself. A container does not require an acknowledgment and may not carry other simple containers. When messages are re-sent, they may be combined into a container in a different manner or sent individually.</p>
<p>MTProto container can have at have at most <code>1024</code> messages. Clients should group acknowledgments, state requests and message resend requests into three separate <a href="/mtproto/service_messages_about_messages#acknowledgment-of-receipt"><code>msgs_ack</code></a>, <a href="https://core.telegram.org/mtproto/service_messages_about_messages#request-for-message-status-information"><code>msgs_state_req</code></a>, <a href="/mtproto/service_messages_about_messages#explicit-request-to-re-send-messages"><code>msg_resend_req</code></a> service messages with at most 8192 IDs each. </p>
<p>Empty containers are also allowed. They are used by the server, for example, to respond to an HTTP request when the timeout specified in http_wait expires, and there are no messages to transmit. </p>
<p><a href="https://github.com/tdlib/td/blob/master/td/mtproto/SessionConnection.cpp">Example implementation</a>. </p>
<h4><a class="anchor" name="message-copies" href="#message-copies"><i class="anchor-icon"></i></a>Message Copies</h4>
<h4><a class="anchor" href="#message-copies" id="message-copies" name="message-copies"><i class="anchor-icon"></i></a>Message Copies</h4>
<p>In some situations, an old message with a msg_id that is no longer valid needs to be re-sent. Then, it is wrapped in a copy container:</p>
<pre><code>msg_copy#e06046b2 orig_message:Message = MessageCopy;</code></pre>
<p>Once received, the message is processed as if the wrapper were not there. However, if it is known for certain that the message orig_message.msg_id was received, then the new message is not processed (while at the same time, it and orig_message.msg_id are acknowledged). The value of orig_message.msg_id must be lower than the container&#39;s msg_id.</p>
<p>Once received, the message is processed as if the wrapper were not there. However, if it is known for certain that the message orig_message.msg_id was received, then the new message is not processed (while at the same time, it and orig_message.msg_id are acknowledged). The value of orig_message.msg_id must be lower than the container's msg_id.</p>
<p>This is not used at this time, because an old message can be wrapped in a simple container with the same result.</p>
<h4><a class="anchor" name="packed-object" href="#packed-object"><i class="anchor-icon"></i></a>Packed Object</h4>
<h4><a class="anchor" href="#packed-object" id="packed-object" name="packed-object"><i class="anchor-icon"></i></a>Packed Object</h4>
<p>Used to replace any other object (or rather, a serialization thereof) with its archived (gzipped) representation:</p>
<pre><code>gzip_packed#3072cfa1 packed_data:string = Object;</code></pre>
<p>At the present time, it is supported in the body of an RPC response (i.e., as result in rpc_result) and generated by the server for a limited number of high-level queries. In addition, it may be used to transmit non-service messages (i. e. RPC queries) from client to server.</p>
<h3><a class="anchor" name="http-wait-long-poll" href="#http-wait-long-poll"><i class="anchor-icon"></i></a>HTTP Wait/Long Poll</h3>
<h3><a class="anchor" href="#http-wait-long-poll" id="http-wait-long-poll" name="http-wait-long-poll"><i class="anchor-icon"></i></a>HTTP Wait/Long Poll</h3>
<p>The following special service query not requiring an acknowledgement (which must be transmitted only through an HTTP connection) is used to enable the server to send messages in the future to the client using HTTP protocol:</p>
<pre><code>http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait;</code></pre>
<p>When such a message (or a container carrying such a message) is received, the server either waits <code>max_delay</code> milliseconds, whereupon it forwards all the messages that it is holding on to the client if there is at least one message queued in session (if needed, by placing them into a container to which acknowledgments may also be added); or else waits no more than <code>max_wait</code> milliseconds until such a message is available. If a message never appears, an empty container is transmitted.</p>
@ -122,8 +124,8 @@ destroy_session#e7512126 session_id:long = DestroySessionRes;</code></pre>
<p>At the same time, the <code>max_delay</code> parameter has higher priority than <code>wait_after</code>, and <code>max_wait</code> has higher priority than <code>max_delay</code>.</p>
<p>This message does not require a response or an acknowledgement. If the container transmitted over HTTP carries several such messages, the behavior is undefined (in fact, the latest parameter will be used). </p>
<p>If no <code>http_wait</code> is present in container, default values <code>max_delay=0</code> (milliseconds), <code>wait_after=0</code> (milliseconds), and <code>max_wait=25000</code> (milliseconds) are used. </p>
<p>If the client&#39;s ping of the server takes a long time, it may make sense to set <code>max_delay</code> to a value that is comparable in magnitude to ping time.</p>
<h2><a class="anchor" name="destruction-of-a-permanent-auth-key" href="#destruction-of-a-permanent-auth-key"><i class="anchor-icon"></i></a>Destruction of a permanent auth key</h2>
<p>If the client's ping of the server takes a long time, it may make sense to set <code>max_delay</code> to a value that is comparable in magnitude to ping time.</p>
<h2><a class="anchor" href="#destruction-of-a-permanent-auth-key" id="destruction-of-a-permanent-auth-key" name="destruction-of-a-permanent-auth-key"><i class="anchor-icon"></i></a>Destruction of a permanent auth key</h2>
<pre><code>destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes;
destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes;
destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes;
@ -131,8 +133,7 @@ destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes;
---functions---
destroy_auth_key#d1435160 = DestroyAuthKeyRes;</code></pre>
<p><code>destroy_auth_key</code> should be called whenever a permanent auth key isn&#39;t needed anymore, such as after the user was logged out. </p>
</div>
<p><code>destroy_auth_key</code> should be called whenever a permanent auth key isn't needed anymore, such as after the user was logged out.</p></div>
</div>

File diff suppressed because one or more lines are too long