mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2025-01-16 06:40:42 +01:00
Update content of files
This commit is contained in:
parent
c955a9a04a
commit
0a27dc93b3
13 changed files with 1401 additions and 1849 deletions
|
@ -85,7 +85,7 @@
|
|||
<p>How to create styled text with message entities</p>
|
||||
<h4><a class="anchor" href="#messageentitytexturl" id="messageentitytexturl" name="messageentitytexturl"><i class="anchor-icon"></i></a><a href="/constructor/messageEntityTextUrl">messageEntityTextUrl</a></h4>
|
||||
<p>Message entity representing a <a href="https://google.com">text url</a>: for in-text urls like <a href="https://google.com">https://google.com</a> use <a href="/constructor/messageEntityUrl">messageEntityUrl</a>.</p>
|
||||
<p>Note that an additional confirmation popup with the full URL must be displayed to the user before opening this link, unless the domain is one of the whitelisted domains specified in the <a href="/api/config#whitelisted-domains"><code>whitelisted_domains</code> client configuration parameter »</a>.</p></div>
|
||||
<p>Note that an additional confirmation popup with the full URL must be displayed to the user before opening this link, unless the domain satisfies the conditions specified in the <a href="/api/config#whitelisted-domains">domain whitelist documentation »</a>.</p></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<p>How to create styled text with message entities</p>
|
||||
<h4><a class="anchor" href="#messageentitytexturl" id="messageentitytexturl" name="messageentitytexturl"><i class="anchor-icon"></i></a><a href="/constructor/messageEntityTextUrl">messageEntityTextUrl</a></h4>
|
||||
<p>Message entity representing a <a href="https://google.com">text url</a>: for in-text urls like <a href="https://google.com">https://google.com</a> use <a href="/constructor/messageEntityUrl">messageEntityUrl</a>.</p>
|
||||
<p>Note that an additional confirmation popup with the full URL must be displayed to the user before opening this link, unless the domain is one of the whitelisted domains specified in the <a href="/api/config#whitelisted-domains"><code>whitelisted_domains</code> client configuration parameter »</a>.</p></div>
|
||||
<p>Note that an additional confirmation popup with the full URL must be displayed to the user before opening this link, unless the domain satisfies the conditions specified in the <a href="/api/config#whitelisted-domains">domain whitelist documentation »</a>.</p></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<li><code>tg:path?query</code></li>
|
||||
<li><code>tg://path?query</code></li>
|
||||
</ul>
|
||||
<p>The <code>#fragment</code> part is always ignored when parsing Telegram deep links. </p>
|
||||
<p>The <code>#fragment</code> part is always ignored. </p>
|
||||
<p>Also note that whenever a <code><username>.t.me</code> link is encountered and <code><username></code> is not equal to <code>www</code>, is not a single letter and is a valid username, it should be treated exactly as a <code>t.me/<username>/</code> link (generate a <code>t.me/<username>/</code> link and append the rest of the path (if present) and the query string (if present)). </p>
|
||||
<h3><a class="anchor" href="#public-username-links" id="public-username-links" name="public-username-links"><i class="anchor-icon"></i></a>Public username links</h3>
|
||||
<p>Used to link to public users, groups and channels, see <a href="/api/invites#public-usernames">here for more info on how to handle them »</a>. </p>
|
||||
|
@ -189,9 +189,9 @@ t.me/<username>/<id>?single&thread=<thread_id>&comment
|
|||
<pre><code>t.me/c/<channel>/<id>?single&thread=<thread_id>&comment=<message_id>&t=<media_timestamp>
|
||||
t.me/c/<channel>/<thread_id>/<id>?single&comment=<message_id>&t=<media_timestamp></code></pre>
|
||||
<p><code>tg:</code> syntax (public links):</p>
|
||||
<pre><code>tg://resolve?domain=<username>&post=<id>&single&thread=<thread_id>&comment=<comment>&t=<media_timestamp></code></pre>
|
||||
<pre><code>tg://resolve?domain=<username>&post=<id>&single&thread=<thread>&comment=<comment>&t=<media_timestamp></code></pre>
|
||||
<p><code>tg:</code> syntax (private links):</p>
|
||||
<pre><code>tg://privatepost?channel=<channelid>&post=<id>&single&thread=<thread_id>&comment=<comment>&t=<media_timestamp></code></pre>
|
||||
<pre><code>tg://privatepost?channel=<channelid>&post=<id>&single&thread=<thread>&comment=<comment>&t=<media_timestamp></code></pre>
|
||||
<p>Parameters:</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -223,7 +223,7 @@ t.me/c/<channel>/<thread_id>/<id>?single&comment=<messa
|
|||
<td>For albums/grouped media, if set indicates that this is a link to a specific media in the album; otherwise, it is a link to the entire album.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>thread_id</code></td>
|
||||
<td><code>thread</code></td>
|
||||
<td style="text-align: center;">Optional</td>
|
||||
<td>For <a href="/api/threads">message threads</a>, contains the thread ID.</td>
|
||||
</tr>
|
||||
|
@ -1224,27 +1224,6 @@ tg://resolve?domain=<bot_username>&startattach=<start_parameter>
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3><a class="anchor" href="#emoji-links" id="emoji-links" name="emoji-links"><i class="anchor-icon"></i></a>Emoji links</h3>
|
||||
<p>Emoji links are merely an abstraction offered by the <a href="/bots/api">bot API</a> to simplify construction of <a href="/constructor/messageEntityCustomEmoji">messageEntityCustomEmoji</a> constructors, and should be ignored by normal clients. </p>
|
||||
<p><code>tg:</code> syntax:</p>
|
||||
<pre><code>tg://emoji?id=<id></code></pre>
|
||||
<p>Parameters:</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th style="text-align: center;">Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>id</code></td>
|
||||
<td style="text-align: center;">Required</td>
|
||||
<td><a href="/api/custom-emoji">Custom emoji ID</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3><a class="anchor" href="#unsupported-links" id="unsupported-links" name="unsupported-links"><i class="anchor-icon"></i></a>Unsupported links</h3>
|
||||
<p>If a client encounters a <code>tg:</code> link type not listed on this page, <a href="/method/help.getDeepLinkInfo">help.getDeepLinkInfo</a> should be invoked with just the <code>path</code> component of the link. </p>
|
||||
<p>Schema:</p>
|
||||
|
|
|
@ -47,16 +47,15 @@ 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.
|
||||
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.<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>
|
||||
</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" href="#recent-changes" id="recent-changes" name="recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
|
||||
<h3><a class="anchor" name="recent-changes" href="#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" href="#2023" id="2023" name="2023"><i class="anchor-icon"></i></a>2023</h3>
|
||||
<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>
|
||||
<h3><a class="anchor" name="2023" href="#2023"><i class="anchor-icon"></i></a>2023</h3>
|
||||
<h4><a class="anchor" name="april-21-2023" href="#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>
|
||||
|
@ -65,10 +64,10 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<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'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" href="#march-9-2023" id="march-9-2023" name="march-9-2023"><i class="anchor-icon"></i></a>March 9, 2023</h4>
|
||||
<h4><a class="anchor" name="march-9-2023" href="#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>
|
||||
|
@ -97,7 +96,7 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<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" href="#february-3-2023" id="february-3-2023" name="february-3-2023"><i class="anchor-icon"></i></a>February 3, 2023</h4>
|
||||
<h4><a class="anchor" name="february-3-2023" href="#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>
|
||||
|
@ -108,8 +107,8 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<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" 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>
|
||||
<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>
|
||||
<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>
|
||||
|
@ -127,13 +126,13 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<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" href="#november-5-2022" id="november-5-2022" name="november-5-2022"><i class="anchor-icon"></i></a>November 5, 2022</h4>
|
||||
<h4><a class="anchor" name="november-5-2022" href="#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'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>
|
||||
|
@ -141,12 +140,12 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<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" href="#august-12-2022" id="august-12-2022" name="august-12-2022"><i class="anchor-icon"></i></a>August 12, 2022</h4>
|
||||
<h4><a class="anchor" name="august-12-2022" href="#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>
|
||||
|
@ -164,11 +163,11 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<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" href="#june-20-2022" id="june-20-2022" name="june-20-2022"><i class="anchor-icon"></i></a>June 20, 2022</h4>
|
||||
<h4><a class="anchor" name="june-20-2022" href="#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 '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>
|
||||
<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>
|
||||
|
@ -181,7 +180,7 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<p><strong>Join Requests & 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>
|
||||
|
@ -201,15 +200,15 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
<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" href="#april-16-2022" id="april-16-2022" name="april-16-2022"><i class="anchor-icon"></i></a>April 16, 2022</h4>
|
||||
<h4><a class="anchor" name="april-16-2022" href="#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 'web_app' 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'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 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>
|
||||
|
@ -218,31 +217,30 @@ To learn how to create and set up a bot, please consult our <a href="https://cor
|
|||
</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>
|
||||
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><br>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" href="#january-31-2022" id="january-31-2022" name="january-31-2022"><i class="anchor-icon"></i></a>January 31, 2022</h4>
|
||||
<h4><a class="anchor" name="january-31-2022" href="#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" 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>
|
||||
<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>
|
||||
<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" href="#december-7-2021" id="december-7-2021" name="december-7-2021"><i class="anchor-icon"></i></a>December 7, 2021</h4>
|
||||
<h4><a class="anchor" name="december-7-2021" href="#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>
|
||||
|
@ -252,7 +250,7 @@ After the next update, only HTTPS links will be allowed in <em>login_url</em> in
|
|||
<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" href="#november-5-2021" id="november-5-2021" name="november-5-2021"><i class="anchor-icon"></i></a>November 5, 2021</h4>
|
||||
<h4><a class="anchor" name="november-5-2021" href="#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>
|
||||
|
@ -264,11 +262,10 @@ After the next update, only HTTPS links will be allowed in <em>login_url</em> in
|
|||
</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>
|
||||
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><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>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<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>
|
||||
<h4><a class="anchor" name="june-25-2021" href="#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>
|
||||
|
@ -276,8 +273,8 @@ User identifiers will become bigger than <code>2^31 - 1</code> before the end of
|
|||
<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'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>
|
||||
<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>
|
||||
|
@ -292,39 +289,35 @@ User identifiers will become bigger than <code>2^31 - 1</code> before the end of
|
|||
</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>
|
||||
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><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>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<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>
|
||||
<h4><a class="anchor" name="april-26-2021" href="#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'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>
|
||||
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><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>
|
||||
</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>
|
||||
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><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>
|
||||
</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>
|
||||
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><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>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<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>
|
||||
<h4><a class="anchor" name="march-9-2021" href="#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>
|
||||
|
@ -353,16 +346,15 @@ After one of the upcoming Bot API updates, user identifiers will become bigger t
|
|||
</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>
|
||||
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><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>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<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>
|
||||
<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>
|
||||
<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' 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>
|
||||
|
@ -378,7 +370,7 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
</ul>
|
||||
<p><strong>Working with Groups</strong></p>
|
||||
<ul>
|
||||
<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 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>
|
||||
|
@ -401,7 +393,7 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<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 [heading](<a href="https://en.wikipedia.org/wiki/Heading_(navigation&#41">https://en.wikipedia.org/wiki/Heading_(navigation&#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 live location <a href="https://en.wikipedia.org/wiki/Heading_(navigation)">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 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>
|
||||
|
@ -425,14 +417,14 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<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" href="#june-4-2020" id="june-4-2020" name="june-4-2020"><i class="anchor-icon"></i></a>June 4, 2020</h4>
|
||||
<h4><a class="anchor" name="june-4-2020" href="#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" href="#april-24-2020" id="april-24-2020" name="april-24-2020"><i class="anchor-icon"></i></a>April 24, 2020</h4>
|
||||
<h4><a class="anchor" name="april-24-2020" href="#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>
|
||||
|
@ -442,19 +434,19 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<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" href="#march-30-2020" id="march-30-2020" name="march-30-2020"><i class="anchor-icon"></i></a>March 30, 2020</h4>
|
||||
<h4><a class="anchor" name="march-30-2020" href="#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'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 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'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 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" href="#january-23-2020" id="january-23-2020" name="january-23-2020"><i class="anchor-icon"></i></a>January 23, 2020</h4>
|
||||
<h4><a class="anchor" name="january-23-2020" href="#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>
|
||||
|
@ -466,20 +458,20 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<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" 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>
|
||||
<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>
|
||||
<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><u>/<ins></code> (for underlined text) and <code><s>/<strike>/<del></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'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" href="#july-29-2019" id="july-29-2019" name="july-29-2019"><i class="anchor-icon"></i></a>July 29, 2019</h4>
|
||||
<h4><a class="anchor" name="july-29-2019" href="#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>
|
||||
|
@ -487,49 +479,50 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<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'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>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'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>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"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></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" href="#may-31-2019" id="may-31-2019" name="may-31-2019"><i class="anchor-icon"></i></a>May 31, 2019</h4>
|
||||
<h4><a class="anchor" name="may-31-2019" href="#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'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>
|
||||
<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"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
|
||||
</ul>
|
||||
<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>
|
||||
<h4><a class="anchor" name="april-14-2019" href="#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'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'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>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"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
|
||||
<li>Document thumbnails now should be inscribed in a 320x320 square instead of 90x90.</li>
|
||||
</ul>
|
||||
<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>
|
||||
<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>
|
||||
<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" href="#july-26-2018" id="july-26-2018" name="july-26-2018"><i class="anchor-icon"></i></a>July 26, 2018</h4>
|
||||
<h4><a class="anchor" name="july-26-2018" href="#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>
|
||||
|
@ -541,36 +534,36 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<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'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" href="#february-13-2018" id="february-13-2018" name="february-13-2018"><i class="anchor-icon"></i></a>February 13, 2018</h4>
|
||||
<h4><a class="anchor" name="february-13-2018" href="#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'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>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" 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>
|
||||
<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>
|
||||
<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" href="#october-11-2017" id="october-11-2017" name="october-11-2017"><i class="anchor-icon"></i></a>October 11, 2017</h4>
|
||||
<h4><a class="anchor" name="october-11-2017" href="#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'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" href="#august-23-2017" id="august-23-2017" name="august-23-2017"><i class="anchor-icon"></i></a>August 23, 2017</h4>
|
||||
<h4><a class="anchor" name="august-23-2017" href="#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>
|
||||
|
@ -578,13 +571,13 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<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" href="#july-21-2017" id="july-21-2017" name="july-21-2017"><i class="anchor-icon"></i></a>July 21, 2017</h4>
|
||||
<h4><a class="anchor" name="july-21-2017" href="#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" href="#june-30-2017" id="june-30-2017" name="june-30-2017"><i class="anchor-icon"></i></a>June 30, 2017</h4>
|
||||
<h4><a class="anchor" name="june-30-2017" href="#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>
|
||||
|
@ -592,10 +585,10 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<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" href="#may-18-2017" id="may-18-2017" name="may-18-2017"><i class="anchor-icon"></i></a>May 18, 2017</h4>
|
||||
<h4><a class="anchor" name="may-18-2017" href="#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'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>
|
||||
|
@ -609,7 +602,7 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
</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'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>
|
||||
|
@ -623,45 +616,30 @@ After one of the upcoming Bot API updates, some user identifiers will become big
|
|||
<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" 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>
|
||||
<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>
|
||||
<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'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" href="#november-21-2016" id="november-21-2016" name="november-21-2016"><i class="anchor-icon"></i></a>November 21, 2016</h4>
|
||||
<h4><a class="anchor" name="november-21-2016" href="#november-21-2016"><i class="anchor-icon"></i></a>November 21, 2016</h4>
|
||||
<p><strong>Bot API 2.3</strong></p>
|
||||
<ul>
|
||||
<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>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>
|
||||
<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><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>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.</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" 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>
|
||||
<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'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>
|
||||
|
@ -671,50 +649,40 @@ If you're not a developer, you may like <a href="https://telegram.org/blog/games
|
|||
</ul>
|
||||
<p><strong>Other changes</strong></p>
|
||||
<ul>
|
||||
<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>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>
|
||||
<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><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>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" href="#may-25-2016" id="may-25-2016" name="may-25-2016"><i class="anchor-icon"></i></a>May 25, 2016</h4>
|
||||
<h4><a class="anchor" name="may-25-2016" href="#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" href="#may-22-2016" id="may-22-2016" name="may-22-2016"><i class="anchor-icon"></i></a>May 22, 2016</h4>
|
||||
<h4><a class="anchor" name="may-22-2016" href="#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'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" href="#may-12-2016" id="may-12-2016" name="may-12-2016"><i class="anchor-icon"></i></a>May 12, 2016</h4>
|
||||
<h4><a class="anchor" name="may-12-2016" href="#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" href="#may-6-2016" id="may-6-2016" name="may-6-2016"><i class="anchor-icon"></i></a>May 6, 2016</h4>
|
||||
<h4><a class="anchor" name="may-6-2016" href="#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" href="#april-9-2016" id="april-9-2016" name="april-9-2016"><i class="anchor-icon"></i></a>April 9, 2016</h4>
|
||||
<h4><a class="anchor" name="april-9-2016" href="#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>
|
||||
|
@ -734,71 +702,72 @@ If you're not a developer, you may like <a href="https://telegram.org/blog/games
|
|||
<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" href="#february-20-2016" id="february-20-2016" name="february-20-2016"><i class="anchor-icon"></i></a>February 20, 2016</h4>
|
||||
<h4><a class="anchor" name="february-20-2016" href="#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" href="#january-20-2016" id="january-20-2016" name="january-20-2016"><i class="anchor-icon"></i></a>January 20, 2016</h4>
|
||||
<h4><a class="anchor" name="january-20-2016" href="#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'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" href="#january-14-2016" id="january-14-2016" name="january-14-2016"><i class="anchor-icon"></i></a>January 14, 2016</h4>
|
||||
<h4><a class="anchor" name="january-14-2016" href="#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" href="#january-4-2016" id="january-4-2016" name="january-4-2016"><i class="anchor-icon"></i></a>January 4, 2016</h4>
|
||||
<h4><a class="anchor" name="january-4-2016" href="#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" 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>
|
||||
<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>
|
||||
<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 'supergroup'.</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" href="#october-8-2015" id="october-8-2015" name="october-8-2015"><i class="anchor-icon"></i></a>October 8, 2015</h4>
|
||||
<h4><a class="anchor" name="october-8-2015" href="#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's exactly what Telegram clients don'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" href="#september-18-2015" id="september-18-2015" name="september-18-2015"><i class="anchor-icon"></i></a>September 18, 2015</h4>
|
||||
<h4><a class="anchor" name="september-18-2015" href="#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" href="#september-7-2015" id="september-7-2015" name="september-7-2015"><i class="anchor-icon"></i></a>September 7, 2015</h4>
|
||||
<h4><a class="anchor" name="september-7-2015" href="#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'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" href="#august-29-2015" id="august-29-2015" name="august-29-2015"><i class="anchor-icon"></i></a>August 29, 2015</h4>
|
||||
<h4><a class="anchor" name="august-29-2015" href="#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" href="#august-15-2015" id="august-15-2015" name="august-15-2015"><i class="anchor-icon"></i></a>August 15, 2015</h4>
|
||||
<h4><a class="anchor" name="august-15-2015" href="#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" href="#july-2015" id="july-2015" name="july-2015"><i class="anchor-icon"></i></a>July 2015</h4>
|
||||
<h4><a class="anchor" name="july-2015" href="#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" href="#june-24-2015" id="june-24-2015" name="june-24-2015"><i class="anchor-icon"></i></a>June 24, 2015</h4>
|
||||
<h4><a class="anchor" name="june-24-2015" href="#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
|
@ -49,7 +49,7 @@
|
|||
<li><a href="/bots">A General Bot Platform Overview</a></li>
|
||||
<li><a href="/bots/api">Full API Reference for Developers</a></li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#what-features-do-bots-have" id="what-features-do-bots-have" name="what-features-do-bots-have"><i class="anchor-icon"></i></a>What features do bots have?</h3>
|
||||
<h3><a class="anchor" name="what-features-do-bots-have" href="#what-features-do-bots-have"><i class="anchor-icon"></i></a>What features do bots have?</h3>
|
||||
<ul>
|
||||
<li><a href="#inputs"><strong>Inputs</strong></a><ul>
|
||||
<li><a href="#inputs">Text</a></li>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<li><a href="#payments">Payments</a></li>
|
||||
<li><a href="#web-login">Web Login</a></li>
|
||||
<li><a href="#html5-games">HTML5 Games</a></li>
|
||||
<li><a href="#stickers-and-custom-emoji">Stickers</a> </li>
|
||||
<li><a href="#stickers">Stickers</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#language-support"><strong>Language Support</strong></a></li>
|
||||
|
@ -83,21 +83,22 @@
|
|||
<li><a href="#botfather"><strong>BotFather, creating and managing bots</strong></a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#inputs" id="inputs" name="inputs"><i class="anchor-icon"></i></a>Inputs</h3>
|
||||
<p>Users can send <strong>messages of all types</strong> to bots, including text, files, locations, stickers, voice messages and even <a href="/bots/api#dice">dice</a> if they're feeling lucky. However, Telegram bots offer many other tools for building flexible interfaces tailored to your specific needs:</p>
|
||||
<h3><a class="anchor" name="inputs" href="#inputs"><i class="anchor-icon"></i></a>Inputs</h3>
|
||||
<p>Users can send <strong>messages of all types</strong> to bots, including text, files, locations, stickers, voice messages and even <a href="/bots/api#dice">dice</a> if they're feeling lucky. However, Telegram bots offer many other tools for building flexible interfaces tailored to your specific needs:</p>
|
||||
<ul>
|
||||
<li><a href="#commands">Commands</a> that are highlighted in messages and can be selected from a list after typing <code>/</code>.</li>
|
||||
<li><a href="#keyboards">Keyboards</a> that replace the user's keyboard with predefined answer options.</li>
|
||||
<li><a href="#keyboards">Keyboards</a> that replace the user's keyboard with predefined answer options.</li>
|
||||
<li><a href="#inline-keyboards">Buttons</a> that are shown next to messages from the bot.</li>
|
||||
</ul>
|
||||
<p>For even more flexibility, <a href="#web-apps">Web Apps</a> support 100% custom interfaces with JavaScript. </p>
|
||||
<div>
|
||||
<a href="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" target="_blank"><img src="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" title="Inputs" class="dev_page_image" width="70%"></a>
|
||||
<a href="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" target="_blank"><img src="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" title="Inputs" class="dev_page_image" width=70% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Note:</strong> Telegram bots can support <a href="#language-support">multiple languages</a> that adapt to the users' language settings in the app.</p>
|
||||
<p><strong>Note:</strong> Telegram bots can support <a href="#language-support">multiple languages</a> that adapt to the users' language settings in the app.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#commands" id="commands" name="commands"><i class="anchor-icon"></i></a>Commands</h4>
|
||||
<h4><a class="anchor" name="commands" href="#commands"><i class="anchor-icon"></i></a>Commands</h4>
|
||||
<p>A command is a simple <code>/keyword</code> that tells the bot what to do. Telegram apps will:</p>
|
||||
<ul>
|
||||
<li><strong>Highlight</strong> commands in messages. When the user taps a highlighted command, that command is immediately sent again.</li>
|
||||
|
@ -112,58 +113,61 @@
|
|||
<li>/newlocation </li>
|
||||
<li>/newrule </li>
|
||||
</ul>
|
||||
<p>Commands should be <strong>as specific as possible</strong> – for example <code>/newlocation</code> or <code>/newrule</code> <strong>is better</strong> than a <code>/new</code> command that then requires an additional parameter from the user like "<em>location</em>" or "<em>rule</em>".</p>
|
||||
<p>Commands should be <strong>as specific as possible</strong> – for example <code>/newlocation</code> or <code>/newrule</code> <strong>is better</strong> than a <code>/new</code> command that then requires an additional parameter from the user like "<em>location</em>“ or ”<em>rule</em>".</p>
|
||||
<div>
|
||||
<a href="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" target="_blank"><img src="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" title="Commands" class="dev_page_image" width="44%"></a>
|
||||
<a href="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" target="_blank"><img src="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" title="Commands" class="dev_page_image"
|
||||
width=44% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>We require <strong>all developers</strong> to support several <a href="#global-commands">Global Commands</a> to make sure Telegram bots offer a consistent and user-friendly experience.</p>
|
||||
</blockquote>
|
||||
<h5><a class="anchor" href="#command-scopes" id="command-scopes" name="command-scopes"><i class="anchor-icon"></i></a>Command Scopes</h5>
|
||||
<p>Your bot is able to <strong>show different commands</strong> to different users and groups – you can control this using <a href="/bots/api#botcommandscope">scopes</a>. For example, your bot could show additional commands to group admins or translate the list based on the user’s <a href="/bots/api#user">language_code</a>.</p>
|
||||
<h5><a class="anchor" name="command-scopes" href="#command-scopes"><i class="anchor-icon"></i></a>Command Scopes</h5>
|
||||
<p>Your bot is able to <strong>show different commands</strong> to different users and groups – you can control this using <a href="/bots/api#botcommandscope">scopes</a>. For example, your bot could show additional commands to group admins or translate the list based on the user’s <a href="/bots/api#user">language_code</a>.</p>
|
||||
<blockquote>
|
||||
<p>Keep in mind that Bot API <a href="/bots/api#update">updates</a> <strong>will not contain any information</strong> about the scope of a command sent by the user – in fact, they may contain commands that don’t exist at all in your bot. Your backend should <strong>always</strong> verify that received commands are valid and that the user was authorized to use them regardless of scope.</p>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<p>Bots with privacy mode enabled will only receive commands in groups under special conditions, <a href="#privacy-mode">see here</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#keyboards" id="keyboards" name="keyboards"><i class="anchor-icon"></i></a>Keyboards</h4>
|
||||
<h4><a class="anchor" name="keyboards" href="#keyboards"><i class="anchor-icon"></i></a>Keyboards</h4>
|
||||
<p>Bots are able to interpret free text input from users, but offering <strong>specific suggestions</strong> is often more intuitive – this is where <strong>custom keyboards</strong> can be extremely useful.</p>
|
||||
<p>Whenever your bot sends a message, it can <strong>display a special keyboard</strong> with predefined reply options (see <a href="/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a>). Telegram apps that receive the message will display your keyboard to the user. Using any of the buttons will immediately send the respective text. This way you can drastically <strong>simplify</strong> and <strong>streamline</strong> user interaction with your bot.</p>
|
||||
<div>
|
||||
<a href="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" target="_blank"><img src="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" title="Keyboards" class="dev_page_image" width="44%"></a>
|
||||
<a href="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" target="_blank"><img src="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" title="Keyboards" class="dev_page_image" width=44% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Check out the <a href="/bots/api#replykeyboardmarkup">one_time_keyboard</a> parameter to automatically hide your bot's keyboard as soon as it's been used.</p>
|
||||
<p>Check out the <a href="/bots/api#replykeyboardmarkup">one_time_keyboard</a> parameter to automatically hide your bot's keyboard as soon as it's been used.</p>
|
||||
</blockquote>
|
||||
<p>You can also <strong>customize the text placeholder</strong> in the input field by setting the <code>input_field_placeholder</code> parameter.</p>
|
||||
<h4><a class="anchor" href="#inline-keyboards" id="inline-keyboards" name="inline-keyboards"><i class="anchor-icon"></i></a>Inline Keyboards</h4>
|
||||
<p>There are times when you'd prefer to do things <strong>without sending any messages</strong> to the chat – like when a user is changing settings, toggling options or navigating search results. In such cases, you can use <a href="/bots/api#inlinekeyboardmarkup">Inline Keyboards</a> that are shown directly below their relevant messages.</p>
|
||||
<p>Unlike with custom reply keyboards, pressing buttons on inline keyboards <strong>doesn't send messages to the chat</strong>. Instead, inline keyboards support buttons that can work behind the scenes or open different interfaces: <a href="/bots/api#inlinekeyboardbutton">callback buttons</a>, <a href="/bots/api#inlinekeyboardbutton">URL buttons</a>, <a href="/bots/api#inlinekeyboardbutton">switch-to-inline buttons</a>, <a href="/bots/api#inlinekeyboardbutton">game buttons</a> and <a href="/bots/api#inlinekeyboardbutton">payment buttons</a>. </p>
|
||||
<h4><a class="anchor" name="inline-keyboards" href="#inline-keyboards"><i class="anchor-icon"></i></a>Inline Keyboards</h4>
|
||||
<p>There are times when you'd prefer to do things <strong>without sending any messages</strong> to the chat – like when a user is changing settings, toggling options or navigating search results. In such cases, you can use <a href="/bots/api#inlinekeyboardmarkup">Inline Keyboards</a> that are shown directly below their relevant messages.</p>
|
||||
<p>Unlike with custom reply keyboards, pressing buttons on inline keyboards <strong>doesn't send messages to the chat</strong>. Instead, inline keyboards support buttons that can work behind the scenes or open different interfaces: <a href="/bots/api#inlinekeyboardbutton">callback buttons</a>, <a href="/bots/api#inlinekeyboardbutton">URL buttons</a>, <a href="/bots/api#inlinekeyboardbutton">switch-to-inline buttons</a>, <a href="/bots/api#inlinekeyboardbutton">game buttons</a> and <a href="/bots/api#inlinekeyboardbutton">payment buttons</a>. </p>
|
||||
<div>
|
||||
<a href="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" target="_blank"><img src="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" title="Inline Keyboard" class="dev_page_image" width="44%"></a>
|
||||
<a href="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" target="_blank"><img src="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" title="Inline Keyboard" class="dev_page_image" width=44% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>To provide a <strong>better user experience</strong>, consider <a href="/bots/api#editmessagereplymarkup">editing your keyboard</a> when the user toggles a setting button or navigates to a new page – this is both <strong>faster</strong> and <strong>smoother</strong> than sending a whole new message and deleting the previous one.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#menu-button" id="menu-button" name="menu-button"><i class="anchor-icon"></i></a>Menu Button</h4>
|
||||
<p>In all bot chats, a menu button appears near the message field. By default, tapping this button <strong>opens a menu</strong> that can hold some or all of a bot's commands, including a short description for each. Users can then <strong>select a command from the menu</strong> without needing to type it out.</p>
|
||||
<h4><a class="anchor" name="menu-button" href="#menu-button"><i class="anchor-icon"></i></a>Menu Button</h4>
|
||||
<p>In all bot chats, a menu button appears near the message field. By default, tapping this button <strong>opens a menu</strong> that can hold some or all of a bot's commands, including a short description for each. Users can then <strong>select a command from the menu</strong> without needing to type it out.</p>
|
||||
<p>You can set different texts of the menu button and its command descriptions for various <strong>individual users</strong> or <strong>groups of users</strong> – for example, showing translated text based on the user’s language, as explained <a href="#commands">here</a>.</p>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001581/11d85/f42u9c5Wncg.133752/b5a95b7f1221032d7d" style="max-width: 400px;" title="Bot Menu Button" alt="Video: Bot Menu Button">
|
||||
<source src="/file/464001555/10fbd/jvTuV2Ke7WQ.1916669.mp4/a056de323645db409d" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<p>The <strong>menu button</strong> can alternatively be used to launch a <a href="#web-apps">Web App</a>.</p>
|
||||
<h4><a class="anchor" href="#global-commands" id="global-commands" name="global-commands"><i class="anchor-icon"></i></a>Global Commands</h4>
|
||||
<h4><a class="anchor" name="global-commands" href="#global-commands"><i class="anchor-icon"></i></a>Global Commands</h4>
|
||||
<p>To make basic interactions more uniform, we ask all developers to support a few <strong>basic commands</strong>. Telegram apps will have interface shortcuts for these commands.</p>
|
||||
<ul>
|
||||
<li>/start - begins the interaction with the user, like sending an introductory message. This command can also be used to pass additional parameters to the bot (see <a href="#deep-linking">Deep Linking</a>).</li>
|
||||
<li>/help - returns a help message, like a short text about what your bot can do and a list of commands.</li>
|
||||
<li>/settings - (if applicable) shows the bot's settings for this user and suggests commands to edit them.</li>
|
||||
<li>/settings - (if applicable) shows the bot's settings for this user and suggests commands to edit them.</li>
|
||||
</ul>
|
||||
<p>Users will see a <strong>Start</strong> button the first time they open a chat with your bot. <strong>Help</strong> and <strong>Settings</strong> links will be available in the menu on the bot's profile page if you add them in <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
<h3><a class="anchor" href="#chat-and-user-selection" id="chat-and-user-selection" name="chat-and-user-selection"><i class="anchor-icon"></i></a>Chat and User Selection</h3>
|
||||
<p>Users will see a <strong>Start</strong> button the first time they open a chat with your bot. <strong>Help</strong> and <strong>Settings</strong> links will be available in the menu on the bot's profile page if you add them in <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
<h3><a class="anchor" name="chat-and-user-selection" href="#chat-and-user-selection"><i class="anchor-icon"></i></a>Chat and User Selection</h3>
|
||||
<p>Bots can present the user with a <strong>friendly</strong> and <strong>intuitive</strong> interface that lists any number of groups, channels or other users according to a custom set of <strong>criteria</strong>. Tapping on a chat will send its identifier to the bot in a service message and seamlessly close the interface.</p>
|
||||
<p>A group management bot is the <strong>perfect example</strong>: an admin could select a chat the bot should manage, and then select a user it should promote – this would happen without ever typing any text.</p>
|
||||
<p>Here is a <strong>quick start guide</strong> to use this feature:</p>
|
||||
|
@ -171,74 +175,75 @@
|
|||
<li>Pick a set of criteria and store them in a <a href="https://core.telegram.org/bots/api#keyboardbuttonrequestchat">KeyboardButtonRequestChat</a> object (or <a href="https://core.telegram.org/bots/api#keyboardbuttonrequestuser">KeyboardButtonRequestUser</a> for users).</li>
|
||||
<li>Create a <a href="https://core.telegram.org/bots/api#keyboardbutton">KeyboardButton</a> and store the criteria under <code>request_chat</code> or <code>request_user</code> respectively.</li>
|
||||
<li>Send a <a href="https://core.telegram.org/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a> that contains the button you just created.</li>
|
||||
<li>When the user selects a chat, you'll receive its identifier in a <code>chat_shared</code> or <code>user_shared</code> service message.</li>
|
||||
<li>When the user selects a chat, you'll receive its identifier in a <code>chat_shared</code> or <code>user_shared</code> service message.</li>
|
||||
</ul>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" loop="" muted="" poster="/file/464001277/1132d/dAINJNWL9jw.34909/08eaf646c24be49a87" style="max-width: 400px;" title="Select Chats For Bots" alt="Select Chats For Bots" vindex="1" preload="auto">
|
||||
<source src="/file/464001095/11121/M6HpBwtivTE.1913043.mp4/0514a29affa78a6dca" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Keep in mind that the bot may not be able to use the identifier it receives if the corresponding chat or user is not already known or accessible by some other means.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#interactions" id="interactions" name="interactions"><i class="anchor-icon"></i></a>Interactions</h3>
|
||||
<h3><a class="anchor" name="interactions" href="#interactions"><i class="anchor-icon"></i></a>Interactions</h3>
|
||||
<p>In addition to sending commands and messages to the chat with the bot, there are several ways of interacting with them without opening any specific chat or group.</p>
|
||||
<ul>
|
||||
<li><a href="#inline-requests"><strong>Inline mode</strong></a> allows sending requests to bots right from the input field – from any chat on Telegram.</li>
|
||||
<li><a href="#deep-linking"><strong>Deep linking</strong></a> allows special links that send certain parameters to the bot when opened.</li>
|
||||
<li><a href="#attachment-menu"><strong>Attachment menu</strong></a> integration makes it possible to use bots from the attachment menu in chats.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#inline-requests" id="inline-requests" name="inline-requests"><i class="anchor-icon"></i></a>Inline Requests</h4>
|
||||
<p>Users can interact with your bot via <strong>inline queries</strong> straight from the message field <strong>in any chat</strong>. All they need to do is start a message with your bot's <em>@username</em> and enter a keyword.</p>
|
||||
<h4><a class="anchor" name="inline-requests" href="#inline-requests"><i class="anchor-icon"></i></a>Inline Requests</h4>
|
||||
<p>Users can interact with your bot via <strong>inline queries</strong> straight from the message field <strong>in any chat</strong>. All they need to do is start a message with your bot's <em>@username</em> and enter a keyword.</p>
|
||||
<p>Having received the query, your bot can return some results. As soon as the user selects one, it is sent to the <strong>relevant chat</strong>. This way, people can request and send content from your bot in any of their chats, groups or channels.</p>
|
||||
<p>Remember that inline functionality has to be enabled via <a href="https://t.me/botfather">@BotFather</a>, or your bot will not receive inline <a href="/bots/api#update">Updates</a>.</p>
|
||||
<div>
|
||||
<a href="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" target="_blank"><img src="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" title="Inline Mode" class="dev_page_image" width="51%/"></a>
|
||||
<a href="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" target="_blank"><img src="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" title="Inline Mode" class="dev_page_image" width=51%/></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Examples of inline bots include <a href="https://gif.t.me">@gif</a>, <a href="https://bing.t.me">@bing</a> and <a href="https://wiki.t.me">@wiki</a>. <a href="#web-apps">Web App</a> bots can also be used inline – try typing <a href="https://durgerkingbot.t.me">@durgerkingbot</a> in any chat.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#deep-linking" id="deep-linking" name="deep-linking"><i class="anchor-icon"></i></a>Deep Linking</h4>
|
||||
<p>Telegram bots have a deep linking mechanism that allows <strong>additional parameters</strong> to be passed to the bot on startup. It could be a command that launches the bot – or an authentication token to connect the user's Telegram account to their account on another platform.</p>
|
||||
<h4><a class="anchor" name="deep-linking" href="#deep-linking"><i class="anchor-icon"></i></a>Deep Linking</h4>
|
||||
<p>Telegram bots have a deep linking mechanism that allows <strong>additional parameters</strong> to be passed to the bot on startup. It could be a command that launches the bot – or an authentication token to connect the user's Telegram account to their account on another platform.</p>
|
||||
<p>Each bot has a link that <strong>opens a conversation</strong> with it in Telegram – <code>https://t.me/<bot_username></code>. Parameters can be added directly to this link to let your bot work with additional information on the fly, without any user input.</p>
|
||||
<blockquote>
|
||||
<p>A-Z, a-z, 0-9, _ and - are allowed. We recommend using base64url to encode parameters with binary and other types of content. The parameter can be up to 64 characters long.</p>
|
||||
</blockquote>
|
||||
<p><strong>Private Chats</strong>
|
||||
In private chats, you can use the <code>start</code> parameter to automatically pass any value to your bot whenever a user presses the link. For example, you could use:</p>
|
||||
<p><strong>Private Chats</strong><br>In private chats, you can use the <code>start</code> parameter to automatically pass any value to your bot whenever a user presses the link. For example, you could use:</p>
|
||||
<pre><code>https://t.me/your_bot?start=airplane</code></pre>
|
||||
<p>When someone opens a chat with your bot via this link, you will receive:</p>
|
||||
<pre><code>/start airplane</code></pre>
|
||||
<p><strong>Groups</strong>
|
||||
In groups, you can add the parameter <code>startgroup</code> to this link. For example:</p>
|
||||
<p><strong>Groups</strong><br>In groups, you can add the parameter <code>startgroup</code> to this link. For example:</p>
|
||||
<pre><code>https://t.me/your_bot?startgroup=spaceship</code></pre>
|
||||
<p>Following a link with this parameter prompts the user to select a group to add the bot to – the resulting update will contain text in the form:</p>
|
||||
<pre><code>/start@your_bot spaceship</code></pre>
|
||||
<blockquote>
|
||||
<p><a href="#web-apps">Web Apps</a> also support deep linking, for more information check out our <a href="/bots/webapps#adding-bots-to-the-attachment-menu">dedicated guide</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#attachment-menu" id="attachment-menu" name="attachment-menu"><i class="anchor-icon"></i></a>Attachment Menu</h4>
|
||||
<h4><a class="anchor" name="attachment-menu" href="#attachment-menu"><i class="anchor-icon"></i></a>Attachment Menu</h4>
|
||||
<p>Certain bots can be added directly to a user’s <strong>attachment menu</strong> – giving them easy access to the bot in any chat. Currently, this option is restricted to certain <a href="/bots/webapps#launching-web-apps-from-the-attachment-menu">approved bots</a>, but may be expanded later.</p>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001491/11651/uwMWNdO29NE.215169/1b37285bbd8fc81244" style="max-width: 400px;" title="Attachment Menu" alt="Video: Bot Attachment Menu">
|
||||
<source src="/file/464001177/11b03/ruSbBLQiLJ8.928268.mp4/d9ad95048d23f3cc3f" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Try adding <a href="https://t.me/durgerkingbot?startattach">@DurgerKingBot</a> to your attachment menu.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#integration" id="integration" name="integration"><i class="anchor-icon"></i></a>Integration</h3>
|
||||
<h3><a class="anchor" name="integration" href="#integration"><i class="anchor-icon"></i></a>Integration</h3>
|
||||
<p>There are various ways of futher integrating bots with Telegram and other services.</p>
|
||||
<ul>
|
||||
<li>Use <a href="#web-apps">Web Apps</a> to replace any website.</li>
|
||||
<li>Accept <a href="#payments">Payments</a> via dozens of integrated third-party payment providers.</li>
|
||||
<li>Connect to Telegram using the <a href="#web-login">Web Login</a> functionality.</li>
|
||||
<li>Create gaming bots by integrating <a href="#html5-games">HTML5 Games</a>.</li>
|
||||
<li>Help users create and manage <a href="#stickers-and-custom-emoji">Telegram Stickers</a>.</li>
|
||||
<li>Help users create and manage <a href="#stickers">Telegram Stickers</a>.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#web-apps" id="web-apps" name="web-apps"><i class="anchor-icon"></i></a>Web Apps</h3>
|
||||
<h3><a class="anchor" name="web-apps" href="#web-apps"><i class="anchor-icon"></i></a>Web Apps</h3>
|
||||
<p>Bots can easily process <strong>complex inputs</strong> of any kind and <strong>dynamic interaction flows</strong> via <a href="webapps">Web Apps</a>. With this unique feature, you can develop any number of flexible, streamlined interfaces in <strong>JavaScript</strong>.</p>
|
||||
<blockquote>
|
||||
<p>Web Apps are covered in detail in our <a href="webapps">dedicated guide</a> – you should read it carefully to learn the wide variety of features they can offer.</p>
|
||||
|
@ -246,14 +251,15 @@ In groups, you can add the parameter <code>startgroup</code> to this link. For e
|
|||
<div class="blog_video_player_wrap" style="max-width: 400px; 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: 400px;" title="Attachment Menu" alt="Video: Bot Attachment Menu">
|
||||
<source src="/file/464001679/11aa9/KQx_BlPVXRo.4922145.mp4/c65433c8ac11a347a8" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
<p>If you develop a <strong>Web App</strong>, be sure to follow our <a href="webapps#design-guidelines">design guidelines</a> – you'll want your custom interface to <strong>seamlessly integrate</strong> into the app to provide users the best possible experience.</p>
|
||||
<h3><a class="anchor" href="#payments" id="payments" name="payments"><i class="anchor-icon"></i></a>Payments</h3>
|
||||
<p>Telegram bots can accept payments with a sleek, streamlined interface that collects all necessary data from the user. Telegram <strong>doesn't collect</strong> any payment data – like the user's credit card information – and sends it directly to one of the supported <a href="payments#supported-payment-providers">payment providers</a>.</p>
|
||||
|
||||
<p>If you develop a <strong>Web App</strong>, be sure to follow our <a href="webapps#design-guidelines">design guidelines</a> – you'll want your custom interface to <strong>seamlessly integrate</strong> into the app to provide users the best possible experience.</p>
|
||||
<h3><a class="anchor" name="payments" href="#payments"><i class="anchor-icon"></i></a>Payments</h3>
|
||||
<p>Telegram bots can accept payments with a sleek, streamlined interface that collects all necessary data from the user. Telegram <strong>doesn't collect</strong> any payment data – like the user's credit card information – and sends it directly to one of the supported <a href="payments#supported-payment-providers">payment providers</a>.</p>
|
||||
<p>Here is a <strong>quick start guide</strong> to implement payments:</p>
|
||||
<ul>
|
||||
<li>Pick a <a href="payments#supported-payment-providers">provider</a> and obtain the <a href="payments#getting-a-token">proper token</a> as well as a <strong>test token</strong> from the "<strong>Stripe TEST MODE</strong>" provider.</li>
|
||||
<li>Pick a <a href="payments#supported-payment-providers">provider</a> and obtain the <a href="payments#getting-a-token">proper token</a> as well as a <strong>test token</strong> from the "<strong>Stripe TEST MODE</strong>" provider.</li>
|
||||
<li>Implement payments via the <a href="/bots/api#payments">appropriate API methods</a>.</li>
|
||||
<li>Test your implementation by using your <strong>test token</strong> along with a <a href="https://stripe.com/docs/testing#cards">test credit card</a>.</li>
|
||||
</ul>
|
||||
|
@ -266,37 +272,38 @@ In groups, you can add the parameter <code>startgroup</code> to this link. For e
|
|||
</ul>
|
||||
<p>A full and exhaustive guide, including live checklist, parameters and in-depth method descriptions is available <a href="/bots/payments">here</a>. We <strong>strongly recommend</strong> that you read the full guide before going live.</p>
|
||||
<div>
|
||||
<a href="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" target="_blank"><img src="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" title="Payments" class="dev_page_image" width="50%"></a>
|
||||
<a href="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" target="_blank"><img src="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" title="Payments" class="dev_page_image" width=50% /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Telegram does not directly process the payments, does not store data about orders and does not collect any fees. Invoices are forwarded directly to the payment provider.
|
||||
For this reason, disputes must be solved between the user, the bot developer and the payment provider. You can read more about this in the <a href="https://telegram.org/privacy#7-third-party-payment-services">Privacy Policy</a>.</p>
|
||||
<p>Telegram does not directly process the payments, does not store data about orders and does not collect any fees. Invoices are forwarded directly to the payment provider.<br>For this reason, disputes must be solved between the user, the bot developer and the payment provider. You can read more about this in the <a href="https://telegram.org/privacy#7-third-party-payment-services">Privacy Policy</a>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#web-login" id="web-login" name="web-login"><i class="anchor-icon"></i></a>Web Login</h3>
|
||||
<h3><a class="anchor" name="web-login" href="#web-login"><i class="anchor-icon"></i></a>Web Login</h3>
|
||||
<p>Telegram offers a <strong>flexible</strong>, <strong>lightweight</strong> and <strong>free</strong> framework to authenticate users on any website and app. This can be used to bridge your platform with Telegram, providing a smooth experience to your users. You can also freely rely on this framework to implement a <strong>fast</strong> and <strong>signup-free</strong> login on your site, regardless of its connection to Telegram.</p>
|
||||
<h4><a class="anchor" href="#widgets" id="widgets" name="widgets"><i class="anchor-icon"></i></a>Widgets</h4>
|
||||
<h4><a class="anchor" name="widgets" href="#widgets"><i class="anchor-icon"></i></a>Widgets</h4>
|
||||
<p>The Telegram login widget is a <strong>simple and secure way to authorize users</strong> on your website.</p>
|
||||
<ol>
|
||||
<li>Choose a bot – ideally its name and profile pic <strong>should match</strong> the website title and logo.</li>
|
||||
<li>Use the <code>/setdomain</code> command in <a href="https://t.me/botfather">@BotFather</a> to pair the bot with your website domain. </li>
|
||||
<li>Configure your widget using <a href="/widgets/login#widget-configuration">our dedicated tool</a> and embed it on your website.</li>
|
||||
</ol>
|
||||
<h4><a class="anchor" href="#inline-login" id="inline-login" name="inline-login"><i class="anchor-icon"></i></a>Inline Login</h4>
|
||||
<p>When users open your website via an <strong>inline button</strong>, you can use the <a href="/bots/api#loginurl">login_url</a> parameter as an alternative to login widgets. This way, you'll be able to <a href="https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots">seamlessly authorize</a> them on your website or app before the page even loads.</p>
|
||||
<h4><a class="anchor" name="inline-login" href="#inline-login"><i class="anchor-icon"></i></a>Inline Login</h4>
|
||||
<p>When users open your website via an <strong>inline button</strong>, you can use the <a href="/bots/api#loginurl">login_url</a> parameter as an alternative to login widgets. This way, you'll be able to <a href="https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots">seamlessly authorize</a> them on your website or app before the page even loads.</p>
|
||||
<div>
|
||||
<a href="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" target="_blank"><img src="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" width="50%" title="Login Widget" class="dev_page_image"></a>
|
||||
<a href="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" target="_blank"><img src="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" width=50% title="Login Widget" class="dev_page_image" /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Make sure to review our <a href="/widgets/login#checking-authorization">guide</a> on authenticating the received data as well as our <a href="https://gist.github.com/anonymous/6516521b1fb3b464534fbc30ea3573c2">sample code</a>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#html5-games" id="html5-games" name="html5-games"><i class="anchor-icon"></i></a>HTML5 Games</h3>
|
||||
<h3><a class="anchor" name="html5-games" href="#html5-games"><i class="anchor-icon"></i></a>HTML5 Games</h3>
|
||||
<p>Bots can serve as <strong>standalone gaming platforms</strong> – with our <a href="/bots/api#games">HTML5 Gaming API</a> you can develop multiplayer or single-player games and let your users have fun comparing <strong>ranks</strong>, <strong>scores</strong> and much more.</p>
|
||||
<p>To get started, follow these simple steps:</p>
|
||||
<ul>
|
||||
<li>Send the <code>/newgame</code> command to <a href="https://t.me/botfather">@BotFather</a></li>
|
||||
<li>Provide a <strong>description text</strong>, an <strong>image</strong> or an <strong>optional gif</strong> to showcase its gameplay</li>
|
||||
<li>Send the game to users via the <a href="/bots/api#sendgame">sendGame</a> method or via an <a href="/bots/api#inlinequeryresultgame">inline query</a></li>
|
||||
<li>When someone wants to play, you'll receive the appropriate <code>game_short_name</code> in a <a href="/bots/api#callbackquery">CallbackQuery</a></li>
|
||||
<li>When someone wants to play, you'll receive the appropriate <code>game_short_name</code> in a <a href="/bots/api#callbackquery">CallbackQuery</a></li>
|
||||
<li>To launch the game, provide the <strong>HTML5 Game URL</strong> as the <code>url</code> param of <a href="/bots/api#answercallbackquery">answerCallbackQuery</a></li>
|
||||
</ul>
|
||||
<p>Then, to handle <strong>highscores</strong>:</p>
|
||||
|
@ -310,50 +317,49 @@ For this reason, disputes must be solved between the user, the bot developer and
|
|||
<li><a href="/bots/api#games">HTML5 Games Bot API Docs</a></li>
|
||||
</ul>
|
||||
<div>
|
||||
<a href="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" target="_blank"><img src="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" title="Games" width="50%" class="dev_page_image"></a>
|
||||
<a href="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" target="_blank"><img src="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" title="Games" width=50% class="dev_page_image" /></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>Check out <a href="https://t.me/gamebot">@GameBot</a> and <a href="https://t.me/gamee">@gamee</a> for examples of what you can do using our Gaming Platform.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#stickers-and-custom-emoji" id="stickers-and-custom-emoji" name="stickers-and-custom-emoji"><i class="anchor-icon"></i></a>Stickers and Custom Emoji</h3>
|
||||
<h3><a class="anchor" name="stickers-and-custom-emoji" href="#stickers-and-custom-emoji"><i class="anchor-icon"></i></a>Stickers and Custom Emoji</h3>
|
||||
<p><a href="https://core.telegram.org/stickers">Stickers</a> and <a href="https://telegram.org/blog/custom-emoji">Custom Emoji</a> are a distinctive Telegram feature used by millions of users to share artwork every day. Stickers and custom emoji take many forms – ranging from <strong>basic images</strong> to smooth <strong>vector animations</strong> and high-detail <strong>.WEBM videos</strong>.</p>
|
||||
<p>All these formats are supported by our <a href="api#stickers">Bot API</a>, which allows bots to <strong>create</strong>, <strong>edit</strong>, <strong>delete</strong> and <strong>share</strong> new artwork packs on the fly. Telegram's <a href="https://core.telegram.org/import-stickers">Import API</a> lets users <strong>migrate packs</strong> from other platforms and sticker apps.</p>
|
||||
<p><strong>Creating a new pack</strong>
|
||||
To create a <strong>new pack</strong>, simply:</p>
|
||||
<p>All these formats are supported by our <a href="api#stickers">Bot API</a>, which allows bots to <strong>create</strong>, <strong>edit</strong>, <strong>delete</strong> and <strong>share</strong> new artwork packs on the fly. Telegram's <a href="https://core.telegram.org/import-stickers">Import API</a> lets users <strong>migrate packs</strong> from other platforms and sticker apps.</p>
|
||||
<p><strong>Creating a new pack</strong><br>To create a <strong>new pack</strong>, simply:</p>
|
||||
<ul>
|
||||
<li><strong>Prepare</strong> your artwork following our <a href="https://core.telegram.org/stickers">technical requirements</a>.</li>
|
||||
<li><strong>Create</strong> a new sticker pack via <a href="api#createnewstickerset">createStickerSet</a>. Set <code>sticker_type</code> to <em>regular</em> to create a sticker pack or to <em>custom emoji</em> to create a pack of custom emoji. Attach the <a href="api#file">files</a> you wish to include in the pack as an array of <a href="https://core.telegram.org/bots#inputsticker">InputSticker</a></li>
|
||||
<li>You can use <a href="api#addstickertoset">addStickerToSet</a> to add stickers or emoji later on.</li>
|
||||
</ul>
|
||||
<p><strong>Additional features</strong>
|
||||
Regular stickers and custom emoji support <strong>keywords</strong> that users can type to quickly find the respective artwork – this can be useful when a sticker doesn't have obvious ties to a specific emoji. You can use the <code>keywords</code> parameter in <a href="https://core.telegram.org/bots#inputsticker">InputSticker</a> to specify them.</p>
|
||||
<p><strong>Additional features</strong><br>Regular stickers and custom emoji support <strong>keywords</strong> that users can type to quickly find the respective artwork – this can be useful when a sticker doesn't have obvious ties to a specific emoji. You can use the <code>keywords</code> parameter in <a href="https://core.telegram.org/bots#inputsticker">InputSticker</a> to specify them.</p>
|
||||
<p>Custom emoji additionally support <strong>adaptive colors</strong> – they will always match the current context (e.g., white on photos, accent color when used as status, etc.); to enable this feature, use the <code>needs_repainting</code> parameter in <a href="api#createnewstickerset">createStickerSet</a>.</p>
|
||||
<p>Once you're done creating and sharing your artwork, don't forget to check out our <a href="api#stickers">remaining sticker methods</a> to find out how to <a href="api#setstickersetthumb">edit</a>, <a href="api#deletestickerfromset">delete</a> and even <a href="api#setstickerpositioninset">reorder</a> your pack. </p>
|
||||
<p>Once you're done creating and sharing your artwork, don't forget to check out our <a href="api#stickers">remaining sticker methods</a> to find out how to <a href="api#setstickersetthumb">edit</a>, <a href="api#deletestickerfromset">delete</a> and even <a href="api#setstickerpositioninset">reorder</a> your pack. </p>
|
||||
<blockquote>
|
||||
<p>Note that these methods will only work on packs <strong>created by the bot that is calling them</strong>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#language-support" id="language-support" name="language-support"><i class="anchor-icon"></i></a>Language Support</h3>
|
||||
<h3><a class="anchor" name="language-support" href="#language-support"><i class="anchor-icon"></i></a>Language Support</h3>
|
||||
<p>Bots can tailor their interfaces to <strong>support multiple languages</strong> – updating inputs and information on the fly. A user’s <a href="/bots/api#user">language_code</a> is included in every relevant <a href="/bots/api#update">update</a> as an <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a>, allowing bots to adapt accordingly. </p>
|
||||
<p>We recommend that you follow our guidelines to provide <strong>the best user experience</strong>.</p>
|
||||
<ul>
|
||||
<li>Your interfaces, texts and <a href="/bots/api#answerinlinequery">inline results</a> should adapt seamlessly to the <em>language_code</em>, without user intervention.</li>
|
||||
<li>Connected <a href="/bots/webapps">WebApps</a> will receive the user's <em>language_code</em> – your HTML page should account for it.</li>
|
||||
<li><a href="/bots/games">HTML5 Games</a> can obtain language information if you specify it as a <a href="/bots/games#using-url-parameters">URL parameter</a>. You can generate this parameter from the <em>language_code</em> field in the <a href="/bots/api#user">User</a> object served with the initial game <a href="/bots/api#callbackquery">CallbackQuery</a>.</li>
|
||||
<li>The bot's <strong>Name</strong>, <strong>Description</strong> and <strong>About text</strong> can be natively localized with the respective <a href="https://core.telegram.org/bots/api#setmydescription">methods</a>.</li>
|
||||
<li>Connected <a href="/bots/webapps">WebApps</a> will receive the user's <em>language_code</em> – your HTML page should account for it.</li>
|
||||
<li><a href="/bots/html5-games">HTML5 Games</a> can obtain language information if you specify it as a <a href="/bots/games#using-url-parameters">URL parameter</a>. You can generate this parameter from the <em>language_code</em> field in the <a href="/bots/api#user">User</a> object served with the initial game <a href="/bots/api#callbackquery">CallbackQuery</a>.</li>
|
||||
<li>The bot's <strong>Name</strong>, <strong>Description</strong> and <strong>About text</strong> can be natively localized with the respective <a href="https://core.telegram.org/bots/api#setmydescription">methods</a>.</li>
|
||||
<li>Command lists can also be specified for individual languages – more on this <a href="#commands">here</a>.</li>
|
||||
</ul>
|
||||
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
|
||||
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001822/10cd0/EvtvjnhA-kA.132475/e285952b505535d85a" style="max-width: 400px;" title="Language Support" alt="Video: Language Support">
|
||||
<source src="/file/464001083/105cd/NF4ViAHfTJc.3601652.mp4/0fd787953c11a6371d" type="video/mp4">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>The <em>language_code</em> is an <strong>optional field</strong> – it could be empty.
|
||||
If you target the general public, your code should always fall back to either the last recorded language tag or English (in this order) when the field is missing for a specific user. </p>
|
||||
<p>The <em>language_code</em> is an <strong>optional field</strong> – it could be empty.<br>If you target the general public, your code should always fall back to either the last recorded language tag or English (in this order) when the field is missing for a specific user. </p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#bot-management" id="bot-management" name="bot-management"><i class="anchor-icon"></i></a>Bot Management</h3>
|
||||
<h4><a class="anchor" href="#privacy-mode" id="privacy-mode" name="privacy-mode"><i class="anchor-icon"></i></a>Privacy Mode</h4>
|
||||
<h3><a class="anchor" name="bot-management" href="#bot-management"><i class="anchor-icon"></i></a>Bot Management</h3>
|
||||
<h4><a class="anchor" name="privacy-mode" href="#privacy-mode"><i class="anchor-icon"></i></a>Privacy Mode</h4>
|
||||
<p>Bots are frequently added to groups to perform basic tasks or assist moderators – like automatically posting company announcements or even celebrating birthdays. By default, <strong>all bots</strong> added to groups run in Privacy Mode and only see relevant messages and commands:</p>
|
||||
<ul>
|
||||
<li>Commands explicitly meant for them (e.g., <code>/command@this_bot</code>).</li>
|
||||
|
@ -367,20 +373,21 @@ If you target the general public, your code should always fall back to either th
|
|||
<li>All messages from private chats.</li>
|
||||
<li>All messages from channels where they are a member.</li>
|
||||
</ul>
|
||||
<p>Privacy mode is <strong>enabled by default</strong> for all bots, except bots that were added to a group as admins (bot admins always receive <strong>all messages</strong>). It can be disabled so that the bot receives all messages like an ordinary user (the bot will need to be re-added to the group for this change to take effect). We only recommend doing this in cases where it is <strong>absolutely necessary</strong> for your bot to work. In most cases, using the force reply option for the bot's messages should be more than enough.</p>
|
||||
<p>Privacy mode is <strong>enabled by default</strong> for all bots, except bots that were added to a group as admins (bot admins always receive <strong>all messages</strong>). It can be disabled so that the bot receives all messages like an ordinary user (the bot will need to be re-added to the group for this change to take effect). We only recommend doing this in cases where it is <strong>absolutely necessary</strong> for your bot to work. In most cases, using the force reply option for the bot's messages should be more than enough.</p>
|
||||
<div>
|
||||
<a href="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" target="_blank"><img src="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" title="Privacy Mode" class="dev_page_image" width="50%/"></a>
|
||||
<a href="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" target="_blank"><img src="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" title="Privacy Mode" class="dev_page_image" width=50%/></a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>This mode not only increases user privacy, but also makes the bot more efficient by reducing the number of inputs it needs to process. Users can always see a bot’s current privacy setting in the list of group members.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#testing-your-bot" id="testing-your-bot" name="testing-your-bot"><i class="anchor-icon"></i></a>Testing your bot</h3>
|
||||
<h3><a class="anchor" name="testing-your-bot" href="#testing-your-bot"><i class="anchor-icon"></i></a>Testing your bot</h3>
|
||||
<p>You can quickly test your bot <strong>without interfering</strong> with its users by simply running another instance of your code on a different bot account. To do so, create a <em>new bot</em> via <a href="https://t.me/botfather">@BotFather</a>, obtain its token and use it in the testing instance of your code.</p>
|
||||
<p>All further testing and debugging can happen privately on the new bot, without affecting the original instance.</p>
|
||||
<blockquote>
|
||||
<p>If you need to share file references across bots, note that the <code>file_id</code> field is tied to a single bot id, so your test instance cannot use a shared <code>file_id</code> database to quickly send media – files must be individually reuploaded.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#dedicated-test-environment" id="dedicated-test-environment" name="dedicated-test-environment"><i class="anchor-icon"></i></a>Dedicated test environment</h4>
|
||||
<h4><a class="anchor" name="dedicated-test-environment" href="#dedicated-test-environment"><i class="anchor-icon"></i></a>Dedicated test environment</h4>
|
||||
<p>Telegram also offers a dedicated <strong>test environment</strong> suitable for more advanced testing. Bots and users in this environment generally have more flexible restrictions – for example:</p>
|
||||
<ul>
|
||||
<li>When working with the test environment, you may use HTTP links without TLS to test your <a href="https://core.telegram.org/bots/features#web-apps">Web Apps</a> or <a href="https://core.telegram.org/bots/features#web-login">Web Login</a>.</li>
|
||||
|
@ -389,62 +396,55 @@ If you target the general public, your code should always fall back to either th
|
|||
<blockquote>
|
||||
<p><strong>Flood limits</strong> are not raised in the test environment, and may at times be stricter. To minimize how this impacts your bot, you should make sure that it handles errors with retry policies and does not depend on hardcoded limit values.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#creating-a-bot-in-the-test-environment" id="creating-a-bot-in-the-test-environment" name="creating-a-bot-in-the-test-environment"><i class="anchor-icon"></i></a>Creating a bot in the test environment</h4>
|
||||
<h4><a class="anchor" name="creating-a-bot-in-the-test-environment" href="#creating-a-bot-in-the-test-environment"><i class="anchor-icon"></i></a>Creating a bot in the test environment</h4>
|
||||
<p>The test environment is <strong>completely separate</strong> from the main environment, so you will need to create a new user account and a new bot with <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
<p>To create an account and log in, use either of the following:</p>
|
||||
<ul>
|
||||
<li><strong>iOS</strong>: tap 10 times on the Settings icon > Accounts > Login to another account > Test.</li>
|
||||
<li><strong>Telegram Desktop</strong>: open ☰ Settings > Shift + Alt + Right click 'Add Account' and select 'Test Server'.</li>
|
||||
<li><strong>macOS</strong>: click the Settings icon 10 times to open the Debug Menu, ⌘ + click 'Add Account' and log in via phone number.</li>
|
||||
<li><strong>Telegram Desktop</strong>: open ☰ Settings > Shift + Alt + Right click 'Add Account' and select 'Test Server'.</li>
|
||||
<li><strong>macOS</strong>: click the Settings icon 10 times to open the Debug Menu, ⌘ + click 'Add Account' and log in via phone number.</li>
|
||||
</ul>
|
||||
<p>After logging in, simply <a href="#creating-a-new-bot">create a new bot</a> following the standard procedure and send your requests to the Test Bot API in this format:</p>
|
||||
<pre><code>https://api.telegram.org/bot<token>/test/METHOD_NAME</code></pre>
|
||||
<blockquote>
|
||||
<p>When working with the test environment, you may use HTTP links without TLS in the <code>url</code> field of both <a href="/bots/api#loginurl">LoginUrl</a> and <a href="/bots/api#webappinfo">WebAppInfo</a>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#status-alerts" id="status-alerts" name="status-alerts"><i class="anchor-icon"></i></a>Status alerts</h4>
|
||||
<h4><a class="anchor" name="status-alerts" href="#status-alerts"><i class="anchor-icon"></i></a>Status alerts</h4>
|
||||
<p>Millions choose Telegram for its speed. To best benefit users, your bot also <strong>needs to be responsive</strong>. In order to help developers keep their bots in shape, <a href="https://t.me/botfather">@BotFather</a> will send <strong>status alerts</strong> if it sees something is wrong.</p>
|
||||
<p>We check the number of replies and the <em>request/response</em> conversion rate for popular bots (~300 requests per minute, this value may change in the future). If your bot returns an <strong>abnormally low number</strong>, you will receive a notification from <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
<h5><a class="anchor" href="#responding-to-alerts" id="responding-to-alerts" name="responding-to-alerts"><i class="anchor-icon"></i></a>Responding to alerts</h5>
|
||||
<h5><a class="anchor" name="responding-to-alerts" href="#responding-to-alerts"><i class="anchor-icon"></i></a>Responding to alerts</h5>
|
||||
<p>By default, <strong>you will only get one alert per bot per hour</strong>. </p>
|
||||
<p>Each alert has the following buttons:</p>
|
||||
<ul>
|
||||
<li><strong>Fixed</strong> - Use this if you found an issue with your bot and fixed it. If you press the fix button, we will resume sending alerts in the regular way so that you can see if your fix worked within 5-10 minutes instead of having to wait for an hour.</li>
|
||||
<li><strong>Support</strong> - Use this to open a chat with <a href="https://t.me/botsupport">@BotSupport</a> if you don't see any issues with your bot or if you think the problem is on our side.</li>
|
||||
<li><strong>Mute for 8h/1w</strong> - Use this if you can't fix your bot at the moment. This will disable all alerts for the bot in question for the specified period of time. <strong>We do not recommend</strong> using this option since your users may migrate to a more stable bot. You can unmute alerts in your bot's settings via <a href="https://t.me/botfather">@BotFather</a>.</li>
|
||||
<li><strong>Support</strong> - Use this to open a chat with <a href="https://t.me/botsupport">@BotSupport</a> if you don't see any issues with your bot or if you think the problem is on our side.</li>
|
||||
<li><strong>Mute for 8h/1w</strong> - Use this if you can't fix your bot at the moment. This will disable all alerts for the bot in question for the specified period of time. <strong>We do not recommend</strong> using this option since your users may migrate to a more stable bot. You can unmute alerts in your bot's settings via <a href="https://t.me/botfather">@BotFather</a>.</li>
|
||||
</ul>
|
||||
<h5><a class="anchor" href="#monitored-issues" id="monitored-issues" name="monitored-issues"><i class="anchor-icon"></i></a>Monitored issues</h5>
|
||||
<h5><a class="anchor" name="monitored-issues" href="#monitored-issues"><i class="anchor-icon"></i></a>Monitored issues</h5>
|
||||
<p>We currently notify you about the following issues:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Too few private messages are sent.</strong> Value: <strong>{value}</strong> - Your bot is sending far fewer messages than it did in previous weeks. This is useful for newsletter-style bots that send messages without prompts from users. The larger the value, the more significant the difference.</p>
|
||||
<li><p><strong>Too few private messages are sent.</strong> Value: <strong>{value}</strong> - Your bot is sending far fewer messages than it did in previous weeks. This is useful for newsletter-style bots that send messages without prompts from users. The larger the value, the more significant the difference.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Too few replies to incoming private messages</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all messages that are being sent to it (the request/response conversion rate for your bot was too low for at least two of the last three 5-minute periods). </p>
|
||||
<li><p><strong>Too few replies to incoming private messages</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all messages that are being sent to it (the request/response conversion rate for your bot was too low for at least two of the last three 5-minute periods). </p>
|
||||
</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<p>To provide a good user experience, please respond to all messages that are sent to your bot. Respond to message updates by calling send… methods (e.g. <a href="/bots/api#sendmessage">sendMessage</a>).</p>
|
||||
</blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Too few answers to inline queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all inline queries that are being sent to it, calculated in the same way as above. Respond to <code>inline_query</code> updates by calling <a href="/bots/api#answerinlinequery">answerInlineQuery</a>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Too few answers to callback queries</strong>. Conversion rate: <strong>{value}</strong></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Too few answers to callback game queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all callback queries that are being sent to it (with or without games), calculated in the same way as above. Respond to <code>callback_query</code> updates by calling <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>.</p>
|
||||
</li>
|
||||
<li><strong>Too few answers to inline queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all inline queries that are being sent to it, calculated in the same way as above. Respond to <code>inline_query</code> updates by calling <a href="/bots/api#answerinlinequery">answerInlineQuery</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#local-bot-api" id="local-bot-api" name="local-bot-api"><i class="anchor-icon"></i></a>Local Bot API</h4>
|
||||
<p>You can host and work with <strong>your own instance</strong> of our open-source <a href="/bots/api">Bot API</a>.
|
||||
The <strong>source code</strong> is available <a href="https://github.com/tdlib/telegram-bot-api">here</a>, along with a quick <a href="https://github.com/tdlib/telegram-bot-api#installation">installation guide</a>.</p>
|
||||
<ul>
|
||||
<li><strong>Too few answers to callback queries</strong>. Conversion rate: <strong>{value}</strong></li>
|
||||
<li><strong>Too few answers to callback game queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all callback queries that are being sent to it (with or without games), calculated in the same way as above. Respond to <code>callback_query</code> updates by calling <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" name="local-bot-api" href="#local-bot-api"><i class="anchor-icon"></i></a>Local Bot API</h4>
|
||||
<p>You can host and work with <strong>your own instance</strong> of our open-source <a href="/bots/api">Bot API</a>.<br>The <strong>source code</strong> is available <a href="https://github.com/tdlib/telegram-bot-api">here</a>, along with a quick <a href="https://github.com/tdlib/telegram-bot-api#installation">installation guide</a>.</p>
|
||||
<p>After <strong>installing the server</strong>, remember to use the <a href="/bots/api#logout">logOut</a> method before <strong>redirecting requests</strong> to your new local API URL.</p>
|
||||
<blockquote>
|
||||
<p>Your local instance runs on port <code>8081</code> by default and will only accept HTTP requests, so a TLS termination proxy has to be used to handle remote HTTPS requests.</p>
|
||||
</blockquote>
|
||||
<p>By hosting our API locally you'll gain access to <strong>some upgrades</strong>, including:</p>
|
||||
<p>By hosting our API locally you'll gain access to <strong>some upgrades</strong>, including:</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -476,36 +476,31 @@ The <strong>source code</strong> is available <a href="https://github.com/tdlib/
|
|||
</tbody>
|
||||
</table>
|
||||
<blockquote>
|
||||
<p>You can find an exhaustive list <a href="/bots/api#using-a-local-bot-api-server">here</a>.
|
||||
All limits may be subject to change in the future, so make sure to follow <a href="https://t.me/botnews">@BotNews</a>.</p>
|
||||
<p>You can find an exhaustive list <a href="/bots/api#using-a-local-bot-api-server">here</a>.<br>All limits may be subject to change in the future, so make sure to follow <a href="https://t.me/botnews">@BotNews</a>.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#botfather" id="botfather" name="botfather"><i class="anchor-icon"></i></a>BotFather</h3>
|
||||
<h3><a class="anchor" name="botfather" href="#botfather"><i class="anchor-icon"></i></a>BotFather</h3>
|
||||
<p>Below is a detailed guide to using <a href="https://t.me/botfather">@BotFather</a>, Telegram’s tool for <strong>creating</strong> and <strong>managing</strong> bots.</p>
|
||||
<h4><a class="anchor" href="#creating-a-new-bot" id="creating-a-new-bot" name="creating-a-new-bot"><i class="anchor-icon"></i></a>Creating a new bot</h4>
|
||||
<h4><a class="anchor" name="creating-a-new-bot" href="#creating-a-new-bot"><i class="anchor-icon"></i></a>Creating a new bot</h4>
|
||||
<p>Use the <code>/newbot</code> command to create a new bot. <a href="https://t.me/botfather">@BotFather</a> will ask you for a name and username, then generate an authentication token for your new bot.</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>The <strong>name</strong> of your bot is displayed in contact details and elsewhere.</p>
|
||||
<li><p>The <strong>name</strong> of your bot is displayed in contact details and elsewhere.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The <strong>username</strong> is a short name, used in search, mentions and t.me links. Usernames are 5-32 characters long and not case sensitive – but may only include Latin characters, numbers, and underscores. Your bot's username must end in 'bot’, like 'tetris_bot' or 'TetrisBot'.</p>
|
||||
<li><p>The <strong>username</strong> is a short name, used in search, mentions and t.me links. Usernames are 5-32 characters long and not case sensitive – but may only include Latin characters, numbers, and underscores. Your bot's username must end in 'bot’, like 'tetris_bot' or 'TetrisBot'.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The <strong>token</strong> is a string, like <code>110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw</code>, which is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot. </p>
|
||||
<li><p>The <strong>token</strong> is a string, like <code>110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw</code>, which is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot. </p>
|
||||
</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<p>Unlike the bot’s name, the username cannot be changed later – so choose it carefully.
|
||||
When sending a request to api.telegram.org, remember to prefix the word ‘bot’ to your token.</p>
|
||||
<p>Unlike the bot’s name, the username cannot be changed later – so choose it carefully.<br>When sending a request to api.telegram.org, remember to prefix the word ‘bot’ to your token.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#about-text-description-and-profile-media" id="about-text-description-and-profile-media" name="about-text-description-and-profile-media"><i class="anchor-icon"></i></a>About text, description and profile media</h4>
|
||||
<p>When new users open your bot, they will be met with a helpful description in a box titled "What can this bot do?".</p>
|
||||
<h4><a class="anchor" name="about-text-description-and-profile-media" href="#about-text-description-and-profile-media"><i class="anchor-icon"></i></a>About text, description and profile media</h4>
|
||||
<p>When new users open your bot, they will be met with a helpful description in a box titled “What can this bot do?”.</p>
|
||||
<p>Properly <a href="#edit-bots">setting this field</a> in <a href="https://t.me/botfather">@BotFather</a> allows everyone to immediately get an idea of what your bot can do – your description should be <strong>brief</strong>, <strong>to the point</strong> and <strong>on topic</strong>.</p>
|
||||
<blockquote>
|
||||
<p>You can also add a photo or video to this field with <code>Edit Description Picture</code> in <a href="https://t.me/botfather">@BotFather</a>.</p>
|
||||
</blockquote>
|
||||
<p>Additionally, just like normal users, bots also come with a <strong>short bio</strong> available on their profile. If you didn't specify this field while first creating your bot, you can set it at any time with the <code>/setabouttext</code> command in <a href="https://t.me/botfather">@BotFather</a>. Users can interact with many bots and they won't have access to their description after starting them – having a quick reminder of the bot's purpose can be very useful.</p>
|
||||
<p>Additionally, just like normal users, bots also come with a <strong>short bio</strong> available on their profile. If you didn't specify this field while first creating your bot, you can set it at any time with the <code>/setabouttext</code> command in <a href="https://t.me/botfather">@BotFather</a>. Users can interact with many bots and they won't have access to their description after starting them – having a quick reminder of the bot's purpose can be very useful.</p>
|
||||
<blockquote>
|
||||
<p>Note that both the <strong>Description</strong> and the <strong>About text</strong> can be <a href="https://core.telegram.org/bots/api#setmydescription">natively localized</a> – each user will automatically see the correct translation for their language.</p>
|
||||
</blockquote>
|
||||
|
@ -513,38 +508,36 @@ When sending a request to api.telegram.org, remember to prefix the word ‘bot
|
|||
<blockquote>
|
||||
<p>Starting from April 21, 2023 (<a href="https://telegram.org/blog/shareable-folders-custom-wallpapers">Telegram 9.6</a>), you can edit your bot directly from its profile page – including setting a custom <strong>profile video</strong>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#generating-an-authentication-token" id="generating-an-authentication-token" name="generating-an-authentication-token"><i class="anchor-icon"></i></a>Generating an authentication token</h4>
|
||||
<h4><a class="anchor" name="generating-an-authentication-token" href="#generating-an-authentication-token"><i class="anchor-icon"></i></a>Generating an authentication token</h4>
|
||||
<p>If your existing token is <strong>compromised</strong> or <strong>you lost it</strong> for some reason, use the <code>/token</code> command to generate a new one.</p>
|
||||
<h4><a class="anchor" href="#transfer-ownership" id="transfer-ownership" name="transfer-ownership"><i class="anchor-icon"></i></a>Transfer ownership</h4>
|
||||
<p>You can transfer ownership of your bot <strong>to another user</strong>.
|
||||
To do this, send <code>/mybots</code>, select your bot, then <em>transfer ownership</em>.
|
||||
You can only transfer a bot to users who have interacted with it at least once.</p>
|
||||
<h4><a class="anchor" name="transfer-ownership" href="#transfer-ownership"><i class="anchor-icon"></i></a>Transfer ownership</h4>
|
||||
<p>You can transfer ownership of your bot <strong>to another user</strong>.<br>To do this, send <code>/mybots</code>, select your bot, then <em>transfer ownership</em>.<br>You can only transfer a bot to users who have interacted with it at least once.</p>
|
||||
<blockquote>
|
||||
<p>Transferring ownership will give full control of the bot to another user – they will be able to access the bot’s messages and even delete it. The transfer is permanent, so please consider it carefully.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#botfather-commands" id="botfather-commands" name="botfather-commands"><i class="anchor-icon"></i></a>BotFather commands</h4>
|
||||
<h4><a class="anchor" name="botfather-commands" href="#botfather-commands"><i class="anchor-icon"></i></a>BotFather commands</h4>
|
||||
<p>The remaining commands are pretty self-explanatory:</p>
|
||||
<ul>
|
||||
<li>/mybots – returns a list of your bots with handy controls to edit their settings.</li>
|
||||
<li>/mygames – does the same for your games.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#edit-bots" id="edit-bots" name="edit-bots"><i class="anchor-icon"></i></a>Edit bots</h4>
|
||||
<h4><a class="anchor" name="edit-bots" href="#edit-bots"><i class="anchor-icon"></i></a>Edit bots</h4>
|
||||
<p>To edit your bot, you have two options.</p>
|
||||
<p>You can use the available commands:</p>
|
||||
<ul>
|
||||
<li>/setname – change your bot's <strong>name</strong>.</li>
|
||||
<li>/setdescription – change the bot's <strong>description</strong> (short text up to 512 characters). Users will see this text at the beginning of the conversation with the bot, titled '<em>What can this bot do?</em>'.</li>
|
||||
<li>/setabouttext – change the bot's <strong>about info</strong>, a shorter text up to 120 characters. Users will see this text on the bot's profile page. When they share your bot with someone, this text is sent together with the link.</li>
|
||||
<li>/setuserpic – change the bot's <strong>profile picture</strong>. </li>
|
||||
<li>/setname – change your bot's <strong>name</strong>.</li>
|
||||
<li>/setdescription – change the bot's <strong>description</strong> (short text up to 512 characters). Users will see this text at the beginning of the conversation with the bot, titled '<em>What can this bot do?</em>'.</li>
|
||||
<li>/setabouttext – change the bot's <strong>about info</strong>, a shorter text up to 120 characters. Users will see this text on the bot's profile page. When they share your bot with someone, this text is sent together with the link.</li>
|
||||
<li>/setuserpic – change the bot's <strong>profile picture</strong>. </li>
|
||||
<li>/setcommands – change the list of <strong>commands</strong> supported by your bot. Users will see these commands as suggestions when they type <code>/</code> in the chat with your bot. See <a href="#commands">commands</a> for more info.</li>
|
||||
<li>/setdomain – link a <strong>website domain</strong> to your bot. See the <a href="#web-login">login widget</a> section.</li>
|
||||
<li>/setdomain – link a <strong>website domain</strong> to your bot. See the <a href="#login-widget">login widget</a> section.</li>
|
||||
<li>/deletebot – delete your bot and <strong>free its username</strong>. Cannot be undone.</li>
|
||||
</ul>
|
||||
<p>Or you can use the <code>/mybots</code> command, tap on your bot and use the modern inline interface to edit it.</p>
|
||||
<blockquote>
|
||||
<p>Starting from April 21, 2023 (<a href="https://telegram.org/blog/shareable-folders-custom-wallpapers">Telegram 9.6</a>), you can edit your bot's public-facing info directly from its profile page – including setting a custom <strong>profile video</strong>.</p>
|
||||
<p>Starting from April 21, 2023 (<a href="https://telegram.org/blog/shareable-folders-custom-wallpapers">Telegram 9.6</a>), you can edit your bot's public-facing info directly from its profile page – including setting a custom <strong>profile video</strong>.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#edit-settings" id="edit-settings" name="edit-settings"><i class="anchor-icon"></i></a>Edit settings</h4>
|
||||
<h4><a class="anchor" name="edit-settings" href="#edit-settings"><i class="anchor-icon"></i></a>Edit settings</h4>
|
||||
<ul>
|
||||
<li>/setinline – toggle <strong>inline mode</strong> for your bot.</li>
|
||||
<li>/setinlinegeo – request <strong>location data</strong> to provide location-based inline results.</li>
|
||||
|
@ -552,7 +545,7 @@ You can only transfer a bot to users who have interacted with it at least once.<
|
|||
<li>/setinlinefeedback – toggle whether the API should <strong>send updates about the results</strong> chosen by users. See an in-depth explanation <a href="/bots/inline#collecting-feedback">here</a>.</li>
|
||||
<li>/setprivacy – set which messages your bot will receive when added to a group. See <a href="#privacy-mode">privacy-mode</a> for more info.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#manage-games" id="manage-games" name="manage-games"><i class="anchor-icon"></i></a>Manage games</h4>
|
||||
<h4><a class="anchor" name="manage-games" href="#manage-games"><i class="anchor-icon"></i></a>Manage games</h4>
|
||||
<ul>
|
||||
<li>/newgame – create a new game.</li>
|
||||
<li>/listgames – see a list of your games.</li>
|
||||
|
@ -566,8 +559,9 @@ You can only transfer a bot to users who have interacted with it at least once.<
|
|||
<p>With this information, you are ready to proceed to our <a href="/bots/api">Full API Reference for Developers</a>.</p>
|
||||
<ul>
|
||||
<li>If you have any questions, check out our <a href="/bots/faq">Bot FAQ</a>.</li>
|
||||
<li>If you're experiencing issues with our API, please contact <a href="https://t.me/botsupport">@BotSupport</a> on Telegram.</li>
|
||||
</ul></div>
|
||||
<li>If you're experiencing issues with our API, please contact <a href="https://t.me/botsupport">@BotSupport</a> on Telegram.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -47,369 +47,208 @@
|
|||
</blockquote>
|
||||
<p>This page lists some libraries and frameworks <strong>developed by the Telegram community</strong> – you should take care to report any bugs you may find to the respective developers, as these projects are not maintained by Telegram.</p>
|
||||
<p>Ping us on <a href="https://telegram.me/botsupport">@BotSupport</a> if you would like your library to appear on this page.</p>
|
||||
<h4><a class="anchor" href="#php" id="php" name="php"><i class="anchor-icon"></i></a>PHP</h4>
|
||||
<h4><a class="anchor" name="php" href="#php"><i class="anchor-icon"></i></a>PHP</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Nutgram</strong>. The Telegram bot framework that doesn't drive you nuts.
|
||||
<a href="https://github.com/nutgram/nutgram">https://github.com/nutgram/nutgram</a></p>
|
||||
<li><p><strong>Nutgram</strong>. The Telegram bot framework that doesn't drive you nuts.<br><a href="https://github.com/nutgram/nutgram">https://github.com/nutgram/nutgram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>klev-o/telegram-bot-api</strong>. Simple and convenient object-oriented implementation Telegram Bot API with PHP version ^7.4 support.
|
||||
<a href="https://github.com/klev-o/telegram-bot-api">https://github.com/klev-o/telegram-bot-api</a></p>
|
||||
<li><p><strong>klev-o/telegram-bot-api</strong>. Simple and convenient object-oriented implementation Telegram Bot API with PHP version ^7.4 support.<br><a href="https://github.com/klev-o/telegram-bot-api">https://github.com/klev-o/telegram-bot-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegraph</strong>. A Laravel package for fluently interacting with Telegram Bots.
|
||||
<a href="https://github.com/def-studio/telegraph">https://github.com/def-studio/telegraph</a></p>
|
||||
<li><p><strong>Telegraph</strong>. A Laravel package for fluently interacting with Telegram Bots.<br><a href="https://github.com/def-studio/telegraph">https://github.com/def-studio/telegraph</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TeleBot</strong>. Easy way to create Telegram bots in PHP. Rich Laravel support out of the box.
|
||||
<a href="https://github.com/westacks/telebot">https://github.com/westacks/telebot</a></p>
|
||||
<li><p><strong>TeleBot</strong>. Easy way to create Telegram bots in PHP. Rich Laravel support out of the box.<br><a href="https://github.com/westacks/telebot">https://github.com/westacks/telebot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TuriBot</strong>. A simple way to communicate with Telegram APIs in PHP.
|
||||
<a href="https://github.com/davtur19/TuriBot">https://github.com/davtur19/TuriBot</a></p>
|
||||
<li><p><strong>TuriBot</strong>. A simple way to communicate with Telegram APIs in PHP.<br><a href="https://github.com/davtur19/TuriBot">https://github.com/davtur19/TuriBot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TelegramBotsApi</strong>. SDK for Telegram Bot API.
|
||||
<a href="https://github.com/kuvardin/TelegramBotsApi">https://github.com/kuvardin/TelegramBotsApi</a></p>
|
||||
<li><p><strong>TelegramBotsApi</strong>. SDK for Telegram Bot API.<br><a href="https://github.com/kuvardin/TelegramBotsApi">https://github.com/kuvardin/TelegramBotsApi</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>PHP Telegram Bot</strong>. PHP Telegram Bot based on the official Telegram Bot API.
|
||||
<a href="https://github.com/php-telegram-bot/core">https://github.com/php-telegram-bot/core</a></p>
|
||||
<li><p><strong>PHP Telegram Bot</strong>. PHP Telegram Bot based on the official Telegram Bot API.<br><a href="https://github.com/php-telegram-bot/core">https://github.com/php-telegram-bot/core</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot PHP</strong>. A library that makes using Telegram Bot API much easier.
|
||||
<a href="https://github.com/telegram-bot-php/core">https://github.com/telegram-bot-php/core</a></p>
|
||||
<li><p><strong>Telegram Bot PHP</strong>. A library that makes using Telegram Bot API much easier.<br><a href="https://github.com/telegram-bot-php/core">https://github.com/telegram-bot-php/core</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>PHP Telegram API</strong>. A complete async capable Telegram Bot API implementation for PHP7.
|
||||
<a href="https://github.com/unreal4u/telegram-api">https://github.com/unreal4u/telegram-api</a></p>
|
||||
<li><p><strong>PHP Telegram API</strong>. A complete async capable Telegram Bot API implementation for PHP7.<br><a href="https://github.com/unreal4u/telegram-api">https://github.com/unreal4u/telegram-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot Api Base</strong>. Clear and simple Telegram Bot API.
|
||||
<a href="https://github.com/tg-bot-api/bot-api-base">https://github.com/tg-bot-api/bot-api-base</a></p>
|
||||
<li><p><strong>Telegram Bot Api Base</strong>. Clear and simple Telegram Bot API.<br><a href="https://github.com/tg-bot-api/bot-api-base">https://github.com/tg-bot-api/bot-api-base</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>NeleBot X Framework</strong>. Framework for Telegram Bot API.
|
||||
<a href="https://github.com/NeleB54Gold/NeleBotX">https://github.com/NeleB54Gold/NeleBotX</a></p>
|
||||
<li><p><strong>NeleBot X Framework</strong>. Framework for Telegram Bot API.<br><a href="https://github.com/NeleB54Gold/NeleBotX">https://github.com/NeleB54Gold/NeleBotX</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Bot API PHP SDK</strong>. Telegram Bot API PHP SDK. Supports Laravel out of the box.
|
||||
<a href="https://github.com/irazasyed/telegram-bot-sdk">https://github.com/irazasyed/telegram-bot-sdk</a></p>
|
||||
<li><p><strong>Bot API PHP SDK</strong>. Telegram Bot API PHP SDK. Supports Laravel out of the box.<br><a href="https://github.com/irazasyed/telegram-bot-sdk">https://github.com/irazasyed/telegram-bot-sdk</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TgBotLib</strong>. A library for creating Telegram Bots in PHP, based on the Telegram Bot API.
|
||||
<a href="https://git.n64.cc/nosial/libs/tgbot">https://git.n64.cc/nosial/libs/tgbot</a></p>
|
||||
<li><p><strong>TgBotLib</strong>. A library for creating Telegram Bots in PHP, based on the Telegram Bot API.<br><a href="https://git.n64.cc/nosial/libs/tgbot">https://git.n64.cc/nosial/libs/tgbot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>PHP Telegram Bot Api</strong>. Native PHP Wrapper for Telegram BOT API.
|
||||
<a href="https://github.com/TelegramBot/Api">https://github.com/TelegramBot/Api</a></p>
|
||||
<li><p><strong>PHP Telegram Bot Api</strong>. Native PHP Wrapper for Telegram BOT API.<br><a href="https://github.com/TelegramBot/Api">https://github.com/TelegramBot/Api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>NovaGram</strong>. An Object-Oriented PHP library for Telegram Bots.
|
||||
<a href="https://github.com/skrtdev/NovaGram">https://github.com/skrtdev/NovaGram</a></p>
|
||||
<li><p><strong>NovaGram</strong>. An Object-Oriented PHP library for Telegram Bots.<br><a href="https://github.com/skrtdev/NovaGram">https://github.com/skrtdev/NovaGram</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#go" id="go" name="go"><i class="anchor-icon"></i></a>Go</h4>
|
||||
<h4><a class="anchor" name="go" href="#go"><i class="anchor-icon"></i></a>Go</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Golang Telegram Bot library</strong>. An autogenerated wrapper for the Telegram Bot API. Inspired by the python-telegram-bot library.
|
||||
<a href="https://github.com/paulsonoflars/gotgbot">https://github.com/paulsonoflars/gotgbot</a></p>
|
||||
<li><p><strong>Golang Telegram Bot library</strong>. An autogenerated wrapper for the Telegram Bot API. Inspired by the python-telegram-bot library.<br><a href="https://github.com/paulsonoflars/gotgbot">https://github.com/paulsonoflars/gotgbot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telego</strong>. Telegram Bot API library.
|
||||
<a href="https://github.com/mymmrac/telego">https://github.com/mymmrac/telego</a></p>
|
||||
<li><p><strong>Telego</strong>. Telegram Bot API library.<br><a href="https://github.com/mymmrac/telego">https://github.com/mymmrac/telego</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Golang Telegram Bot</strong>. Telegram Bot API Go framework.
|
||||
<a href="https://github.com/go-telegram/bot">https://github.com/go-telegram/bot</a></p>
|
||||
<li><p><strong>Golang Telegram Bot</strong>. Telegram Bot API Go framework.<br><a href="https://github.com/go-telegram/bot">https://github.com/go-telegram/bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>echotron</strong>. An elegant and concurrent library for the Telegram Bot API.
|
||||
<a href="https://github.com/NicoNex/echotron">https://github.com/NicoNex/echotron</a></p>
|
||||
<li><p><strong>echotron</strong>. An elegant and concurrent library for the Telegram Bot API.<br><a href="https://github.com/NicoNex/echotron">https://github.com/NicoNex/echotron</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot API helper for Golang</strong>. A Telegram Bot API wrapper.
|
||||
<a href="https://github.com/meinside/telegram-bot-go">https://github.com/meinside/telegram-bot-go</a></p>
|
||||
<li><p><strong>Telegram Bot API helper for Golang</strong>. A Telegram Bot API wrapper.<br><a href="https://github.com/meinside/telegram-bot-go">https://github.com/meinside/telegram-bot-go</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>telebot</strong>. A Telegram bot framework.
|
||||
<a href="https://github.com/tucnak/telebot">https://github.com/tucnak/telebot</a></p>
|
||||
<li><p><strong>telebot</strong>. A Telegram bot framework.<br><a href="https://github.com/tucnak/telebot">https://github.com/tucnak/telebot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot API client for Golang</strong>. Telegram Bot API client library for golang.
|
||||
<a href="https://github.com/udev-21/ya-golang-tbot-api">https://github.com/udev-21/ya-golang-tbot-api</a></p>
|
||||
<li><p><strong>Telegram Bot API client for Golang</strong>. Telegram Bot API client library for golang.<br><a href="https://github.com/udev-21/ya-golang-tbot-api">https://github.com/udev-21/ya-golang-tbot-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>go-tg</strong>. Library for accessing Telegram Bot API, with batteries for building complex bots included.
|
||||
<a href="https://github.com/mr-linch/go-tg">https://github.com/mr-linch/go-tg</a></p>
|
||||
<li><p><strong>go-tg</strong>. Library for accessing Telegram Bot API, with batteries for building complex bots included.<br><a href="https://github.com/mr-linch/go-tg">https://github.com/mr-linch/go-tg</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot API: Go implementation</strong>. A Telegram IM bots API implementation.
|
||||
<a href="https://github.com/temoon/telegram-bots-api">https://github.com/temoon/telegram-bots-api</a></p>
|
||||
<li><p><strong>Telegram Bot API: Go implementation</strong>. A Telegram IM bots API implementation.<br><a href="https://github.com/temoon/telegram-bots-api">https://github.com/temoon/telegram-bots-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegrambot</strong>. Telegram Bot API in Go, but with more clean code.
|
||||
<a href="https://github.com/nickname76/telegrambot">https://github.com/nickname76/telegrambot</a></p>
|
||||
<li><p><strong>Telegrambot</strong>. Telegram Bot API in Go, but with more clean code.<br><a href="https://github.com/nickname76/telegrambot">https://github.com/nickname76/telegrambot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>go-telegram-bot-api</strong>. Bindings for the Telegram Bot API.
|
||||
<a href="https://github.com/go-telegram-bot-api/telegram-bot-api">https://github.com/go-telegram-bot-api/telegram-bot-api</a></p>
|
||||
<li><p><strong>go-telegram-bot-api</strong>. Bindings for the Telegram Bot API.<br><a href="https://github.com/go-telegram-bot-api/telegram-bot-api">https://github.com/go-telegram-bot-api/telegram-bot-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TgWrap</strong>. A library with Telegram Bot API bindings.
|
||||
<a href="https://github.com/rogozhka/tgwrap">https://github.com/rogozhka/tgwrap</a></p>
|
||||
<li><p><strong>TgWrap</strong>. A library with Telegram Bot API bindings.<br><a href="https://github.com/rogozhka/tgwrap">https://github.com/rogozhka/tgwrap</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#python" id="python" name="python"><i class="anchor-icon"></i></a>Python</h4>
|
||||
<h4><a class="anchor" name="python" href="#python"><i class="anchor-icon"></i></a>Python</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>python-telegram-bot</strong>. A wrapper you can't refuse.
|
||||
<a href="https://github.com/python-telegram-bot/python-telegram-bot">https://github.com/python-telegram-bot/python-telegram-bot</a></p>
|
||||
<li><p><strong>python-telegram-bot</strong>. A wrapper you can't refuse.<br><a href="https://github.com/python-telegram-bot/python-telegram-bot">https://github.com/python-telegram-bot/python-telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>pyTelegramBotAPI</strong>. A simple, but extensible Python implementation for the Telegram Bot API.
|
||||
<a href="https://github.com/eternnoir/pyTelegramBotAPI">https://github.com/eternnoir/pyTelegramBotAPI</a></p>
|
||||
<li><p><strong>pyTelegramBotAPI</strong>. A simple, but extensible Python implementation for the Telegram Bot API.<br><a href="https://github.com/eternnoir/pyTelegramBotAPI">https://github.com/eternnoir/pyTelegramBotAPI</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>AIOGram</strong>. A pretty simple and fully asynchronous library for Telegram Bot API written with asyncio and aiohttp.
|
||||
<a href="https://github.com/aiogram/aiogram">https://github.com/aiogram/aiogram</a></p>
|
||||
<li><p><strong>AIOGram</strong>. A pretty simple and fully asynchronous library for Telegram Bot API written with asyncio and aiohttp.<br><a href="https://github.com/aiogram/aiogram">https://github.com/aiogram/aiogram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>TGramBot</strong>. A partially auto-generated and asynchronous Minimal Telegram Bot API framework.
|
||||
<a href="https://github.com/KeralaBots/TGramBot">https://github.com/KeralaBots/TGramBot</a></p>
|
||||
<li><p><strong>TGramBot</strong>. A partially auto-generated and asynchronous Minimal Telegram Bot API framework.<br><a href="https://github.com/KeralaBots/TGramBot">https://github.com/KeralaBots/TGramBot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>OrigamiBot</strong>. A pythonic Telegram bot API library.
|
||||
<a href="https://github.com/cmd410/OrigamiBot">https://github.com/cmd410/OrigamiBot</a></p>
|
||||
<li><p><strong>OrigamiBot</strong>. A pythonic Telegram bot API library.<br><a href="https://github.com/cmd410/OrigamiBot">https://github.com/cmd410/OrigamiBot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>pytgbot</strong>. A module to access the Telegram Bot API.
|
||||
<a href="https://github.com/luckydonald/pytgbot">https://github.com/luckydonald/pytgbot</a></p>
|
||||
<li><p><strong>pytgbot</strong>. A module to access the Telegram Bot API.<br><a href="https://github.com/luckydonald/pytgbot">https://github.com/luckydonald/pytgbot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>teleflask</strong>. A framework based on flask and pytgbot.
|
||||
<a href="https://github.com/luckydonald/teleflask">https://github.com/luckydonald/teleflask</a></p>
|
||||
<li><p><strong>teleflask</strong>. A framework based on flask and pytgbot.<br><a href="https://github.com/luckydonald/teleflask">https://github.com/luckydonald/teleflask</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>telegram-text</strong>. A Python markup module, which can be used with other frameworks.
|
||||
<a href="https://github.com/SKY-ALIN/telegram-text">https://github.com/SKY-ALIN/telegram-text</a></p>
|
||||
<li><p><strong>telegram-text</strong>. A Python markup module, which can be used with other frameworks.<br><a href="https://github.com/SKY-ALIN/telegram-text">https://github.com/SKY-ALIN/telegram-text</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#rust" id="rust" name="rust"><i class="anchor-icon"></i></a>Rust</h4>
|
||||
<h4><a class="anchor" name="rust" href="#rust"><i class="anchor-icon"></i></a>Rust</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Frankenstein</strong>. A Telegram Bot API client.
|
||||
<a href="https://github.com/ayrat555/frankenstein">https://github.com/ayrat555/frankenstein</a></p>
|
||||
<li><p><strong>Frankenstein</strong>. A Telegram Bot API client.<br><a href="https://github.com/ayrat555/frankenstein">https://github.com/ayrat555/frankenstein</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>teloxide</strong>. An elegant Telegram bots framework.
|
||||
<a href="https://github.com/teloxide/teloxide">https://github.com/teloxide/teloxide</a></p>
|
||||
<li><p><strong>teloxide</strong>. An elegant Telegram bots framework.<br><a href="https://github.com/teloxide/teloxide">https://github.com/teloxide/teloxide</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Ferrisgram</strong>. An asynchronous autogenerated wrapper for the Telegram Bot API.
|
||||
<a href="https://github.com/ferrisgram/ferrisgram">https://github.com/ferrisgram/ferrisgram</a></p>
|
||||
<li><p><strong>Ferrisgram</strong>. An asynchronous autogenerated wrapper for the Telegram Bot API.<br><a href="https://github.com/ferrisgram/ferrisgram">https://github.com/ferrisgram/ferrisgram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>carapax</strong>. A Telegram Bot API framework.
|
||||
<a href="https://github.com/tg-rs/carapax">https://github.com/tg-rs/carapax</a></p>
|
||||
<li><p><strong>carapax</strong>. A Telegram Bot API framework.<br><a href="https://github.com/tg-rs/carapax">https://github.com/tg-rs/carapax</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>tgbotapi</strong>. A library for using the Telegram Bot API.
|
||||
<a href="https://github.com/Syfaro/tgbotapi-rs">https://github.com/Syfaro/tgbotapi-rs</a></p>
|
||||
<li><p><strong>tgbotapi</strong>. A library for using the Telegram Bot API.<br><a href="https://github.com/Syfaro/tgbotapi-rs">https://github.com/Syfaro/tgbotapi-rs</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>telegram-bot</strong>. A Library for creating a Telegram Bot.
|
||||
<a href="https://github.com/telegram-rs/telegram-bot">https://github.com/telegram-rs/telegram-bot</a></p>
|
||||
<li><p><strong>telegram-bot</strong>. A Library for creating a Telegram Bot.<br><a href="https://github.com/telegram-rs/telegram-bot">https://github.com/telegram-rs/telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telebot</strong>. Write Telegram bots with Tokio and Futures.
|
||||
<a href="https://github.com/bytesnake/telebot">https://github.com/bytesnake/telebot</a></p>
|
||||
<li><p><strong>Telebot</strong>. Write Telegram bots with Tokio and Futures.<br><a href="https://github.com/bytesnake/telebot">https://github.com/bytesnake/telebot</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#kotlin" id="kotlin" name="kotlin"><i class="anchor-icon"></i></a>Kotlin</h4>
|
||||
<h4><a class="anchor" name="kotlin" href="#kotlin"><i class="anchor-icon"></i></a>Kotlin</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>TelegramBotAPI</strong>. Type-safe library for work with Telegram Bot API.
|
||||
<a href="https://github.com/InsanusMokrassar/TelegramBotAPI">https://github.com/InsanusMokrassar/TelegramBotAPI</a></p>
|
||||
<li><p><strong>TelegramBotAPI</strong>. Type-safe library for work with Telegram Bot API.<br><a href="https://github.com/InsanusMokrassar/TelegramBotAPI">https://github.com/InsanusMokrassar/TelegramBotAPI</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Kotlin Telegram Bot</strong>. Telegram Bot API wrapper, with handy Kotlin DSL.
|
||||
<a href="https://github.com/vendelieu/telegram-bot">https://github.com/vendelieu/telegram-bot</a></p>
|
||||
<li><p><strong>Kotlin Telegram Bot</strong>. Telegram Bot API wrapper, with handy Kotlin DSL.<br><a href="https://github.com/vendelieu/telegram-bot">https://github.com/vendelieu/telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Kotlin Telegram Bot</strong>. A wrapper for the Telegram Bot API.
|
||||
<a href="https://github.com/kotlin-telegram-bot/kotlin-telegram-bot">https://github.com/kotlin-telegram-bot/kotlin-telegram-bot</a></p>
|
||||
<li><p><strong>Kotlin Telegram Bot</strong>. A wrapper for the Telegram Bot API.<br><a href="https://github.com/kotlin-telegram-bot/kotlin-telegram-bot">https://github.com/kotlin-telegram-bot/kotlin-telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram Bot API in Kotlin Multiplatform</strong>. Telegram Bot API in Kotlin.
|
||||
<a href="https://github.com/omarmiatello/telegram">https://github.com/omarmiatello/telegram</a></p>
|
||||
<li><p><strong>Telegram Bot API in Kotlin Multiplatform</strong>. Telegram Bot API in Kotlin.<br><a href="https://github.com/omarmiatello/telegram">https://github.com/omarmiatello/telegram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>kt-telegram-bot</strong>. Telegram Bot API library for Kotlin language.
|
||||
<a href="https://github.com/elbekD/kt-telegram-bot">https://github.com/elbekD/kt-telegram-bot</a></p>
|
||||
<li><p><strong>kt-telegram-bot</strong>. Telegram Bot API library for Kotlin language.<br><a href="https://github.com/elbekD/kt-telegram-bot">https://github.com/elbekD/kt-telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Iris Telegram API</strong>. Yet another Telegram API bot created with Kotlin.
|
||||
<a href="https://github.com/iris2iris/iris-telegram-api">https://github.com/iris2iris/iris-telegram-api</a></p>
|
||||
<li><p><strong>Iris Telegram API</strong>. Yet another Telegram API bot created with Kotlin.<br><a href="https://github.com/iris2iris/iris-telegram-api">https://github.com/iris2iris/iris-telegram-api</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#nodejs" id="nodejs" name="nodejs"><i class="anchor-icon"></i></a>Node.js</h4>
|
||||
<h4><a class="anchor" name="node-js" href="#node-js"><i class="anchor-icon"></i></a>Node.js</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Telegraf</strong>. Modern Telegram Bot Framework for Node.js.
|
||||
<a href="https://github.com/telegraf/telegraf">https://github.com/telegraf/telegraf</a></p>
|
||||
<li><p><strong>Telegraf</strong>. Modern Telegram Bot Framework for Node.js.<br><a href="https://github.com/telegraf/telegraf">https://github.com/telegraf/telegraf</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Node-Telegram-bot</strong>. Node.js module to interact with the official Telegram Bot API.
|
||||
<a href="https://github.com/yagop/node-telegram-bot-api">https://github.com/yagop/node-telegram-bot-api</a></p>
|
||||
<li><p><strong>Node-Telegram-bot</strong>. Node.js module to interact with the official Telegram Bot API.<br><a href="https://github.com/yagop/node-telegram-bot-api">https://github.com/yagop/node-telegram-bot-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telebot</strong>. The easy way to write Telegram bots.
|
||||
<a href="https://github.com/mullwar/telebot">https://github.com/mullwar/telebot</a></p>
|
||||
<li><p><strong>Telebot</strong>. The easy way to write Telegram bots.<br><a href="https://github.com/mullwar/telebot">https://github.com/mullwar/telebot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Slimbot</strong>. A fuss-free, thin wrapper around Telegram Bot API for Node.js. No frills.
|
||||
<a href="https://github.com/edisonchee/slimbot">https://github.com/edisonchee/slimbot</a></p>
|
||||
<li><p><strong>Slimbot</strong>. A fuss-free, thin wrapper around Telegram Bot API for Node.js. No frills.<br><a href="https://github.com/edisonchee/slimbot">https://github.com/edisonchee/slimbot</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#net" id="net" name="net"><i class="anchor-icon"></i></a>.NET</h4>
|
||||
<h4><a class="anchor" name="net" href="#net"><i class="anchor-icon"></i></a>.NET</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Telegram.bot</strong>. .NET Client for Telegram Bot API.
|
||||
<a href="https://github.com/TelegramBots/Telegram.Bot">https://github.com/TelegramBots/Telegram.Bot</a></p>
|
||||
<li><p><strong>Telegram.bot</strong>. .NET Client for Telegram Bot API.<br><a href="https://github.com/TelegramBots/Telegram.Bot">https://github.com/TelegramBots/Telegram.Bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram.Bots</strong>. A .NET 5 wrapper for the Telegram Bot API.
|
||||
<a href="https://github.com/TelegramBotsAPI/Telegram.Bots">https://github.com/TelegramBotsAPI/Telegram.Bots</a></p>
|
||||
<li><p><strong>Telegram.Bots</strong>. A .NET 5 wrapper for the Telegram Bot API.<br><a href="https://github.com/TelegramBotsAPI/Telegram.Bots">https://github.com/TelegramBotsAPI/Telegram.Bots</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>RxTelegram.Bot</strong>. RxTelegram uses a reactive approach to make Updates available.
|
||||
<a href="https://github.com/RxTelegram/RxTelegram.Bot">https://github.com/RxTelegram/RxTelegram.Bot</a></p>
|
||||
<li><p><strong>RxTelegram.Bot</strong>. RxTelegram uses a reactive approach to make Updates available.<br><a href="https://github.com/RxTelegram/RxTelegram.Bot">https://github.com/RxTelegram/RxTelegram.Bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegram.BotAPI for NET</strong>. One of the most complete libraries available to interact with the Telegram Bot API.
|
||||
<a href="https://github.com/Eptagone/Telegram.BotAPI">https://github.com/Eptagone/Telegram.BotAPI</a></p>
|
||||
<li><p><strong>Telegram.BotAPI for NET</strong>. One of the most complete libraries available to interact with the Telegram Bot API.<br><a href="https://github.com/Eptagone/Telegram.BotAPI">https://github.com/Eptagone/Telegram.BotAPI</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#swift" id="swift" name="swift"><i class="anchor-icon"></i></a>Swift</h4>
|
||||
<h4><a class="anchor" name="swift" href="#swift"><i class="anchor-icon"></i></a>Swift</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Telegram Vapor Bot</strong>. The wrapper for the Telegram Bot API written in Swift with Vapor.
|
||||
<a href="https://github.com/nerzh/telegram-vapor-bot">https://github.com/nerzh/telegram-vapor-bot</a></p>
|
||||
<li><p><strong>Telegram Vapor Bot</strong>. The wrapper for the Telegram Bot API written in Swift with Vapor.<br><a href="https://github.com/nerzh/telegram-vapor-bot">https://github.com/nerzh/telegram-vapor-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>telegram-bot-swift</strong>. Telegram Bot SDK for Swift.
|
||||
<a href="https://github.com/rapierorg/telegram-bot-swift">https://github.com/rapierorg/telegram-bot-swift</a></p>
|
||||
<li><p><strong>telegram-bot-swift</strong>. Telegram Bot SDK for Swift.<br><a href="https://github.com/rapierorg/telegram-bot-swift">https://github.com/rapierorg/telegram-bot-swift</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Telegrammer</strong>. Telegram Bot Framework written in Swift 5.1 with SwiftNIO network framework.
|
||||
<a href="https://github.com/givip/Telegrammer">https://github.com/givip/Telegrammer</a></p>
|
||||
<li><p><strong>Telegrammer</strong>. Telegram Bot Framework written in Swift 5.1 with SwiftNIO network framework.<br><a href="https://github.com/givip/Telegrammer">https://github.com/givip/Telegrammer</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#typescript" id="typescript" name="typescript"><i class="anchor-icon"></i></a>TypeScript</h4>
|
||||
<h4><a class="anchor" name="typescript" href="#typescript"><i class="anchor-icon"></i></a>TypeScript</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>grammY</strong>. The Telegram Bot Framework.
|
||||
<a href="https://github.com/grammyjs/grammY">https://github.com/grammyjs/grammY</a></p>
|
||||
<li><p><strong>grammY</strong>. The Telegram Bot Framework.<br><a href="https://github.com/grammyjs/grammY">https://github.com/grammyjs/grammY</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Nestgram</strong>. Framework for working with Telegram Bot API on TypeScript like Nest.js.
|
||||
<a href="https://github.com/Degreet/nestgram">https://github.com/Degreet/nestgram</a></p>
|
||||
<li><p><strong>Nestgram</strong>. Framework for working with Telegram Bot API on TypeScript like Nest.js.<br><a href="https://github.com/Degreet/nestgram">https://github.com/Degreet/nestgram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>puregram</strong>. Powerful and modern telegram bot api sdk for node.js and typescript.
|
||||
<a href="https://github.com/nitreojs/puregram">https://github.com/nitreojs/puregram</a></p>
|
||||
<li><p><strong>puregram</strong>. Powerful and modern telegram bot api sdk for node.js and typescript.<br><a href="https://github.com/nitreojs/puregram">https://github.com/nitreojs/puregram</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#java" id="java" name="java"><i class="anchor-icon"></i></a>Java</h4>
|
||||
<h4><a class="anchor" name="java" href="#java"><i class="anchor-icon"></i></a>Java</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>TelegramBots</strong>. A simple to use library to create Telegram Bots.
|
||||
<a href="https://github.com/rubenlagus/TelegramBots">https://github.com/rubenlagus/TelegramBots</a></p>
|
||||
<li><p><strong>TelegramBots</strong>. A simple to use library to create Telegram Bots.<br><a href="https://github.com/rubenlagus/TelegramBots">https://github.com/rubenlagus/TelegramBots</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Java API</strong>. Telegram Bot API for Java.
|
||||
<a href="https://github.com/pengrad/java-telegram-bot-api">https://github.com/pengrad/java-telegram-bot-api</a></p>
|
||||
<li><p><strong>Java API</strong>. Telegram Bot API for Java.<br><a href="https://github.com/pengrad/java-telegram-bot-api">https://github.com/pengrad/java-telegram-bot-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>ReBot</strong>. A Java EE Telegram Bot API.
|
||||
<a href="https://github.com/rebasing-xyz/rebot">https://github.com/rebasing-xyz/rebot</a></p>
|
||||
<li><p><strong>ReBot</strong>. A Java EE Telegram Bot API.<br><a href="https://github.com/rebasing-xyz/rebot">https://github.com/rebasing-xyz/rebot</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#scala" id="scala" name="scala"><i class="anchor-icon"></i></a>Scala</h4>
|
||||
<h4><a class="anchor" name="scala" href="#scala"><i class="anchor-icon"></i></a>Scala</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>canoe</strong>. Functional Telegram Bot API.
|
||||
<a href="https://github.com/augustjune/canoe">https://github.com/augustjune/canoe</a></p>
|
||||
<li><p><strong>canoe</strong>. Functional Telegram Bot API.<br><a href="https://github.com/augustjune/canoe">https://github.com/augustjune/canoe</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>bot4s.telegram</strong>. Simple, extensible, strongly-typed wrapper for the Telegram Bot API.
|
||||
<a href="https://github.com/bot4s/telegram">https://github.com/bot4s/telegram</a></p>
|
||||
<li><p><strong>bot4s.telegram</strong>. Simple, extensible, strongly-typed wrapper for the Telegram Bot API.<br><a href="https://github.com/bot4s/telegram">https://github.com/bot4s/telegram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>F[Tg] - Telegramium</strong>. Pure functional Telegram Bot API implementation.
|
||||
<a href="https://github.com/apimorphism/telegramium">https://github.com/apimorphism/telegramium</a></p>
|
||||
<li><p><strong>F[Tg] - Telegramium</strong>. Pure functional Telegram Bot API implementation.<br><a href="https://github.com/apimorphism/telegramium">https://github.com/apimorphism/telegramium</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#ruby" id="ruby" name="ruby"><i class="anchor-icon"></i></a>Ruby</h4>
|
||||
<h4><a class="anchor" name="ruby" href="#ruby"><i class="anchor-icon"></i></a>Ruby</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Telegram::Bot</strong>. Ruby gem for building Telegram Bot with optional Rails integration.
|
||||
<a href="https://github.com/telegram-bot-rb/telegram-bot">https://github.com/telegram-bot-rb/telegram-bot</a></p>
|
||||
<li><p><strong>Telegram::Bot</strong>. Ruby gem for building Telegram Bot with optional Rails integration.<br><a href="https://github.com/telegram-bot-rb/telegram-bot">https://github.com/telegram-bot-rb/telegram-bot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>telegram-bot-ruby</strong>. Ruby wrapper for Telegram's Bot API.
|
||||
<a href="https://github.com/atipugin/telegram-bot-ruby">https://github.com/atipugin/telegram-bot-ruby</a></p>
|
||||
<li><p><strong>telegram-bot-ruby</strong>. Ruby wrapper for Telegram's Bot API.<br><a href="https://github.com/atipugin/telegram-bot-ruby">https://github.com/atipugin/telegram-bot-ruby</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" href="#other-languages" id="other-languages" name="other-languages"><i class="anchor-icon"></i></a>Other Languages</h4>
|
||||
<h4><a class="anchor" name="other-languages" href="#other-languages"><i class="anchor-icon"></i></a>Other Languages</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Elixir. <strong>ExGram</strong>. Telegram Bot API low level API and framework.
|
||||
<a href="https://github.com/rockneurotiko/ex_gram">https://github.com/rockneurotiko/ex_gram</a></p>
|
||||
<li><p>Elixir. <strong>ExGram</strong>. Telegram Bot API low level API and framework.<br><a href="https://github.com/rockneurotiko/ex_gram">https://github.com/rockneurotiko/ex_gram</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Elixir. <strong>Nadia</strong>. Telegram Bot API Wrapper.
|
||||
<a href="https://github.com/zhyu/nadia">https://github.com/zhyu/nadia</a></p>
|
||||
<li><p>Elixir. <strong>Nadia</strong>. Telegram Bot API Wrapper.<br><a href="https://github.com/zhyu/nadia">https://github.com/zhyu/nadia</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>C++. <strong>tgbot-cpp</strong>. A library for Telegram Bot API.
|
||||
<a href="https://github.com/reo7sp/tgbot-cpp">https://github.com/reo7sp/tgbot-cpp</a></p>
|
||||
<li><p>C++. <strong>tgbot-cpp</strong>. A library for Telegram Bot API.<br><a href="https://github.com/reo7sp/tgbot-cpp">https://github.com/reo7sp/tgbot-cpp</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>C++. <strong>tgbot</strong>. A library for Telegram Bot API with generated API types and methods.
|
||||
<a href="https://github.com/egorpugin/tgbot">https://github.com/egorpugin/tgbot</a></p>
|
||||
<li><p>C++. <strong>tgbot</strong>. A library for Telegram Bot API with generated API types and methods.<br><a href="https://github.com/egorpugin/tgbot">https://github.com/egorpugin/tgbot</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Dart. <strong>TeleDart</strong>. A library interfacing with the latest Telegram Bot API.
|
||||
<a href="https://github.com/DinoLeung/TeleDart">https://github.com/DinoLeung/TeleDart</a></p>
|
||||
<li><p>Dart. <strong>TeleDart</strong>. A library interfacing with the latest Telegram Bot API.<br><a href="https://github.com/DinoLeung/TeleDart">https://github.com/DinoLeung/TeleDart</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Pascal. <strong>TGBotMini</strong>. Telegram Bot Mini API.
|
||||
<a href="https://github.com/HemulGM/TGBotMini">https://github.com/HemulGM/TGBotMini</a></p>
|
||||
<li><p>Pascal. <strong>TGBotMini</strong>. Telegram Bot Mini API.<br><a href="https://github.com/HemulGM/TGBotMini">https://github.com/HemulGM/TGBotMini</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Clojure. <strong>telegrambot-lib</strong>. A library for interacting with the Telegram Bot API.
|
||||
<a href="https://github.com/wdhowe/telegrambot-lib">https://github.com/wdhowe/telegrambot-lib</a></p>
|
||||
<li><p>Clojure. <strong>telegrambot-lib</strong>. A library for interacting with the Telegram Bot API.<br><a href="https://github.com/wdhowe/telegrambot-lib">https://github.com/wdhowe/telegrambot-lib</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Lua. <strong>telegram-bot-lua</strong>. A feature-filled Telegram Bot API library.
|
||||
<a href="https://github.com/wrxck/telegram-bot-lua">https://github.com/wrxck/telegram-bot-lua</a></p>
|
||||
<li><p>Lua. <strong>telegram-bot-lua</strong>. A feature-filled Telegram Bot API library.<br><a href="https://github.com/wrxck/telegram-bot-lua">https://github.com/wrxck/telegram-bot-lua</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>OCaml. <strong>TelegraML</strong>. A library for creating bots for Telegram.
|
||||
<a href="https://github.com/nv-vn/TelegraML">https://github.com/nv-vn/TelegraML</a></p>
|
||||
<li><p>OCaml. <strong>TelegraML</strong>. A library for creating bots for Telegram.<br><a href="https://github.com/nv-vn/TelegraML">https://github.com/nv-vn/TelegraML</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Haskell. <strong>haskell-telegram-api</strong>. High-level bindings to the Telegram Bot API based on <a href="https://haskell-servant.github.io/">servant</a> library.
|
||||
<a href="https://github.com/klappvisor/haskell-telegram-api">https://github.com/klappvisor/haskell-telegram-api</a></p>
|
||||
<li><p>Haskell. <strong>haskell-telegram-api</strong>. High-level bindings to the Telegram Bot API based on <a href="https://haskell-servant.github.io/">servant</a> library.<br><a href="https://github.com/klappvisor/haskell-telegram-api">https://github.com/klappvisor/haskell-telegram-api</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Perl. <strong>Telegram Bot</strong>. A genuine Perl 6 client for the Telegram's Bot API.
|
||||
<a href="https://github.com/GildedHonour/TelegramBot">https://github.com/GildedHonour/TelegramBot</a></p>
|
||||
<li><p>Perl. <strong>Telegram Bot</strong>. A genuine Perl 6 client for the Telegram's Bot API.<br><a href="https://github.com/GildedHonour/TelegramBot">https://github.com/GildedHonour/TelegramBot</a></p>
|
||||
</li>
|
||||
</ul></div>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -49,33 +49,34 @@
|
|||
<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">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>To see a <strong>Web App</strong> in action, try our sample <a href="https://t.me/durgerkingbot">@DurgerKingBot</a>.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<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="#april-21-2023" id="april-21-2023" name="april-21-2023"><i class="anchor-icon"></i></a>April 21, 2023</h4>
|
||||
<h3><a class="anchor" name="recent-changes" href="#recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
|
||||
<h4><a class="anchor" name="april-21-2023" href="#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 Web Apps from inline query results and from a direct link.</li>
|
||||
<li>Added the method <em>switchInlineQuery</em> to the class <a href="#initializing-web-apps">WebApp</a>.</li>
|
||||
</ul>
|
||||
<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>
|
||||
<h4><a class="anchor" name="december-30-2022" href="#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-web-apps">WebApp</a>.</li>
|
||||
<li>Added the events <em>qrTextReceived</em>, <em>clipboardTextReceived</em>.</li>
|
||||
</ul>
|
||||
<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>
|
||||
<h4><a class="anchor" name="august-12-2022" href="#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-web-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" href="#june-20-2022" id="june-20-2022" name="june-20-2022"><i class="anchor-icon"></i></a>June 20, 2022</h4>
|
||||
<h4><a class="anchor" name="june-20-2022" href="#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>
|
||||
|
@ -87,18 +88,19 @@
|
|||
<li>Added the <a href="#events-available-for-web-apps">events</a> <em>backButtonClicked</em>, <em>settingsButtonClicked</em>, <em>invoiceClosed</em>.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h3><a class="anchor" href="#designing-web-apps" id="designing-web-apps" name="designing-web-apps"><i class="anchor-icon"></i></a>Designing Web 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>Web 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>
|
||||
<h3><a class="anchor" name="designing-web-apps" href="#designing-web-apps"><i class="anchor-icon"></i></a>Designing Web Apps</h3>
|
||||
<h4><a class="anchor" name="color-schemes" href="#color-schemes"><i class="anchor-icon"></i></a>Color Schemes</h4>
|
||||
<p>Web 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">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p><a href="#themeparams">Jump to technical information</a></p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#design-guidelines" id="design-guidelines" name="design-guidelines"><i class="anchor-icon"></i></a>Design Guidelines</h4>
|
||||
<h4><a class="anchor" name="design-guidelines" href="#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 Web App should ideally reflect these principles.</p>
|
||||
<ul>
|
||||
<li>All elements should be responsive and designed with a mobile-first approach.</li>
|
||||
|
@ -108,12 +110,13 @@
|
|||
<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" href="#implementing-web-apps" id="implementing-web-apps" name="implementing-web-apps"><i class="anchor-icon"></i></a>Implementing Web Apps</h3>
|
||||
<p>Telegram currently supports six different ways of launching Web Apps: from a <a href="#keyboard-button-web-apps">keyboard button</a>, from an <a href="#inline-button-web-apps">inline button</a>, from the <a href="#launching-web-apps-from-the-menu-button">bot menu button</a>, via <a href="#inline-mode-web-apps">inline mode</a>, from a <a href="#direct-link-web-apps">direct link</a> – and even from the <a href="#launching-web-apps-from-the-attachment-menu">attachment menu</a>.</p>
|
||||
<h3><a class="anchor" name="implementing-web-apps" href="#implementing-web-apps"><i class="anchor-icon"></i></a>Implementing Web Apps</h3>
|
||||
<p>Telegram currently supports six different ways of launching Web Apps: from a <a href="#keyboard-button-web-apps">keyboard button</a>, from an <a href="#inline-button-web-apps">inline button</a>, from the <a href="#launching-web-apps-from-the-menu-button">bot menu button</a>, via <a href="#inline-mode-web-apps">inline mode</a>, from a <a href="#direct-link-web-apps">direct link</a> – and even from the <a href="#launching-web-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" href="#keyboard-button-web-apps" id="keyboard-button-web-apps" name="keyboard-button-web-apps"><i class="anchor-icon"></i></a>Keyboard Button Web Apps</h4>
|
||||
|
||||
<h4><a class="anchor" name="keyboard-button-web-apps" href="#keyboard-button-web-apps"><i class="anchor-icon"></i></a>Keyboard Button Web Apps</h4>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> Web 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-web-apps">Telegram.WebApp.sendData</a>. This makes it possible for the bot to produce a response without communicating with any external servers.</p>
|
||||
</blockquote>
|
||||
|
@ -122,84 +125,84 @@
|
|||
<p>To transmit data from the user back to the bot, the Web App can call the <a href="#initializing-web-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" href="#inline-button-web-apps" id="inline-button-web-apps" name="inline-button-web-apps"><i class="anchor-icon"></i></a>Inline Button Web Apps</h4>
|
||||
<h4><a class="anchor" name="inline-button-web-apps" href="#inline-button-web-apps"><i class="anchor-icon"></i></a>Inline Button Web Apps</h4>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> For more interactive Web 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 Web App using a <strong>web_app</strong> type <a href="/bots/api#inlinekeyboardbutton">Inline KeyboardButton</a>.</p>
|
||||
<p>From the button, a Web 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>From the button, a Web 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 Web 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" href="#launching-web-apps-from-the-menu-button" id="launching-web-apps-from-the-menu-button" name="launching-web-apps-from-the-menu-button"><i class="anchor-icon"></i></a>Launching Web Apps from the Menu Button</h4>
|
||||
<h4><a class="anchor" name="launching-web-apps-from-the-menu-button" href="#launching-web-apps-from-the-menu-button"><i class="anchor-icon"></i></a>Launching Web Apps from the Menu Button</h4>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> Web 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-web-apps">launching a Web 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 Web 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">
|
||||
</source></video>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<p>To configure the menu button, you must specify the text it should show and the Web 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 > 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's language, or show links to different Web Apps based on a user'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 Web Apps based on a user's settings in your bot.</li>
|
||||
</ul>
|
||||
<p>Apart from this, Web Apps opened via the menu button work in the exact same way as when <a href="#inline-button-web-apps">using inline buttons</a>.</p>
|
||||
<blockquote>
|
||||
<p><a href="https://t.me/durgerkingbot">@DurgerKingBot</a> allows launching its Web App both from an inline button and from the menu button.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#inline-mode-web-apps" id="inline-mode-web-apps" name="inline-mode-web-apps"><i class="anchor-icon"></i></a>Inline Mode Web Apps</h4>
|
||||
<h4><a class="anchor" name="inline-mode-web-apps" href="#inline-mode-web-apps"><i class="anchor-icon"></i></a>Inline Mode Web Apps</h4>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> Web 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>^==NEW==^ You can use the <em>button</em> parameter in the <a href="/bots/api#answerinlinequery">answerInlineQuery</a> method to display a special 'Switch to Web App' button either above or in place of the inline results. This button will <strong>open a Web App</strong> from the specified URL. Once done, you can call the <a href="#initializing-web-apps">Telegram.WebApp.switchInlineQuery</a> method to send the user back to inline mode.</p>
|
||||
<p>Inline Web 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><sup><mark>NEW</mark></sup> You can use the <em>button</em> parameter in the <a href="/bots/api#answerinlinequery">answerInlineQuery</a> method to display a special 'Switch to Web App' button either above or in place of the inline results. This button will <strong>open a Web App</strong> from the specified URL. Once done, you can call the <a href="#initializing-web-apps">Telegram.WebApp.switchInlineQuery</a> method to send the user back to inline mode.</p>
|
||||
<p>Inline Web 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" href="#direct-link-web-apps" id="direct-link-web-apps" name="direct-link-web-apps"><i class="anchor-icon"></i></a>Direct Link Web Apps</h4>
|
||||
<h4><a class="anchor" name="direct-link-web-apps" href="#direct-link-web-apps"><i class="anchor-icon"></i></a>Direct Link Web Apps</h4>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> Web 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>^==NEW==^ You can use direct links to <strong>open a Web 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 Web App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
|
||||
<p><sup><mark>NEW</mark></sup> You can use direct links to <strong>open a Web 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 Web App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
|
||||
<p>In this mode, Web 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>Web 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>Web 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>
|
||||
<code>https://t.me/botusername/appname?startapp=command</code></p>
|
||||
<p><code>https://t.me/botusername/appname</code><br><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" href="#launching-web-apps-from-the-attachment-menu" id="launching-web-apps-from-the-attachment-menu" name="launching-web-apps-from-the-attachment-menu"><i class="anchor-icon"></i></a>Launching Web Apps from the Attachment Menu</h4>
|
||||
<h4><a class="anchor" name="launching-web-apps-from-the-attachment-menu" href="#launching-web-apps-from-the-attachment-menu"><i class="anchor-icon"></i></a>Launching Web Apps from the Attachment Menu</h4>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> Web 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>
|
||||
<p><strong>TL;DR:</strong> Web 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 class="icon" src="/file/464001085/2/E4hNXSNQimQ.2503/bf6ffcab3cb3afd43d" alt="Attach"> menu in <strong>any type of chat</strong>.</p>
|
||||
</blockquote>
|
||||
<p>Web 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 web 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 > Configure Attachment Menu</em>. Then specify the URL that will be opened to launch the bot's Web App via its icon in the attachment menu.</p>
|
||||
<p>You can add a 'Settings' item to the context menu of your Web 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>Web 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 web 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 > Configure Attachment Menu</em>. Then specify the URL that will be opened to launch the bot's Web App via its icon in the attachment menu.</p>
|
||||
<p>You can add a 'Settings' item to the context menu of your Web 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 Web 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" href="#initializing-web-apps" id="initializing-web-apps" name="initializing-web-apps"><i class="anchor-icon"></i></a>Initializing Web Apps</h3>
|
||||
<h3><a class="anchor" name="initializing-web-apps" href="#initializing-web-apps"><i class="anchor-icon"></i></a>Initializing Web Apps</h3>
|
||||
<p>To connect your Web 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><head></code> tag before any other scripts, using this code:</p>
|
||||
<pre><code><script src="https://telegram.org/js/telegram-web-app.js"></script></code></pre>
|
||||
<pre><code><script src="https://telegram.org/js/telegram-web-app.js"></script></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>
|
||||
|
@ -213,27 +216,27 @@
|
|||
<tr>
|
||||
<td>initData</td>
|
||||
<td>String</td>
|
||||
<td>A string with raw data transferred to the Web App, convenient for <a href="#validating-data-received-via-the-web-app">validating data</a>.<br><strong>WARNING:</strong> <a href="#validating-data-received-via-the-web-app">Validate data</a> from this field before using it on the bot's server.</td>
|
||||
<td>A string with raw data transferred to the Web App, convenient for <a href="#validating-data-received-via-the-web-app">validating data</a>.<br><strong>WARNING:</strong> <a href="#validating-data-received-via-the-web-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 Web 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-web-app">validated</a>.</td>
|
||||
<td>An object with input data transferred to the Web 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-web-app">validated</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>version</td>
|
||||
<td>String</td>
|
||||
<td>The version of the Bot API available in the user'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'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>
|
||||
|
@ -248,12 +251,12 @@
|
|||
<tr>
|
||||
<td>viewportHeight</td>
|
||||
<td>Float</td>
|
||||
<td>The current height of the visible area of the Web 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 Web App, with its lower part remaining outside the screen area. From this position, the user can "pull" the Web App to its maximum height, while the bot can do the same by calling the <strong>expand()</strong> method. As the position of the Web 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>
|
||||
<td>The current height of the visible area of the Web 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 Web App, with its lower part remaining outside the screen area. From this position, the user can “pull” the Web App to its maximum height, while the bot can do the same by calling the <strong>expand()</strong> method. As the position of the Web 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 Web 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 Web App, with its lower part remaining outside the screen area. From this position, the user can "pull" the Web 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 Web 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 Web App reaches its final size.<br><br><em>Note the <a href="#events-available-for-web-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 Web 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 Web App, with its lower part remaining outside the screen area. From this position, the user can “pull” the Web 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 Web 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 Web App reaches its final size.<br><br><em>Note the <a href="#events-available-for-web-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>
|
||||
|
@ -288,27 +291,27 @@
|
|||
<tr>
|
||||
<td>isVersionAtLeast(version)</td>
|
||||
<td>Function</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>
|
||||
<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>==Bot API 6.1+== A method that sets the app header color. You can only pass <em>Telegram.WebApp.themeParams.bg_color</em> or <em>Telegram.WebApp.themeParams.secondary_bg_color</em> as a color or you can use keywords <em>bg_color</em>, <em>secondary_bg_color</em> instead.</td>
|
||||
<td><mark>Bot API 6.1+</mark> A method that sets the app header color. You can only pass <em>Telegram.WebApp.themeParams.bg_color</em> or <em>Telegram.WebApp.themeParams.secondary_bg_color</em> as a color or you can use keywords <em>bg_color</em>, <em>secondary_bg_color</em> instead.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>setBackgroundColor(color)</td>
|
||||
<td>Function</td>
|
||||
<td>==Bot API 6.1+== A method that sets the app background color in the <code>#RRGGBB</code> format or you can use keywords <em>bg_color</em>, <em>secondary_bg_color</em> instead.</td>
|
||||
<td><mark>Bot API 6.1+</mark> A method that sets the app background color in the <code>#RRGGBB</code> format or you can use keywords <em>bg_color</em>, <em>secondary_bg_color</em> instead.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>enableClosingConfirmation()</td>
|
||||
<td>Function</td>
|
||||
<td>==Bot API 6.2+== A method that enables a confirmation dialog while the user is trying to close the Web App.</td>
|
||||
<td><mark>Bot API 6.2+</mark> A method that enables a confirmation dialog while the user is trying to close the Web App.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>disableClosingConfirmation()</td>
|
||||
<td>Function</td>
|
||||
<td>==Bot API 6.2+== A method that disables the confirmation dialog while the user is trying to close the Web App.</td>
|
||||
<td><mark>Bot API 6.2+</mark> A method that disables the confirmation dialog while the user is trying to close the Web App.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onEvent(eventType, eventHandler)</td>
|
||||
|
@ -326,14 +329,14 @@
|
|||
<td>A method used to send data to the bot. When this method is called, a service message is sent to the bot containing the data <em>data</em> of the length up to 4096 bytes, and the Web App is closed. See the field <em>web_app_data</em> in the class <a href="/bots/api#message">Message</a>.<br><br><em>This method is only available for Web Apps launched via a <a href="#keyboard-button-web-apps">Keyboard button</a>.</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>switchInlineQuery(query[, choose_chat_types]) ^==NEW==^</td>
|
||||
<td>switchInlineQuery(query[, choose_chat_types]) <sup><mark>NEW</mark></sup></td>
|
||||
<td>Function</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>
|
||||
<td><mark>Bot API 6.7+</mark> 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 Web 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 Web App interface (e.g. a click inside the Web App or on the main button)</em></td>
|
||||
<td>A method that opens a link in an external browser. The Web 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 Web App interface (e.g. a click inside the Web App or on the main button)</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>openTelegramLink(url)</td>
|
||||
|
@ -343,42 +346,42 @@
|
|||
<tr>
|
||||
<td>openInvoice(url[, callback])</td>
|
||||
<td>Function</td>
|
||||
<td>==Bot API 6.1+== A method that opens an invoice using the link <em>url</em>. The Web App will receive the <a href="#events-available-for-web-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><mark>Bot API 6.1+</mark> A method that opens an invoice using the link <em>url</em>. The Web App will receive the <a href="#events-available-for-web-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>==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 Web App will receive the <a href="#events-available-for-web-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><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 Web App will receive the <a href="#events-available-for-web-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>==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>
|
||||
<td><mark>Bot API 6.2+</mark> 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>==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>
|
||||
<td><mark>Bot API 6.2+</mark> 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>==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 Web App will receive the <a href="#events-available-for-web-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><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 Web App will receive the <a href="#events-available-for-web-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>==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-web-apps">event</a> <em>qrTextReceived</em>.</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-web-apps">event</a> <em>qrTextReceived</em>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>readTextFromClipboard([callback])</td>
|
||||
<td>Function</td>
|
||||
<td>==Bot API 6.4+== A method that requests text from the clipboard. The Web App will receive the <a href="#events-available-for-web-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 Web Apps launched from the attachment menu and only in response to a user interaction with the Web App interface (e.g. a click inside the Web App or on the main button).</em></td>
|
||||
<td><mark>Bot API 6.4+</mark> A method that requests text from the clipboard. The Web App will receive the <a href="#events-available-for-web-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 Web Apps launched from the attachment menu and only in response to a user interaction with the Web App interface (e.g. a click inside the Web App or on the main button).</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ready()</td>
|
||||
<td>Function</td>
|
||||
<td>A method that informs the Telegram app that the Web 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 Web 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 Web 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 Web 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>
|
||||
|
@ -392,8 +395,8 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" href="#themeparams" id="themeparams" name="themeparams"><i class="anchor-icon"></i></a>ThemeParams</h4>
|
||||
<p>Web 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>
|
||||
<h4><a class="anchor" name="themeparams" href="#themeparams"><i class="anchor-icon"></i></a>ThemeParams</h4>
|
||||
<p>Web 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>
|
||||
|
@ -406,44 +409,45 @@
|
|||
<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>. ==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>
|
||||
<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>
|
||||
</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" href="#popupparams" id="popupparams" name="popupparams"><i class="anchor-icon"></i></a>PopupParams</h4>
|
||||
|
||||
<h4><a class="anchor" name="popupparams" href="#popupparams"><i class="anchor-icon"></i></a>PopupParams</h4>
|
||||
<p>This object describes the native popup.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -467,11 +471,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" href="#scanqrpopupparams" id="scanqrpopupparams" name="scanqrpopupparams"><i class="anchor-icon"></i></a>ScanQrPopupParams</h4>
|
||||
<h4><a class="anchor" name="scanqrpopupparams" href="#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>
|
||||
|
@ -485,11 +489,11 @@
|
|||
<tr>
|
||||
<td>text</td>
|
||||
<td>String</td>
|
||||
<td><em>Optional</em>. The text to be displayed under the 'Scan QR' 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" href="#popupbutton" id="popupbutton" name="popupbutton"><i class="anchor-icon"></i></a>PopupButton</h4>
|
||||
<h4><a class="anchor" name="popupbutton" href="#popupbutton"><i class="anchor-icon"></i></a>PopupButton</h4>
|
||||
<p>This object describes the native popup button.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -503,12 +507,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>
|
||||
|
@ -517,7 +521,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" href="#backbutton" id="backbutton" name="backbutton"><i class="anchor-icon"></i></a>BackButton</h4>
|
||||
<h4><a class="anchor" name="backbutton" href="#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 Web App in the Telegram interface.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -536,27 +540,27 @@
|
|||
<tr>
|
||||
<td>onClick(callback)</td>
|
||||
<td>Function</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>
|
||||
<td><mark>Bot API 6.1+</mark> 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>==Bot API 6.1+== A method that removes the button press event handler. An alias for <code>Telegram.WebApp.offEvent('backButtonClicked', callback)</code></td>
|
||||
<td><mark>Bot API 6.1+</mark> 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>==Bot API 6.1+== A method to make the button active and visible.</td>
|
||||
<td><mark>Bot API 6.1+</mark> A method to make the button active and visible.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>hide()</td>
|
||||
<td>Function</td>
|
||||
<td>==Bot API 6.1+== A method to hide the button.</td>
|
||||
<td><mark>Bot API 6.1+</mark> 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" href="#mainbutton" id="mainbutton" name="mainbutton"><i class="anchor-icon"></i></a>MainButton</h4>
|
||||
<h4><a class="anchor" name="mainbutton" href="#mainbutton"><i class="anchor-icon"></i></a>MainButton</h4>
|
||||
<p>This object controls the main button, which is displayed at the bottom of the Web App in the Telegram interface.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -605,17 +609,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('mainButtonClicked', 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('mainButtonClicked', 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 Web App from the <a href="#launching-web-apps-from-the-attachment-menu">attachment menu</a> hides the main button until the user interacts with the Web App interface.</em></td>
|
||||
<td>A method to make the button visible.<br><em>Note that opening the Web App from the <a href="#launching-web-apps-from-the-attachment-menu">attachment menu</a> hides the main button until the user interacts with the Web App interface.</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>hide()</td>
|
||||
|
@ -635,7 +639,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>
|
||||
|
@ -645,12 +649,12 @@
|
|||
<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" href="#hapticfeedback" id="hapticfeedback" name="hapticfeedback"><i class="anchor-icon"></i></a>HapticFeedback</h4>
|
||||
<h4><a class="anchor" name="hapticfeedback" href="#hapticfeedback"><i class="anchor-icon"></i></a>HapticFeedback</h4>
|
||||
<p>This object controls haptic feedback.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -664,22 +668,22 @@
|
|||
<tr>
|
||||
<td>impactOccurred(style)</td>
|
||||
<td>Function</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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>notificationOccurred(type)</td>
|
||||
<td>Function</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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>selectionChanged()</td>
|
||||
<td>Function</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>
|
||||
<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>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>All these methods return the HapticFeedback object so they can be chained.</p>
|
||||
<h4><a class="anchor" href="#webappinitdata" id="webappinitdata" name="webappinitdata"><i class="anchor-icon"></i></a>WebAppInitData</h4>
|
||||
<h4><a class="anchor" name="webappinitdata" href="#webappinitdata"><i class="anchor-icon"></i></a>WebAppInitData</h4>
|
||||
<p>This object contains data that is transferred to the Web App when it is opened. It is empty if the Web App was launched from a <a href="#keyboard-button-web-apps">keyboard button</a> or from <a href="#inline-mode-web-apps">inline mode</a>.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -711,19 +715,19 @@
|
|||
<td><em>Optional.</em> An object containing data about the chat where the bot was launched via the attachment menu. Returned for supergroups, channels and group chats – only for Web Apps launched via the attachment menu.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>chat_type ^==NEW==^</td>
|
||||
<td>chat_type <sup><mark>NEW</mark></sup></td>
|
||||
<td>String</td>
|
||||
<td><em>Optional.</em> Type of the chat from which the Web 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 Web Apps launched from direct links.</td>
|
||||
<td><em>Optional.</em> Type of the chat from which the Web 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 Web Apps launched from direct links.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>chat_instance ^==NEW==^</td>
|
||||
<td>chat_instance <sup><mark>NEW</mark></sup></td>
|
||||
<td>String</td>
|
||||
<td><em>Optional.</em> Global identifier, uniquely corresponding to the chat from which the Web App was opened. Returned only for Web Apps launched from a direct link.</td>
|
||||
</tr>
|
||||
<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 Web 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 Web 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 Web 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 Web App can load the correct interface right away.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>can_send_after</td>
|
||||
|
@ -742,7 +746,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" href="#webappuser" id="webappuser" name="webappuser"><i class="anchor-icon"></i></a>WebAppUser</h4>
|
||||
<h4><a class="anchor" name="webappuser" href="#webappuser"><i class="anchor-icon"></i></a>WebAppUser</h4>
|
||||
<p>This object contains the data of the Web App user.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -781,7 +785,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'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>
|
||||
|
@ -795,7 +799,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" href="#webappchat" id="webappchat" name="webappchat"><i class="anchor-icon"></i></a>WebAppChat</h4>
|
||||
<h4><a class="anchor" name="webappchat" href="#webappchat"><i class="anchor-icon"></i></a>WebAppChat</h4>
|
||||
<p>This object represents a chat.</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -814,7 +818,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>
|
||||
|
@ -833,19 +837,19 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4><a class="anchor" href="#validating-data-received-via-the-web-app" id="validating-data-received-via-the-web-app" name="validating-data-received-via-the-web-app"><i class="anchor-icon"></i></a>Validating data received via the Web App</h4>
|
||||
<p>To validate data received via the Web 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=<value></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=<auth_date>\nquery_id=<query_id>\nuser=<user>'</code>.</p>
|
||||
<h4><a class="anchor" name="validating-data-received-via-the-web-app" href="#validating-data-received-via-the-web-app"><i class="anchor-icon"></i></a>Validating data received via the Web App</h4>
|
||||
<p>To validate data received via the Web 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=<value></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=<auth_date>\nquery_id=<query_id>\nuser=<user>'</code>.</p>
|
||||
<p>The full check might look like:</p>
|
||||
<pre><code>data_check_string = ...
|
||||
<a href='/constructor/secret_key'>secret_key</a> = <a href='/type/HMAC_SHA256%28%3Cbot_token%26gt'>HMAC_SHA256(<bot_token></a>;, "WebAppData")
|
||||
secret_key = HMAC_SHA256(<bot_token>, "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 Web 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" href="#events-available-for-web-apps" id="events-available-for-web-apps" name="events-available-for-web-apps"><i class="anchor-icon"></i></a>Events Available for Web Apps</h4>
|
||||
<h4><a class="anchor" name="events-available-for-web-apps" href="#events-available-for-web-apps"><i class="anchor-icon"></i></a>Events Available for Web Apps</h4>
|
||||
<p>The Web 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>
|
||||
|
@ -857,64 +861,58 @@ 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'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 Web 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 Web App is finished. If it is false, the resizing is ongoing (the user is expanding or collapsing the Web App or an animated object is playing). The current value of the visible section’s height is available in <em>this.viewportHeight</em>.</td>
|
||||
<td>Occurs when the visible section of the Web 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 Web App is finished. If it is false, the resizing is ongoing (the user is expanding or collapsing the Web App or an animated object is playing). The current value of the visible section’s 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>==Bot API 6.1+== Occurrs when the <a href="#backbutton">back button</a> is pressed. <br><em>eventHandler</em> receives no parameters.</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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>settingsButtonClicked</code></td>
|
||||
<td>==Bot API 6.1+== Occurrs when the Settings item in context menu is pressed. <br><em>eventHandler</em> receives no parameters.</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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>invoiceClosed</code></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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>popupClosed</code></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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>qrTextReceived</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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>clipboardTextReceived</code></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 Web App has no access to the clipboard, the field <em>data</em> will be <em>null</em>.</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 Web App has no access to the clipboard, the field <em>data</em> will be <em>null</em>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<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>
|
||||
<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>
|
||||
<p>A special link is used to add bots to the attachment menu:</p>
|
||||
<p><code>https://t.me/botusername?startattach</code>
|
||||
or
|
||||
<code>https://t.me/botusername?startattach=command</code></p>
|
||||
<p><code>https://t.me/botusername?startattach</code><br>or<br><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 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 class="icon" 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 Web 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>
|
||||
<code>https://t.me/username?attach=botusername&startattach=command</code>
|
||||
<code>https://t.me/+1234567890?attach=botusername</code>
|
||||
<code>https://t.me/+1234567890?attach=botusername&startattach=command</code></p>
|
||||
<p>These links open the Web 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 Web 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&choose=users+bots</code>
|
||||
<code>https://t.me/botusername?startattach=command&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 Web App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
|
||||
<h3><a class="anchor" href="#testing-web-apps" id="testing-web-apps" name="testing-web-apps"><i class="anchor-icon"></i></a>Testing Web 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><code>https://t.me/username?attach=botusername</code><br><code>https://t.me/username?attach=botusername&startattach=command</code><br><code>https://t.me/+1234567890?attach=botusername</code><br><code>https://t.me/+1234567890?attach=botusername&startattach=command</code></p>
|
||||
<p>These links open the Web 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 Web 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&choose=users+bots</code><br><code>https://t.me/botusername?startattach=command&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 Web App in the <em>start_param</em> field and in the GET parameter <em>tgWebAppStartParam</em>.</p>
|
||||
<h3><a class="anchor" name="testing-web-apps" href="#testing-web-apps"><i class="anchor-icon"></i></a>Testing Web 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>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 > Accounts > Login to another account > Test.</li>
|
||||
|
@ -927,7 +925,7 @@ or
|
|||
<blockquote>
|
||||
<p><strong>Note:</strong> When working with the test environment, you may use HTTP links without TLS to test your Web App.</p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#debug-mode-for-web-apps" id="debug-mode-for-web-apps" name="debug-mode-for-web-apps"><i class="anchor-icon"></i></a>Debug Mode for Web Apps</h4>
|
||||
<h4><a class="anchor" name="debug-mode-for-web-apps" href="#debug-mode-for-web-apps"><i class="anchor-icon"></i></a>Debug Mode for Web Apps</h4>
|
||||
<p>Use these tools to find app-specific issues in your Web App:</p>
|
||||
<p><strong>Android</strong></p>
|
||||
<ul>
|
||||
|
@ -945,9 +943,10 @@ or
|
|||
<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 Web Apps".</li>
|
||||
<li>Quickly click 5 times on the Settings icon to open the debug menu and enable “Debug Web Apps”.</li>
|
||||
<li>Right click in the web app and choose <em>Inspect Element</em>.</li>
|
||||
</ul></div>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -47,42 +47,24 @@ Client developers are required to comply with the Security…">
|
|||
<div id="dev_page_content"><!-- scroll_nav -->
|
||||
|
||||
<blockquote>
|
||||
<p>Please feel free to check out our <a href="http://core.telegram.org/techfaq">FAQ for the Technically Inclined</a>.
|
||||
Client developers are required to comply with the <a href="/mtproto/security_guidelines">Security Guidelines</a>.</p>
|
||||
<p>Please feel free to check out our <a href="http://core.telegram.org/techfaq">FAQ for the Technically Inclined</a>.<br>Client developers are required to comply with the <a href="/mtproto/security_guidelines">Security Guidelines</a>.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related articles</h3>
|
||||
<h3><a class="anchor" name="related-articles" href="#related-articles"><i class="anchor-icon"></i></a>Related articles</h3>
|
||||
<p><div class="dev_page_nav_wrap"></p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="/mtproto/description">Mobile Protocol: Detailed Description</a></p>
|
||||
<li><a href="/mtproto/description">Mobile Protocol: Detailed Description</a></li>
|
||||
<li><a href="/mtproto/auth_key">Creating an Authorization Key</a></li>
|
||||
<li><a href="/mtproto/samples-auth_key">Creating an Authorization Key: Example</a></li>
|
||||
<li><a href="/mtproto/service_messages">Mobile Protocol: Service Messages</a></li>
|
||||
<li><a href="/mtproto/service_messages_about_messages">Mobile Protocol: Service Messages about Messages</a></li>
|
||||
<li><a href="/mtproto/serialize">Binary Data Serialization</a></li>
|
||||
<li><p><a href="/mtproto/TL">TL Language</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="/mtproto/auth_key">Creating an Authorization Key</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="/mtproto/service_messages">Mobile Protocol: Service Messages</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="/mtproto/service_messages_about_messages">Mobile Protocol: Service Messages about Messages</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="/mtproto/serialize">Binary Data Serialization</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="/mtproto/TL">TL Language</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="/schema/mtproto">MTProto TL-schema</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="/api/end-to-end">End-to-end encryption, Secret Chats</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="/schema/end-to-end">End-to-end TL-schema</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="/mtproto/security_guidelines">Security Guidelines for Client Software Developers</a></p>
|
||||
<li><p><a href="/schema/mtproto">MTProto TL-schema</a></p>
|
||||
</li>
|
||||
<li><a href="/api/end-to-end">End-to-end encryption, Secret Chats</a></li>
|
||||
<li><a href="/schema/end-to-end">End-to-end TL-schema</a></li>
|
||||
<li><a href="/mtproto/security_guidelines">Security Guidelines for Client Software Developers</a></li>
|
||||
</ul>
|
||||
<p></div></p>
|
||||
<hr>
|
||||
|
@ -91,7 +73,7 @@ Client developers are required to comply with the <a href="/mtproto/security_gui
|
|||
<li><a href="/api/end-to-end">Secret Chats, end-to-end-encryption</a></li>
|
||||
<li><a href="/api/end-to-end/voice-calls">End-to-end encrypted Voice Calls</a></li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#general-description" id="general-description" name="general-description"><i class="anchor-icon"></i></a>General Description</h3>
|
||||
<h3><a class="anchor" name="general-description" href="#general-description"><i class="anchor-icon"></i></a>General Description</h3>
|
||||
<p>The protocol is designed for access to a server API from applications running on mobile devices. It must be emphasized that a web browser is not such an application.</p>
|
||||
<p>The protocol is subdivided into three virtually independent components:</p>
|
||||
<ul>
|
||||
|
@ -100,14 +82,14 @@ Client developers are required to comply with the <a href="/mtproto/security_gui
|
|||
<li>Transport component: defines the method for the client and the server to transmit messages over some other existing network protocol (such as HTTP, HTTPS, WS (plain WebSockets), WSS (WebSockets over HTTPS), TCP, UDP).</li>
|
||||
</ul>
|
||||
<div><a href="/file/811140746/2/CzMyJPVnPo8.81605/c2310d6ede1a5e220f">
|
||||
<img src="/file/811140746/2/CzMyJPVnPo8.81605/c2310d6ede1a5e220f" alt="MTProto 2.0, server-client encryption, cloud chats" class="dev_page_image" style="max-width: 600px;">
|
||||
<img src="/file/811140746/2/CzMyJPVnPo8.81605/c2310d6ede1a5e220f" alt="MTProto 2.0, server-client encryption, cloud chats" class="dev_page_image" style="max-width: 600px;" />
|
||||
</a></div>
|
||||
|
||||
<blockquote>
|
||||
<p>As of version 4.6, major Telegram clients are using <strong>MTProto 2.0</strong>, described in this article.
|
||||
MTProto v1.0 (<a href="/mtproto_v1">described here</a> for reference) is deprecated and is currently being phased out. </p>
|
||||
<p>As of version 4.6, major Telegram clients are using <strong>MTProto 2.0</strong>, described in this article.<br>MTProto v1.0 (<a href="/mtproto_v1">described here</a> for reference) is deprecated and is currently being phased out. </p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#brief-component-summary" id="brief-component-summary" name="brief-component-summary"><i class="anchor-icon"></i></a>Brief Component Summary</h3>
|
||||
<h4><a class="anchor" href="#high-level-component-rpc-query-languageapi" id="high-level-component-rpc-query-languageapi" name="high-level-component-rpc-query-languageapi"><i class="anchor-icon"></i></a>High-Level Component (RPC Query Language/API)</h4>
|
||||
<h3><a class="anchor" name="brief-component-summary" href="#brief-component-summary"><i class="anchor-icon"></i></a>Brief Component Summary</h3>
|
||||
<h4><a class="anchor" name="high-level-component-rpc-query-language-api" href="#high-level-component-rpc-query-language-api"><i class="anchor-icon"></i></a>High-Level Component (RPC Query Language/API)</h4>
|
||||
<p>From the standpoint of the high-level component, the client and the server exchange <em>messages</em> inside a <em>session</em>. The session is attached to the client device (the application, to be more exact) rather than a specific websocket/http/https/tcp connection. In addition, each session is attached to a <em>user key ID</em> by which authorization is actually accomplished.</p>
|
||||
<p>Several connections to a server may be open; messages may be sent in either direction through any of the connections (a response to a query is not necessarily returned through the same connection that carried the original query, although most often, that is the case; however, in no case can a message be returned through a connection belonging to a different session). When the UDP protocol is used, a response might be returned by a different IP address than the one to which the query had been sent.</p>
|
||||
<p>There are several types of messages:</p>
|
||||
|
@ -121,19 +103,19 @@ MTProto v1.0 (<a href="/mtproto_v1">described here</a> for reference) is depreca
|
|||
<p>From the standpoint of lower level protocols, a message is a binary data stream aligned along a 4 or 16-byte boundary. The first several fields in the message are fixed and are used by the cryptographic/authorization system.</p>
|
||||
<p>Each message, either individual or inside a container, consists of a <em>message identifier</em> (64 bits, see below), a <em>message sequence number within a session</em> (32 bits), the <em>length</em> (of the message body in bytes; 32 bits), and a <em>body</em> (any size which is a multiple of 4 bytes). In addition, when a container or a single message is sent, an <em>internal header</em> is added at the top (see below), then the entire message is encrypted, and an <em>external header</em> is placed at the top of the message (a 64-bit <em>key identifier</em> and a 128-bit <em>message key</em>).</p>
|
||||
<p>A <em>message body</em> normally consists of a 32-bit <em>message type</em> followed by type-dependent <em>parameters</em>. In particular, each RPC function has a corresponding message type. For more detail, see <a href="/mtproto/serialize">Binary Data Serialization</a>, <a href="/mtproto/service_messages">Mobile Protocol: Service Messages</a>.</p>
|
||||
<p>All numbers are written as little endian. However, very large numbers (2048-bit or <code>pq</code>, <code>p</code>, <code>q</code> params) used in RSA and DH are written in the big endian format because that is how the OpenSSL library does it.</p>
|
||||
<h4><a class="anchor" href="#authorization-and-encryption" id="authorization-and-encryption" name="authorization-and-encryption"><i class="anchor-icon"></i></a>Authorization and Encryption</h4>
|
||||
<p>All numbers are written as little endian. However, very large numbers (2048-bit) used in RSA and DH are written in the big endian format because that is how the OpenSSL library does it.</p>
|
||||
<h4><a class="anchor" name="authorization-and-encryption" href="#authorization-and-encryption"><i class="anchor-icon"></i></a>Authorization and Encryption</h4>
|
||||
<p>Prior to a message (or a multipart message) being transmitted over a network using a transport protocol, it is encrypted in a certain way, and an <em>external header</em> is added at the top of the message which is: a 64-bit <em>key identifier</em> (that uniquely identifies an <em>authorization key</em> for the server as well as the <em>user</em>) and a 128-bit <em>message key</em>. A user key together with the message key defines an actual 256-bit key which is what encrypts the message using AES-256 encryption. Note that the initial part of the message to be encrypted contains variable data (session, message ID, sequence number, server salt) that obviously influences the message key (and thus the AES key and iv). The message key is defined as the 128 middle bits of the SHA256 of the message body (including session, message ID, etc.), including the padding bytes, prepended by 32 bytes taken from the authorization key. Multipart messages are encrypted as a single message.</p>
|
||||
<blockquote>
|
||||
<p>For a technical specification, see <a href="/mtproto/description">Mobile Protocol: Detailed Description</a></p>
|
||||
</blockquote>
|
||||
<p>The first thing a client application must do is <a href="/mtproto/auth_key">create an authorization key</a> which is normally generated when it is first run and almost never changes.</p>
|
||||
<p>To prevent attackers potentially intercepting encrypted messages from decrypting them <em>post factum</em> by somehow appropriating the authorization key (for example, by stealing a device – even though in that case one could also gain access to all the information cached on the device without decrypting anything), MTProto supports <a href="https://core.telegram.org/api/pfs">Perfect Forward Secrecy</a> in both <a href="https://core.telegram.org/api/pfs">cloud chats</a> and <a href="https://core.telegram.org/api/end-to-end/pfs">secret chats</a>.</p>
|
||||
<h4><a class="anchor" href="#time-synchronization" id="time-synchronization" name="time-synchronization"><i class="anchor-icon"></i></a>Time Synchronization</h4>
|
||||
<p>If client time diverges widely from server time, a server may start ignoring client messages, or vice versa, because of an invalid message identifier (which is closely related to creation time). Under these circumstances, the server will send the client a special message containing the correct time and a certain 128-bit salt (either explicitly provided by the client in a special RPC synchronization request or equal to the key of the latest message received from the client during the current session). This message could be the first one in a container that includes other messages (if the time discrepancy is significant but does not as yet result in the client's messages being ignored).</p>
|
||||
<p>Having received such a message or a container holding it, the client first performs a time synchronization (in effect, simply storing the difference between the server's time and its own to be able to compute the “correct” time in the future) and then verifies the message identifiers for correctness.</p>
|
||||
<p>To prevent attackers potentially intercepting encrypted messages from decrypting them <em>post factum</em> by somehow appropriating the authorization key (for example, by stealing a device – even though in that case one could also gain access to all the information cached on the device without decrypting anything), MTProto supports <a href="https://core.telegram.org/api/pfs">Perfect Forward Secrecy</a> in both <a href="https://core.telegram.org/api/pfs">cloud chats</a> and <a href="https://core.telegram.org/api/end-to-end/pfs">secret chats</a>.</p>
|
||||
<h4><a class="anchor" name="time-synchronization" href="#time-synchronization"><i class="anchor-icon"></i></a>Time Synchronization</h4>
|
||||
<p>If client time diverges widely from server time, a server may start ignoring client messages, or vice versa, because of an invalid message identifier (which is closely related to creation time). Under these circumstances, the server will send the client a special message containing the correct time and a certain 128-bit salt (either explicitly provided by the client in a special RPC synchronization request or equal to the key of the latest message received from the client during the current session). This message could be the first one in a container that includes other messages (if the time discrepancy is significant but does not as yet result in the client's messages being ignored).</p>
|
||||
<p>Having received such a message or a container holding it, the client first performs a time synchronization (in effect, simply storing the difference between the server's time and its own to be able to compute the “correct” time in the future) and then verifies the message identifiers for correctness.</p>
|
||||
<p>Where a correction has been neglected, the client will have to generate a new session to assure the monotonicity of message identifiers.</p>
|
||||
<h3><a class="anchor" href="#mtproto-transport" id="mtproto-transport" name="mtproto-transport"><i class="anchor-icon"></i></a>MTProto transport</h3>
|
||||
<h3><a class="anchor" name="mtproto-transport" href="#mtproto-transport"><i class="anchor-icon"></i></a>MTProto transport</h3>
|
||||
<p>Before being sent using the selected transport protocol, the payload has to be wrapped in a secondary protocol header, defined by the appropriate MTProto transport protocol. </p>
|
||||
<ul>
|
||||
<li><a href="mtproto/mtproto-transports#abridged">Abridged</a></li>
|
||||
|
@ -141,17 +123,15 @@ MTProto v1.0 (<a href="/mtproto_v1">described here</a> for reference) is depreca
|
|||
<li><a href="mtproto/mtproto-transports#padded-intermediate">Padded intermediate</a></li>
|
||||
<li><a href="mtproto/mtproto-transports#full">Full</a></li>
|
||||
</ul>
|
||||
<p>The server recognizes these different protocols (and distinguishes them from HTTP, too) by the header.
|
||||
Additionally, the following transport features can be used: </p>
|
||||
<p>The server recognizes these different protocols (and distinguishes them from HTTP, too) by the header.<br>Additionally, the following transport features can be used: </p>
|
||||
<ul>
|
||||
<li><a href="mtproto/mtproto-transports#quick-ack">Quick ack</a></li>
|
||||
<li><a href="mtproto/mtproto-transports#transport-errors">Transport errors</a></li>
|
||||
<li><a href="mtproto/mtproto-transports#transport-obfuscation">Transport obfuscation</a></li>
|
||||
</ul>
|
||||
<p>Example implementations for these protocols can be seen in <a href="https://github.com/tdlib/td/blob/master/td/mtproto/TcpTransport.cpp">tdlib</a> and <a href="https://github.com/danog/MadelineProto/tree/v8/src/Stream/MTProtoTransport">MadelineProto</a>.</p>
|
||||
<h3><a class="anchor" href="#transport" id="transport" name="transport"><i class="anchor-icon"></i></a>Transport</h3>
|
||||
<p>Enables the delivery of encrypted containers together with the external header (hereinafter, <em>Payload</em>) from client to server and back.
|
||||
Multiple transport protocols are defined:</p>
|
||||
<p>Example implementations for these protocols can be seen in <a href="https://github.com/tdlib/td/blob/master/td/mtproto/TcpTransport.cpp">tdlib</a> and <a href="https://github.com/danog/MadelineProto/tree/master/src/danog/MadelineProto/Stream/MTProtoTransport">MadelineProto</a>.</p>
|
||||
<h3><a class="anchor" name="transport" href="#transport"><i class="anchor-icon"></i></a>Transport</h3>
|
||||
<p>Enables the delivery of encrypted containers together with the external header (hereinafter, <em>Payload</em>) from client to server and back.<br>Multiple transport protocols are defined:</p>
|
||||
<ul>
|
||||
<li><a href="/mtproto/transports#tcp">TCP</a></li>
|
||||
<li><a href="/mtproto/transports#websocket">Websocket</a></li>
|
||||
|
@ -161,10 +141,10 @@ Multiple transport protocols are defined:</p>
|
|||
<li>UDP</li>
|
||||
</ul>
|
||||
<p>(We shall examine only the first five types.)</p>
|
||||
<h3><a class="anchor" href="#recap" id="recap" name="recap"><i class="anchor-icon"></i></a>Recap</h3>
|
||||
<h3><a class="anchor" name="recap" href="#recap"><i class="anchor-icon"></i></a>Recap</h3>
|
||||
<p>To recap, using the <a href="https://en.wikipedia.org/wiki/OSI_model#Layer_architecture">ISO/OSI stack as comparison</a>: </p>
|
||||
<ul>
|
||||
<li>Layer 7 (Application): <a href="#high-level-component-rpc-query-languageapi">High-level RPC API</a></li>
|
||||
<li>Layer 7 (Application): <a href="#high-level-component-rpc-query-language-api">High-level RPC API</a></li>
|
||||
<li>Layer 6 (Presentation): <a href="/mtproto/TL">Type Language</a></li>
|
||||
<li>Layer 5 (Session): <a href="https://core.telegram.org/mtproto/description#session">MTProto session</a></li>
|
||||
<li>Layer 4 (Transport):<ul>
|
||||
|
@ -175,8 +155,9 @@ Multiple transport protocols are defined:</p>
|
|||
</li>
|
||||
<li>Layer 3 (Network): IP</li>
|
||||
<li>Layer 2 (Data link): MAC/LLC</li>
|
||||
<li>Layer 1 (Physical): IEEE 802.3, IEEE 802.11, etc...</li>
|
||||
</ul></div>
|
||||
<li>Layer 1 (Physical): IEEE 802.3, IEEE 802.11, etc…</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -44,88 +44,85 @@
|
|||
|
||||
<div id="dev_page_content"><p>The query format is described using <a href="/mtproto/serialize">Binary Data Serialization</a> and the <a href="/mtproto/TL">TL Language</a>. All large numbers are transmitted as strings containing the required sequence of bytes in big endian order. Hash functions, such as SHA1, return strings (of 20 bytes) which can also be interpreted as big endian numbers. Small numbers (<code>int</code>, <code>long</code>, <code>int128</code>, <code>int256</code>) are normally little endian; however, if they are part of SHA1, the bytes are not rearranged. This way, if <code>long</code> <code>x</code> is the 64 lower-order bits of SHA1 of string <code>s</code>, then the <em>final</em> 8 bytes of 20-byte string <code>SHA1(s)</code> are taken and interpreted as a 64-bit integer.</p>
|
||||
<p>Prior to sending off unencrypted messages (required in this instance to generate an authorization key), the client must undergo (p,q) authorization as follows.</p>
|
||||
<h4><a class="anchor" href="#dh-exchange-initiation" id="dh-exchange-initiation" name="dh-exchange-initiation"><i class="anchor-icon"></i></a>DH exchange initiation</h4>
|
||||
<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>
|
||||
<h4><a class="anchor" name="dh-exchange-initiation" href="#dh-exchange-initiation"><i class="anchor-icon"></i></a>DH exchange initiation</h4>
|
||||
<p>1) Client sends query to server</p>
|
||||
<pre><code>req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;</code></pre>
|
||||
<p>The value of <em>nonce</em> is selected randomly by the client (random number) and identifies the client within this communication. Following this step, it is known to all.</p>
|
||||
<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>
|
||||
<p>2) Server sends response of the form</p>
|
||||
<pre><code>resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector long = ResPQ;</code></pre>
|
||||
<p>Here, string pq is a representation of a natural number (in binary big endian format). This number is the product of two different odd prime numbers. Normally, pq is less than or equal to 2^63-1. The value of <em>server_nonce</em> is selected randomly by the server; following this step, it is known to all.</p>
|
||||
<p><code>server_public_key_fingerprints</code> is a list of public RSA key fingerprints (64 lower-order bits of SHA1 (server_public_key); the public key is represented as a bare type <code>rsa_public_key n:string e:string = RSAPublicKey</code>, where, as usual, n and e are numbers in big endian format serialized as strings of bytes, following which SHA1 is computed) received by the server.</p>
|
||||
<p>All subsequent messages contain the pair (nonce, server_nonce) both in the plain-text, and the encrypted portions which makes it possible to identify a “temporary session” — one run of the key generation protocol described on this page that uses the same (nonce, server_nonce) pair. An intruder could not create a parallel session with the server with the same parameters and reuse parts of server- or client-encrypted messages for its own purposes in such a parallel session, because a different server_nonce would be selected by the server for any new “temporary session”.</p>
|
||||
<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--q" id="3-client-decomposes-pq-into-prime-factors-such-that-p--q" name="3-client-decomposes-pq-into-prime-factors-such-that-p--q"><i class="anchor-icon"></i></a>3) Client decomposes pq into prime factors such that p < q.</h5>
|
||||
<h4><a class="anchor" name="proof-of-work" href="#proof-of-work"><i class="anchor-icon"></i></a>Proof of work</h4>
|
||||
<p>3) Client decomposes pq into prime factors such that p < q.</p>
|
||||
<p>This starts a round of Diffie-Hellman key exchanges.</p>
|
||||
<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>
|
||||
<h4><a class="anchor" name="presenting-proof-of-work-server-authentication" href="#presenting-proof-of-work-server-authentication"><i class="anchor-icon"></i></a>Presenting proof of work; Server authentication</h4>
|
||||
<p>4) Client sends query to server</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>
|
||||
<p>Here, encrypted_data is obtained as follows:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>new_nonce := another (good) random number generated by the client; after this query, it is known to both client and server;</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>data := a serialization of </p>
|
||||
<li>new_nonce := another (good) random number generated by the client; after this query, it is known to both client and server;</li>
|
||||
<li><p>data := a serialization of </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>
|
||||
<p>or of</p>
|
||||
<pre><code>p_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data;</code></pre>
|
||||
<p>where <code>dc</code> is the ID of the DC we're talking to; <code>10000</code> has to be added to the DC ID when connecting to the test servers; it has to be made negative if the DC we're connecting to is a media (not CDN) DC. </p>
|
||||
</li>
|
||||
<li>
|
||||
<p>encrypted_data := RSA_PAD (data, server_public_key), where RSA_PAD is a version of RSA with a variant of OAEP+ padding explained below in 4.1).</p>
|
||||
<li><p>encrypted_data := RSA_PAD (data, server_public_key), where RSA_PAD is a version of RSA with a variant of OAEP+ padding explained below in 4.1).</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Someone might intercept the query and replace it with their own, independently decomposing pq into factors instead of the client. The only field that it makes sense to modify is new_nonce which would be the one an intruder would have to re-generate (because an intruder cannot decrypt the encrypted data sent by the client). Since all subsequent messages are encrypted using new_nonce or contain new_nonce_hash, they will not be processed by the client (an intruder would not be able to make it look as though they had been generated by the server because they would not contain new_nonce). Therefore, this intercept will only result in the intruder's completing the authorization key generation protocol in place of the client and creating a new key (that has nothing to do with the client); however, the same effect could be achieved simply by creating a new key in one's own name.</p>
|
||||
<p>Someone might intercept the query and replace it with their own, independently decomposing pq into factors instead of the client. The only field that it makes sense to modify is new_nonce which would be the one an intruder would have to re-generate (because an intruder cannot decrypt the encrypted data sent by the client). Since all subsequent messages are encrypted using new_nonce or contain new_nonce_hash, they will not be processed by the client (an intruder would not be able to make it look as though they had been generated by the server because they would not contain new_nonce). Therefore, this intercept will only result in the intruder's completing the authorization key generation protocol in place of the client and creating a new key (that has nothing to do with the client); however, the same effect could be achieved simply by creating a new key in one's own name.</p>
|
||||
<p>An alternative form of inner data (<code>p_q_inner_data_temp_dc</code>) is used to create temporary keys, that are only stored in the server RAM and are discarded after at most <code>expires_in</code> seconds. The server is free to discard its copy earlier. In all other respects the temporary key generation protocol is the same. After a temporary key is created, the client usually binds it to its principal authorisation key by means of the <a href="/method/auth.bindTempAuthKey">auth.bindTempAuthKey</a> method, and uses it for all client-server communication until it expires; then a new temporary key is generated. Thus Perfect Forward Secrecy (PFS) in client-server communication is achieved. <a href="/api/pfs">Read more about PFS »</a></p>
|
||||
<h5><a class="anchor" href="#41-rsa-paddata-server-public-key-mentioned-above-is-implemented-as-follows" id="41-rsa-paddata-server-public-key-mentioned-above-is-implemented-as-follows" name="41-rsa-paddata-server-public-key-mentioned-above-is-implemented-as-follows"><i class="anchor-icon"></i></a>4.1) <code>RSA_PAD(data, server_public_key)</code> mentioned above is implemented as follows:</h5>
|
||||
<p>4.1) RSA_PAD(data, server_public_key) mentioned above is implemented as follows:</p>
|
||||
<ul>
|
||||
<li>data_with_padding := data + random_padding_bytes; -- where random_padding_bytes are chosen so that the resulting length of data_with_padding is precisely 192 bytes, and data is the TL-serialized data to be encrypted as before. One has to check that data is not longer than 144 bytes.</li>
|
||||
<li>data_pad_reversed := BYTE_REVERSE(data_with_padding); -- is obtained from data_with_padding by reversing the byte order.</li>
|
||||
<li>data_with_padding := data + random_padding_bytes; — where random_padding_bytes are chosen so that the resulting length of data_with_padding is precisely 192 bytes, and data is the TL-serialized data to be encrypted as before. One has to check that data is not longer than 144 bytes.</li>
|
||||
<li>data_pad_reversed := BYTE_REVERSE(data_with_padding); — is obtained from data_with_padding by reversing the byte order.</li>
|
||||
<li>a random 32-byte temp_key is generated.</li>
|
||||
<li>data_with_hash := data_pad_reversed + SHA256(temp_key + data_with_padding); -- after this assignment, data_with_hash is exactly 224 bytes long.</li>
|
||||
<li>aes_encrypted := AES256_IGE(data_with_hash, temp_key, 0); -- AES256-IGE encryption with zero IV.</li>
|
||||
<li>temp_key_xor := temp_key XOR SHA256(aes_encrypted); -- adjusted key, 32 bytes</li>
|
||||
<li>key_aes_encrypted := temp_key_xor + aes_encrypted; -- exactly 256 bytes (2048 bits) long</li>
|
||||
<li>data_with_hash := data_pad_reversed + SHA256(temp_key + data_with_padding); — after this assignment, data_with_hash is exactly 224 bytes long.</li>
|
||||
<li>aes_encrypted := AES256_IGE(data_with_hash, temp_key, 0); — AES256-IGE encryption with zero IV.</li>
|
||||
<li>temp_key_xor := temp_key XOR SHA256(aes_encrypted); — adjusted key, 32 bytes</li>
|
||||
<li>key_aes_encrypted := temp_key_xor + aes_encrypted; — exactly 256 bytes (2048 bits) long</li>
|
||||
<li>The value of key_aes_encrypted is compared with the RSA-modulus of server_pubkey as a big-endian 2048-bit (256-byte) unsigned integer. If key_aes_encrypted turns out to be greater than or equal to the RSA modulus, the previous steps starting from the generation of new random temp_key are repeated. Otherwise the final step is performed:</li>
|
||||
<li>encrypted_data := RSA(key_aes_encrypted, server_pubkey); -- 256-byte big-endian integer is elevated to the requisite power from the RSA public key modulo the RSA modulus, and the result is stored as a big-endian integer consisting of exactly 256 bytes (with leading zero bytes if required).</li>
|
||||
<li>encrypted_data := RSA(key_aes_encrypted, server_pubkey); — 256-byte big-endian integer is elevated to the requisite power from the RSA public key modulo the RSA modulus, and the result is stored as a big-endian integer consisting of exactly 256 bytes (with leading zero bytes if required).</li>
|
||||
</ul>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<p>5) Server responds with:</p>
|
||||
<pre><code>server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;</code></pre>
|
||||
<blockquote>
|
||||
<p>If the query is incorrect, the server returns a <code>-404</code> error and the handshake must be restarted (any subsequent request also returns <code>-404</code>, even if it is correct).<br>
|
||||
A <code>-444</code> error may also be returned if a test DC ID is passed in <code>p_q_inner_data_(_temp)dc</code> when handshaking with a production DC, and vice versa. </p>
|
||||
<p>If the query is incorrect, the server returns a <code>-404</code> error and the handshake must be restarted (any subsequent request also returns <code>-404</code>, even if it is correct).</p>
|
||||
</blockquote>
|
||||
<p>Here, encrypted_answer is obtained as follows:</p>
|
||||
<ul>
|
||||
<li>new_nonce_hash := 128 lower-order bits of SHA1 (new_nonce);</li>
|
||||
<li>answer := serialization <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>
|
||||
<li><p>answer := 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>
|
||||
</li>
|
||||
<li><p>answer_with_hash := SHA1(answer) + answer + (0-15 random bytes); such that the length be divisible by 16;</p>
|
||||
</li>
|
||||
<li>answer_with_hash := SHA1(answer) + answer + (0-15 random bytes); such that the length be divisible by 16;</li>
|
||||
<li>tmp_aes_key := SHA1(new_nonce + server_nonce) + substr (SHA1(server_nonce + new_nonce), 0, 12);</li>
|
||||
<li>tmp_aes_iv := substr (SHA1(server_nonce + new_nonce), 12, 8) + SHA1(new_nonce + new_nonce) + substr (new_nonce, 0, 4);</li>
|
||||
<li>encrypted_answer := AES256_ige_encrypt (answer_with_hash, tmp_aes_key, tmp_aes_iv); here, tmp_aes_key is a 256-bit key, and tmp_aes_iv is a 256-bit initialization vector. The same as in all the other instances that use AES encryption, the encrypted data is padded with random bytes to a length divisible by 16 immediately prior to encryption.</li>
|
||||
</ul>
|
||||
<p>Following this step, new_nonce is still known to client and server only. The client is certain that it is the server that responded and that the response was generated specifically in response to client query req_DH_params, since the response data are encrypted using new_nonce.</p>
|
||||
<p>Client is expected to check whether <strong>p = dh_prime</strong> is a safe 2048-bit prime (meaning that both <strong>p</strong> and <strong>(p-1)/2</strong> are prime, and that 2^2047 < p < 2^2048), and that <strong>g</strong> generates a cyclic subgroup of prime order <strong>(p-1)/2</strong>, i.e. is a quadratic residue <strong>mod p</strong>. Since <strong>g</strong> is always equal to 2, 3, 4, 5, 6 or 7, this is easily done using quadratic reciprocity law, yielding a simple condition on <strong>p mod 4g</strong> -- namely, <strong>p mod 8 = 7</strong> for <strong>g = 2</strong>; <strong>p mod 3 = 2</strong> for <strong>g = 3</strong>; no extra condition for <strong>g = 4</strong>; <strong>p mod 5 = 1 or 4</strong> for <strong>g = 5</strong>; <strong>p mod 24 = 19 or 23</strong> for <strong>g = 6</strong>; and <strong>p mod 7 = 3, 5 or 6</strong> for <strong>g = 7</strong>. After <strong>g</strong> and <strong>p</strong> have been checked by the client, it makes sense to cache the result, so as not to repeat lengthy computations in future.</p>
|
||||
<p>If the verification takes too long time (which is the case for older mobile devices), one might initially run only 15 Miller--Rabin iterations for verifying primeness of <strong>p</strong> and <strong>(p - 1)/2</strong> with error probability not exceeding one billionth, and do more iterations later in the background.</p>
|
||||
<p>Another optimization is to embed into the client application code a small table with some known "good" couples <strong>(g,p)</strong> (or just known safe primes <strong>p</strong>, since the condition on <strong>g</strong> is easily verified during execution), checked during code generation phase, so as to avoid doing such verification during runtime altogether. Server changes these values rarely, thus one usually has to put the current value of server's <strong>dh_prime</strong> into such a table. For example, current value of <strong>dh_prime</strong> equals (in big-endian byte order)</p>
|
||||
<p>Client is expected to check whether <strong>p = dh_prime</strong> is a safe 2048-bit prime (meaning that both <strong>p</strong> and <strong>(p-1)/2</strong> are prime, and that 2<sup>2047 < p < 2</sup>2048), and that <strong>g</strong> generates a cyclic subgroup of prime order <strong>(p-1)/2</strong>, i.e. is a quadratic residue <strong>mod p</strong>. Since <strong>g</strong> is always equal to 2, 3, 4, 5, 6 or 7, this is easily done using quadratic reciprocity law, yielding a simple condition on <strong>p mod 4g</strong> — namely, <strong>p mod 8 = 7</strong> for <strong>g = 2</strong>; <strong>p mod 3 = 2</strong> for <strong>g = 3</strong>; no extra condition for <strong>g = 4</strong>; <strong>p mod 5 = 1 or 4</strong> for <strong>g = 5</strong>; <strong>p mod 24 = 19 or 23</strong> for <strong>g = 6</strong>; and <strong>p mod 7 = 3, 5 or 6</strong> for <strong>g = 7</strong>. After <strong>g</strong> and <strong>p</strong> have been checked by the client, it makes sense to cache the result, so as not to repeat lengthy computations in future.</p>
|
||||
<p>If the verification takes too long time (which is the case for older mobile devices), one might initially run only 15 Miller—Rabin iterations for verifying primeness of <strong>p</strong> and <strong>(p - 1)/2</strong> with error probability not exceeding one billionth, and do more iterations later in the background.</p>
|
||||
<p>Another optimization is to embed into the client application code a small table with some known “good” couples <strong>(g,p)</strong> (or just known safe primes <strong>p</strong>, since the condition on <strong>g</strong> is easily verified during execution), checked during code generation phase, so as to avoid doing such verification during runtime altogether. Server changes these values rarely, thus one usually has to put the current value of server's <strong>dh_prime</strong> into such a table. For example, current value of <strong>dh_prime</strong> equals (in big-endian byte order)</p>
|
||||
<pre><code>C7 1C AE B9 C6 B1 C9 04 8E 6C 52 2F 70 F1 3F 73 98 0D 40 23 8E 3E 21 C1 49 34 D0 37 56 3D 93 0F 48 19 8A 0A A7 C1 40 58 22 94 93 D2 25 30 F4 DB FA 33 6F 6E 0A C9 25 13 95 43 AE D4 4C CE 7C 37 20 FD 51 F6 94 58 70 5A C6 8C D4 FE 6B 6B 13 AB DC 97 46 51 29 69 32 84 54 F1 8F AF 8C 59 5F 64 24 77 FE 96 BB 2A 94 1D 5B CD 1D 4A C8 CC 49 88 07 08 FA 9B 37 8E 3C 4F 3A 90 60 BE E6 7C F9 A4 A4 A6 95 81 10 51 90 7E 16 27 53 B5 6B 0F 6B 41 0D BA 74 D8 A8 4B 2A 14 B3 14 4E 0E F1 28 47 54 FD 17 ED 95 0D 59 65 B4 B9 DD 46 58 2D B1 17 8D 16 9C 6B C4 65 B0 D6 FF 9C A3 92 8F EF 5B 9A E4 E4 18 FC 15 E8 3E BE A0 F8 7F A9 FF 5E ED 70 05 0D ED 28 49 F4 7B F9 59 D9 56 85 0C E9 29 85 1F 0D 81 15 F6 35 B1 05 EE 2E 4E 15 D0 4B 24 54 BF 6F 4F AD F0 34 B1 04 03 11 9C D8 E3 B9 2F CC 5B</code></pre>
|
||||
<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>6) Client computes random 2048-bit number <em>b</em> (using a sufficient amount of entropy) and sends the server a message</p>
|
||||
<pre><code>set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;</code></pre>
|
||||
<p>Here, encrypted_data is obtained thus:</p>
|
||||
<ul>
|
||||
<li>g_b := pow(g, b) mod dh_prime;</li>
|
||||
<li>data := serialization <pre><code>client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data</code></pre>
|
||||
<li><p>data := 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>
|
||||
</li>
|
||||
<li><p>data_with_hash := SHA1(data) + data + (0-15 random bytes); such that length be divisible by 16;</p>
|
||||
</li>
|
||||
<li>data_with_hash := SHA1(data) + data + (0-15 random bytes); such that length be divisible by 16;</li>
|
||||
<li>encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);</li>
|
||||
</ul>
|
||||
<p>The retry_id field is equal to zero at the time of the first attempt; otherwise, it is equal to auth_key_aux_hash from the previous failed attempt (see <a href="#9-server-responds-in-one-of-three-ways">Item 9</a>).</p>
|
||||
<h5><a class="anchor" href="#8-thereafter-auth-key-equals-powg-ab-mod-dh-prime-on-the-server-it-is-computed-as-powg-b-a-mod-dh-prime-and-on-the-client-as-g-ab-mod-dh-prime" id="8-thereafter-auth-key-equals-powg-ab-mod-dh-prime-on-the-server-it-is-computed-as-powg-b-a-mod-dh-prime-and-on-the-client-as-g-ab-mod-dh-prime" name="8-thereafter-auth-key-equals-powg-ab-mod-dh-prime-on-the-server-it-is-computed-as-powg-b-a-mod-dh-prime-and-on-the-client-as-g-ab-mod-dh-prime"><i class="anchor-icon"></i></a>8) Thereafter, auth_key equals <code>pow(g, {ab}) mod dh_prime</code>; on the server, it is computed as <code>pow(g_b, a) mod dh_prime</code>, and on the client as <code>(g_a)^b mod dh_prime</code>.</h5>
|
||||
<p>Auth_key_hash is computed := 64 lower-order bits of SHA1 (auth_key). The server checks whether there already is another key with the same auth_key_hash and responds in one of the following ways.</p>
|
||||
<h4><a class="anchor" href="#dh-key-exchange-complete" id="dh-key-exchange-complete" name="dh-key-exchange-complete"><i class="anchor-icon"></i></a>DH key exchange complete</h4>
|
||||
<h5><a class="anchor" href="#9-server-responds-in-one-of-three-ways" id="9-server-responds-in-one-of-three-ways" name="9-server-responds-in-one-of-three-ways"><i class="anchor-icon"></i></a>9) Server responds in one of three ways:</h5>
|
||||
<p>The retry_id field is equal to zero at the time of the first attempt; otherwise, it is equal to auth_key_aux_hash from the previous failed attempt (see Item 9).</p>
|
||||
<p>7) Thereafter, auth_key equals <code>pow(g, {ab}) mod dh_prime</code>; on the server, it is computed as <code>pow(g_b, a) mod dh_prime</code>, and on the client as <code>(g_a)^b mod dh_prime</code>.</p>
|
||||
<p>8) auth_key_hash is computed := 64 lower-order bits of SHA1 (auth_key). The server checks whether there already is another key with the same auth_key_hash and responds in one of the following ways.</p>
|
||||
<h4><a class="anchor" name="dh-key-exchange-complete" href="#dh-key-exchange-complete"><i class="anchor-icon"></i></a>DH key exchange complete</h4>
|
||||
<p>9) Server responds in one of three ways:</p>
|
||||
<pre><code>dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;
|
||||
dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer;
|
||||
dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer;</code></pre>
|
||||
|
@ -133,12 +130,14 @@ dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = S
|
|||
<li>new_nonce_hash1, new_nonce_hash2, and new_nonce_hash3 are obtained as the 128 lower-order bits of SHA1 of the byte string derived from the new_nonce string by adding a single byte with the value of 1, 2, or 3, and followed by another 8 bytes with auth_key_aux_hash. Different values are required to prevent an intruder from changing server response dh_gen_ok into dh_gen_retry.</li>
|
||||
<li>auth_key_aux_hash is the 64 <em>higher-order</em> bits of SHA1(auth_key). It must not be confused with auth_key_hash.</li>
|
||||
</ul>
|
||||
<p>In the other case, the client goes to <a href="/mtproto/auth_key#7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message">Item 7)</a> generating a new <em>b</em>.
|
||||
In the first case, the client and the server have negotiated auth_key, following which they forget all other temporary data, and the client creates another encrypted session using auth_key. At the same time, server_salt is initially set to <code>substr(new_nonce, 0, 8) XOR substr(server_nonce, 0, 8)</code>. If required, the client stores the difference between server_time received in 5) and its local time, to be able always to have a good approximation of server time which is required to generate correct message identifiers.</p>
|
||||
<p>In the other case, the client goes to Item 6) generating a new <em>b</em>.<br>In the first case, the client and the server have negotiated auth_key, following which they forget all other temporary data, and the client creates another encrypted session using auth_key. At the same time, server_salt is initially set to <code>substr(new_nonce, 0, 8) XOR substr(server_nonce, 0, 8)</code>. If required, the client stores the difference between server_time received in 5) and its local time, to be able always to have a good approximation of server time which is required to generate correct message identifiers.</p>
|
||||
<p><strong>IMPORTANT</strong>: Apart from the conditions on the Diffie-Hellman prime <strong>dh_prime</strong> and generator <strong>g</strong>, both sides are to check that <strong>g</strong>, <strong>g_a</strong> and <strong>g_b</strong> are greater than <strong>1</strong> and less than <strong>dh_prime - 1</strong>. We recommend checking that <strong>g_a</strong> and <strong>g_b</strong> are between <strong>2^{2048-64}</strong> and <strong>dh_prime - 2^{2048-64}</strong> as well.</p>
|
||||
<h4><a class="anchor" href="#error-handling-lost-queries-and-responses" id="error-handling-lost-queries-and-responses" name="error-handling-lost-queries-and-responses"><i class="anchor-icon"></i></a>Error Handling (Lost Queries and Responses)</h4>
|
||||
<h4><a class="anchor" name="error-handling-lost-queries-and-responses" href="#error-handling-lost-queries-and-responses"><i class="anchor-icon"></i></a>Error Handling (Lost Queries and Responses)</h4>
|
||||
<p>If the client fails to receive any response to its query from the server within a certain time interval, it may simply re-send the query. If the server has already sent a response to this query (<em>exactly</em> the same request and not just similar: all the parameters during the repeat request must take on the same values) but it did not get to the client, the server will simply re-send the same response. The server remembers the response for up to 10 minutes after having received the query in 1). If the server has already forgotten the response or the requisite temporary data, the client will have to start from the beginning.</p>
|
||||
<p>The server may consider that if the client has already sent in the next query using the data from the previous server response to the specific client, the response is known to have been received by the client and may be forgotten by the server.</p></div>
|
||||
<p>The server may consider that if the client has already sent in the next query using the data from the previous server response to the specific client, the response is known to have been received by the client and may be forgotten by the server.</p>
|
||||
<h4><a class="anchor" name="usage-example" href="#usage-example"><i class="anchor-icon"></i></a>Usage Example</h4>
|
||||
<p>An example of a complete list of queries required to generate an authorization key is shown on <a href="/mtproto/samples-auth_key">a separate page</a>.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ Additionally, the following transport features can be used: </p>
|
|||
<li><a href="#transport-errors">Transport errors</a></li>
|
||||
<li><a href="#transport-obfuscation">Transport obfuscation</a></li>
|
||||
</ul>
|
||||
<p>Example implementations for these protocols can be seen in <a href="https://github.com/tdlib/td/blob/master/td/mtproto/TcpTransport.cpp">tdlib</a> and <a href="https://github.com/danog/MadelineProto/tree/v8/src/Stream/MTProtoTransport">MadelineProto</a>.</p>
|
||||
<p>Example implementations for these protocols can be seen in <a href="https://github.com/tdlib/td/blob/master/td/mtproto/TcpTransport.cpp">tdlib</a> and <a href="https://github.com/danog/MadelineProto/tree/master/src/danog/MadelineProto/Stream/MTProtoTransport">MadelineProto</a>.</p>
|
||||
<h3><a class="anchor" href="#abridged" id="abridged" name="abridged"><i class="anchor-icon"></i></a>Abridged</h3>
|
||||
<p>The lightest protocol available.</p>
|
||||
<ul>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -127,7 +127,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td><a href="/constructor/messageEntityTextUrl">messageEntityTextUrl</a></td>
|
||||
<td>Message entity representing a <a href="https://google.com">text url</a>: for in-text urls like <a href="https://google.com">https://google.com</a> use <a href="/constructor/messageEntityUrl">messageEntityUrl</a>.<br><br>Note that an additional confirmation popup with the full URL must be displayed to the user before opening this link, unless the domain satisfies the conditions specified in the <a href="/api/config#whitelisted-domains">domain whitelist documentation »</a>.</td>
|
||||
<td>Message entity representing a <a href="https://google.com">text url</a>: for in-text urls like <a href="https://google.com">https://google.com</a> use <a href="/constructor/messageEntityUrl">messageEntityUrl</a>.<br><br>Note that an additional confirmation popup with the full URL must be displayed to the user before opening this link, unless the domain is one of the whitelisted domains specified in the <a href="/api/config#whitelisted-domains"><code>whitelisted_domains</code> client configuration parameter »</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="/constructor/messageEntityMentionName">messageEntityMentionName</a></td>
|
||||
|
|
Loading…
Reference in a new issue