Update content of files

This commit is contained in:
GitHub Action 2022-05-13 22:37:40 +00:00
parent 4efaf918af
commit d0c19d16f3
1893 changed files with 344013 additions and 0 deletions

View file

@ -0,0 +1,261 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Telegram APIs</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="We offer two kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages for…">
<meta property="og:title" content="Telegram APIs">
<meta property="og:image" content="df8a0f9162ddfc1daf">
<meta property="og:description" content="We offer two kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages for…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Telegram APIs</h1>
<div id="dev_page_content"><p>We offer two kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib-build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge.</p>
<p>You can also add <a href="/widgets"><strong>Telegram Widgets</strong></a> to your website.</p>
<p>Designers are welcome to create <a href="/animated_stickers"><strong>Animated Stickers</strong></a> or <a href="/themes"><strong>Custom Themes</strong></a> for Telegram.</p>
<hr>
<h3><a class="anchor" name="bot-api" href="#bot-api"><i class="anchor-icon"></i></a>Bot API</h3>
<div>
<a href="/file/811140327/1/zlN4goPTupk/9ff2f2f01c4bd1b013" target="_blank"><img src="/file/811140934/1/tbDSLHSaijc/fdcc7b6d5fb3354adf" title="The Botfather. Click for hi-res picture" style="max-width: 200px;float:right" /></a>
</div>
<p>This API allows you to connect bots to our system. <a href="/bots"><strong>Telegram Bots</strong></a> are special accounts that do not require an additional phone number to set up. These accounts serve as an interface for code running somewhere on your server.</p>
<p>To use this, you don&#39;t need to know anything about how our MTProto encryption protocol works — our intermediary server will handle all encryption and communication with the Telegram API for you. You communicate with this server via a simple HTTPS-interface that offers a simplified version of the Telegram API.</p>
<blockquote>
<p><a href="/bots"><strong>Learn more about the Bot API here &raquo;</strong></a></p>
</blockquote>
<p>Bot developers can also make use of our <a href="/bots/payments"><strong>Payments API</strong></a> to accept <strong>payments</strong> from Telegram users around the world.</p>
<hr>
<h3><a class="anchor" name="tdlib-build-your-own-telegram" href="#tdlib-build-your-own-telegram"><i class="anchor-icon"></i></a>TDLib build your own Telegram</h3>
<p>Even if you&#39;re looking for maximum customization, you don&#39;t have to create your app from scratch. Try our <a href="https://core.telegram.org/tdlib"><strong>Telegram Database Library</strong></a> (or simply TDLib), a tool for third-party developers that makes it easy to build fast, secure and feature-rich Telegram apps.</p>
<p>TDLib takes care of all <strong>network implementation</strong> details, <strong>encryption</strong> and <strong>local data storage</strong>, so that you can dedicate more time to design, responsive interfaces and beautiful animations.</p>
<p>TDLib supports all Telegram features and makes developing Telegram apps a breeze on any platform. It can be used on Android, iOS, Windows, macOS, Linux and virtually any other system. The library is open source and compatible with virtually <strong>any programming language</strong>.</p>
<blockquote>
<p><a href="https://core.telegram.org/tdlib"><strong>Learn more about TDLib here »</strong></a></p>
</blockquote>
<hr>
<h3><a class="anchor" name="telegram-api" href="#telegram-api"><i class="anchor-icon"></i></a>Telegram API</h3>
<p>This API allows you to build your own customized Telegram clients. It is 100% open for all developers who wish to create Telegram applications on our platform. Feel free to study the open <a href="https://telegram.org/apps#source-code">source code</a> of existing Telegram applications for examples of how things work here. Don&#39;t forget to <a href="/api/obtaining_api_id">register</a> your application in our system. </p>
<ul>
<li><a href="#getting-started">Getting Started</a></li>
<li><a href="#security">Security</a></li>
<li><a href="#optimization">Optimization</a></li>
<li><a href="#api-methods">API methods</a></li>
</ul>
<h3><a class="anchor" name="getting-started" href="#getting-started"><i class="anchor-icon"></i></a>Getting started</h3>
<h4><a class="anchor" name="creating-an-application" href="#creating-an-application"><i class="anchor-icon"></i></a><a href="/api/obtaining_api_id">Creating an application</a></h4>
<p>How to get your application identifier and create a new Telegram app.</p>
<h4><a class="anchor" name="user-authorization" href="#user-authorization"><i class="anchor-icon"></i></a><a href="/api/auth">User authorization</a></h4>
<p>How to register a user&#39;s phone to start using the API.</p>
<h4><a class="anchor" name="two-factor-authentication" href="#two-factor-authentication"><i class="anchor-icon"></i></a><a href="/api/srp">Two-factor authentication</a></h4>
<p>How to login to a user&#39;s account if they have enabled 2FA, how to change password.</p>
<h4><a class="anchor" name="qr-code-login" href="#qr-code-login"><i class="anchor-icon"></i></a><a href="/api/qr-login">QR code login</a></h4>
<p><a href="https://en.wikipedia.org/wiki/QR_code">QR code</a> login flow</p>
<h4><a class="anchor" name="error-handling" href="#error-handling"><i class="anchor-icon"></i></a><a href="/api/errors">Error handling</a></h4>
<p>How to handle API return errors correctly.</p>
<h4><a class="anchor" name="handling-different-data-centers" href="#handling-different-data-centers"><i class="anchor-icon"></i></a><a href="/api/datacenter">Handling different data centers</a></h4>
<p>How to connect to the closest DC access point for faster interaction with the API, and things to watch out for when developing a client.</p>
<h4><a class="anchor" name="handling-updates" href="#handling-updates"><i class="anchor-icon"></i></a><a href="/api/updates">Handling updates</a></h4>
<p>How to subscribe to updates and handle them properly.</p>
<h4><a class="anchor" name="handling-push-notifications" href="#handling-push-notifications"><i class="anchor-icon"></i></a><a href="/api/push-updates">Handling PUSH-notifications</a></h4>
<p>How to subscribe and handle them properly.</p>
<h4><a class="anchor" name="channels-supergroups-gigagroups-and-basic-groups" href="#channels-supergroups-gigagroups-and-basic-groups"><i class="anchor-icon"></i></a><a href="/api/channel">Channels, supergroups, gigagroups and basic groups</a></h4>
<p>How to handle channels, supergroups, gigagroups, basic groups, and what&#39;s the difference between them.</p>
<h4><a class="anchor" name="channel-statistics" href="#channel-statistics"><i class="anchor-icon"></i></a><a href="/api/stats">Channel statistics</a></h4>
<p>Telegram offers detailed channel statistics for channels and supergroups. </p>
<h4><a class="anchor" name="calling-methods" href="#calling-methods"><i class="anchor-icon"></i></a><a href="/api/invoking">Calling methods</a></h4>
<p>Additional options for calling methods.</p>
<h4><a class="anchor" name="uploading-and-downloading-files" href="#uploading-and-downloading-files"><i class="anchor-icon"></i></a><a href="/api/files">Uploading and Downloading Files</a></h4>
<p>How to transfer large data batches correctly.</p>
<h4><a class="anchor" name="pagination" href="#pagination"><i class="anchor-icon"></i></a><a href="/api/offsets">Pagination</a></h4>
<p>How to fetch results from large lists of objects.</p>
<h4><a class="anchor" name="client-configuration" href="#client-configuration"><i class="anchor-icon"></i></a><a href="/api/config">Client configuration</a></h4>
<p>The MTProto API has multiple client configuration parameters that can be fetched with the appropriate methods. </p>
<h3><a class="anchor" name="security" href="#security"><i class="anchor-icon"></i></a>Security</h3>
<h4><a class="anchor" name="secret-chats-end-to-end-encryption" href="#secret-chats-end-to-end-encryption"><i class="anchor-icon"></i></a><a href="/api/end-to-end">Secret chats, end-to-end encryption</a></h4>
<p>End-to-end-encrypted messaging.</p>
<h4><a class="anchor" name="security-guidelines" href="#security-guidelines"><i class="anchor-icon"></i></a><a href="/mtproto/security_guidelines">Security guidelines</a></h4>
<p>Important checks required in your client application.</p>
<h4><a class="anchor" name="perfect-forward-secrecy" href="#perfect-forward-secrecy"><i class="anchor-icon"></i></a><a href="/api/pfs">Perfect Forward Secrecy</a></h4>
<p>Binding temporary authorization key to permanent ones.</p>
<h4><a class="anchor" name="end-to-end-encryption-in-voice-and-video-calls" href="#end-to-end-encryption-in-voice-and-video-calls"><i class="anchor-icon"></i></a><a href="https://core.telegram.org/api/end-to-end/video-calls">End-to-End Encryption in Voice and Video Calls</a></h4>
<p>End-to-end-encrypted calls.</p>
<h3><a class="anchor" name="optimization" href="#optimization"><i class="anchor-icon"></i></a>Optimization</h3>
<h4><a class="anchor" name="client-optimization" href="#client-optimization"><i class="anchor-icon"></i></a><a href="/api/optimisation">Client optimization</a></h4>
<p>Ways to boost API interactions.</p>
<h3><a class="anchor" name="api-methods" href="#api-methods"><i class="anchor-icon"></i></a>API methods</h3>
<h4><a class="anchor" name="available-method-list" href="#available-method-list"><i class="anchor-icon"></i></a><a href="/methods">Available method list</a></h4>
<p>A list of available high-level methods.</p>
<h4><a class="anchor" name="api-tl-schema-as-json" href="#api-tl-schema-as-json"><i class="anchor-icon"></i></a><a href="/schema">API TL-schema</a>, <a href="/schema/json">as JSON</a></h4>
<p>Text and JSON-presentation of types and methods used in API.</p>
<h4><a class="anchor" name="available-layer-list" href="#available-layer-list"><i class="anchor-icon"></i></a><a href="/api/layers">Available layer list</a></h4>
<p>A list of available schema versions.</p>
<h3><a class="anchor" name="other-articles" href="#other-articles"><i class="anchor-icon"></i></a>Other articles</h3>
<h4><a class="anchor" name="working-with-bots-using-the-mtproto-api" href="#working-with-bots-using-the-mtproto-api"><i class="anchor-icon"></i></a><a href="/api/bots">Working with bots, using the MTProto API</a></h4>
<p>How to work with bots using the MTProto API.</p>
<h4><a class="anchor" name="commands" href="#commands"><i class="anchor-icon"></i></a><a href="/api/bots/commands">Commands</a></h4>
<p><a href="/bots">Bots</a> offer a set of commands that can be used by users in private, or in a chat. </p>
<h4><a class="anchor" name="buttons" href="#buttons"><i class="anchor-icon"></i></a><a href="/api/bots/buttons">Buttons</a></h4>
<p>Users can interact with your bot via <strong>buttons</strong> or even <strong>inline buttons</strong>, straight from inline <strong>messages</strong> in <strong>any</strong> chat. </p>
<h4><a class="anchor" name="inline-queries" href="#inline-queries"><i class="anchor-icon"></i></a><a href="/api/bots/inline">Inline queries</a></h4>
<p>Users can interact with your bot via <strong>inline queries</strong>, straight from the <strong>text input field</strong> in <strong>any</strong> chat. </p>
<h4><a class="anchor" name="games" href="#games"><i class="anchor-icon"></i></a><a href="/api/bots/games">Games</a></h4>
<p>Bots can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats; how to work with games in the MTProto API.</p>
<h4><a class="anchor" name="search-amp-filters" href="#search-amp-filters"><i class="anchor-icon"></i></a><a href="/api/search">Search &amp; filters</a></h4>
<p>Telegram allows applying detailed message filters while looking for messages in chats.<br>This allows the server to filter messages based on a text query, and even on their type, and this feature is often used by graphical clients to implement features like the chat gallery, chat profile pictures and more.</p>
<h4><a class="anchor" name="polls" href="#polls"><i class="anchor-icon"></i></a><a href="/api/poll">Polls</a></h4>
<p>Telegram allows sending polls and quizzes, that can be voted on by thousands, if not millions of users in chats and channels.</p>
<h4><a class="anchor" name="reactions" href="#reactions"><i class="anchor-icon"></i></a><a href="/api/reactions">Reactions</a></h4>
<p>Telegram allows users to react on any message using specific emojis, triggering cute lottie animations. </p>
<h4><a class="anchor" name="invite-links-and-join-requests" href="#invite-links-and-join-requests"><i class="anchor-icon"></i></a><a href="/api/invites">Invite links and join requests</a></h4>
<p>Channels, basic groups and supergroups may have a public username or a private invite link: private invite links may be further enhanced with per-user join requests.</p>
<h4><a class="anchor" name="admin-banned-and-default-rights-for-channels-supergroups-and-gro" href="#admin-banned-and-default-rights-for-channels-supergroups-and-gro"><i class="anchor-icon"></i></a><a href="/api/rights">Admin, banned and default rights for channels, supergroups and groups</a></h4>
<p>How to handle admin permissions, granular bans and global permissions in channels, groups and supergroups.</p>
<h4><a class="anchor" name="discussion-groups" href="#discussion-groups"><i class="anchor-icon"></i></a><a href="/api/discussion">Discussion groups</a></h4>
<p><a href="/api/channel">Groups</a> can be associated to a <a href="/api/channel">channel</a> as a <a href="https://telegram.org/blog/privacy-discussions-web-bots">discussion group</a>, to allow users to discuss about posts. </p>
<h4><a class="anchor" name="channel-comments-and-message-threads" href="#channel-comments-and-message-threads"><i class="anchor-icon"></i></a><a href="/api/threads">Channel comments and message threads</a></h4>
<p>Telegram allows commenting on a <a href="/api/channel">channel post</a> or on a generic <a href="/api/channel">group message</a>, thanks to message threads.</p>
<h4><a class="anchor" name="admin-log" href="#admin-log"><i class="anchor-icon"></i></a><a href="/api/recent-actions">Admin log</a></h4>
<p>Both supergroups and channels offer a so-called <a href="https://telegram.org/blog/admin-revolution">admin log</a>, a log of recent relevant supergroup and channel actions, like the modification of group/channel settings or information on behalf of an admin, user kicks and bans, and more. </p>
<h4><a class="anchor" name="pinned-messages" href="#pinned-messages"><i class="anchor-icon"></i></a><a href="/api/pin">Pinned messages</a></h4>
<p>Telegram allows pinning multiple messages on top of a specific chat. </p>
<h4><a class="anchor" name="mentions" href="#mentions"><i class="anchor-icon"></i></a><a href="/api/mentions">Mentions</a></h4>
<p>Telegram allows mentioning other users in case of urgent duckling matters, and quickly navigating to those mentions in order to read them as swiftly as possible.</p>
<h4><a class="anchor" name="scheduled-messages" href="#scheduled-messages"><i class="anchor-icon"></i></a><a href="/api/scheduled-messages">Scheduled messages</a></h4>
<p>Telegram allows scheduling messages.</p>
<h4><a class="anchor" name="live-geolocations" href="#live-geolocations"><i class="anchor-icon"></i></a><a href="/api/live-location">Live geolocations</a></h4>
<p>Telegram allows sending the live geolocation of a user in a chat, optionally setting a proximity alert. </p>
<h4><a class="anchor" name="min-constructors" href="#min-constructors"><i class="anchor-icon"></i></a><a href="/api/min">Min constructors</a></h4>
<p>Sometimes, <a href="/constructor/user">user</a> and <a href="/constructor/channel">channel</a> constructors met in group chat updates may not contain full info about the user: how to handle such constructors.</p>
<h4><a class="anchor" name="account-deletion" href="#account-deletion"><i class="anchor-icon"></i></a><a href="/api/account-deletion">Account deletion</a></h4>
<p>How to reset an account if the <a href="/api/srp">2FA</a> password was forgotten.</p>
<h4><a class="anchor" name="imported-messages" href="#imported-messages"><i class="anchor-icon"></i></a><a href="/api/import">Imported messages</a></h4>
<p>Telegram allows importing messages and media from foreign chat apps.</p>
<h4><a class="anchor" name="telegram-passport" href="#telegram-passport"><i class="anchor-icon"></i></a><a href="/api/passport">Telegram Passport</a></h4>
<p>How to work with <a href="/api/passport">Telegram Passport</a> directly using the MTProto API.</p>
<h4><a class="anchor" name="telegram-payments" href="#telegram-payments"><i class="anchor-icon"></i></a><a href="/api/payments">Telegram Payments</a></h4>
<p>How to work with Telegram Payments directly using the MTProto API.</p>
<h4><a class="anchor" name="styled-text-with-message-entities" href="#styled-text-with-message-entities"><i class="anchor-icon"></i></a><a href="/api/entities">Styled text with message entities</a></h4>
<p>How to create styled text with message entities</p>
<h4><a class="anchor" name="working-with-animated-emojis" href="#working-with-animated-emojis"><i class="anchor-icon"></i></a><a href="/api/animated-emojis">Working with animated emojis</a></h4>
<p>Graphical telegram clients should transform emojis into their respective animated version. </p>
<h4><a class="anchor" name="working-with-animated-dice" href="#working-with-animated-dice"><i class="anchor-icon"></i></a><a href="/api/dice">Working with animated dice</a></h4>
<p>Telegram supports sending <a href="https://telegram.org/blog/folders#and-one-more-thing">animated dice</a> emojis. </p>
<h4><a class="anchor" name="message-drafts" href="#message-drafts"><i class="anchor-icon"></i></a><a href="/api/drafts">Message drafts</a></h4>
<p>How to handle message drafts</p>
<h4><a class="anchor" name="folders" href="#folders"><i class="anchor-icon"></i></a><a href="/api/folders">Folders</a></h4>
<p>Working with folders</p>
<h4><a class="anchor" name="top-peer-rating" href="#top-peer-rating"><i class="anchor-icon"></i></a><a href="/api/top-rating">Top peer rating</a></h4>
<p>If <a href="/method/contacts.toggleTopPeers">enabled</a>, the rating of <a href="/constructor/topPeer">top peers</a> indicates the relevance of a frequently used peer in a certain <a href="/type/TopPeerCategory">category</a> (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).</p>
<h4><a class="anchor" name="handling-file-references" href="#handling-file-references"><i class="anchor-icon"></i></a><a href="/api/file_reference">Handling file references</a></h4>
<p>How to handle file references.</p>
<h4><a class="anchor" name="seamless-telegram-login" href="#seamless-telegram-login"><i class="anchor-icon"></i></a><a href="/api/url-authorization">Seamless Telegram Login</a></h4>
<p>Handle Seamless Telegram Login URL authorization requests.</p>
<h4><a class="anchor" name="web-events" href="#web-events"><i class="anchor-icon"></i></a><a href="/api/web-events">Web events</a></h4>
<p>When interacting with HTML5 games and the websites of payment gateways, Telegram apps should expose the following JS APIs.</p>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,261 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Telegram APIs</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="We offer two kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages for…">
<meta property="og:title" content="Telegram APIs">
<meta property="og:image" content="df8a0f9162ddfc1daf">
<meta property="og:description" content="We offer two kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages for…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Telegram APIs</h1>
<div id="dev_page_content"><p>We offer two kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib-build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge.</p>
<p>You can also add <a href="/widgets"><strong>Telegram Widgets</strong></a> to your website.</p>
<p>Designers are welcome to create <a href="/animated_stickers"><strong>Animated Stickers</strong></a> or <a href="/themes"><strong>Custom Themes</strong></a> for Telegram.</p>
<hr>
<h3><a class="anchor" name="bot-api" href="#bot-api"><i class="anchor-icon"></i></a>Bot API</h3>
<div>
<a href="/file/811140327/1/zlN4goPTupk/9ff2f2f01c4bd1b013" target="_blank"><img src="/file/811140934/1/tbDSLHSaijc/fdcc7b6d5fb3354adf" title="The Botfather. Click for hi-res picture" style="max-width: 200px;float:right" /></a>
</div>
<p>This API allows you to connect bots to our system. <a href="/bots"><strong>Telegram Bots</strong></a> are special accounts that do not require an additional phone number to set up. These accounts serve as an interface for code running somewhere on your server.</p>
<p>To use this, you don&#39;t need to know anything about how our MTProto encryption protocol works — our intermediary server will handle all encryption and communication with the Telegram API for you. You communicate with this server via a simple HTTPS-interface that offers a simplified version of the Telegram API.</p>
<blockquote>
<p><a href="/bots"><strong>Learn more about the Bot API here &raquo;</strong></a></p>
</blockquote>
<p>Bot developers can also make use of our <a href="/bots/payments"><strong>Payments API</strong></a> to accept <strong>payments</strong> from Telegram users around the world.</p>
<hr>
<h3><a class="anchor" name="tdlib-build-your-own-telegram" href="#tdlib-build-your-own-telegram"><i class="anchor-icon"></i></a>TDLib build your own Telegram</h3>
<p>Even if you&#39;re looking for maximum customization, you don&#39;t have to create your app from scratch. Try our <a href="https://core.telegram.org/tdlib"><strong>Telegram Database Library</strong></a> (or simply TDLib), a tool for third-party developers that makes it easy to build fast, secure and feature-rich Telegram apps.</p>
<p>TDLib takes care of all <strong>network implementation</strong> details, <strong>encryption</strong> and <strong>local data storage</strong>, so that you can dedicate more time to design, responsive interfaces and beautiful animations.</p>
<p>TDLib supports all Telegram features and makes developing Telegram apps a breeze on any platform. It can be used on Android, iOS, Windows, macOS, Linux and virtually any other system. The library is open source and compatible with virtually <strong>any programming language</strong>.</p>
<blockquote>
<p><a href="https://core.telegram.org/tdlib"><strong>Learn more about TDLib here »</strong></a></p>
</blockquote>
<hr>
<h3><a class="anchor" name="telegram-api" href="#telegram-api"><i class="anchor-icon"></i></a>Telegram API</h3>
<p>This API allows you to build your own customized Telegram clients. It is 100% open for all developers who wish to create Telegram applications on our platform. Feel free to study the open <a href="https://telegram.org/apps#source-code">source code</a> of existing Telegram applications for examples of how things work here. Don&#39;t forget to <a href="/api/obtaining_api_id">register</a> your application in our system. </p>
<ul>
<li><a href="#getting-started">Getting Started</a></li>
<li><a href="#security">Security</a></li>
<li><a href="#optimization">Optimization</a></li>
<li><a href="#api-methods">API methods</a></li>
</ul>
<h3><a class="anchor" name="getting-started" href="#getting-started"><i class="anchor-icon"></i></a>Getting started</h3>
<h4><a class="anchor" name="creating-an-application" href="#creating-an-application"><i class="anchor-icon"></i></a><a href="/api/obtaining_api_id">Creating an application</a></h4>
<p>How to get your application identifier and create a new Telegram app.</p>
<h4><a class="anchor" name="user-authorization" href="#user-authorization"><i class="anchor-icon"></i></a><a href="/api/auth">User authorization</a></h4>
<p>How to register a user&#39;s phone to start using the API.</p>
<h4><a class="anchor" name="two-factor-authentication" href="#two-factor-authentication"><i class="anchor-icon"></i></a><a href="/api/srp">Two-factor authentication</a></h4>
<p>How to login to a user&#39;s account if they have enabled 2FA, how to change password.</p>
<h4><a class="anchor" name="qr-code-login" href="#qr-code-login"><i class="anchor-icon"></i></a><a href="/api/qr-login">QR code login</a></h4>
<p><a href="https://en.wikipedia.org/wiki/QR_code">QR code</a> login flow</p>
<h4><a class="anchor" name="error-handling" href="#error-handling"><i class="anchor-icon"></i></a><a href="/api/errors">Error handling</a></h4>
<p>How to handle API return errors correctly.</p>
<h4><a class="anchor" name="handling-different-data-centers" href="#handling-different-data-centers"><i class="anchor-icon"></i></a><a href="/api/datacenter">Handling different data centers</a></h4>
<p>How to connect to the closest DC access point for faster interaction with the API, and things to watch out for when developing a client.</p>
<h4><a class="anchor" name="handling-updates" href="#handling-updates"><i class="anchor-icon"></i></a><a href="/api/updates">Handling updates</a></h4>
<p>How to subscribe to updates and handle them properly.</p>
<h4><a class="anchor" name="handling-push-notifications" href="#handling-push-notifications"><i class="anchor-icon"></i></a><a href="/api/push-updates">Handling PUSH-notifications</a></h4>
<p>How to subscribe and handle them properly.</p>
<h4><a class="anchor" name="channels-supergroups-gigagroups-and-basic-groups" href="#channels-supergroups-gigagroups-and-basic-groups"><i class="anchor-icon"></i></a><a href="/api/channel">Channels, supergroups, gigagroups and basic groups</a></h4>
<p>How to handle channels, supergroups, gigagroups, basic groups, and what&#39;s the difference between them.</p>
<h4><a class="anchor" name="channel-statistics" href="#channel-statistics"><i class="anchor-icon"></i></a><a href="/api/stats">Channel statistics</a></h4>
<p>Telegram offers detailed channel statistics for channels and supergroups. </p>
<h4><a class="anchor" name="calling-methods" href="#calling-methods"><i class="anchor-icon"></i></a><a href="/api/invoking">Calling methods</a></h4>
<p>Additional options for calling methods.</p>
<h4><a class="anchor" name="uploading-and-downloading-files" href="#uploading-and-downloading-files"><i class="anchor-icon"></i></a><a href="/api/files">Uploading and Downloading Files</a></h4>
<p>How to transfer large data batches correctly.</p>
<h4><a class="anchor" name="pagination" href="#pagination"><i class="anchor-icon"></i></a><a href="/api/offsets">Pagination</a></h4>
<p>How to fetch results from large lists of objects.</p>
<h4><a class="anchor" name="client-configuration" href="#client-configuration"><i class="anchor-icon"></i></a><a href="/api/config">Client configuration</a></h4>
<p>The MTProto API has multiple client configuration parameters that can be fetched with the appropriate methods. </p>
<h3><a class="anchor" name="security" href="#security"><i class="anchor-icon"></i></a>Security</h3>
<h4><a class="anchor" name="secret-chats-end-to-end-encryption" href="#secret-chats-end-to-end-encryption"><i class="anchor-icon"></i></a><a href="/api/end-to-end">Secret chats, end-to-end encryption</a></h4>
<p>End-to-end-encrypted messaging.</p>
<h4><a class="anchor" name="security-guidelines" href="#security-guidelines"><i class="anchor-icon"></i></a><a href="/mtproto/security_guidelines">Security guidelines</a></h4>
<p>Important checks required in your client application.</p>
<h4><a class="anchor" name="perfect-forward-secrecy" href="#perfect-forward-secrecy"><i class="anchor-icon"></i></a><a href="/api/pfs">Perfect Forward Secrecy</a></h4>
<p>Binding temporary authorization key to permanent ones.</p>
<h4><a class="anchor" name="end-to-end-encryption-in-voice-and-video-calls" href="#end-to-end-encryption-in-voice-and-video-calls"><i class="anchor-icon"></i></a><a href="https://core.telegram.org/api/end-to-end/video-calls">End-to-End Encryption in Voice and Video Calls</a></h4>
<p>End-to-end-encrypted calls.</p>
<h3><a class="anchor" name="optimization" href="#optimization"><i class="anchor-icon"></i></a>Optimization</h3>
<h4><a class="anchor" name="client-optimization" href="#client-optimization"><i class="anchor-icon"></i></a><a href="/api/optimisation">Client optimization</a></h4>
<p>Ways to boost API interactions.</p>
<h3><a class="anchor" name="api-methods" href="#api-methods"><i class="anchor-icon"></i></a>API methods</h3>
<h4><a class="anchor" name="available-method-list" href="#available-method-list"><i class="anchor-icon"></i></a><a href="/methods">Available method list</a></h4>
<p>A list of available high-level methods.</p>
<h4><a class="anchor" name="api-tl-schema-as-json" href="#api-tl-schema-as-json"><i class="anchor-icon"></i></a><a href="/schema">API TL-schema</a>, <a href="/schema/json">as JSON</a></h4>
<p>Text and JSON-presentation of types and methods used in API.</p>
<h4><a class="anchor" name="available-layer-list" href="#available-layer-list"><i class="anchor-icon"></i></a><a href="/api/layers">Available layer list</a></h4>
<p>A list of available schema versions.</p>
<h3><a class="anchor" name="other-articles" href="#other-articles"><i class="anchor-icon"></i></a>Other articles</h3>
<h4><a class="anchor" name="working-with-bots-using-the-mtproto-api" href="#working-with-bots-using-the-mtproto-api"><i class="anchor-icon"></i></a><a href="/api/bots">Working with bots, using the MTProto API</a></h4>
<p>How to work with bots using the MTProto API.</p>
<h4><a class="anchor" name="commands" href="#commands"><i class="anchor-icon"></i></a><a href="/api/bots/commands">Commands</a></h4>
<p><a href="/bots">Bots</a> offer a set of commands that can be used by users in private, or in a chat. </p>
<h4><a class="anchor" name="buttons" href="#buttons"><i class="anchor-icon"></i></a><a href="/api/bots/buttons">Buttons</a></h4>
<p>Users can interact with your bot via <strong>buttons</strong> or even <strong>inline buttons</strong>, straight from inline <strong>messages</strong> in <strong>any</strong> chat. </p>
<h4><a class="anchor" name="inline-queries" href="#inline-queries"><i class="anchor-icon"></i></a><a href="/api/bots/inline">Inline queries</a></h4>
<p>Users can interact with your bot via <strong>inline queries</strong>, straight from the <strong>text input field</strong> in <strong>any</strong> chat. </p>
<h4><a class="anchor" name="games" href="#games"><i class="anchor-icon"></i></a><a href="/api/bots/games">Games</a></h4>
<p>Bots can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats; how to work with games in the MTProto API.</p>
<h4><a class="anchor" name="search-amp-filters" href="#search-amp-filters"><i class="anchor-icon"></i></a><a href="/api/search">Search &amp; filters</a></h4>
<p>Telegram allows applying detailed message filters while looking for messages in chats.<br>This allows the server to filter messages based on a text query, and even on their type, and this feature is often used by graphical clients to implement features like the chat gallery, chat profile pictures and more.</p>
<h4><a class="anchor" name="polls" href="#polls"><i class="anchor-icon"></i></a><a href="/api/poll">Polls</a></h4>
<p>Telegram allows sending polls and quizzes, that can be voted on by thousands, if not millions of users in chats and channels.</p>
<h4><a class="anchor" name="reactions" href="#reactions"><i class="anchor-icon"></i></a><a href="/api/reactions">Reactions</a></h4>
<p>Telegram allows users to react on any message using specific emojis, triggering cute lottie animations. </p>
<h4><a class="anchor" name="invite-links-and-join-requests" href="#invite-links-and-join-requests"><i class="anchor-icon"></i></a><a href="/api/invites">Invite links and join requests</a></h4>
<p>Channels, basic groups and supergroups may have a public username or a private invite link: private invite links may be further enhanced with per-user join requests.</p>
<h4><a class="anchor" name="admin-banned-and-default-rights-for-channels-supergroups-and-gro" href="#admin-banned-and-default-rights-for-channels-supergroups-and-gro"><i class="anchor-icon"></i></a><a href="/api/rights">Admin, banned and default rights for channels, supergroups and groups</a></h4>
<p>How to handle admin permissions, granular bans and global permissions in channels, groups and supergroups.</p>
<h4><a class="anchor" name="discussion-groups" href="#discussion-groups"><i class="anchor-icon"></i></a><a href="/api/discussion">Discussion groups</a></h4>
<p><a href="/api/channel">Groups</a> can be associated to a <a href="/api/channel">channel</a> as a <a href="https://telegram.org/blog/privacy-discussions-web-bots">discussion group</a>, to allow users to discuss about posts. </p>
<h4><a class="anchor" name="channel-comments-and-message-threads" href="#channel-comments-and-message-threads"><i class="anchor-icon"></i></a><a href="/api/threads">Channel comments and message threads</a></h4>
<p>Telegram allows commenting on a <a href="/api/channel">channel post</a> or on a generic <a href="/api/channel">group message</a>, thanks to message threads.</p>
<h4><a class="anchor" name="admin-log" href="#admin-log"><i class="anchor-icon"></i></a><a href="/api/recent-actions">Admin log</a></h4>
<p>Both supergroups and channels offer a so-called <a href="https://telegram.org/blog/admin-revolution">admin log</a>, a log of recent relevant supergroup and channel actions, like the modification of group/channel settings or information on behalf of an admin, user kicks and bans, and more. </p>
<h4><a class="anchor" name="pinned-messages" href="#pinned-messages"><i class="anchor-icon"></i></a><a href="/api/pin">Pinned messages</a></h4>
<p>Telegram allows pinning multiple messages on top of a specific chat. </p>
<h4><a class="anchor" name="mentions" href="#mentions"><i class="anchor-icon"></i></a><a href="/api/mentions">Mentions</a></h4>
<p>Telegram allows mentioning other users in case of urgent duckling matters, and quickly navigating to those mentions in order to read them as swiftly as possible.</p>
<h4><a class="anchor" name="scheduled-messages" href="#scheduled-messages"><i class="anchor-icon"></i></a><a href="/api/scheduled-messages">Scheduled messages</a></h4>
<p>Telegram allows scheduling messages.</p>
<h4><a class="anchor" name="live-geolocations" href="#live-geolocations"><i class="anchor-icon"></i></a><a href="/api/live-location">Live geolocations</a></h4>
<p>Telegram allows sending the live geolocation of a user in a chat, optionally setting a proximity alert. </p>
<h4><a class="anchor" name="min-constructors" href="#min-constructors"><i class="anchor-icon"></i></a><a href="/api/min">Min constructors</a></h4>
<p>Sometimes, <a href="/constructor/user">user</a> and <a href="/constructor/channel">channel</a> constructors met in group chat updates may not contain full info about the user: how to handle such constructors.</p>
<h4><a class="anchor" name="account-deletion" href="#account-deletion"><i class="anchor-icon"></i></a><a href="/api/account-deletion">Account deletion</a></h4>
<p>How to reset an account if the <a href="/api/srp">2FA</a> password was forgotten.</p>
<h4><a class="anchor" name="imported-messages" href="#imported-messages"><i class="anchor-icon"></i></a><a href="/api/import">Imported messages</a></h4>
<p>Telegram allows importing messages and media from foreign chat apps.</p>
<h4><a class="anchor" name="telegram-passport" href="#telegram-passport"><i class="anchor-icon"></i></a><a href="/api/passport">Telegram Passport</a></h4>
<p>How to work with <a href="/api/passport">Telegram Passport</a> directly using the MTProto API.</p>
<h4><a class="anchor" name="telegram-payments" href="#telegram-payments"><i class="anchor-icon"></i></a><a href="/api/payments">Telegram Payments</a></h4>
<p>How to work with Telegram Payments directly using the MTProto API.</p>
<h4><a class="anchor" name="styled-text-with-message-entities" href="#styled-text-with-message-entities"><i class="anchor-icon"></i></a><a href="/api/entities">Styled text with message entities</a></h4>
<p>How to create styled text with message entities</p>
<h4><a class="anchor" name="working-with-animated-emojis" href="#working-with-animated-emojis"><i class="anchor-icon"></i></a><a href="/api/animated-emojis">Working with animated emojis</a></h4>
<p>Graphical telegram clients should transform emojis into their respective animated version. </p>
<h4><a class="anchor" name="working-with-animated-dice" href="#working-with-animated-dice"><i class="anchor-icon"></i></a><a href="/api/dice">Working with animated dice</a></h4>
<p>Telegram supports sending <a href="https://telegram.org/blog/folders#and-one-more-thing">animated dice</a> emojis. </p>
<h4><a class="anchor" name="message-drafts" href="#message-drafts"><i class="anchor-icon"></i></a><a href="/api/drafts">Message drafts</a></h4>
<p>How to handle message drafts</p>
<h4><a class="anchor" name="folders" href="#folders"><i class="anchor-icon"></i></a><a href="/api/folders">Folders</a></h4>
<p>Working with folders</p>
<h4><a class="anchor" name="top-peer-rating" href="#top-peer-rating"><i class="anchor-icon"></i></a><a href="/api/top-rating">Top peer rating</a></h4>
<p>If <a href="/method/contacts.toggleTopPeers">enabled</a>, the rating of <a href="/constructor/topPeer">top peers</a> indicates the relevance of a frequently used peer in a certain <a href="/type/TopPeerCategory">category</a> (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).</p>
<h4><a class="anchor" name="handling-file-references" href="#handling-file-references"><i class="anchor-icon"></i></a><a href="/api/file_reference">Handling file references</a></h4>
<p>How to handle file references.</p>
<h4><a class="anchor" name="seamless-telegram-login" href="#seamless-telegram-login"><i class="anchor-icon"></i></a><a href="/api/url-authorization">Seamless Telegram Login</a></h4>
<p>Handle Seamless Telegram Login URL authorization requests.</p>
<h4><a class="anchor" name="web-events" href="#web-events"><i class="anchor-icon"></i></a><a href="/api/web-events">Web events</a></h4>
<p>When interacting with HTML5 games and the websites of payment gateways, Telegram apps should expose the following JS APIs.</p>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Account deletion</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content=" How to reset an account if the 2FA password was forgotten.">
<meta property="og:title" content="Account deletion">
<meta property="og:image" content="c176ebb99487f059b0">
<meta property="og:description" content=" How to reset an account if the 2FA password was forgotten.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/account-deletion" >Account deletion</a></li></ul></div>
<h1 id="dev_page_title">Account deletion</h1>
<div id="dev_page_content"><p>If the user has successfully provided the login code, but they forgot the <a href="/api/srp">2FA</a> password, the account should be reset: this can be done using <a href="/method/account.deleteAccount">account.deleteAccount</a>. </p>
<p>If the account's 2FA password was modified more than 7 days ago and was active in the last 7 days, account deletion will be delayed for 7 days, and a <a href="/constructor/updateServiceNotification">service message will be sent to the user</a>, containing a link in one of the following formats:</p>
<ul>
<li><code>https://telegram.me/confirmphone?phone=XXX&amp;hash=YYYY</code></li>
<li><code>tg://confirmphone?phone=XXX&amp;hash=YYYY</code></li>
</ul>
<p>When clicked, <a href="/method/account.sendConfirmPhoneCode">account.sendConfirmPhoneCode</a> must be called with the specified <code>hash</code>, using the account with the specified <code>phone</code> number.
This will send a phone number verification code to the phone number associated with the account.
The phone code settings are the same as for the <a href="/api/auth">login code</a>, and <a href="/method/auth.cancelCode">auth.cancelCode</a> with <a href="/method/auth.resendCode">auth.resendCode</a> can be used as well, to resend or cancel the phone code as for the <a href="/api/auth">login code</a>.</p>
<p>Once the SMS code is received, the <a href="/method/account.confirmPhone">account.confirmPhone</a> method will have to be called with the SMS code and the phone hash received from the <a href="/method/account.sendConfirmPhoneCode">account.sendConfirmPhoneCode</a> method.</p>
<p>This will cancel deletion of the account and will log out the user that tried to reset it.
Otherwise, if the number isn't confirmed in 7 days, the account will be deleted and the user will be free to recreate it.</p>
<h2><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related articles</h2>
<h3><a class="anchor" href="#user-authorization" id="user-authorization" name="user-authorization"><i class="anchor-icon"></i></a><a href="/api/auth">User Authorization</a></h3>
<p>How to register a user's phone to start using the API.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,191 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Animated Emojis</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Graphical telegram clients should transform emojis into their respective animated version.">
<meta property="og:title" content="Animated Emojis">
<meta property="og:image" content="">
<meta property="og:description" content="Graphical telegram clients should transform emojis into their respective animated version.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/animated-emojis" >Animated Emojis</a></li></ul></div>
<h1 id="dev_page_title">Animated Emojis</h1>
<div id="dev_page_content"><p>Graphical telegram clients should transform emojis into their respective animated version. </p>
<pre><code><a href='/constructor/inputStickerSetAnimatedEmoji'>inputStickerSetAnimatedEmoji</a>#28703c8 = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/messages.stickerSet'>messages.stickerSet</a>#b60a24a6 set:<a href='/type/StickerSet'>StickerSet</a> packs:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/StickerPack'>StickerPack</a>&gt; documents:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Document'>Document</a>&gt; = <a href='/type/messages.StickerSet'>messages.StickerSet</a>;
---functions---
<a href='/method/messages.getStickerSet'>messages.getStickerSet</a>#c8a0ec74 stickerset:<a href='/type/InputStickerSet'>InputStickerSet</a> hash:<a href='/type/int'>int</a> = <a href='/type/messages.StickerSet'>messages.StickerSet</a>;</code></pre>
<p>On startup, clients should fetch the animated emoji stickerset by calling the <a href="/method/messages.getStickerSet">messages.getStickerSet</a> method, providing <a href="/constructor/inputStickerSetAnimatedEmoji">inputStickerSetAnimatedEmoji</a> to the <code>stickerset</code> field.<br>
The returned stickerset will contain a set of animated stickers, one for each of the supported emojis. </p>
<p>Clients should substitute messages containing only one instance of one of the allowed emojis with the respective animated sticker. </p>
<p>Animated emojis should loop only once when first sent or received, or when clicked.<br>
For <a href="#emoji-reactions">supported emojis</a>, clients on both sides of private chats with users are supposed to show a reaction animation when any of the two users clicks on the animated emoji: <a href="#emoji-reactions">click here for more info »</a>.</p>
<p>For special <a href="/api/dice">dice emojis</a> like <img class="emoji" src="//telegram.org/img/emoji/40/F09F8EB2.png" width="20" height="20" alt="🎲" />, <img class="emoji" src="//telegram.org/img/emoji/40/F09F8EAF.png" width="20" height="20" alt="🎯" />, or <img class="emoji" src="//telegram.org/img/emoji/40/F09F8F80.png" width="20" height="20" alt="🏀" />, clients are supposed to behave differently both when sending and receiving such emojis: <a href="/api/dice">click here for more info »</a>.</p>
<h3><a class="anchor" href="#emojis-with-sounds" id="emojis-with-sounds" name="emojis-with-sounds"><i class="anchor-icon"></i></a>Emojis with sounds</h3>
<p>Certain animated emojis should play sound when clicked, as specified by <a href="/api/config#client-configuration">server-side configuration</a>. </p>
<p>The returned JSON object will contain the following map, with a list of file IDs to download:</p>
<pre><code> "emojies_sounds": {
"\ud83c\udf83": {
"id": "4956223179606458539",
"access_hash": "-2107001400913062971",
"file_reference_base64": "AF-4ApC7ukC0UWEPZN0TeSJURe7T"
},
"\u26b0": {
"id": "4956223179606458540",
"access_hash": "-1498869544183595185",
"file_reference_base64": "AF-4ApCLKMGt96WCvLm58kbqZHd3"
},
"\ud83e\udddf\u200d\u2642": {
"id": "4960929110848176331",
"access_hash": "3986395821757915468",
"file_reference_base64": "AF-4ApAedNln3IMEHH-SUQuH8L9g"
},
}</code></pre>
<p>The <a href="/api/file_reference">file reference field</a> should be base64-decoded before <a href="/api/files">downloading the file</a>.</p>
<h3><a class="anchor" href="#emoji-reactions" id="emoji-reactions" name="emoji-reactions"><i class="anchor-icon"></i></a>Emoji reactions</h3>
<pre><code><a href='/constructor/inputStickerSetAnimatedEmojiAnimations'>inputStickerSetAnimatedEmojiAnimations</a>#cde3739 = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/messages.stickerSet'>messages.stickerSet</a>#b60a24a6 set:<a href='/type/StickerSet'>StickerSet</a> packs:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/StickerPack'>StickerPack</a>&gt; documents:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Document'>Document</a>&gt; = <a href='/type/messages.StickerSet'>messages.StickerSet</a>;
<a href='/constructor/stickerPack'>stickerPack</a>#12b299d4 emoticon:<a href='/type/string'>string</a> documents:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; = <a href='/type/StickerPack'>StickerPack</a>;
<a href='/constructor/sendMessageEmojiInteraction'>sendMessageEmojiInteraction</a>#25972bcb emoticon:<a href='/type/string'>string</a> msg_id:<a href='/type/int'>int</a> interaction:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/SendMessageAction'>SendMessageAction</a>;
<a href='/constructor/sendMessageEmojiInteractionSeen'>sendMessageEmojiInteractionSeen</a>#b665902e emoticon:<a href='/type/string'>string</a> = <a href='/type/SendMessageAction'>SendMessageAction</a>;
<a href='/constructor/updateUserTyping'>updateUserTyping</a>#c01e857f user_id:<a href='/type/long'>long</a> action:<a href='/type/SendMessageAction'>SendMessageAction</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.getStickerSet'>messages.getStickerSet</a>#c8a0ec74 stickerset:<a href='/type/InputStickerSet'>InputStickerSet</a> hash:<a href='/type/int'>int</a> = <a href='/type/messages.StickerSet'>messages.StickerSet</a>;
<a href='/method/messages.setTyping'>messages.setTyping</a>#58943ee2 flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> top_msg_id:flags.0?<a href='/type/int'>int</a> action:<a href='/type/SendMessageAction'>SendMessageAction</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Not to be confused with <a href="/api/reactions">message reactions »</a>. </p>
<p>On startup, clients should fetch the animated reaction emoji stickerset by calling the <a href="/method/messages.getStickerSet">messages.getStickerSet</a> method, providing <a href="/constructor/inputStickerSetAnimatedEmojiAnimations">inputStickerSetAnimatedEmojiAnimations</a> to the <code>stickerset</code> field.<br>
The returned stickerset will contain a set of animated emoji reactions, <em>one or more</em> for each of the supported emojis.<br>
If a set of reactions for the <img class="emoji" src="//telegram.org/img/emoji/40/E29DA4.png" width="20" height="20" alt="❤" /> emoji is returned, the same reactions should also be assigned to the <img class="emoji" src="//telegram.org/img/emoji/40/F09FA7A1.png" width="20" height="20" alt="🧡" />, <img class="emoji" src="//telegram.org/img/emoji/40/F09F929B.png" width="20" height="20" alt="💛" />, <img class="emoji" src="//telegram.org/img/emoji/40/F09F929A.png" width="20" height="20" alt="💚" />, <img class="emoji" src="//telegram.org/img/emoji/40/F09F9299.png" width="20" height="20" alt="💙" />, <img class="emoji" src="//telegram.org/img/emoji/40/F09F929C.png" width="20" height="20" alt="💜" />, <img class="emoji" src="//telegram.org/img/emoji/40/F09F96A4.png" width="20" height="20" alt="🖤" />, <img class="emoji" src="//telegram.org/img/emoji/40/F09FA48D.png" width="20" height="20" alt="🤍" /> and <img class="emoji" src="//telegram.org/img/emoji/40/F09FA48E.png" width="20" height="20" alt="🤎" /> emojis. </p>
<p>Clients on both sides of private chats with users should overlay one of the appropriate reaction animations over the animated sticker when any of the two users clicks on a supported animated emoji.<br>
The reaction animation for each separate tap should be chosen randomly from all the available reactions for a given emoji, and multiple taps should be aggregated and sent to the other user as follows: </p>
<p>At each tap, clients should store all occurred taps in a local list.<br>
After 1 second has elapsed with no more taps, the local list should be cleared and stored taps should be sent using <a href="/method/messages.setTyping">messages.setTyping</a>, passing a <a href="/constructor/sendMessageEmojiInteraction">sendMessageEmojiInteraction</a> constructor with the following fields: </p>
<ul>
<li><code>emoticon</code> - The emoji we're reacting to</li>
<li><code>msg_id</code> - Message ID of the animated emoji that was clicked</li>
<li><code>interaction</code> - A JSON object with interaction info, containing the following keys:<ul>
<li><code>v</code> - An integer indicating the object version, currently <code>1</code></li>
<li><code>a</code> - An array of JSON objects, each containing the following keys:<ul>
<li><code>t</code> - float, number of seconds that passed since the previous tap in the array, the first tap uses a value of <code>0.0</code>.</li>
<li><code>i</code> - integer, 1-based index of the randomly chosen animation for the tap (equivalent to the index of a specific emoji-related animation in <a href="/constructor/stickerPack">stickerPack</a> + 1).</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>1 second after the receiving user has seen the last reaction animation for a specific emoji, an acknowledgement must be sent using <a href="/method/messages.setTyping">messages.setTyping</a>, passing a <a href="/constructor/sendMessageEmojiInteractionSeen">sendMessageEmojiInteractionSeen</a> with that emoji.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,221 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>User Authorization</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to register a user&#39;s phone to start using the API.">
<meta property="og:title" content="User Authorization">
<meta property="og:image" content="9ebfef6d534b708d3a">
<meta property="og:description" content="How to register a user&#39;s phone to start using the API.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/auth" >User Authorization</a></li></ul></div>
<h1 id="dev_page_title">User Authorization</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Authorization is associated with a client's encryption key identifier: <strong>auth_key_id</strong>. No additional parameters need to be passed into methods following authorization. </p>
<p>To log in as a <a href="/bots">bot</a>, follow <a href="/api/bots">these instructions »</a>.</p>
<h3><a class="anchor" href="#sending-a-verification-code" id="sending-a-verification-code" name="sending-a-verification-code"><i class="anchor-icon"></i></a>Sending a verification code</h3>
<p>Example implementations: <a href="https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java">telegram for android</a>, <a href="https://github.com/tdlib/td/tree/master/td/telegram/SendCodeHelper.cpp">tdlib</a>.</p>
<p>To show a nicely formatted and validated phone number field, the <a href="/constructor/help.countriesList">help.countriesList</a> constructor can be obtained using the <a href="/method/help.getCountriesList">help.getCountriesList</a> method.<br>
The <a href="/constructor/help.countriesList">help.countriesList</a> config is then used as described <a href="/api/config#country-information-and-login-phone-patterns">here »</a>. </p>
<p>Then, a text message containing an authorization code is sent to the user's phone using <a href="/method/auth.sendCode">auth.sendCode</a>.<br>
However, this is not always the case, if logout tokens are used: </p>
<h4><a class="anchor" href="#logout-tokens" id="logout-tokens" name="logout-tokens"><i class="anchor-icon"></i></a>Logout tokens</h4>
<p>When invoking <a href="/method/auth.logOut">auth.logOut</a> on a previously authorized session with 2FA enabled, the server may return a <code>future_auth_token</code>, which should be stored in the local database.<br>
At all times, the logout token database should contain at most 20 tokens: evict older tokens as new tokens are added.<br>
When invoking <a href="/method/auth.sendCode">auth.sendCode</a>, all logout tokens present in the database should be provided to <code>codeSettings.logout_tokens</code>.<br>
If any of the logout tokens matches the account we're trying to login into and the token hasn't expired, <a href="/method/auth.sendCode">auth.sendCode</a> will directly return a <code>SESSION_PASSWORD_NEEDED</code> RPC error, directly asking the user to <a href="#2fa">enter the 2FA password</a>, without sending any authorization code. </p>
<p>Otherwise, the system will send an authorization code using the following logic:</p>
<h4><a class="anchor" href="#code-types" id="code-types" name="code-types"><i class="anchor-icon"></i></a>Code types</h4>
<p>The system will automatically choose how to send the authorization code; there are multiple possible ways the code can arrive:</p>
<ul>
<li><a href="/constructor/auth.loggedOut">Logout tokens »</a></li>
<li><a href="/constructor/auth.sentCodeTypeApp">Telegram code</a></li>
<li><a href="/constructor/auth.sentCodeTypeSms">SMS code</a></li>
<li><a href="/constructor/auth.sentCodeTypeCall">Phone call</a>: a synthesized voice will tell the user which verification code to input.</li>
<li><a href="/constructor/auth.sentCodeTypeFlashCall">Flash phone call</a>: the code will be sent via a flash phone call, that will be closed immediately.
In the last case, the phone code will then be the phone number itself, just make sure that the phone number matches the specified pattern (see <a href="/constructor/auth.sentCodeTypeFlashCall">auth.sentCodeTypeFlashCall</a>).</li>
<li><a href="/constructor/auth.sentCodeTypeMissedCall">Missed phone call</a>: the code will be sent via a flash phone call, that will be closed immediately. The last digits of the phone number that calls are the code that must be entered manually by the user.</li>
</ul>
<p>The <a href="/method/auth.sendCode">auth.sendCode</a> method also has parameters for enabling/disabling use of flash calls and missed calls, and allows passing an SMS token that will be included in the sent SMS.
For example, the latter is required in newer versions of android, to use the <a href="https://developers.google.com/identity/sms-retriever/overview">android SMS receiver APIs</a>.</p>
<p>The returned <a href="/type/auth.SentCode">auth.SentCode</a> object will contain multiple parameters:</p>
<table class="table">
<tbody>
<tr>
<td><strong>flags</strong></td>
<td style="text-align: center;"><a href="/type/%23">#</a></td>
<td>Flags, see <a href="/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></td>
</tr>
<tr>
<td><strong>type</strong></td>
<td style="text-align: center;"><a href="/type/auth.SentCodeType">auth.SentCodeType</a></td>
<td>Phone code type</td>
</tr>
<tr>
<td><strong>phone_code_hash</strong></td>
<td style="text-align: center;"><a href="/type/string">string</a></td>
<td>Phone code hash, to be stored and later re-used with <a href="/method/auth.signIn">auth.signIn</a></td>
</tr>
<tr>
<td><strong>next_type</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.1?<a href="/type/auth.CodeType">auth.CodeType</a></td>
<td>Phone code type that will be sent next, if the phone code is not received within <code>timeout</code> seconds: to send it use <a href="/method/auth.resendCode">auth.resendCode</a></td>
</tr>
<tr>
<td><strong>timeout</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.2?<a href="/type/int">int</a></td>
<td>Timeout for reception of the phone code</td>
</tr>
</tbody>
</table>
<p>If the message takes too long (<code>timeout</code> seconds) to arrive at the phone, the <a href="/method/auth.resendCode">auth.resendCode</a> method may be invoked to resend a code of type <code>next_type</code>.
If the same happens again, you can use <a href="/method/auth.resendCode">auth.resendCode</a> with the <code>next_type</code> returned by the previous call to <a href="/method/auth.resendCode">auth.resendCode</a>.
To cancel the verification code use <a href="/method/auth.cancelCode">auth.cancelCode</a>.</p>
<h3><a class="anchor" href="#sign-insign-up" id="sign-insign-up" name="sign-insign-up"><i class="anchor-icon"></i></a>Sign in/sign up</h3>
<p>When user enters verification code, the <a href="/method/auth.signIn">auth.signIn</a> method must be used to validate it and possibly sign user in.</p>
<p>If the code was entered correctly, but the method returns <a href="/constructor/auth.authorizationSignUpRequired">auth.authorizationSignUpRequired</a>, it means that account with this phone number doesn't exist yet: user needs to provide basic information, accept terms of service and then the new user registration method (<a href="/method/auth.signUp">auth.signUp</a>) must be invoked.</p>
<h3><a class="anchor" href="#2fa" id="2fa" name="2fa"><i class="anchor-icon"></i></a>2FA</h3>
<p>When trying to sign in using <a href="/method/auth.signIn">auth.signIn</a>, an <a href="/method/auth.signIn#possible-errors">error 400 SESSION_PASSWORD_NEEDED</a> may be returned, if the user has two-factor authentication enabled.
In this case, instructions for <a href="/api/srp">SRP 2FA authentication</a> must be followed.</p>
<p>To set up two-factor authorization on an already authorized account, follow the <a href="/api/srp">SRP 2FA authentication docs</a>.</p>
<h4><a class="anchor" href="#test-accounts" id="test-accounts" name="test-accounts"><i class="anchor-icon"></i></a>Test Accounts</h4>
<p>Each phone number is limited to only a certain amount of logins per day (e.g. 5, but this is subject to change) after which the API will return a FLOOD error until the next day. This might not be enough for testing the implementation of User Authorization flows in client applications.</p>
<p>There are several reserved phone number prefixes for testing that your application handles redirects between DCs, sign up, sign in and 2FA flows correctly. These numbers are only available on <strong>Test DCs</strong> (their IP addresses for TCP transport are available in <a href="https://my.telegram.org/apps">API development tools</a> panel after <a href="https://core.telegram.org/api/obtaining_api_id#obtaining-api-id">api_id was obtained</a>, <a href="https://core.telegram.org/mtproto/transports#uri-format">URI format</a> for HTTPS/Websocket transport).</p>
<p>If you wish to emulate an application of a user associated with DC number X, it is sufficient to specify the phone number as <code>99966XYYYY</code>, where YYYY are random numbers, when registering the user. A user like this would always get XXXXX as the login confirmation code (the DC number, repeated five times). Note that the value of X must be in the range of 1-3 because there are only 3 Test DCs. When the flood limit is reached for any particular test number, just choose another number (changing the YYYY random part).</p>
<p>Do not store any important or private information in the messages of such test accounts; anyone can make use of the simplified authorization mechanism and we periodically wipe all information stored there.</p>
<p>Proceed with User Authorization flows in <strong>Production DCs</strong> only after you make sure everything works correctly on <strong>Test DCs</strong> first to avoid reaching flood limits.</p>
<blockquote>
<p>To help you with working on production DCs, logins with the same phone number with which the <code>api_id</code> was registered have more generous flood limits.</p>
</blockquote>
<h3><a class="anchor" href="#we-are-authorized" id="we-are-authorized" name="we-are-authorized"><i class="anchor-icon"></i></a>We are authorized</h3>
<p>As a result of authorization, the client key, <strong>auth_key_id</strong>, becomes associated with the user, and each subsequent API call with this key will be executed with that user's identity. The authorization method itself returns the relevant user. It is best to immediately store the User ID locally in a binding with the key.</p>
<p>Only a small portion of the API methods are available to <strong>unauthorized</strong> users:</p>
<ul>
<li><a href="/method/auth.sendCode">auth.sendCode</a></li>
<li><a href="/method/auth.resendCode">auth.resendCode</a></li>
<li><a href="/method/account.getPassword">account.getPassword</a></li>
<li><a href="/method/auth.checkPassword">auth.checkPassword</a></li>
<li><a href="/method/auth.checkPhone">auth.checkPhone</a></li>
<li><a href="/method/auth.signUp">auth.signUp</a></li>
<li><a href="/method/auth.signIn">auth.signIn</a></li>
<li><a href="/method/auth.importAuthorization">auth.importAuthorization</a></li>
<li><a href="/method/help.getConfig">help.getConfig</a></li>
<li><a href="/method/help.getNearestDc">help.getNearestDc</a></li>
<li><a href="/method/help.getAppUpdate">help.getAppUpdate</a></li>
<li><a href="/method/help.getCdnConfig">help.getCdnConfig</a></li>
<li><a href="/method/langpack.getLangPack">langpack.getLangPack</a></li>
<li><a href="/method/langpack.getStrings">langpack.getStrings</a></li>
<li><a href="/method/langpack.getDifference">langpack.getDifference</a></li>
<li><a href="/method/langpack.getLanguages">langpack.getLanguages</a></li>
<li><a href="/method/langpack.getLanguage">langpack.getLanguage</a></li>
</ul>
<p>Other methods will result in an error: <a href="/api/errors#401-unauthorized"><strong>401 UNAUTHORIZED</strong></a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,145 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Bots</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Working with bots, using the MTProto API.
See here for more info about bots.
Please note that you can also use the simplified…">
<meta property="og:title" content="Bots">
<meta property="og:image" content="">
<meta property="og:description" content="Working with bots, using the MTProto API.
See here for more info about bots.
Please note that you can also use the simplified…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/bots" >Bots</a></li></ul></div>
<h1 id="dev_page_title">Bots</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Working with bots, using the MTProto API.</p>
<p>See <a href="/bots">here</a> for more info about bots. </p>
<p>Please note that you can also use the simplified <a href="/bots/api">HTTP Bot API</a> to use bots, see <a href="/bots">here for more info »</a>.</p>
<h3><a class="anchor" href="#login" id="login" name="login"><i class="anchor-icon"></i></a>Login</h3>
<pre><code>---functions---
<a href='/method/auth.importBotAuthorization'>auth.importBotAuthorization</a>#67a3ff2c flags:<a href='/type/int'>int</a> api_id:<a href='/type/int'>int</a> api_hash:<a href='/type/string'>string</a> bot_auth_token:<a href='/type/string'>string</a> = <a href='/type/auth.Authorization'>auth.Authorization</a>;</code></pre>
<p>In order to login as a bot, instead of using the <a href="/api/auth">standard login code flow</a>, simply provide the <a href="/bots#creating-a-new-bot">bot token</a> generated by <a href="https://t.me/botfather">@botfather</a>.<br>
You must still provide your <a href="/api/obtaining_api_id#obtaining-api-id">API ID</a>, as per user logins. </p>
<p>After successful authorization, you will be able to use <a href="/methods">most MTProto API methods</a>, just as any normal user.<br>
Methods that can be called by bots will have a <strong>Bots can use this method</strong> notice. </p>
<h3><a class="anchor" href="#commands" id="commands" name="commands"><i class="anchor-icon"></i></a><a href="/api/bots/commands">Commands</a></h3>
<p><a href="/bots">Bots</a> offer a set of commands that can be used by users in private, or in a chat. </p>
<h3><a class="anchor" href="#buttons" id="buttons" name="buttons"><i class="anchor-icon"></i></a><a href="/api/bots/buttons">Buttons</a></h3>
<p>Users can interact with your bot via <strong>buttons</strong> or even <strong>inline buttons</strong>, straight from inline <strong>messages</strong> in <strong>any</strong> chat. </p>
<h3><a class="anchor" href="#inline-queries" id="inline-queries" name="inline-queries"><i class="anchor-icon"></i></a><a href="/api/bots/inline">Inline queries</a></h3>
<p>Users can interact with your bot via <strong>inline queries</strong>, straight from the <strong>text input field</strong> in <strong>any</strong> chat. </p>
<h3><a class="anchor" href="#games" id="games" name="games"><i class="anchor-icon"></i></a><a href="/api/bots/games">Games</a></h3>
<p>Bots can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats; how to work with games in the MTProto API.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,245 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Buttons</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Users can interact with your bot via buttons or even inline buttons, straight from inline messages in any chat. ">
<meta property="og:title" content="Buttons">
<meta property="og:image" content="">
<meta property="og:description" content="Users can interact with your bot via buttons or even inline buttons, straight from inline messages in any chat. ">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/bots%2Fbuttons" >Buttons</a></li></ul></div>
<h1 id="dev_page_title">Buttons</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Users can interact with your bot via <strong>buttons</strong> or even <strong>inline buttons</strong>, straight from inline <strong>messages</strong> in <strong>any</strong> chat.<br>
This article describes the full button flow, using the MTProto API. </p>
<p>For a simplified description using the HTTP bot API, see <a href="/bots/#inline-keyboards-and-on-the-fly-updating">here »</a>. </p>
<h3><a class="anchor" href="#buttons" id="buttons" name="buttons"><i class="anchor-icon"></i></a>Buttons</h3>
<pre><code><a href='/constructor/keyboardButton'>keyboardButton</a>#a2fa4880 text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonUrl'>keyboardButtonUrl</a>#258aff05 text:<a href='/type/string'>string</a> url:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonCallback'>keyboardButtonCallback</a>#35bbdb6b flags:<a href='/type/%23'>#</a> requires_password:flags.0?<a href='/constructor/true'>true</a> text:<a href='/type/string'>string</a> data:<a href='/type/bytes'>bytes</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRequestPhone'>keyboardButtonRequestPhone</a>#b16a6c29 text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRequestGeoLocation'>keyboardButtonRequestGeoLocation</a>#fc796b3f text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonSwitchInline'>keyboardButtonSwitchInline</a>#568a748 flags:<a href='/type/%23'>#</a> same_peer:flags.0?<a href='/constructor/true'>true</a> text:<a href='/type/string'>string</a> query:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonGame'>keyboardButtonGame</a>#50f41ccf text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonBuy'>keyboardButtonBuy</a>#afd93fbb text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonUrlAuth'>keyboardButtonUrlAuth</a>#10b78d29 flags:<a href='/type/%23'>#</a> text:<a href='/type/string'>string</a> fwd_text:flags.0?<a href='/type/string'>string</a> url:<a href='/type/string'>string</a> button_id:<a href='/type/int'>int</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/inputKeyboardButtonUrlAuth'>inputKeyboardButtonUrlAuth</a>#d02e7fd4 flags:<a href='/type/%23'>#</a> request_write_access:flags.0?<a href='/constructor/true'>true</a> text:<a href='/type/string'>string</a> fwd_text:flags.1?<a href='/type/string'>string</a> url:<a href='/type/string'>string</a> bot:<a href='/type/InputUser'>InputUser</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRequestPoll'>keyboardButtonRequestPoll</a>#bbc7515d flags:<a href='/type/%23'>#</a> quiz:flags.0?<a href='/type/Bool'>Bool</a> text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRow'>keyboardButtonRow</a>#77608b83 buttons:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/KeyboardButton'>KeyboardButton</a>&gt; = <a href='/type/KeyboardButtonRow'>KeyboardButtonRow</a>;
<a href='/constructor/replyKeyboardHide'>replyKeyboardHide</a>#a03e5b85 flags:<a href='/type/%23'>#</a> selective:flags.2?<a href='/constructor/true'>true</a> = <a href='/type/ReplyMarkup'>ReplyMarkup</a>;
<a href='/constructor/replyKeyboardForceReply'>replyKeyboardForceReply</a>#86b40b08 flags:<a href='/type/%23'>#</a> single_use:flags.1?<a href='/constructor/true'>true</a> selective:flags.2?<a href='/constructor/true'>true</a> placeholder:flags.3?<a href='/type/string'>string</a> = <a href='/type/ReplyMarkup'>ReplyMarkup</a>;
<a href='/constructor/replyKeyboardMarkup'>replyKeyboardMarkup</a>#85dd99d1 flags:<a href='/type/%23'>#</a> resize:flags.0?<a href='/constructor/true'>true</a> single_use:flags.1?<a href='/constructor/true'>true</a> selective:flags.2?<a href='/constructor/true'>true</a> rows:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/KeyboardButtonRow'>KeyboardButtonRow</a>&gt; placeholder:flags.3?<a href='/type/string'>string</a> = <a href='/type/ReplyMarkup'>ReplyMarkup</a>;
<a href='/constructor/replyInlineMarkup'>replyInlineMarkup</a>#48a30254 rows:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/KeyboardButtonRow'>KeyboardButtonRow</a>&gt; = <a href='/type/ReplyMarkup'>ReplyMarkup</a>;
<a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
---functions---
<a href='/method/messages.sendMessage'>messages.sendMessage</a>#d9d75a4 flags:<a href='/type/%23'>#</a> no_webpage:flags.1?<a href='/constructor/true'>true</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>Bots can attach a <a href="/type/ReplyMarkup">ReplyMarkup</a> constructor to outgoing messages, to attach an <a href="/bots#inline-keyboards-and-on-the-fly-updating">inline keyboard</a> or a <a href="/bots#keyboards">custom reply keyboard</a>:</p>
<ul>
<li><a href="/constructor/replyKeyboardMarkup">replyKeyboardMarkup</a> - Sends a <a href="/bots#keyboards">custom reply keyboard</a>. <br> User clients receiving such a constructor should display a <a href="/bots#keyboards">special keyboard</a> with custom reply options.</li>
<li><a href="/constructor/replyKeyboardHide">replyKeyboardHide</a> - Hides the <a href="/bots#keyboards">custom reply keyboard</a>. <br> User clients receiving this constructor should hide the <a href="/bots#keyboards">custom reply keyboard</a> opened by <a href="/constructor/replyKeyboardMarkup">replyKeyboardMarkup</a></li>
<li><a href="/constructor/replyKeyboardForceReply">replyKeyboardForceReply</a> - Sends a <a href="/bots/api#forcereply">force reply</a> constructor <br> User clients receiving a message with this constructor should act as if the user had clicked on the reply button of the message, displaying the reply UI. </li>
<li><a href="/constructor/replyInlineMarkup">replyInlineMarkup</a> - Attaches an <a href="/bots#inline-keyboards-and-on-the-fly-updating">inline keyboard</a> to the message, allowing users to send callback data to the bot without sending actual messages to the current chat, see <a href="/bots#pressing-buttons">here for more info »</a>. </li>
</ul>
<h3><a class="anchor" href="#pressing-buttons" id="pressing-buttons" name="pressing-buttons"><i class="anchor-icon"></i></a>Pressing buttons</h3>
<pre><code><a href='/constructor/keyboardButton'>keyboardButton</a>#a2fa4880 text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonUrl'>keyboardButtonUrl</a>#258aff05 text:<a href='/type/string'>string</a> url:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonCallback'>keyboardButtonCallback</a>#35bbdb6b flags:<a href='/type/%23'>#</a> requires_password:flags.0?<a href='/constructor/true'>true</a> text:<a href='/type/string'>string</a> data:<a href='/type/bytes'>bytes</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRequestPhone'>keyboardButtonRequestPhone</a>#b16a6c29 text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRequestGeoLocation'>keyboardButtonRequestGeoLocation</a>#fc796b3f text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRequestPoll'>keyboardButtonRequestPoll</a>#bbc7515d flags:<a href='/type/%23'>#</a> quiz:flags.0?<a href='/type/Bool'>Bool</a> text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonSwitchInline'>keyboardButtonSwitchInline</a>#568a748 flags:<a href='/type/%23'>#</a> same_peer:flags.0?<a href='/constructor/true'>true</a> text:<a href='/type/string'>string</a> query:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonGame'>keyboardButtonGame</a>#50f41ccf text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonBuy'>keyboardButtonBuy</a>#afd93fbb text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonUrlAuth'>keyboardButtonUrlAuth</a>#10b78d29 flags:<a href='/type/%23'>#</a> text:<a href='/type/string'>string</a> fwd_text:flags.0?<a href='/type/string'>string</a> url:<a href='/type/string'>string</a> button_id:<a href='/type/int'>int</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
// Used by bots to send a keyboardButtonUrlAuth
<a href='/constructor/inputKeyboardButtonUrlAuth'>inputKeyboardButtonUrlAuth</a>#d02e7fd4 flags:<a href='/type/%23'>#</a> request_write_access:flags.0?<a href='/constructor/true'>true</a> text:<a href='/type/string'>string</a> fwd_text:flags.1?<a href='/type/string'>string</a> url:<a href='/type/string'>string</a> bot:<a href='/type/InputUser'>InputUser</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRow'>keyboardButtonRow</a>#77608b83 buttons:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/KeyboardButton'>KeyboardButton</a>&gt; = <a href='/type/KeyboardButtonRow'>KeyboardButtonRow</a>;</code></pre>
<p>Both <a href="/bots#keyboards">reply</a> and <a href="/bots#inline-keyboards-and-on-the-fly-updating">inline</a> keyboards are composed of a vector of <a href="/constructor/keyboardButtonRow">rows</a>, each row containing a vector of <a href="/type/KeyboardButton">buttons</a>, for each column.<br>
Each row can have a different number of columns, and user clients should properly handle clicking buttons of every type. </p>
<p>Buttons available only in reply keyboards:</p>
<ul>
<li><a href="/constructor/keyboardButton">keyboardButton</a> - Send a message to the chat, replying to the message that attached the <a href="/bots#keyboard">reply keyboard</a></li>
<li><a href="/constructor/keyboardButtonRequestPhone">keyboardButtonRequestPhone</a> - Only in private chats, send the current user's contact to the chat, replying to the message that attached the <a href="/bots#keyboard">reply keyboard</a></li>
<li><a href="/constructor/keyboardButtonRequestGeoLocation">keyboardButtonRequestGeoLocation</a> - Only in private chats, send the current user's geolocation to the chat, replying to the message that attached the <a href="/bots#keyboard">reply keyboard</a></li>
<li><a href="/constructor/keyboardButtonRequestPoll">keyboardButtonRequestPoll</a> - Only in private chats, prompt the user to create and send a <a href="/api/poll">poll</a> (or a quiz poll, depending on the <code>quiz</code> flag), replying to the message that attached the <a href="/bots#keyboard">reply keyboard</a></li>
</ul>
<p>Buttons available only in inline keyboards:</p>
<ul>
<li><a href="/constructor/keyboardButtonUrl">keyboardButtonUrl</a> - Open the URL, showing a "Do you want to open this URL?" prompt (unless the URL is one of the <a href="https://github.com/DrKLO/Telegram/blob/002c01ecd37cd08ed07b3ed84d79318d091dfc85/TMessagesProj/src/main/java/org/telegram/messenger/browser/Browser.java#L351">internal URIs</a>, in which case the URL should be opened right away)</li>
<li><a href="/constructor/keyboardButtonCallback">keyboardButtonCallback</a> - Send the callback data to the bot, optionally providing the user's 2FA SRP payload for identity verification, see <a href="#callback-queries">here for more info »</a></li>
<li><a href="/constructor/keyboardButtonSwitchInline">keyboardButtonSwitchInline</a><ul>
<li>If <code>keyboardButtonSwitchInline.same_peer</code> is set, insert the bot's username and <code>keyboardButtonSwitchInline.query</code> in the current chat's input field, triggering an <a href="/api/bots/inline">inline query</a>.</li>
<li>If <code>keyboardButtonSwitchInline.same_peer</code> is not set, prompt the user to select one of their chats, and then insert the bot's username and <code>keyboardButtonSwitchInline.query</code> in the current chat's input field, triggering an <a href="/api/bots/inline">inline query</a>.</li>
</ul>
</li>
<li><a href="/constructor/keyboardButtonGame">keyboardButtonGame</a> - Open the <a href="/constructor/game">game</a> from the attached <a href="/constructor/messageMediaGame">messageMediaGame</a> constructor, for more info <a href="/api/bots/games">see here »</a></li>
<li><a href="/constructor/keyboardButtonBuy">keyboardButtonBuy</a> - Proceed to initiating the payment flow, for more info <a href="/api/payments">see here »</a></li>
<li><a href="/constructor/keyboardButtonUrlAuth">keyboardButtonUrlAuth</a> - Log into a website using the user's Telegram account, as specified <a href="/api/url-authorization">here »</a></li>
</ul>
<h3><a class="anchor" href="#callback-queries" id="callback-queries" name="callback-queries"><i class="anchor-icon"></i></a>Callback queries</h3>
<p><a href="/constructor/keyboardButtonCallback">keyboardButtonCallback</a> buttons can be used to send the specified <code>data</code> payload back to the bot, when they are clicked.<br>
Additionally, a bot can verify a user's identity by requiring they verify their 2FA password with <a href="/api/srp">SRP</a>. </p>
<h4><a class="anchor" href="#sending-a-callback-query" id="sending-a-callback-query" name="sending-a-callback-query"><i class="anchor-icon"></i></a>Sending a callback query</h4>
<pre><code><a href='/constructor/keyboardButtonGame'>keyboardButtonGame</a>#50f41ccf text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonCallback'>keyboardButtonCallback</a>#35bbdb6b flags:<a href='/type/%23'>#</a> requires_password:flags.0?<a href='/constructor/true'>true</a> text:<a href='/type/string'>string</a> data:<a href='/type/bytes'>bytes</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/messages.botCallbackAnswer'>messages.botCallbackAnswer</a>#36585ea4 flags:<a href='/type/%23'>#</a> alert:flags.1?<a href='/constructor/true'>true</a> has_url:flags.3?<a href='/constructor/true'>true</a> native_ui:flags.4?<a href='/constructor/true'>true</a> message:flags.0?<a href='/type/string'>string</a> url:flags.2?<a href='/type/string'>string</a> cache_time:<a href='/type/int'>int</a> = <a href='/type/messages.BotCallbackAnswer'>messages.BotCallbackAnswer</a>;
---functions---
<a href='/method/messages.getBotCallbackAnswer'>messages.getBotCallbackAnswer</a>#9342ca07 flags:<a href='/type/%23'>#</a> game:flags.1?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> msg_id:<a href='/type/int'>int</a> data:flags.0?<a href='/type/bytes'>bytes</a> password:flags.2?<a href='/type/InputCheckPasswordSRP'>InputCheckPasswordSRP</a> = <a href='/type/messages.BotCallbackAnswer'>messages.BotCallbackAnswer</a>;</code></pre>
<p>When the user clicks on a <a href="/constructor/keyboardButtonCallback">keyboardButtonCallback</a> in a message sent by a bot, or generated by an <a href="/api/bots/inline">inline query</a>, <a href="/method/messages.getBotCallbackAnswer">messages.getBotCallbackAnswer</a> should be called, passing the peer and ID of the message.<br>
The same should happen when clicking on <a href="/constructor/keyboardButtonGame">keyboardButtonGame</a> buttons, with the difference that the <code>game</code> flag must be set instead of the <code>data</code> parameter. </p>
<p>Make sure to properly handle bot timeouts in the form of <code>BOT_RESPONSE_TIMEOUT</code> RPC errors, as the bot may be offline and unable to reply. </p>
<p>The returned <a href="/constructor/messages.botCallbackAnswer">messages.botCallbackAnswer</a> constructor contains:</p>
<ul>
<li><code>message</code> if specified, a message that should be shown in a non-blocking toast notification</li>
<li><code>alert</code> indicates whether the <code>message</code> should be shown as a dismissible prompt, instead of a simple toast notification</li>
<li><code>has_url</code> Whether an URL is present</li>
<li><code>url</code> if specified, the client should open the URL, without showing a confirmation prompt. <br> This is safe and allowed, because here, bots can only return: <ul>
<li>URLs to themselves with added query parameters (<code>t.me/bot?start=aaa</code>)</li>
<li>URLs to a valid game, if the bot has manually configured games, and the clicked button was a <a href="/constructor/keyboardButtonGame">keyboardButtonGame</a>. </li>
</ul>
</li>
<li><code>native_ui</code> whether to open game URLs in a WebView or in native UI.</li>
<li><code>cache_time</code> specifies for how long should this answer be cached, client-side</li>
</ul>
<h5><a class="anchor" href="#srp-verification" id="srp-verification" name="srp-verification"><i class="anchor-icon"></i></a>SRP verification</h5>
<p>If the <code>requires_password</code> flag is set, the <a href="/api/srp">SRP 2FA payload</a> must also be generated and attached to the query, to verify the identity of the user. </p>
<p><strong>Note that the bot will NOT be able to access your password or the SRP payload</strong>. </p>
<p>The SRP payload will be processed exclusively on the Telegram's servers, simply returning an RPC error without passing the query to the bot if the verification fails.<br>
This is just a way of verifying the identity of the user, mainly used by the official <a href="https://t.me/botfather">@botfather</a> bot to allow securely transferring the ownership of a bot to another user.</p>
<h4><a class="anchor" href="#answering-a-callback-query" id="answering-a-callback-query" name="answering-a-callback-query"><i class="anchor-icon"></i></a>Answering a callback query</h4>
<pre><code><a href='/constructor/updateBotCallbackQuery'>updateBotCallbackQuery</a>#b9cfc48d flags:<a href='/type/%23'>#</a> query_id:<a href='/type/long'>long</a> user_id:<a href='/type/long'>long</a> peer:<a href='/type/Peer'>Peer</a> msg_id:<a href='/type/int'>int</a> chat_instance:<a href='/type/long'>long</a> data:flags.0?<a href='/type/bytes'>bytes</a> game_short_name:flags.1?<a href='/type/string'>string</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/updateInlineBotCallbackQuery'>updateInlineBotCallbackQuery</a>#691e9052 flags:<a href='/type/%23'>#</a> query_id:<a href='/type/long'>long</a> user_id:<a href='/type/long'>long</a> msg_id:<a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a> chat_instance:<a href='/type/long'>long</a> data:flags.0?<a href='/type/bytes'>bytes</a> game_short_name:flags.1?<a href='/type/string'>string</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.setBotCallbackAnswer'>messages.setBotCallbackAnswer</a>#d58f130a flags:<a href='/type/%23'>#</a> alert:flags.1?<a href='/constructor/true'>true</a> query_id:<a href='/type/long'>long</a> message:flags.0?<a href='/type/string'>string</a> url:flags.2?<a href='/type/string'>string</a> cache_time:<a href='/type/int'>int</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>After the user invokes <a href="/method/messages.getBotCallbackAnswer">messages.getBotCallbackAnswer</a>, an <a href="/constructor/updateBotCallbackQuery">updateBotCallbackQuery</a> or <a href="/constructor/updateInlineBotCallbackQuery">updateInlineBotCallbackQuery</a> is generated and sent to the bot, depending on whether the query originated from a normal message sent by the bot, or from a message sent from an <a href="/api/bots/inline">inline query</a>. </p>
<p>Either way, bots must reply to the query as quickly as possible using <a href="/method/messages.setBotCallbackAnswer">messages.setBotCallbackAnswer</a>: </p>
<ul>
<li><code>query_id</code> is the <code>query_id</code> from <a href="/method/messages.getBotCallbackAnswer">messages.getBotCallbackAnswer</a>, an <a href="/constructor/updateBotCallbackQuery">updateBotCallbackQuery</a> or <a href="/constructor/updateInlineBotCallbackQuery">updateInlineBotCallbackQuery</a></li>
<li><code>message</code>, <code>alert</code>, <code>url</code> can contain messages and URLs to trigger different client behaviour, as <a href="#sending-a-callback-query">specified above »</a></li>
<li><code>cache_time</code> indicates the maximum amount of time in seconds that the result of the callback query may be cached by the <strong>client</strong>. </li>
</ul>
<p>If a <code>game_short_name</code> is present in the update, the bot should return the URL of the game with the specified name.<br>
The <a href="/method/messages.setBotCallbackAnswer">messages.setBotCallbackAnswer</a> method must be called anyway, even if no <code>message</code> or <code>url</code> is returned, to avoid timeouts on the client. </p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,143 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Commands</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Bots offer a set of commands that can be used by users in private, or in a chat.">
<meta property="og:title" content="Commands">
<meta property="og:image" content="">
<meta property="og:description" content="Bots offer a set of commands that can be used by users in private, or in a chat.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/bots%2Fcommands" >Commands</a></li></ul></div>
<h1 id="dev_page_title">Commands</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p><a href="/bots">Bots</a> offer a set of <a href="/bots/#commands">commands</a> that can be used by users in private, or in a chat. </p>
<p>For a simplified description using the HTTP bot API, see <a href="/bots/#commands">here »</a>. </p>
<h3><a class="anchor" href="#getting-commands" id="getting-commands" name="getting-commands"><i class="anchor-icon"></i></a>Getting commands</h3>
<pre><code><a href='/constructor/botCommand'>botCommand</a>#c27ac8c7 command:<a href='/type/string'>string</a> description:<a href='/type/string'>string</a> = <a href='/type/BotCommand'>BotCommand</a>;
<a href='/constructor/botInfo'>botInfo</a>#1b74b335 user_id:<a href='/type/long'>long</a> description:<a href='/type/string'>string</a> commands:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotCommand'>BotCommand</a>&gt; = <a href='/type/BotInfo'>BotInfo</a>;
<a href='/constructor/channelFull'>channelFull</a>#e13c3d20 flags:<a href='/type/%23'>#</a> can_view_participants:flags.3?<a href='/constructor/true'>true</a> can_set_username:flags.6?<a href='/constructor/true'>true</a> can_set_stickers:flags.7?<a href='/constructor/true'>true</a> hidden_prehistory:flags.10?<a href='/constructor/true'>true</a> can_set_location:flags.16?<a href='/constructor/true'>true</a> has_scheduled:flags.19?<a href='/constructor/true'>true</a> can_view_stats:flags.20?<a href='/constructor/true'>true</a> blocked:flags.22?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants_count:flags.0?<a href='/type/int'>int</a> admins_count:flags.1?<a href='/type/int'>int</a> kicked_count:flags.2?<a href='/type/int'>int</a> banned_count:flags.2?<a href='/type/int'>int</a> online_count:flags.13?<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> chat_photo:<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.23?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href='/type/long'>long</a> migrated_from_max_id:flags.4?<a href='/type/int'>int</a> pinned_msg_id:flags.5?<a href='/type/int'>int</a> stickerset:flags.8?<a href='/type/StickerSet'>StickerSet</a> available_min_id:flags.9?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> linked_chat_id:flags.14?<a href='/type/long'>long</a> location:flags.15?<a href='/type/ChannelLocation'>ChannelLocation</a> slowmode_seconds:flags.17?<a href='/type/int'>int</a> slowmode_next_send_date:flags.18?<a href='/type/int'>int</a> stats_dc:flags.12?<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> call:flags.21?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.24?<a href='/type/int'>int</a> pending_suggestions:flags.25?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; groupcall_default_join_as:flags.26?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.27?<a href='/type/string'>string</a> requests_pending:flags.28?<a href='/type/int'>int</a> recent_requesters:flags.28?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; default_send_as:flags.29?<a href='/type/Peer'>Peer</a> available_reactions:flags.30?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/ChatFull'>ChatFull</a>;
<a href='/constructor/userFull'>userFull</a>#cf366521 flags:<a href='/type/%23'>#</a> blocked:flags.0?<a href='/constructor/true'>true</a> phone_calls_available:flags.4?<a href='/constructor/true'>true</a> phone_calls_private:flags.5?<a href='/constructor/true'>true</a> can_pin_message:flags.7?<a href='/constructor/true'>true</a> has_scheduled:flags.12?<a href='/constructor/true'>true</a> video_calls_available:flags.13?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:flags.1?<a href='/type/string'>string</a> settings:<a href='/type/PeerSettings'>PeerSettings</a> profile_photo:flags.2?<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> bot_info:flags.3?<a href='/type/BotInfo'>BotInfo</a> pinned_msg_id:flags.6?<a href='/type/int'>int</a> common_chats_count:<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> ttl_period:flags.14?<a href='/type/int'>int</a> theme_emoticon:flags.15?<a href='/type/string'>string</a> private_forward_name:flags.16?<a href='/type/string'>string</a> = <a href='/type/UserFull'>UserFull</a>;
<a href='/constructor/user'>user</a>#3ff6ecb0 flags:<a href='/type/%23'>#</a> self:flags.10?<a href='/constructor/true'>true</a> contact:flags.11?<a href='/constructor/true'>true</a> mutual_contact:flags.12?<a href='/constructor/true'>true</a> deleted:flags.13?<a href='/constructor/true'>true</a> bot:flags.14?<a href='/constructor/true'>true</a> bot_chat_history:flags.15?<a href='/constructor/true'>true</a> bot_nochats:flags.16?<a href='/constructor/true'>true</a> verified:flags.17?<a href='/constructor/true'>true</a> restricted:flags.18?<a href='/constructor/true'>true</a> min:flags.20?<a href='/constructor/true'>true</a> bot_inline_geo:flags.21?<a href='/constructor/true'>true</a> support:flags.23?<a href='/constructor/true'>true</a> scam:flags.24?<a href='/constructor/true'>true</a> apply_min_photo:flags.25?<a href='/constructor/true'>true</a> fake:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:flags.0?<a href='/type/long'>long</a> first_name:flags.1?<a href='/type/string'>string</a> last_name:flags.2?<a href='/type/string'>string</a> username:flags.3?<a href='/type/string'>string</a> phone:flags.4?<a href='/type/string'>string</a> photo:flags.5?<a href='/type/UserProfilePhoto'>UserProfilePhoto</a> status:flags.6?<a href='/type/UserStatus'>UserStatus</a> bot_info_version:flags.14?<a href='/type/int'>int</a> restriction_reason:flags.18?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; bot_inline_placeholder:flags.19?<a href='/type/string'>string</a> lang_code:flags.22?<a href='/type/string'>string</a> = <a href='/type/User'>User</a>;</code></pre>
<p>The <a href="/constructor/botInfo">botInfo</a> constructors contained in the <a href="/constructor/userFull">userFull</a>, <a href="/constructor/chatFull">chatFull</a>, <a href="/constructor/channelFull">channelFull</a> contain a list of commands, and for groups, the ID and a description of each bot. </p>
<p>In graphical clients, when users begin a message with a <code>/</code>, a list of commands supported by all bots present in the current chat should be shown; the same should be done for one-to-one chats with the bot itself. </p>
<p>If the command list of a bot changes, the <code>bot_info_version</code> contained in the <a href="/constructor/user">user</a> constructor received in updates will change; this indicates that the client should refetch full bot information using <a href="/method/users.getFullUser">users.getFullUser</a>.</p>
<h3><a class="anchor" href="#setting-commands" id="setting-commands" name="setting-commands"><i class="anchor-icon"></i></a>Setting commands</h3>
<pre><code><a href='/constructor/botCommand'>botCommand</a>#c27ac8c7 command:<a href='/type/string'>string</a> description:<a href='/type/string'>string</a> = <a href='/type/BotCommand'>BotCommand</a>;
---functions---
<a href='/method/bots.setBotCommands'>bots.setBotCommands</a>#517165a scope:<a href='/type/BotCommandScope'>BotCommandScope</a> lang_code:<a href='/type/string'>string</a> commands:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotCommand'>BotCommand</a>&gt; = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>The command list can be changed by the owner of the bot through <a href="https://t.me/botfather">@botfather</a>, but bots can also change their own command list by invoking <a href="/method/bots.setBotCommands">bots.setBotCommands</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,174 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Games</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Bots can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats. ">
<meta property="og:title" content="Games">
<meta property="og:image" content="">
<meta property="og:description" content="Bots can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats. ">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/bots%2Fgames" >Games</a></li></ul></div>
<h1 id="dev_page_title">Games</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Bots can offer users <a href="/bots/games">HTML5 games</a> to play solo or to compete against each other in groups and one-on-one chats. </p>
<h3><a class="anchor" href="#sending-a-game" id="sending-a-game" name="sending-a-game"><i class="anchor-icon"></i></a>Sending a game</h3>
<pre><code><a href='/constructor/inputUserSelf'>inputUserSelf</a>#f7c1b13f = <a href='/type/InputUser'>InputUser</a>;
<a href='/constructor/inputGameID'>inputGameID</a>#32c3e77 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputGame'>InputGame</a>;
<a href='/constructor/inputGameShortName'>inputGameShortName</a>#c331e80a bot_id:<a href='/type/InputUser'>InputUser</a> short_name:<a href='/type/string'>string</a> = <a href='/type/InputGame'>InputGame</a>;
<a href='/constructor/inputMediaGame'>inputMediaGame</a>#d33f43f3 id:<a href='/type/InputGame'>InputGame</a> = <a href='/type/InputMedia'>InputMedia</a>;
<a href='/constructor/game'>game</a>#bdf9653b flags:<a href='/type/%23'>#</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> short_name:<a href='/type/string'>string</a> title:<a href='/type/string'>string</a> description:<a href='/type/string'>string</a> photo:<a href='/type/Photo'>Photo</a> document:flags.0?<a href='/type/Document'>Document</a> = <a href='/type/Game'>Game</a>;
<a href='/constructor/messageMediaGame'>messageMediaGame</a>#fdb19008 game:<a href='/type/Game'>Game</a> = <a href='/type/MessageMedia'>MessageMedia</a>;
---functions---
<a href='/method/messages.sendMedia'>messages.sendMedia</a>#e25ff8e0 flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> media:<a href='/type/InputMedia'>InputMedia</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>Bots can directly send a game using <a href="/method/messages.sendMedia">messages.sendMedia</a>, providing:</p>
<ul>
<li>The bot's shortname obtained from <a href="https://t.me/botfather">@BotFather</a> to <code>inputGameShortName.short_name</code></li>
<li>The current bot's info to <code>inputGameShortName.bot_id</code></li>
</ul>
<p>The sent message will contain a <a href="/constructor/messageMediaGame">messageMediaGame</a> with a <a href="/constructor/game">game</a>, that can then be used by users to forward the game using sendMedia with <a href="/constructor/inputGameID">inputGameID</a>.</p>
<h3><a class="anchor" href="#starting-a-game" id="starting-a-game" name="starting-a-game"><i class="anchor-icon"></i></a>Starting a game</h3>
<p>Games are started clicking on the button, which triggers an callback query that returns the game URL, for more info <a href="/api/bots/buttons#callback-queries">see here »</a>.<br>
The game should then be opened in a WebView or in native UI (specified by the <code>native_ui</code> flag), exposing the <a href="/api/web-events">appropriate HTML5 APIs</a> in order to receive various JS game events directly from the code of the game, as described <a href="/api/web-events">here »</a>. </p>
<h3><a class="anchor" href="#setting-highscores" id="setting-highscores" name="setting-highscores"><i class="anchor-icon"></i></a>Setting highscores</h3>
<pre><code>---functions---
<a href='/method/messages.setGameScore'>messages.setGameScore</a>#8ef8ecc0 flags:<a href='/type/%23'>#</a> edit_message:flags.0?<a href='/constructor/true'>true</a> force:flags.1?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/int'>int</a> user_id:<a href='/type/InputUser'>InputUser</a> score:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.setInlineGameScore'>messages.setInlineGameScore</a>#15ad9f64 flags:<a href='/type/%23'>#</a> edit_message:flags.0?<a href='/constructor/true'>true</a> force:flags.1?<a href='/constructor/true'>true</a> id:<a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a> user_id:<a href='/type/InputUser'>InputUser</a> score:<a href='/type/int'>int</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Games are supposed to report back to the MTProto API every time the user looses a game with a new highscore.<br>
Since games run in the browser, they cannot directly report data to the API using the bot token, which must be kept secret.<br>
Instead, they should send highscores to an intermediate server, that will then report scores using <a href="/method/messages.setGameScore">messages.setGameScore</a> or <a href="/method/messages.setInlineGameScore">messages.setInlineGameScore</a>, depending on the source of the game. </p>
<ul>
<li>The <code>edit_message</code> flag should be set if the game message should be automatically edited to include the current scoreboard</li>
<li>The <code>force</code> flag should be set if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters.</li>
</ul>
<h3><a class="anchor" href="#getting-highscores" id="getting-highscores" name="getting-highscores"><i class="anchor-icon"></i></a>Getting highscores</h3>
<pre><code><a href='/constructor/messageActionGameScore'>messageActionGameScore</a>#92a72876 game_id:<a href='/type/long'>long</a> score:<a href='/type/int'>int</a> = <a href='/type/MessageAction'>MessageAction</a>;
<a href='/constructor/messageService'>messageService</a>#2b085862 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> action:<a href='/type/MessageAction'>MessageAction</a> ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/highScore'>highScore</a>#73a379eb pos:<a href='/type/int'>int</a> user_id:<a href='/type/long'>long</a> score:<a href='/type/int'>int</a> = <a href='/type/HighScore'>HighScore</a>;
<a href='/constructor/messages.highScores'>messages.highScores</a>#9a3bfd99 scores:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/HighScore'>HighScore</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.HighScores'>messages.HighScores</a>;
---functions---
<a href='/method/messages.getGameHighScores'>messages.getGameHighScores</a>#e822649d peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/int'>int</a> user_id:<a href='/type/InputUser'>InputUser</a> = <a href='/type/messages.HighScores'>messages.HighScores</a>;
<a href='/method/messages.getInlineGameHighScores'>messages.getInlineGameHighScores</a>#f635e1b id:<a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a> user_id:<a href='/type/InputUser'>InputUser</a> = <a href='/type/messages.HighScores'>messages.HighScores</a>;</code></pre>
<p>Every time a highscore is reached, and the <code>edit_message</code> flag is set when reporting the score, a <a href="/constructor/messageService">messageService</a> with a <a href="/constructor/messageActionGameScore">messageActionGameScore</a> is generated, indicating that the highscore of a certain game has changed, thanks to a certain <code>user_id</code>.<br>
Our own current position of the scoreboard is also reported as <code>pos</code>. </p>
<p>When receiving such an update, graphical clients should refetch the scoreboard using <a href="/method/messages.getGameHighScores">messages.getGameHighScores</a> or <a href="/method/messages.getInlineGameHighScores">messages.getInlineGameHighScores</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,218 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Inline</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Users can interact with your bot via inline queries, straight from the text input field in any chat.
This article describes…">
<meta property="og:title" content="Inline">
<meta property="og:image" content="">
<meta property="og:description" content="Users can interact with your bot via inline queries, straight from the text input field in any chat.
This article describes…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Inline</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Users can interact with your bot via <a href="/bots/#inline-mode"><strong>inline queries</strong></a>, straight from the <strong>text input field</strong> in <strong>any</strong> chat.<br>
This article describes the full inline bot flow, using the MTProto API. </p>
<p>For a simplified description using the HTTP bot API, see <a href="/bots/#inline-mode">here »</a>. </p>
<h3><a class="anchor" href="#making-an-inline-query" id="making-an-inline-query" name="making-an-inline-query"><i class="anchor-icon"></i></a>Making an inline query</h3>
<pre><code><a href='/constructor/messages.botResults'>messages.botResults</a>#947ca848 flags:<a href='/type/%23'>#</a> gallery:flags.0?<a href='/constructor/true'>true</a> query_id:<a href='/type/long'>long</a> next_offset:flags.1?<a href='/type/string'>string</a> switch_pm:flags.2?<a href='/type/InlineBotSwitchPM'>InlineBotSwitchPM</a> results:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInlineResult'>BotInlineResult</a>&gt; cache_time:<a href='/type/int'>int</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.BotResults'>messages.BotResults</a>;
---functions---
<a href='/method/messages.getInlineBotResults'>messages.getInlineBotResults</a>#514e999d flags:<a href='/type/%23'>#</a> bot:<a href='/type/InputUser'>InputUser</a> peer:<a href='/type/InputPeer'>InputPeer</a> geo_point:flags.0?<a href='/type/InputGeoPoint'>InputGeoPoint</a> query:<a href='/type/string'>string</a> offset:<a href='/type/string'>string</a> = <a href='/type/messages.BotResults'>messages.BotResults</a>;</code></pre>
<p>When, in a graphical client, the user starts a message with an <code>@</code>, clients should:</p>
<ul>
<li>Use the cached <a href="/api/top-rating">top peer rating for inline bots</a> to show a list of frequently used inline bots.</li>
<li>If the user chooses a bot from the recent bot list or:</li>
<li>Finishes typing a full username followed by a whitespace, and if the username <a href="/method/contacts.resolveUsername">resolves</a> to a valid bot</li>
<li><a href="/method/messages.getInlineBotResults">messages.getInlineBotResults</a> is called, with the following parameters:<ul>
<li><code>bot</code> - The bot peer</li>
<li><code>peer</code> - The chat where the user made the query</li>
<li><code>geo_point</code> - The user's current geolocation, if the bot requires <a href="/bots/inline#location-based-results">location-based inline results</a> (the <code>bot_inline_geo</code> flag of the bot's <a href="/constructor/user">user constructor</a> will be set)</li>
<li><code>query</code> - What the user typed after the bot's username</li>
<li><code>offset</code> - If the user scrolls past the first <code>len(results)</code> results, and <code>next_offset</code> field is set, the inline query should be repeated with this offset.</li>
</ul>
</li>
</ul>
<h3><a class="anchor" href="#answering-to-an-inline-query" id="answering-to-an-inline-query" name="answering-to-an-inline-query"><i class="anchor-icon"></i></a>Answering to an inline query</h3>
<pre><code><a href='/constructor/inputBotInlineMessageMediaAuto'>inputBotInlineMessageMediaAuto</a>#3380c786 flags:<a href='/type/%23'>#</a> message:<a href='/type/string'>string</a> entities:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineMessageText'>inputBotInlineMessageText</a>#3dcd7a87 flags:<a href='/type/%23'>#</a> no_webpage:flags.0?<a href='/constructor/true'>true</a> message:<a href='/type/string'>string</a> entities:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineMessageMediaGeo'>inputBotInlineMessageMediaGeo</a>#96929a85 flags:<a href='/type/%23'>#</a> geo_point:<a href='/type/InputGeoPoint'>InputGeoPoint</a> heading:flags.0?<a href='/type/int'>int</a> period:flags.1?<a href='/type/int'>int</a> proximity_notification_radius:flags.3?<a href='/type/int'>int</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineMessageMediaVenue'>inputBotInlineMessageMediaVenue</a>#417bbf11 flags:<a href='/type/%23'>#</a> geo_point:<a href='/type/InputGeoPoint'>InputGeoPoint</a> title:<a href='/type/string'>string</a> address:<a href='/type/string'>string</a> provider:<a href='/type/string'>string</a> venue_id:<a href='/type/string'>string</a> venue_type:<a href='/type/string'>string</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineMessageMediaContact'>inputBotInlineMessageMediaContact</a>#a6edbffd flags:<a href='/type/%23'>#</a> phone_number:<a href='/type/string'>string</a> first_name:<a href='/type/string'>string</a> last_name:<a href='/type/string'>string</a> vcard:<a href='/type/string'>string</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineMessageGame'>inputBotInlineMessageGame</a>#4b425864 flags:<a href='/type/%23'>#</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a>;
<a href='/constructor/inputBotInlineResult'>inputBotInlineResult</a>#88bf9319 flags:<a href='/type/%23'>#</a> id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> title:flags.1?<a href='/type/string'>string</a> description:flags.2?<a href='/type/string'>string</a> url:flags.3?<a href='/type/string'>string</a> thumb:flags.4?<a href='/type/InputWebDocument'>InputWebDocument</a> content:flags.5?<a href='/type/InputWebDocument'>InputWebDocument</a> send_message:<a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a> = <a href='/type/InputBotInlineResult'>InputBotInlineResult</a>;
<a href='/constructor/inputBotInlineResultPhoto'>inputBotInlineResultPhoto</a>#a8d864a7 id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> photo:<a href='/type/InputPhoto'>InputPhoto</a> send_message:<a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a> = <a href='/type/InputBotInlineResult'>InputBotInlineResult</a>;
<a href='/constructor/inputBotInlineResultDocument'>inputBotInlineResultDocument</a>#fff8fdc4 flags:<a href='/type/%23'>#</a> id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> title:flags.1?<a href='/type/string'>string</a> description:flags.2?<a href='/type/string'>string</a> document:<a href='/type/InputDocument'>InputDocument</a> send_message:<a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a> = <a href='/type/InputBotInlineResult'>InputBotInlineResult</a>;
<a href='/constructor/inputBotInlineResultGame'>inputBotInlineResultGame</a>#4fa417f2 id:<a href='/type/string'>string</a> short_name:<a href='/type/string'>string</a> send_message:<a href='/type/InputBotInlineMessage'>InputBotInlineMessage</a> = <a href='/type/InputBotInlineResult'>InputBotInlineResult</a>;
<a href='/constructor/updateBotInlineQuery'>updateBotInlineQuery</a>#496f379c flags:<a href='/type/%23'>#</a> query_id:<a href='/type/long'>long</a> user_id:<a href='/type/long'>long</a> query:<a href='/type/string'>string</a> geo:flags.0?<a href='/type/GeoPoint'>GeoPoint</a> peer_type:flags.1?<a href='/type/InlineQueryPeerType'>InlineQueryPeerType</a> offset:<a href='/type/string'>string</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.setInlineBotResults'>messages.setInlineBotResults</a>#eb5ea206 flags:<a href='/type/%23'>#</a> gallery:flags.0?<a href='/constructor/true'>true</a> private:flags.1?<a href='/constructor/true'>true</a> query_id:<a href='/type/long'>long</a> results:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputBotInlineResult'>InputBotInlineResult</a>&gt; cache_time:<a href='/type/int'>int</a> next_offset:flags.2?<a href='/type/string'>string</a> switch_pm:flags.3?<a href='/type/InlineBotSwitchPM'>InlineBotSwitchPM</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Bots can answer to incoming <a href="/constructor/updateBotInlineQuery">updateBotInlineQuery</a> updates using <a href="/method/messages.setInlineBotResults">messages.setInlineBotResults</a>.<br>
Just like its <a href="/bots/api#answerinlinequery">bot API counterpart</a>, the method can be used to send a set of inline results to the user; see the <a href="/method/messages.setInlineBotResults">constructor page for more info on the MTProto method parameters »</a>.</p>
<p>In general, the method accepts a vector of <a href="/type/InputBotInlineResult">InputBotInlineResult</a> constructors, that when <a href="#sending-the-inline-query-result">chosen</a>, generates a message with optionally attached media, and even inline buttons.</p>
<h3><a class="anchor" href="#sending-the-inline-query-result" id="sending-the-inline-query-result" name="sending-the-inline-query-result"><i class="anchor-icon"></i></a>Sending the inline query result</h3>
<pre><code><a href='/constructor/botInlineMessageMediaAuto'>botInlineMessageMediaAuto</a>#764cf810 flags:<a href='/type/%23'>#</a> message:<a href='/type/string'>string</a> entities:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
<a href='/constructor/botInlineMessageText'>botInlineMessageText</a>#8c7f65e2 flags:<a href='/type/%23'>#</a> no_webpage:flags.0?<a href='/constructor/true'>true</a> message:<a href='/type/string'>string</a> entities:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
<a href='/constructor/botInlineMessageMediaGeo'>botInlineMessageMediaGeo</a>#51846fd flags:<a href='/type/%23'>#</a> geo:<a href='/type/GeoPoint'>GeoPoint</a> heading:flags.0?<a href='/type/int'>int</a> period:flags.1?<a href='/type/int'>int</a> proximity_notification_radius:flags.3?<a href='/type/int'>int</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
<a href='/constructor/botInlineMessageMediaVenue'>botInlineMessageMediaVenue</a>#8a86659c flags:<a href='/type/%23'>#</a> geo:<a href='/type/GeoPoint'>GeoPoint</a> title:<a href='/type/string'>string</a> address:<a href='/type/string'>string</a> provider:<a href='/type/string'>string</a> venue_id:<a href='/type/string'>string</a> venue_type:<a href='/type/string'>string</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
<a href='/constructor/botInlineMessageMediaContact'>botInlineMessageMediaContact</a>#18d1cdc2 flags:<a href='/type/%23'>#</a> phone_number:<a href='/type/string'>string</a> first_name:<a href='/type/string'>string</a> last_name:<a href='/type/string'>string</a> vcard:<a href='/type/string'>string</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> = <a href='/type/BotInlineMessage'>BotInlineMessage</a>;
<a href='/constructor/botInlineResult'>botInlineResult</a>#11965f3a flags:<a href='/type/%23'>#</a> id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> title:flags.1?<a href='/type/string'>string</a> description:flags.2?<a href='/type/string'>string</a> url:flags.3?<a href='/type/string'>string</a> thumb:flags.4?<a href='/type/WebDocument'>WebDocument</a> content:flags.5?<a href='/type/WebDocument'>WebDocument</a> send_message:<a href='/type/BotInlineMessage'>BotInlineMessage</a> = <a href='/type/BotInlineResult'>BotInlineResult</a>;
<a href='/constructor/botInlineMediaResult'>botInlineMediaResult</a>#17db940b flags:<a href='/type/%23'>#</a> id:<a href='/type/string'>string</a> type:<a href='/type/string'>string</a> photo:flags.0?<a href='/type/Photo'>Photo</a> document:flags.1?<a href='/type/Document'>Document</a> title:flags.2?<a href='/type/string'>string</a> description:flags.3?<a href='/type/string'>string</a> send_message:<a href='/type/BotInlineMessage'>BotInlineMessage</a> = <a href='/type/BotInlineResult'>BotInlineResult</a>;
<a href='/constructor/messages.botResults'>messages.botResults</a>#947ca848 flags:<a href='/type/%23'>#</a> gallery:flags.0?<a href='/constructor/true'>true</a> query_id:<a href='/type/long'>long</a> next_offset:flags.1?<a href='/type/string'>string</a> switch_pm:flags.2?<a href='/type/InlineBotSwitchPM'>InlineBotSwitchPM</a> results:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInlineResult'>BotInlineResult</a>&gt; cache_time:<a href='/type/int'>int</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.BotResults'>messages.BotResults</a>;
---functions---
<a href='/method/messages.sendInlineBotResult'>messages.sendInlineBotResult</a>#7aa11297 flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> hide_via:flags.11?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> random_id:<a href='/type/long'>long</a> query_id:<a href='/type/long'>long</a> id:<a href='/type/string'>string</a> schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>The user client should display the <code>results</code> obtained <a href="#making-an-inline-query">during querying</a> in a list, making sure to handle eventual bot timeouts in the form of a <code>BOT_RESPONSE_TIMEOUT</code> RPC error, by simply not displaying anything.</p>
<p>If the user then chooses a specific <code>BotInlineResult</code>, the <a href="/method/messages.sendInlineBotResult">messages.sendInlineBotResult</a> method should be invoked, passing:</p>
<ul>
<li>The <code>query_id</code> from <code>messages.botResults</code></li>
<li>The <code>id</code> of the chosen result</li>
<li>The <code>peer</code> where to send the chosen result</li>
</ul>
<p>The resulting <a href="/constructor/message">message</a> will have the <code>via_bot_id</code> field set, to indicate that the result was generated by the bot that generated the inline result.<br>
Graphical clients should display the bot <code>@username</code> in the header of the message, allowing the user to click on it, automatically starting an inline query by inserting <code>@username</code> in the text bar.</p>
<h3><a class="anchor" href="#inline-feedback" id="inline-feedback" name="inline-feedback"><i class="anchor-icon"></i></a>Inline feedback</h3>
<pre><code><a href='/constructor/inputBotInlineMessageID'>inputBotInlineMessageID</a>#890c3d89 dc_id:<a href='/type/int'>int</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a>;
<a href='/constructor/updateBotInlineSend'>updateBotInlineSend</a>#12f12a07 flags:<a href='/type/%23'>#</a> user_id:<a href='/type/long'>long</a> query:<a href='/type/string'>string</a> geo:flags.0?<a href='/type/GeoPoint'>GeoPoint</a> id:<a href='/type/string'>string</a> msg_id:flags.1?<a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a> = <a href='/type/Update'>Update</a>;</code></pre>
<p>If <a href="/bots/inline#collecting-feedback">feedback collection</a> is enabled, the bot may receive an <a href="/constructor/updateBotInlineSend">updateBotInlineSend</a> when the user <a href="#sending-the-inline-query-result">chooses and sends</a> an inline result. </p>
<p>Even if the <a href="/bots/inline#collecting-feedback">probability setting is set to 100%</a>, not all inline results may be reported due to caching (see the <code>cache_time</code> parameter in <a href="/api/bots/buttons#answering-a-callback-query">Answering a callback query</a>).<br>
<a href="/bots/inline#collecting-feedback">Feedback collection</a> can also create load issues for popular bots, so adjust the probability setting to a lower value in such cases.</p>
<p>Either way, feedback collection should only be used for statistical purposes rather than functional. </p>
<p>The <a href="/constructor/updateBotInlineSend">updateBotInlineSend</a> will contain: </p>
<ul>
<li><code>id</code> - The ID of the chosen result</li>
<li><code>msg_id</code> - The ID of the sent inline message</li>
<li><code>user_id</code> - The ID of the user that chose the result</li>
<li><code>query</code> - The query string that was used to obtain the result</li>
<li><code>geo</code> - For bots requiring <a href="/bots/inline#location-based-results">location-based inline results</a>, the user's location</li>
</ul>
<h3><a class="anchor" href="#editing-sent-inline-messages" id="editing-sent-inline-messages" name="editing-sent-inline-messages"><i class="anchor-icon"></i></a>Editing sent inline messages</h3>
<pre><code><a href='/constructor/updateInlineBotCallbackQuery'>updateInlineBotCallbackQuery</a>#691e9052 flags:<a href='/type/%23'>#</a> query_id:<a href='/type/long'>long</a> user_id:<a href='/type/long'>long</a> msg_id:<a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a> chat_instance:<a href='/type/long'>long</a> data:flags.0?<a href='/type/bytes'>bytes</a> game_short_name:flags.1?<a href='/type/string'>string</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/inputBotInlineMessageID'>inputBotInlineMessageID</a>#890c3d89 dc_id:<a href='/type/int'>int</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a>;
---functions---
<a href='/method/messages.editInlineBotMessage'>messages.editInlineBotMessage</a>#83557dba flags:<a href='/type/%23'>#</a> no_webpage:flags.1?<a href='/constructor/true'>true</a> id:<a href='/type/InputBotInlineMessageID'>InputBotInlineMessageID</a> message:flags.11?<a href='/type/string'>string</a> media:flags.14?<a href='/type/InputMedia'>InputMedia</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Sent inline messages can be edited by the bot, for example in response to a <a href="/api/bots/buttons#callback-queries">button press callback query</a>. </p>
<p>Simply pass the <a href="/constructor/inputBotInlineMessageID">inputBotInlineMessageID</a> specified in the <a href="/constructor/updateInlineBotCallbackQuery">updateInlineBotCallbackQuery</a> to <a href="/method/messages.editInlineBotMessage">messages.editInlineBotMessage</a> along with the new message, making sure to send the query to the <a href="/api/datacenter">datacenter</a> specified in <code>inputBotInlineMessageID.dc_id</code>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,165 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Channels, supergroups, gigagroups and basic groups</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to handle channels, supergroups, gigagroups, basic groups, and what&#39;s the difference between them.">
<meta property="og:title" content="Channels, supergroups, gigagroups and basic groups">
<meta property="og:image" content="2831d0518f782d1977">
<meta property="og:description" content="How to handle channels, supergroups, gigagroups, basic groups, and what&#39;s the difference between them.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/channel" >Channels, supergroups, gigagroups and basic…</a></li></ul></div>
<h1 id="dev_page_title">Channels, supergroups, gigagroups and basic groups</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<h3><a class="anchor" href="#channels" id="channels" name="channels"><i class="anchor-icon"></i></a>Channels</h3>
<p><a href="https://telegram.org/tour/channels">Channels</a> are a tool for broadcasting your messages to large audiences. They can have an unlimited number of subscribers, they can be public with a permanent URL and each post in a channel has its own view counter.<br>
Technically, they are represented by <a href="/constructor/channel">channel</a> constructors. </p>
<p>Channels can be created using the <a href="/method/channels.createChannel">channels.createChannel</a> method, by setting the <code>broadcast</code> flag. </p>
<h3><a class="anchor" href="#supergroups" id="supergroups" name="supergroups"><i class="anchor-icon"></i></a>Supergroups</h3>
<p><a href="https://telegram.org/tour/groups">Supergroups</a> are a powerful tool for building communities and can support up to 200,000 members each.<br>
Technically, supergroups are actually channels: they are represented by <a href="/constructor/channel">channel</a> constructors, with the <code>megagroup</code> flag set to true. </p>
<p>Channels can be created using the <a href="/method/channels.createChannel">channels.createChannel</a> method, by setting the <code>megagroup</code> flag.<br>
Supergroups can also be assigned a <code>geo_point</code> to become <a href="https://telegram.org/blog/contacts-local-groups">geochats</a>. </p>
<h3><a class="anchor" href="#gigagroups" id="gigagroups" name="gigagroups"><i class="anchor-icon"></i></a>Gigagroups</h3>
<p>Gigagroups are something between a channel and a supergroup.<br>
An admin, <a href="/api/config#channel-suggestions">when prompted by the API using suggestions »</a>, can convert a megagroup into a gigagroup using <a href="/method/channels.convertToGigagroup">channels.convertToGigagroup</a> (one way only).<br>
After that, only admins will be able to write in the group (like when <a href="#rights"><code>send_messages</code> rights are disabled for all group participants by default</a>), but the participant limit is removed and the group can become much bigger than a supergroup (e.g. &gt;200,000 currently).<br>
Also, one can't invite people into gigagroups and participants of voice chats in gigagroups are muted by default. </p>
<h3><a class="anchor" href="#basic-groups" id="basic-groups" name="basic-groups"><i class="anchor-icon"></i></a>Basic groups</h3>
<p>In previous versions of telegram, only basic groups (represented by <a href="/constructor/chat">chat</a> constructors) could be created using <a href="/method/messages.createChat">messages.createChat</a>: these groups have fewer features, and can only have 200 members at max.<br>
Messages from all basic groups are stored in the <a href="/api/updates#message-related-event-sequences">user's message box »</a>: this means that all basic groups and all private chats share the same, single message ID and <a href="/api/updates">PTS</a> sequence. </p>
<h4><a class="anchor" href="#migration" id="migration" name="migration"><i class="anchor-icon"></i></a>Migration</h4>
<p>To upgrade a basic group to a supergroup, <a href="/method/messages.migrateChat">messages.migrateChat</a> can be used.
The <code>chats</code> field of the result will have two objects: </p>
<ul>
<li>A <a href="/constructor/chat">chat</a> constructor with a <code>migrated_to</code> field, indicating the address of the new supergroup</li>
<li>The new <a href="/constructor/channel">channel</a> megagroup constructor</li>
</ul>
<p>When <a href="/method/channels.getFullChannel">getting full info</a> about the migrated channel, the <a href="/constructor/channelFull">channelFull</a> object will have <code>migrated_from_chat_id</code> and <code>migrated_from_max_id</code> fields indicating the original ID of the chat, and the message ID in the original chat at which the group was migrated.</p>
<p>All users of the chat will receive an <a href="/constructor/updateNewMessage">updateNewMessage</a> from the old chat with a <a href="/constructor/messageService">messageService</a> containing a <a href="/constructor/messageActionChatMigrateTo">messageActionChatMigrateTo</a> constructor.</p>
<p>All new messages have to be sent to the new supergroup.</p>
<p>When working with migrated groups clients need to handle loading of the message history (as well as search results et cetera) from both the basic group and the new supergroup. This is done by merging the two messages lists (requested with different <a href="/type/Peer">Peer</a> values) client side.</p>
<h3><a class="anchor" href="#invite-links-and-join-requests" id="invite-links-and-join-requests" name="invite-links-and-join-requests"><i class="anchor-icon"></i></a>Invite links and join requests</h3>
<p>Channels, basic groups and supergroups may have a public username or a private invite link: private invite links may be further enhanced with per-user join requests.</p>
<p>For more info on how to work with public usernames, invite links and join requests, see <a href="/api/invites">here »</a>.</p>
<h3><a class="anchor" href="#rights" id="rights" name="rights"><i class="anchor-icon"></i></a>Rights</h3>
<p>Channels, basic groups and supergroups allow setting <a href="https://telegram.org/blog/permissions-groups-undo">granular permissions</a> both for admins and specific users; channels, supergroups and basic groups also allow setting global granular permissions for users.</p>
<p>For more info on how to set and modify rights, see <a href="/api/rights">here »</a>.</p>
<h3><a class="anchor" href="#pinned-messages" id="pinned-messages" name="pinned-messages"><i class="anchor-icon"></i></a>Pinned messages</h3>
<p>Telegram allows pinning multiple messages on top in a chat, group, supergroup or channel. </p>
<p>See <a href="/api/pin">here »</a> for more info on pinning and unpinning messages. </p>
<h3><a class="anchor" href="#discussion" id="discussion" name="discussion"><i class="anchor-icon"></i></a>Discussion</h3>
<p>Groups can be associated to a channel as a <a href="https://telegram.org/blog/privacy-discussions-web-bots">discussion group</a>, to allow users to discuss about posts. </p>
<p>For more info on how to set a discussion group in channel, see <a href="/api/discussion">here »</a></p>
<h3><a class="anchor" href="#recent-actions" id="recent-actions" name="recent-actions"><i class="anchor-icon"></i></a>Recent actions</h3>
<p>Both supergroups and channels offer a so-called <a href="https://telegram.org/blog/admin-revolution">admin log</a>, a log of recent relevant supergroup and channel actions, like the modification of group/channel settings or information on behalf of an admin, user kicks and bans, and more.</p>
<p>See <a href="/api/recent-actions">here »</a> for more info.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,431 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Client configuration</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods.">
<meta property="og:title" content="Client configuration">
<meta property="og:image" content="">
<meta property="og:description" content="The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/config" >Client configuration</a></li></ul></div>
<h1 id="dev_page_title">Client configuration</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods. </p>
<h3><a class="anchor" href="#mtproto-configuration" id="mtproto-configuration" name="mtproto-configuration"><i class="anchor-icon"></i></a>MTProto configuration</h3>
<pre><code><a href='/constructor/config'>config</a>#330b4067 flags:<a href='/type/%23'>#</a> phonecalls_enabled:flags.1?<a href='/constructor/true'>true</a> default_p2p_contacts:flags.3?<a href='/constructor/true'>true</a> preload_featured_stickers:flags.4?<a href='/constructor/true'>true</a> ignore_phone_entities:flags.5?<a href='/constructor/true'>true</a> revoke_pm_inbox:flags.6?<a href='/constructor/true'>true</a> blocked_mode:flags.8?<a href='/constructor/true'>true</a> pfs_enabled:flags.13?<a href='/constructor/true'>true</a> date:<a href='/type/int'>int</a> expires:<a href='/type/int'>int</a> test_mode:<a href='/type/Bool'>Bool</a> this_dc:<a href='/type/int'>int</a> dc_options:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DcOption'>DcOption</a>&gt; dc_txt_domain_name:<a href='/type/string'>string</a> chat_size_max:<a href='/type/int'>int</a> megagroup_size_max:<a href='/type/int'>int</a> forwarded_count_max:<a href='/type/int'>int</a> online_update_period_ms:<a href='/type/int'>int</a> offline_blur_timeout_ms:<a href='/type/int'>int</a> offline_idle_timeout_ms:<a href='/type/int'>int</a> online_cloud_timeout_ms:<a href='/type/int'>int</a> notify_cloud_delay_ms:<a href='/type/int'>int</a> notify_default_delay_ms:<a href='/type/int'>int</a> push_chat_period_ms:<a href='/type/int'>int</a> push_chat_limit:<a href='/type/int'>int</a> saved_gifs_limit:<a href='/type/int'>int</a> edit_time_limit:<a href='/type/int'>int</a> revoke_time_limit:<a href='/type/int'>int</a> revoke_pm_time_limit:<a href='/type/int'>int</a> rating_e_decay:<a href='/type/int'>int</a> stickers_recent_limit:<a href='/type/int'>int</a> stickers_faved_limit:<a href='/type/int'>int</a> channels_read_media_period:<a href='/type/int'>int</a> tmp_sessions:flags.0?<a href='/type/int'>int</a> pinned_dialogs_count_max:<a href='/type/int'>int</a> pinned_infolder_count_max:<a href='/type/int'>int</a> call_receive_timeout_ms:<a href='/type/int'>int</a> call_ring_timeout_ms:<a href='/type/int'>int</a> call_connect_timeout_ms:<a href='/type/int'>int</a> call_packet_timeout_ms:<a href='/type/int'>int</a> me_url_prefix:<a href='/type/string'>string</a> autoupdate_url_prefix:flags.7?<a href='/type/string'>string</a> gif_search_username:flags.9?<a href='/type/string'>string</a> venue_search_username:flags.10?<a href='/type/string'>string</a> img_search_username:flags.11?<a href='/type/string'>string</a> static_maps_provider:flags.12?<a href='/type/string'>string</a> caption_length_max:<a href='/type/int'>int</a> message_length_max:<a href='/type/int'>int</a> webfile_dc_id:<a href='/type/int'>int</a> suggested_lang_code:flags.2?<a href='/type/string'>string</a> lang_pack_version:flags.2?<a href='/type/int'>int</a> base_lang_pack_version:flags.2?<a href='/type/int'>int</a> = <a href='/type/Config'>Config</a>;
<a href='/constructor/nearestDc'>nearestDc</a>#8e1a1775 country:<a href='/type/string'>string</a> this_dc:<a href='/type/int'>int</a> nearest_dc:<a href='/type/int'>int</a> = <a href='/type/NearestDc'>NearestDc</a>;
---functions---
<a href='/method/help.getConfig'>help.getConfig</a>#c4f9186b = <a href='/type/Config'>Config</a>;
<a href='/method/help.getNearestDc'>help.getNearestDc</a>#1fb33026 = <a href='/type/NearestDc'>NearestDc</a>;</code></pre>
<p>The huge <a href="/constructor/config">config</a> constructor contains lots of useful information, from chat and message size limitations, to privacy settings, online status refresh interval and timeout, VoIP configuration, default inline bot usernames for GIF, image and venue lookup, and lots of other global and user-specific information, check out the <a href="/constructor/config">constructor page</a> for more information.</p>
<h3><a class="anchor" href="#client-configuration" id="client-configuration" name="client-configuration"><i class="anchor-icon"></i></a>Client configuration</h3>
<pre><code><a href='/constructor/jsonObjectValue'>jsonObjectValue</a>#c0de1bd9 key:<a href='/type/string'>string</a> value:<a href='/type/JSONValue'>JSONValue</a> = <a href='/type/JSONObjectValue'>JSONObjectValue</a>;
<a href='/constructor/jsonNull'>jsonNull</a>#3f6d7b68 = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonBool'>jsonBool</a>#c7345e6a value:<a href='/type/Bool'>Bool</a> = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonNumber'>jsonNumber</a>#2be0dfa4 value:<a href='/type/double'>double</a> = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonString'>jsonString</a>#b71e767a value:<a href='/type/string'>string</a> = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonArray'>jsonArray</a>#f7444763 value:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/JSONValue'>JSONValue</a>&gt; = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonObject'>jsonObject</a>#99c1d49d value:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/JSONObjectValue'>JSONObjectValue</a>&gt; = <a href='/type/JSONValue'>JSONValue</a>;
---functions---
<a href='/method/help.getAppConfig'>help.getAppConfig</a>#98914110 = <a href='/type/JSONValue'>JSONValue</a>;</code></pre>
<p>The <a href="/method/help.getAppConfig">help.getAppConfig</a> method returns a JSON object containing rapidly evolving, client-specific configuration parameters.<br>
While <a href="/method/help.getConfig">help.getConfig</a> returns MTProto-specific configuration with information about server-side limitations and other MTProto-related information, <a href="/method/help.getAppConfig">help.getAppConfig</a> returns configuration parameters useful for graphical Telegram clients.</p>
<p>Typical fields included in the resulting JSON object are: </p>
<ul>
<li><code>emojies_animated_zoom</code> - <a href="/api/animated-emojis">Animated emojis</a> and <a href="/api/dice">animated dice</a> should be scaled by this factor before being shown to the user (float)</li>
<li><code>keep_alive_service</code> - Whether app clients should start a keepalive service to keep the app running and fetch updates even when the app is closed (boolean)</li>
<li><code>background_connection</code> - Whether app clients should start a background TCP connection for MTProto update fetching (boolean)</li>
<li><code>emojies_send_dice</code> - A list of supported <a href="/api/dice">animated dice</a> stickers (array of strings).</li>
<li><code>emojies_send_dice_success</code> - For <a href="/api/dice">animated dice</a> emojis other than the basic <img class="emoji" src="//telegram.org/img/emoji/40/F09F8EB2.png" width="20" height="20" alt="🎲" />, indicates the winning dice value and the final frame of the animated sticker, at which to show the fireworks <img class="emoji" src="//telegram.org/img/emoji/40/F09F8E86.png" width="20" height="20" alt="🎆" /> (object with emoji keys and object values, containing <code>value</code> and <code>frame_start</code> float values)</li>
<li><code>emojies_sounds</code> - A map of soundbites to be played when the user clicks on the specified <a href="/api/animated-emojis">animated emoji</a>; the <a href="/api/file_reference">file reference field</a> should be base64-decoded before <a href="/api/files">downloading the file</a> (map of <a href="/api/files">file IDs</a>, with emoji string keys)</li>
<li><code>gif_search_branding</code> - Specifies the name of the service providing GIF search through <a href="#mtproto-configuration">gif_search_username</a> (string)</li>
<li><code>gif_search_emojies</code> - Specifies a list of emojies that should be suggested as search term in a bar above the GIF search box (array of string emojis)</li>
<li><code>stickers_emoji_suggest_only_api</code> - Specifies that the app should not display local sticker suggestions for emojis at all and just use the result of <a href="/method/messages.getStickers">messages.getStickers</a> (bool)</li>
<li><code>stickers_emoji_cache_time</code> - Specifies the validity period of the local cache of <a href="/method/messages.getStickers">messages.getStickers</a>, also relevant when generating the <a href="/api/offsets#hash-generation">pagination hash</a> when invoking the method. (int)</li>
<li><code>qr_login_camera</code> - Whether the Settings-&gt;Devices menu should show an option to scan a <a href="/api/qr-login">QR login code</a> (boolean)</li>
<li><code>qr_login_code</code> - Whether the login screen should show a <a href="/api/qr-login">QR code login option</a>, possibly as default login method (string, "disabled", "primary" or "secondary")</li>
<li><code>dialog_filters_enabled</code> - Whether clients should show an option for managing <a href="/api/folders">dialog filters AKA folders</a> (boolean)</li>
<li><code>dialog_filters_tooltip</code> - Whether clients should actively show a tooltip, inviting the user to configure <a href="/api/folders">dialog filters AKA folders</a>; typically this happens when the chat list is long enough to start getting cluttered. (boolean)</li>
<li><code>autoarchive_setting_available</code> - Whether clients <em>can</em> invoke <a href="/method/account.setGlobalPrivacySettings">account.setGlobalPrivacySettings</a> with <a href="/constructor/globalPrivacySettings"><code>globalPrivacySettings.archive_and_mute_new_noncontact_peers = boolTrue</code></a>, to automatically archive and mute new incoming chats from non-contacts. (boolean)</li>
<li><code>pending_suggestions</code> - Contains a list of suggestions that should be actively shown as a tooltip to the user. (Array of strings, possible values shown <a href="#suggestions">in the suggestions section »</a>. </li>
<li><code>url_auth_domains</code> - A list of domains that support automatic login with manual user confirmation, <a href="/api/url-authorization#link-url-authorization">click here for more info on URL authorization »</a>. (array of strings)</li>
<li><code>autologin_domains</code> - A list of Telegram domains that support automatic login with no user confirmation, <a href="/api/url-authorization#link-url-authorization">click here for more info on URL authorization »</a>. (array of strings)</li>
<li><code>autologin_token</code> - Autologin token, <a href="/api/url-authorization#link-url-authorization">click here for more info on URL authorization »</a>. (string)</li>
<li><code>round_video_encoding</code> - Contains a set of recommended codec parameters for round videos. </li>
<li><code>chat_read_mark_size_threshold</code> - Per-user read receipts, fetchable using <a href="/method/messages.getMessageReadParticipants">messages.getMessageReadParticipants</a>, will be available in groups with an amount of participants less or equal to <code>chat_read_mark_size_threshold</code>. (int)</li>
<li><code>chat_read_mark_expire_period</code> - To protect user privacy, read receipts are only stored for <code>chat_read_mark_expire_period</code> seconds after the message was sent. (int)</li>
<li><code>groupcall_video_participants_max</code> - Maximum number of participants in a group call (livestreams allow ∞ participants) (int)</li>
<li><code>reactions_default</code> - Default emoji reaction to use in the quick reaction menu, this value can be changed using <a href="/method/messages.setDefaultReaction">messages.setDefaultReaction</a> (string)</li>
<li><code>reactions_uniq_max</code> - Maximum number of unique reaction-emojis for any given message: for example, if there are 2000 <img class="emoji" src="//telegram.org/img/emoji/40/F09F918D.png" width="20" height="20" alt="👍" /> and 1000 <img class="emoji" src="//telegram.org/img/emoji/40/F09F9881.png" width="20" height="20" alt="😁" /> reactions and reactions_uniq_max = 2, you can't add a <img class="emoji" src="//telegram.org/img/emoji/40/F09F918E.png" width="20" height="20" alt="👎" /> reaction, because that would raise the number of unique reaction-emojis to 3 &gt; 2. (integer)</li>
</ul>
<p>Example value: </p>
<pre><code class="language-json">{
"test": 1,
"emojies_animated_zoom": 0.625,
"keep_alive_service": true,
"background_connection": true,
"emojies_send_dice": [
"\ud83c\udfb2",
"\ud83c\udfaf",
"\ud83c\udfc0",
"\u26bd",
"\u26bd\ufe0f",
"\ud83c\udfb0",
"\ud83c\udfb3"
],
"emojies_send_dice_success": {
"\ud83c\udfaf": {
"value": 6,
"frame_start": 62
},
"\ud83c\udfc0": {
"value": 5,
"frame_start": 110
},
"\u26bd": {
"value": 5,
"frame_start": 110
},
"\u26bd\ufe0f": {
"value": 5,
"frame_start": 110
},
"\ud83c\udfb0": {
"value": 64,
"frame_start": 110
},
"\ud83c\udfb3": {
"value": 6,
"frame_start": 110
}
},
"emojies_sounds": {
"\ud83c\udf83": {
"id": "4956223179606458539",
"access_hash": "-2107001400913062971",
"file_reference_base64": "AGIaeBZckszt-s71DzCHhSkfZI_l"
},
"\u26b0": {
"id": "4956223179606458540",
"access_hash": "-1498869544183595185",
"file_reference_base64": "AGIaeBZRfKxsAgnaLEDh5XIa8Gri"
},
"\ud83e\udddf\u200d\u2642": {
"id": "4960929110848176331",
"access_hash": "3986395821757915468",
"file_reference_base64": "AGIaeBZcFga_bS9BsPvVNA2zuYCI"
},
"\ud83e\udddf": {
"id": "4960929110848176332",
"access_hash": "-8929417974289765626",
"file_reference_base64": "AGIaeBbUbidUDCl4nImJXPTl2wWj"
},
"\ud83e\udddf\u200d\u2640": {
"id": "4960929110848176333",
"access_hash": "9161696144162881753",
"file_reference_base64": "AGIaeBb-ulJ2E-rSI2B8EKyAXs-8"
},
"\ud83c\udf51": {
"id": "4963180910661861548",
"access_hash": "-7431729439735063448",
"file_reference_base64": "AGIaeBa940aXpIVLThj0J2ctxYFe"
},
"\ud83c\udf8a": {
"id": "5094064004578410732",
"access_hash": "8518192996098758509",
"file_reference_base64": "AGIaeBZFqTTp5drt0JZ86DGDAu1t"
},
"\ud83c\udf84": {
"id": "5094064004578410733",
"access_hash": "-4142643820629256996",
"file_reference_base64": "AGIaeBbEqu-gV0qAUdP5lD3MxLSK"
},
"\ud83e\uddbe": {
"id": "5094064004578410734",
"access_hash": "-8934384022571962340",
"file_reference_base64": "AGIaeBZ0YCp8_Zl_cmP4nvKkkSfF"
}
},
"gif_search_branding": "tenor",
"gif_search_emojies": [
"\ud83d\udc4d",
"\ud83d\ude18",
"\ud83d\ude0d",
"\ud83d\ude21",
"\ud83e\udd73",
"\ud83d\ude02",
"\ud83d\ude2e",
"\ud83d\ude44",
"\ud83d\ude0e",
"\ud83d\udc4e"
],
"stickers_emoji_suggest_only_api": false,
"stickers_emoji_cache_time": 86400,
"groupcall_video_participants_max": 1000,
"qr_login_camera": true,
"qr_login_code": "primary",
"dialog_filters_enabled": true,
"dialog_filters_tooltip": true,
"autoarchive_setting_available": false,
"pending_suggestions": [
"AUTOARCHIVE_POPULAR",
"VALIDATE_PASSWORD",
"VALIDATE_PHONE_NUMBER",
"NEWCOMER_TICKS"
],
"autologin_token": "string",
"autologin_domains": [
"instantview.telegram.org",
"translations.telegram.org",
"contest.dev",
"contest.com",
"bugs.telegram.org",
"suggestions.telegram.org",
"themes.telegram.org",
"promote.telegram.org"
],
"round_video_encoding": {
"diameter": 384,
"video_bitrate": 1000,
"audio_bitrate": 64,
"max_size": 12582912
},
"chat_read_mark_expire_period": 604800,
"chat_read_mark_size_threshold": 100,
"reactions_default": "\ud83d\udc4d",
"reactions_uniq_max": 11
}</code></pre>
<h3><a class="anchor" href="#suggestions" id="suggestions" name="suggestions"><i class="anchor-icon"></i></a>Suggestions</h3>
<p>The API can return a set of useful suggestions for users of graphical clients. </p>
<h4><a class="anchor" href="#basic-suggestions" id="basic-suggestions" name="basic-suggestions"><i class="anchor-icon"></i></a>Basic suggestions</h4>
<pre><code><a href='/constructor/jsonObjectValue'>jsonObjectValue</a>#c0de1bd9 key:<a href='/type/string'>string</a> value:<a href='/type/JSONValue'>JSONValue</a> = <a href='/type/JSONObjectValue'>JSONObjectValue</a>;
<a href='/constructor/jsonNull'>jsonNull</a>#3f6d7b68 = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonBool'>jsonBool</a>#c7345e6a value:<a href='/type/Bool'>Bool</a> = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonNumber'>jsonNumber</a>#2be0dfa4 value:<a href='/type/double'>double</a> = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonString'>jsonString</a>#b71e767a value:<a href='/type/string'>string</a> = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonArray'>jsonArray</a>#f7444763 value:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/JSONValue'>JSONValue</a>&gt; = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonObject'>jsonObject</a>#99c1d49d value:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/JSONObjectValue'>JSONObjectValue</a>&gt; = <a href='/type/JSONValue'>JSONValue</a>;
---functions---
<a href='/method/help.getAppConfig'>help.getAppConfig</a>#98914110 = <a href='/type/JSONValue'>JSONValue</a>;</code></pre>
<p>The <a href="/method/help.getAppConfig">help.getAppConfig</a> method returns a JSON object containing rapidly evolving, client-specific configuration parameters.<br>
A full list of these parameters can be seen in the <a href="#client-configuration">Client Configuration section »</a>, but we're mostly interested in the <code>pending_suggestions</code> and <code>autoarchive_setting_available</code> fields of the returned JSON object: </p>
<ul>
<li><code>autoarchive_setting_available</code> - Whether clients <em>can</em> invoke <a href="/method/account.setGlobalPrivacySettings">account.setGlobalPrivacySettings</a> with <a href="/constructor/globalPrivacySettings"><code>globalPrivacySettings.archive_and_mute_new_noncontact_peers = boolTrue</code></a>, to automatically archive and mute new incoming chats from non-contacts. (boolean)</li>
<li><code>pending_suggestions</code> - Contains a list of suggestions that should be actively shown as a tooltip to the user. Array of strings, possible values shown below:<ul>
<li><code>"AUTOARCHIVE_POPULAR"</code> - Users <em>should</em> invoke <a href="/method/account.setGlobalPrivacySettings">account.setGlobalPrivacySettings</a> with <a href="/constructor/globalPrivacySettings"><code>globalPrivacySettings.archive_and_mute_new_noncontact_peers = boolTrue</code></a>, to automatically archive and mute new incoming chats from non-contacts.</li>
<li><code>"VALIDATE_PASSWORD"</code> - Users should make sure they still remember their <a href="/api/srp">2-step verification password</a>.</li>
<li><code>"VALIDATE_PHONE_NUMBER"</code> - Users should check whether their <a href="/api/auth">authorization phone number</a> is correct and change the phone number if it is inaccessible.</li>
<li><code>"NEWCOMER_TICKS"</code> - Show the user a hint about the meaning of one and two ticks on sent messages.</li>
</ul>
</li>
</ul>
<h4><a class="anchor" href="#channel-suggestions" id="channel-suggestions" name="channel-suggestions"><i class="anchor-icon"></i></a>Channel suggestions</h4>
<pre><code><a href='/constructor/messages.chatFull'>messages.chatFull</a>#e5d7d19c full_chat:<a href='/type/ChatFull'>ChatFull</a> chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ChatFull'>messages.ChatFull</a>;
<a href='/constructor/channelFull'>channelFull</a>#e13c3d20 flags:<a href='/type/%23'>#</a> can_view_participants:flags.3?<a href='/constructor/true'>true</a> can_set_username:flags.6?<a href='/constructor/true'>true</a> can_set_stickers:flags.7?<a href='/constructor/true'>true</a> hidden_prehistory:flags.10?<a href='/constructor/true'>true</a> can_set_location:flags.16?<a href='/constructor/true'>true</a> has_scheduled:flags.19?<a href='/constructor/true'>true</a> can_view_stats:flags.20?<a href='/constructor/true'>true</a> blocked:flags.22?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants_count:flags.0?<a href='/type/int'>int</a> admins_count:flags.1?<a href='/type/int'>int</a> kicked_count:flags.2?<a href='/type/int'>int</a> banned_count:flags.2?<a href='/type/int'>int</a> online_count:flags.13?<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> chat_photo:<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.23?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href='/type/long'>long</a> migrated_from_max_id:flags.4?<a href='/type/int'>int</a> pinned_msg_id:flags.5?<a href='/type/int'>int</a> stickerset:flags.8?<a href='/type/StickerSet'>StickerSet</a> available_min_id:flags.9?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> linked_chat_id:flags.14?<a href='/type/long'>long</a> location:flags.15?<a href='/type/ChannelLocation'>ChannelLocation</a> slowmode_seconds:flags.17?<a href='/type/int'>int</a> slowmode_next_send_date:flags.18?<a href='/type/int'>int</a> stats_dc:flags.12?<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> call:flags.21?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.24?<a href='/type/int'>int</a> pending_suggestions:flags.25?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; groupcall_default_join_as:flags.26?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.27?<a href='/type/string'>string</a> requests_pending:flags.28?<a href='/type/int'>int</a> recent_requesters:flags.28?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; default_send_as:flags.29?<a href='/type/Peer'>Peer</a> available_reactions:flags.30?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/ChatFull'>ChatFull</a>;
---functions---
<a href='/method/channels.getFullChannel'>channels.getFullChannel</a>#8736a09 channel:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/messages.ChatFull'>messages.ChatFull</a>;</code></pre>
<p>Some <a href="/api/channel">channel/supergroup</a>-related suggestions can also be contained in the <code>pending_suggestions</code> field of the <a href="/constructor/channelFull">channelFull</a> constructor, returned by <a href="/method/channels.getFullChannel">channels.getFullChannel</a>.<br>
Here's a list of possible suggestions: </p>
<ul>
<li><code>CONVERT_GIGAGROUP</code> - The <a href="/api/channel">supergroup</a> has many participants: the admin should call <a href="/method/channels.convertToGigagroup">channels.convertToGigagroup</a> to convert it to a gigagroup.</li>
</ul>
<h4><a class="anchor" href="#dismissing-suggestions" id="dismissing-suggestions" name="dismissing-suggestions"><i class="anchor-icon"></i></a>Dismissing suggestions</h4>
<pre><code><a href='/constructor/boolFalse'>boolFalse</a>#bc799737 = <a href='/type/Bool'>Bool</a>;
<a href='/constructor/boolTrue'>boolTrue</a>#997275b5 = <a href='/type/Bool'>Bool</a>;
---functions---
<a href='/method/help.dismissSuggestion'>help.dismissSuggestion</a>#f50dbaa1 peer:<a href='/type/InputPeer'>InputPeer</a> suggestion:<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p><a href="/method/help.dismissSuggestion">help.dismissSuggestion</a> can be used to dismiss a suggestion.<br>
Pass <a href="/constructor/inputPeerEmpty">inputPeerEmpty</a> to <code>peer</code> for <a href="#basic-suggestions">basic suggestions</a> and the <a href="/api/channel">channel/supergroup</a>'s peer for <a href="#channel-suggestions">channel suggestions</a>.</p>
<h3><a class="anchor" href="#app-specific-configuration" id="app-specific-configuration" name="app-specific-configuration"><i class="anchor-icon"></i></a>App-specific configuration</h3>
<pre><code><a href='/constructor/help.appUpdate'>help.appUpdate</a>#ccbbce30 flags:<a href='/type/%23'>#</a> can_not_skip:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> version:<a href='/type/string'>string</a> text:<a href='/type/string'>string</a> entities:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; document:flags.1?<a href='/type/Document'>Document</a> url:flags.2?<a href='/type/string'>string</a> sticker:flags.3?<a href='/type/Document'>Document</a> = <a href='/type/help.AppUpdate'>help.AppUpdate</a>;
<a href='/constructor/help.noAppUpdate'>help.noAppUpdate</a>#c45a6536 = <a href='/type/help.AppUpdate'>help.AppUpdate</a>;
<a href='/constructor/updates'>updates</a>#74ae4240 updates:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Update'>Update</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; date:<a href='/type/int'>int</a> seq:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/constructor/updateServiceNotification'>updateServiceNotification</a>#ebe46819 flags:<a href='/type/%23'>#</a> popup:flags.0?<a href='/constructor/true'>true</a> inbox_date:flags.1?<a href='/type/int'>int</a> type:<a href='/type/string'>string</a> message:<a href='/type/string'>string</a> media:<a href='/type/MessageMedia'>MessageMedia</a> entities:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; = <a href='/type/Update'>Update</a>;
<a href='/constructor/help.inviteText'>help.inviteText</a>#18cb9f78 message:<a href='/type/string'>string</a> = <a href='/type/help.InviteText'>help.InviteText</a>;
---functions---
<a href='/method/help.getAppUpdate'>help.getAppUpdate</a>#522d5a7d source:<a href='/type/string'>string</a> = <a href='/type/help.AppUpdate'>help.AppUpdate</a>;
<a href='/method/help.getAppChangelog'>help.getAppChangelog</a>#9010ef6f prev_app_version:<a href='/type/string'>string</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/help.getInviteText'>help.getInviteText</a>#4d392343 = <a href='/type/help.InviteText'>help.InviteText</a>;</code></pre>
<ul>
<li><a href="/method/help.getAppUpdate">help.getAppUpdate</a> - Get info about an application update, can contain the updated application binary in the attached document</li>
<li><a href="/method/help.getAppChangelog">help.getAppChangelog</a> - Get a list of service messages with app-specific changelogs</li>
<li><a href="/method/help.getInviteText">help.getInviteText</a> - Returns a localized invitation message that can be sent via SMS to contacts that haven't signed up to Telegram yet</li>
</ul>
<h3><a class="anchor" href="#terms-of-service" id="terms-of-service" name="terms-of-service"><i class="anchor-icon"></i></a>Terms of service</h3>
<pre><code><a href='/constructor/help.termsOfServiceUpdateEmpty'>help.termsOfServiceUpdateEmpty</a>#e3309f7f expires:<a href='/type/int'>int</a> = <a href='/type/help.TermsOfServiceUpdate'>help.TermsOfServiceUpdate</a>;
<a href='/constructor/help.termsOfServiceUpdate'>help.termsOfServiceUpdate</a>#28ecf961 expires:<a href='/type/int'>int</a> terms_of_service:<a href='/type/help.TermsOfService'>help.TermsOfService</a> = <a href='/type/help.TermsOfServiceUpdate'>help.TermsOfServiceUpdate</a>;
<a href='/constructor/help.termsOfService'>help.termsOfService</a>#780a0310 flags:<a href='/type/%23'>#</a> popup:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/DataJSON'>DataJSON</a> text:<a href='/type/string'>string</a> entities:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; min_age_confirm:flags.1?<a href='/type/int'>int</a> = <a href='/type/help.TermsOfService'>help.TermsOfService</a>;
<a href='/constructor/auth.authorizationSignUpRequired'>auth.authorizationSignUpRequired</a>#44747e9a flags:<a href='/type/%23'>#</a> terms_of_service:flags.0?<a href='/type/help.TermsOfService'>help.TermsOfService</a> = <a href='/type/auth.Authorization'>auth.Authorization</a>;
---functions---
<a href='/method/help.getTermsOfServiceUpdate'>help.getTermsOfServiceUpdate</a>#2ca51fd1 = <a href='/type/help.TermsOfServiceUpdate'>help.TermsOfServiceUpdate</a>;
<a href='/method/help.acceptTermsOfService'>help.acceptTermsOfService</a>#ee72f79a id:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/auth.signIn'>auth.signIn</a>#bcd51581 phone_number:<a href='/type/string'>string</a> phone_code_hash:<a href='/type/string'>string</a> phone_code:<a href='/type/string'>string</a> = <a href='/type/auth.Authorization'>auth.Authorization</a>;
<a href='/method/account.deleteAccount'>account.deleteAccount</a>#418d4e0b reason:<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>These methods can be used for managing consent to Telegram's <a href="https://telegram.org/tos">Terms Of Service</a>. </p>
<p>Typically, before a user <a href="/api/auth#sign-insign-up">signs up</a> by invoking <a href="/method/auth.signUp">auth.signUp</a>, apps should show a pop-up (if the <code>popup</code> flag of the <a href="/constructor/help.termsOfService">help.termsOfService</a> method is set), asking the user to accept Telegram's terms of service; in case of denial, the user is to be returned to the initial page of the login flow. </p>
<p>When signing up for the first time, the <a href="/constructor/help.termsOfService">help.termsOfService</a> is to be obtained from the <a href="/constructor/auth.authorizationSignUpRequired">auth.authorizationSignUpRequired</a> constructor returned by the <a href="/method/auth.signIn">auth.signIn</a>. </p>
<p>After signing up, or when logging in as an existing user, apps are supposed to call <a href="/method/help.getTermsOfServiceUpdate">help.getTermsOfServiceUpdate</a> to check for any updates to the Terms of Service; this call should be repeated after <code>expires</code> seconds have elapsed.<br>
If an update to the Terms Of Service is available, clients are supposed to show a consent popup; if accepted, clients should call <a href="/method/help.acceptTermsOfService">help.acceptTermsOfService</a>, providing the <a href="/constructor/help.termsOfService">termsOfService <code>id</code> JSON object</a>; in case of denial, clients are to delete the account using <a href="/method/account.deleteAccount">account.deleteAccount</a>, providing <code>Decline ToS update</code> as deletion <code>reason</code>. </p>
<p>Example implementation: <a href="https://github.com/DrKLO/Telegram/blob/dbf81a34affcd1c24d78e1403347ea8b3a186154/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java#L3510">android (signup)</a>, <a href="https://github.com/DrKLO/Telegram/blob/ed9e38da5b3b6ca80a7cb719a000d310d07497b0/TMessagesProj/src/main/java/org/telegram/ui/Components/TermsOfServiceView.java">android (after login)</a></p>
<h3><a class="anchor" href="#telegram-support-info" id="telegram-support-info" name="telegram-support-info"><i class="anchor-icon"></i></a>Telegram support info</h3>
<pre><code><a href='/constructor/user'>user</a>#3ff6ecb0 flags:<a href='/type/%23'>#</a> self:flags.10?<a href='/constructor/true'>true</a> contact:flags.11?<a href='/constructor/true'>true</a> mutual_contact:flags.12?<a href='/constructor/true'>true</a> deleted:flags.13?<a href='/constructor/true'>true</a> bot:flags.14?<a href='/constructor/true'>true</a> bot_chat_history:flags.15?<a href='/constructor/true'>true</a> bot_nochats:flags.16?<a href='/constructor/true'>true</a> verified:flags.17?<a href='/constructor/true'>true</a> restricted:flags.18?<a href='/constructor/true'>true</a> min:flags.20?<a href='/constructor/true'>true</a> bot_inline_geo:flags.21?<a href='/constructor/true'>true</a> support:flags.23?<a href='/constructor/true'>true</a> scam:flags.24?<a href='/constructor/true'>true</a> apply_min_photo:flags.25?<a href='/constructor/true'>true</a> fake:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:flags.0?<a href='/type/long'>long</a> first_name:flags.1?<a href='/type/string'>string</a> last_name:flags.2?<a href='/type/string'>string</a> username:flags.3?<a href='/type/string'>string</a> phone:flags.4?<a href='/type/string'>string</a> photo:flags.5?<a href='/type/UserProfilePhoto'>UserProfilePhoto</a> status:flags.6?<a href='/type/UserStatus'>UserStatus</a> bot_info_version:flags.14?<a href='/type/int'>int</a> restriction_reason:flags.18?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; bot_inline_placeholder:flags.19?<a href='/type/string'>string</a> lang_code:flags.22?<a href='/type/string'>string</a> = <a href='/type/User'>User</a>;
<a href='/constructor/help.support'>help.support</a>#17c6b5f6 phone_number:<a href='/type/string'>string</a> user:<a href='/type/User'>User</a> = <a href='/type/help.Support'>help.Support</a>;
<a href='/constructor/help.supportName'>help.supportName</a>#8c05f1c9 name:<a href='/type/string'>string</a> = <a href='/type/help.SupportName'>help.SupportName</a>;
---functions---
<a href='/method/help.getSupport'>help.getSupport</a>#9cdf08cd = <a href='/type/help.Support'>help.Support</a>;
<a href='/method/help.getSupportName'>help.getSupportName</a>#d360e72c = <a href='/type/help.SupportName'>help.SupportName</a>;</code></pre>
<p>These methods can be used for fetching info about Telegram's support user, that users can use to get support and ask questions about the app. </p>
<ul>
<li><a href="/method/help.getSupport">help.getSupport</a> - Will return the <a href="/constructor/user">user</a> object that can be used for contacting support.</li>
<li><a href="/method/help.getSupportName">help.getSupportName</a> - Will return a localized name for the support chat.</li>
</ul>
<h3><a class="anchor" href="#country-information-and-login-phone-patterns" id="country-information-and-login-phone-patterns" name="country-information-and-login-phone-patterns"><i class="anchor-icon"></i></a>Country information and login phone patterns</h3>
<pre><code><a href='/constructor/help.countryCode'>help.countryCode</a>#4203c5ef flags:<a href='/type/%23'>#</a> country_code:<a href='/type/string'>string</a> prefixes:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; patterns:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/help.CountryCode'>help.CountryCode</a>;
<a href='/constructor/help.country'>help.country</a>#c3878e23 flags:<a href='/type/%23'>#</a> hidden:flags.0?<a href='/constructor/true'>true</a> iso2:<a href='/type/string'>string</a> default_name:<a href='/type/string'>string</a> name:flags.1?<a href='/type/string'>string</a> country_codes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/help.CountryCode'>help.CountryCode</a>&gt; = <a href='/type/help.Country'>help.Country</a>;
<a href='/constructor/help.countriesListNotModified'>help.countriesListNotModified</a>#93cc1f32 = <a href='/type/help.CountriesList'>help.CountriesList</a>;
<a href='/constructor/help.countriesList'>help.countriesList</a>#87d0759e countries:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/help.Country'>help.Country</a>&gt; hash:<a href='/type/int'>int</a> = <a href='/type/help.CountriesList'>help.CountriesList</a>;
---functions---
<a href='/method/help.getCountriesList'>help.getCountriesList</a>#735787a8 lang_code:<a href='/type/string'>string</a> hash:<a href='/type/int'>int</a> = <a href='/type/help.CountriesList'>help.CountriesList</a>;</code></pre>
<p><a href="/method/help.getCountriesList">help.getCountriesList</a> can be used to fetch a list of localized names for all available countries and phone code patterns for logging in. </p>
<p>The phone code pattern should be used when showing the <a href="/api/auth">login</a> screen, or when changing phone number: for example, a pattern value of <code>XXX XXX XXX</code> with <code>country_code</code> <code>+39</code> indicates that the phone field for login should accept a spaced pattern like <code>+39 123 456 789</code>.<br>
Also, the beginning of the national part of the phone number (<code>123 456 789</code>) should match one of the <code>prefixes</code>, if any were returned. </p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Working with Different Data Centers</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to connect to the closest DC access point for faster interaction with the API, and things to watch out for when developing a client.">
<meta property="og:title" content="Working with Different Data Centers">
<meta property="og:image" content="5bb32ac46255f88a6c">
<meta property="og:description" content="How to connect to the closest DC access point for faster interaction with the API, and things to watch out for when developing a client.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/datacenter" >Working with Different Data Centers</a></li></ul></div>
<h1 id="dev_page_title">Working with Different Data Centers</h1>
<div id="dev_page_content"><p>The servers are divided into several data centers (hereinafter “DCs”) in different parts of the world.
A complete list of proxy access points for these DCs may be obtained using <a href="/method/help.getConfig">help.getConfig</a>:</p>
<pre><code><a href='/constructor/dcOption'>dcOption</a>#18b7a10d flags:<a href='/type/%23'>#</a> ipv6:flags.0?<a href='/constructor/true'>true</a> media_only:flags.1?<a href='/constructor/true'>true</a> tcpo_only:flags.2?<a href='/constructor/true'>true</a> cdn:flags.3?<a href='/constructor/true'>true</a> static:flags.4?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> ip_address:<a href='/type/string'>string</a> port:<a href='/type/int'>int</a> secret:flags.10?<a href='/type/bytes'>bytes</a> = <a href='/type/DcOption'>DcOption</a>;
<a href='/constructor/config'>config</a>#330b4067 flags:<a href='/type/%23'>#</a> phonecalls_enabled:flags.1?<a href='/constructor/true'>true</a> default_p2p_contacts:flags.3?<a href='/constructor/true'>true</a> preload_featured_stickers:flags.4?<a href='/constructor/true'>true</a> ignore_phone_entities:flags.5?<a href='/constructor/true'>true</a> revoke_pm_inbox:flags.6?<a href='/constructor/true'>true</a> blocked_mode:flags.8?<a href='/constructor/true'>true</a> pfs_enabled:flags.13?<a href='/constructor/true'>true</a> date:<a href='/type/int'>int</a> expires:<a href='/type/int'>int</a> test_mode:<a href='/type/Bool'>Bool</a> this_dc:<a href='/type/int'>int</a> dc_options:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DcOption'>DcOption</a>&gt; dc_txt_domain_name:<a href='/type/string'>string</a> chat_size_max:<a href='/type/int'>int</a> megagroup_size_max:<a href='/type/int'>int</a> forwarded_count_max:<a href='/type/int'>int</a> online_update_period_ms:<a href='/type/int'>int</a> offline_blur_timeout_ms:<a href='/type/int'>int</a> offline_idle_timeout_ms:<a href='/type/int'>int</a> online_cloud_timeout_ms:<a href='/type/int'>int</a> notify_cloud_delay_ms:<a href='/type/int'>int</a> notify_default_delay_ms:<a href='/type/int'>int</a> push_chat_period_ms:<a href='/type/int'>int</a> push_chat_limit:<a href='/type/int'>int</a> saved_gifs_limit:<a href='/type/int'>int</a> edit_time_limit:<a href='/type/int'>int</a> revoke_time_limit:<a href='/type/int'>int</a> revoke_pm_time_limit:<a href='/type/int'>int</a> rating_e_decay:<a href='/type/int'>int</a> stickers_recent_limit:<a href='/type/int'>int</a> stickers_faved_limit:<a href='/type/int'>int</a> channels_read_media_period:<a href='/type/int'>int</a> tmp_sessions:flags.0?<a href='/type/int'>int</a> pinned_dialogs_count_max:<a href='/type/int'>int</a> pinned_infolder_count_max:<a href='/type/int'>int</a> call_receive_timeout_ms:<a href='/type/int'>int</a> call_ring_timeout_ms:<a href='/type/int'>int</a> call_connect_timeout_ms:<a href='/type/int'>int</a> call_packet_timeout_ms:<a href='/type/int'>int</a> me_url_prefix:<a href='/type/string'>string</a> autoupdate_url_prefix:flags.7?<a href='/type/string'>string</a> gif_search_username:flags.9?<a href='/type/string'>string</a> venue_search_username:flags.10?<a href='/type/string'>string</a> img_search_username:flags.11?<a href='/type/string'>string</a> static_maps_provider:flags.12?<a href='/type/string'>string</a> caption_length_max:<a href='/type/int'>int</a> message_length_max:<a href='/type/int'>int</a> webfile_dc_id:<a href='/type/int'>int</a> suggested_lang_code:flags.2?<a href='/type/string'>string</a> lang_pack_version:flags.2?<a href='/type/int'>int</a> base_lang_pack_version:flags.2?<a href='/type/int'>int</a> = <a href='/type/Config'>Config</a>;
---functions---
<a href='/method/help.getConfig'>help.getConfig</a>#c4f9186b = <a href='/type/Config'>Config</a>;</code></pre>
<p>In this context, <strong>this_dc</strong> is the number of the current DC, <strong>dc_options</strong> is a list of all DCs available at the moment, each of which has an <strong>id</strong>, <strong>ip</strong>, and <strong>port</strong> for establishing a connection. Please note that <strong>ip</strong> and <strong>port</strong> may change frequently, based on proxy server load and the user's current location.<br>
Typically, each DC has at least one IPv4 and one IPv6 endpoint available. </p>
<p>To optimize client communication with the API, each client must use the connection to the closest access point for its main queries (sending messages, getting contacts, etc.). Therefore, knowing how to select a DC is required before communicating with the API.</p>
<h3><a class="anchor" href="#registrationauthorization" id="registrationauthorization" name="registrationauthorization"><i class="anchor-icon"></i></a>Registration/Authorization</h3>
<p>The <a href="/method/auth.sendCode">auth.sendCode</a> method is the basic entry point when registering a new user or authorizing an existing user. 95% of all redirection cases to a different DC will occur when invoking this method.</p>
<p>The client does not yet know which DC it will be associated with; therefore, it establishes an encrypted connection to a random address and sends its query to that address.
Having received a <strong>phone_number</strong> from a client, we can find out whether or not it is registered in the system. If it is, then, if necessary, instead of sending a text message, we request that it establish a connection with a different DC first (PHONE_MIGRATE_X error).
If we do not yet have a user with this number, we examine its IP-address. We can use it to identify the closest DC. Again, if necessary, we redirect the user to a different DC (NETWORK_MIGRATE_X error).</p>
<h4><a class="anchor" href="#testing-redirects" id="testing-redirects" name="testing-redirects"><i class="anchor-icon"></i></a>Testing Redirects</h4>
<p>There are reserved phone number prefixes to test the correctness of the application's handling of redirects between DCs. Read more in <a href="https://core.telegram.org/api/auth#test-phone-numbers">User Authorization</a> article.</p>
<h3><a class="anchor" href="#file-access" id="file-access" name="file-access"><i class="anchor-icon"></i></a>File Access</h3>
<p>A file saved by a user with <a href="/method/upload.saveFilePart">upload.saveFilePart</a> will be available for direct download only from the DC where the query was executed. That is why each file has a <strong>dc_id</strong> parameter:</p>
<pre><code><a href='/constructor/document'>document</a>#1e87342b flags:<a href='/type/%23'>#</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> size:<a href='/type/int'>int</a> thumbs:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_thumbs:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; = <a href='/type/Document'>Document</a>;
<a href='/constructor/photo'>photo</a>#fb197a65 flags:<a href='/type/%23'>#</a> has_stickers:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> sizes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_sizes:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> = <a href='/type/Photo'>Photo</a>;
<a href='/constructor/encryptedFile'>encryptedFile</a>#4a70994c id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> size:<a href='/type/int'>int</a> dc_id:<a href='/type/int'>int</a> key_fingerprint:<a href='/type/int'>int</a> = <a href='/type/EncryptedFile'>EncryptedFile</a>;
<a href='/constructor/userProfilePhoto'>userProfilePhoto</a>#82d1f706 flags:<a href='/type/%23'>#</a> has_video:flags.0?<a href='/constructor/true'>true</a> photo_id:<a href='/type/long'>long</a> stripped_thumb:flags.1?<a href='/type/bytes'>bytes</a> dc_id:<a href='/type/int'>int</a> = <a href='/type/UserProfilePhoto'>UserProfilePhoto</a>;
<a href='/constructor/chatPhoto'>chatPhoto</a>#1c6e1c11 flags:<a href='/type/%23'>#</a> has_video:flags.0?<a href='/constructor/true'>true</a> photo_id:<a href='/type/long'>long</a> stripped_thumb:flags.1?<a href='/type/bytes'>bytes</a> dc_id:<a href='/type/int'>int</a> = <a href='/type/ChatPhoto'>ChatPhoto</a>;</code></pre>
<p>To download the file, an encrypted connection to DC <strong>dc_id</strong> must be established and used to execute the <a href="/method/upload.getFile">upload.getFile</a> query.
If an attempt is made to download the file over a wrong connection, the FILE_MIGRATE_X error will be returned.</p>
<p>Please note that encryption keys are not copied between DCs; therefore, the process of establishing an encrypted connection is started from the very beginning for each new DC. An issued auth_key can be associated with the current authorized user by using an <a href="#authorization-transfer">authorization transfer</a>.</p>
<h3><a class="anchor" href="#user-migration" id="user-migration" name="user-migration"><i class="anchor-icon"></i></a>User Migration</h3>
<p>During the process of working with the API, user information is accumulated in the DC with which the user is associated. This is the reason a user cannot be associated with a different DC by means of the client. However, in the future, during prolonged communication from an unusual location, we may decide that the user's data must be moved to a different DC. After some time, the data will be copied and the association will be updated. Once this happens, when executing any query transmitted to the old DC, the API will return the USER_MIGRATE_X error. The client will then have to establish a connection with the new DC and repeat the query.</p>
<h3><a class="anchor" href="#authorization-transfer" id="authorization-transfer" name="authorization-transfer"><i class="anchor-icon"></i></a>Authorization Transfer</h3>
<p>The following methods can be used to eliminate the need for users to enter the code from a text message every time:</p>
<pre><code><a href='/constructor/auth.exportedAuthorization'>auth.exportedAuthorization</a>#b434e2b8 id:<a href='/type/long'>long</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/auth.ExportedAuthorization'>auth.ExportedAuthorization</a>;
<a href='/constructor/auth.authorization'>auth.authorization</a>#33fb7bb8 flags:<a href='/type/%23'>#</a> setup_password_required:flags.1?<a href='/constructor/true'>true</a> otherwise_relogin_days:flags.1?<a href='/type/int'>int</a> tmp_sessions:flags.0?<a href='/type/int'>int</a> user:<a href='/type/User'>User</a> = <a href='/type/auth.Authorization'>auth.Authorization</a>;
---functions---
<a href='/method/auth.importAuthorization'>auth.importAuthorization</a>#a57a7dad id:<a href='/type/long'>long</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/auth.Authorization'>auth.Authorization</a>;
<a href='/method/auth.exportAuthorization'>auth.exportAuthorization</a>#e5bfffcd dc_id:<a href='/type/int'>int</a> = <a href='/type/auth.ExportedAuthorization'>auth.ExportedAuthorization</a>;</code></pre>
<p><a href="/method/auth.exportAuthorization">auth.exportAuthorization</a> must be executed in the current DC (the DC with which a connection has already been established), passing in <strong>dc_id</strong> as the value for the new DC. The method should return the user identifier and a long string of random data. An import operation can be performed at the new DC by sending it what was received. Queries requiring authorization can then be successfully executed in the new DC.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,152 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Dice</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram supports sending [animated dice](https://telegram.org/blog/folders#and-one-more-thing) emojis.">
<meta property="og:title" content="Dice">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram supports sending [animated dice](https://telegram.org/blog/folders#and-one-more-thing) emojis.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/dice" >Dice</a></li></ul></div>
<h1 id="dev_page_title">Dice</h1>
<div id="dev_page_content"><p>Telegram supports sending <a href="https://telegram.org/blog/folders#and-one-more-thing">animated dice</a> emojis.<br>
This is implemented by using the dice constructors: </p>
<pre><code><a href='/constructor/inputMediaDice'>inputMediaDice</a>#e66fbf7b emoticon:<a href='/type/string'>string</a> = <a href='/type/InputMedia'>InputMedia</a>;
<a href='/constructor/messageMediaDice'>messageMediaDice</a>#3f7ee58b value:<a href='/type/int'>int</a> emoticon:<a href='/type/string'>string</a> = <a href='/type/MessageMedia'>MessageMedia</a>;
<a href='/constructor/inputStickerSetDice'>inputStickerSetDice</a>#e67f520e emoticon:<a href='/type/string'>string</a> = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/messages.stickerSet'>messages.stickerSet</a>#b60a24a6 set:<a href='/type/StickerSet'>StickerSet</a> packs:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/StickerPack'>StickerPack</a>&gt; documents:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Document'>Document</a>&gt; = <a href='/type/messages.StickerSet'>messages.StickerSet</a>;
---functions---
<a href='/method/messages.sendMedia'>messages.sendMedia</a>#e25ff8e0 flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> media:<a href='/type/InputMedia'>InputMedia</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.getStickerSet'>messages.getStickerSet</a>#c8a0ec74 stickerset:<a href='/type/InputStickerSet'>InputStickerSet</a> hash:<a href='/type/int'>int</a> = <a href='/type/messages.StickerSet'>messages.StickerSet</a>;
<a href='/method/help.getAppConfig'>help.getAppConfig</a>#98914110 = <a href='/type/JSONValue'>JSONValue</a>;</code></pre>
<p>On startup, clients should fetch <a href="/api/config#client-configuration">app configuration using help.getAppConfig</a>.<br>
Then, for each dice emoji contained in the <code>emojies_send_dice</code> field, clients should fetch the dice emoji stickerset by calling the <a href="/method/messages.getStickerSet">messages.getStickerSet</a> method, providing the properly populated <a href="/constructor/inputStickerSetDice">inputStickerSetDice</a> to the <code>stickerset</code> field.<br>
The returned stickerset will contain a set of animated stickers, one for each of the dice outcomes, plus a first looping sticker that should be shown as preview to the user before actually sending the dice. </p>
<p>If a user attempts to send a single emoji from the ones specified in <code>emojies_send_dice</code>, the dice should be sent using <a href="/method/messages.sendMedia">messages.sendMedia</a>, providing the dice emoji to the <code>emoticon</code> field. </p>
<p>Incoming dice stickers will be received as a <a href="/constructor/messageMediaDice">messageMediaDice</a> constructor, along with a randomly generated server-side value, ranging from 1 to the maximum allowed value for this type of dice.<br>
Clients should display the correct dice animated sticker for the specified value: since dice values start from 1, and the first animated sticker in dice stickerset is the preview, <code>value</code> can be used to directly index the <code>documents</code> sticker array from the animated stickerset. </p>
<p>The <code>emojies_send_dice_success</code> configuration parameter contains more info about dice emojis other than the basic <img class="emoji" src="//telegram.org/img/emoji/40/F09F8EB2.png" width="20" height="20" alt="🎲" />: </p>
<pre><code> "emojies_send_dice_success": {
"\ud83c\udfaf": {
"value": 6,
"frame_start": 62
},
"\ud83c\udfc0": {
"value": 5,
"frame_start": 110
}
}</code></pre>
<p>For each of the dice emojis, a maximum "winning" value is specified, along with the frame number at which to show the fireworks <img class="emoji" src="//telegram.org/img/emoji/40/F09F8E86.png" width="20" height="20" alt="🎆" />.<br>
Please note that dice animated stickers should loop only once, right after being sent/received <strong>for the first time</strong>; clicking on the dice sticker should bring up a popup, inviting the user to send a new dice of the same type. </p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Discussion groups</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="[Groups](/api/channel) can be associated to a [channel](/api/channel) as a [discussion group](https://telegram.org/blog/privacy-discussions-web-bots), to allow users to discuss about posts.">
<meta property="og:title" content="Discussion groups">
<meta property="og:image" content="">
<meta property="og:description" content="[Groups](/api/channel) can be associated to a [channel](/api/channel) as a [discussion group](https://telegram.org/blog/privacy-discussions-web-bots), to allow users to discuss about posts.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/discussion" >Discussion groups</a></li></ul></div>
<h1 id="dev_page_title">Discussion groups</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p><a href="/api/channel">Groups</a> can be associated to a <a href="/api/channel">channel</a> as a <a href="https://telegram.org/blog/privacy-discussions-web-bots">discussion group</a>, to allow users to discuss about posts. </p>
<pre><code><a href='/constructor/boolFalse'>boolFalse</a>#bc799737 = <a href='/type/Bool'>Bool</a>;
<a href='/constructor/boolTrue'>boolTrue</a>#997275b5 = <a href='/type/Bool'>Bool</a>;
<a href='/constructor/channelFull'>channelFull</a>#e13c3d20 flags:<a href='/type/%23'>#</a> can_view_participants:flags.3?<a href='/constructor/true'>true</a> can_set_username:flags.6?<a href='/constructor/true'>true</a> can_set_stickers:flags.7?<a href='/constructor/true'>true</a> hidden_prehistory:flags.10?<a href='/constructor/true'>true</a> can_set_location:flags.16?<a href='/constructor/true'>true</a> has_scheduled:flags.19?<a href='/constructor/true'>true</a> can_view_stats:flags.20?<a href='/constructor/true'>true</a> blocked:flags.22?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants_count:flags.0?<a href='/type/int'>int</a> admins_count:flags.1?<a href='/type/int'>int</a> kicked_count:flags.2?<a href='/type/int'>int</a> banned_count:flags.2?<a href='/type/int'>int</a> online_count:flags.13?<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> chat_photo:<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.23?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href='/type/long'>long</a> migrated_from_max_id:flags.4?<a href='/type/int'>int</a> pinned_msg_id:flags.5?<a href='/type/int'>int</a> stickerset:flags.8?<a href='/type/StickerSet'>StickerSet</a> available_min_id:flags.9?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> linked_chat_id:flags.14?<a href='/type/long'>long</a> location:flags.15?<a href='/type/ChannelLocation'>ChannelLocation</a> slowmode_seconds:flags.17?<a href='/type/int'>int</a> slowmode_next_send_date:flags.18?<a href='/type/int'>int</a> stats_dc:flags.12?<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> call:flags.21?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.24?<a href='/type/int'>int</a> pending_suggestions:flags.25?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; groupcall_default_join_as:flags.26?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.27?<a href='/type/string'>string</a> requests_pending:flags.28?<a href='/type/int'>int</a> recent_requesters:flags.28?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; default_send_as:flags.29?<a href='/type/Peer'>Peer</a> available_reactions:flags.30?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/ChatFull'>ChatFull</a>;
<a href='/constructor/messages.chats'>messages.chats</a>#64ff9fd5 chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; = <a href='/type/messages.Chats'>messages.Chats</a>;
---functions---
<a href='/method/channels.setDiscussionGroup'>channels.setDiscussionGroup</a>#40582bb2 broadcast:<a href='/type/InputChannel'>InputChannel</a> group:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/channels.getGroupsForDiscussion'>channels.getGroupsForDiscussion</a>#f5dad378 = <a href='/type/messages.Chats'>messages.Chats</a>;</code></pre>
<p>A discussion group can be associated to a channel using <a href="/method/channels.setDiscussionGroup">channels.setDiscussionGroup</a>.<br>
The discussion group can be accessed in the client by clicking on the discuss button of the channel, or by accessing the <a href="/api/threads">comment section</a> of a specific post; the discussion group ID is also present in the <code>linked_chat_id</code> field of the <a href="/constructor/channelFull">channelFull</a> constructor. </p>
<p>All messages sent to the channel will also be sent to the linked group (with sender peer <code>from_id</code> equal to the peer of the linked channel); those messages will also be automatically <a href="/api/pin">pinned</a> in the group.<br>
The comment section of a particular post can be disabled by removing the channel post message from the discussion group. </p>
<h3><a class="anchor" href="#linking-a-discussion-group" id="linking-a-discussion-group" name="linking-a-discussion-group"><i class="anchor-icon"></i></a>Linking a discussion group</h3>
<p>To obtain a list of admined supergroups that a channel admin can possibly associate to a channel, use <a href="/method/channels.getGroupsForDiscussion">channels.getGroupsForDiscussion</a>.<br>
Returned <a href="/api/channel#basic-groups">basic group chats</a> must be first <a href="/api/channel#migration">upgraded to supergroups</a> before they can be set as a discussion group.<br>
Before linking a supergroup to a channel, access to the supergroup's old messages must also be enabled using <a href="/method/channels.togglePreHistoryHidden">channels.togglePreHistoryHidden</a>. </p>
<p>To set a returned supergroup as a discussion group use <a href="/method/channels.setDiscussionGroup">channels.setDiscussionGroup</a>.</p>
<p>Schema: </p>
<pre><code><a href='/constructor/boolFalse'>boolFalse</a>#bc799737 = <a href='/type/Bool'>Bool</a>;
<a href='/constructor/boolTrue'>boolTrue</a>#997275b5 = <a href='/type/Bool'>Bool</a>;
<a href='/constructor/messages.chats'>messages.chats</a>#64ff9fd5 chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; = <a href='/type/messages.Chats'>messages.Chats</a>;
---functions---
<a href='/method/channels.setDiscussionGroup'>channels.setDiscussionGroup</a>#40582bb2 broadcast:<a href='/type/InputChannel'>InputChannel</a> group:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/channels.getGroupsForDiscussion'>channels.getGroupsForDiscussion</a>#f5dad378 = <a href='/type/messages.Chats'>messages.Chats</a>;
<a href='/method/channels.togglePreHistoryHidden'>channels.togglePreHistoryHidden</a>#eabbb94c channel:<a href='/type/InputChannel'>InputChannel</a> enabled:<a href='/type/Bool'>Bool</a> = <a href='/type/Updates'>Updates</a>;</code></pre></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,134 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Message drafts</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to handle message drafts">
<meta property="og:title" content="Message drafts">
<meta property="og:image" content="89f7ae8e51fc1ce19f">
<meta property="og:description" content="How to handle message drafts">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/drafts" >Message drafts</a></li></ul></div>
<h1 id="dev_page_title">Message drafts</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Message <a href="https://telegram.org/blog/drafts">drafts</a> in Telegram allow syncing the text typed into message fields between devices.</p>
<h3><a class="anchor" href="#drafts" id="drafts" name="drafts"><i class="anchor-icon"></i></a>Drafts</h3>
<p>Drafts are represented by the <a href="/type/DraftMessage">DraftMessage</a> constructors.
The parameters of the peer-specific draft should be used as defaults when composing a message to be sent to a certain peer (in the case of media, the same draft should still be used as base, the message will become the caption).
If the user exits the app before sending the message, the message should be saved as a draft:</p>
<h3><a class="anchor" href="#saving-drafts" id="saving-drafts" name="saving-drafts"><i class="anchor-icon"></i></a>Saving drafts</h3>
<p>Drafts can be saved using the <a href="/method/messages.saveDraft">messages.saveDraft</a> method.</p>
<h3><a class="anchor" href="#downloading-drafts" id="downloading-drafts" name="downloading-drafts"><i class="anchor-icon"></i></a>Downloading drafts</h3>
<p>New drafts are automatically sent to all devices via <a href="/constructor/updateDraftMessage">updateDraftMessage</a> updates.</p>
<p><a href="/constructor/dialog">Dialog</a> objects fetched via the API also contain the draft associated with the dialog.</p>
<h3><a class="anchor" href="#clearing-drafts" id="clearing-drafts" name="clearing-drafts"><i class="anchor-icon"></i></a>Clearing drafts</h3>
<p>Drafts can be cleared by setting the <code>clear_draft</code> flag when sending messages or media using <a href="/method/messages.sendMessage">messages.sendMessage</a>, <a href="/method/messages.sendMedia">messages.sendMedia</a>, <a href="/method/messages.sendMultiMedia">messages.sendMultiMedia</a>, <a href="/method/messages.sendInlineBotResult">messages.sendInlineBotResult</a> and similar or manually by passing empty values to <a href="/method/messages.saveDraft">messages.saveDraft</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,247 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>End-to-End Encryption, Secret Chats</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="New feature for end-to-end-encrypted messaging.">
<meta property="og:title" content="End-to-End Encryption, Secret Chats">
<meta property="og:image" content="842181036bcb572cf0">
<meta property="og:description" content="New feature for end-to-end-encrypted messaging.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/end-to-end" >End-to-End Encryption, Secret Chats</a></li></ul></div>
<h1 id="dev_page_title">End-to-End Encryption, Secret Chats</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<blockquote>
<p>This article on MTProto's End-to-End encryption is meant for <strong>advanced users</strong>.
If you want to learn more about <a href="https://telegram.org/faq#secret-chats">Secret Chats</a> from a less intimidating source, kindly see our <a href="https://telegram.org/faq#secret-chats">general FAQ</a>.</p>
</blockquote>
<blockquote>
<p>Note that as of version 4.6, major Telegram clients are using <strong>MTProto 2.0</strong>.
MTProto v.1.0 is deprecated and is currently being phased out.</p>
</blockquote>
<hr>
<h5><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related articles</h5>
<p><div class="dev_page_nav_wrap"></p>
<ul>
<li><a href="/mtproto/security_guidelines">Security guidelines for developers</a></li>
<li><a href="/api/end-to-end/pfs">Perfect Forward Secrecy in Secret Chats</a></li>
<li><a href="/api/end-to-end/seq_no">Sequence numbers in Secret Chats</a></li>
<li><a href="/schema/end-to-end">End-to-End TL Schema</a></li>
</ul>
<p></div></p>
<hr>
<p>Secret Chats are one-on-one chats wherein messages are encrypted with a key held only by the chat's participants. Note that the <a href="/schema/end-to-end">schema</a> for these end-to-end encrypted Secret Chats is different from what is used for <a href="/mtproto">cloud chats</a>:</p>
<div>
<a href="/file/811140633/4/hHw6Zy2DPyQ.109500/cabc10049a7190694f" target="_blank"><img src="/file/811140633/4/hHw6Zy2DPyQ.109500/cabc10049a7190694f" title="End-to-end encryption in MTProto 2.0 (Secret Chats)" class="dev_page_image" style="max-width: 600px"></a>
</div>
<h4><a class="anchor" href="#a-note-on-mtproto-20" id="a-note-on-mtproto-20" name="a-note-on-mtproto-20"><i class="anchor-icon"></i></a>A note on MTProto 2.0</h4>
<p>This article describes the end-to-end encryption layer in the MTProto protocol version <strong>2.0</strong>.
The principal differences from version 1.0 (<a href="/api/end-to-end_v1">described here</a> for reference) are as follows:</p>
<ul>
<li>SHA-256 is used instead of SHA-1;</li>
<li>Padding bytes are involved in the computation of msg_key;</li>
<li>msg_key depends not only on the message to be encrypted, but on a portion of the secret chat key as well;</li>
<li>12..1024 padding bytes are used instead of 0..15 padding bytes in v.1.0.</li>
</ul>
<p>See also: <a href="https://core.telegram.org/mtproto">MTProto 2.0: Cloud Chats, server-client encryption</a></p>
<h3><a class="anchor" href="#key-generation" id="key-generation" name="key-generation"><i class="anchor-icon"></i></a>Key Generation</h3>
<p>Keys are generated using the <a href="https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange">Diffie-Hellman protocol</a>.</p>
<p>Let us consider the following scenario: User <strong>A</strong> would like to initiate end-to-end encrypted communication with User <strong>B</strong>.</p>
<h4><a class="anchor" href="#sending-a-request" id="sending-a-request" name="sending-a-request"><i class="anchor-icon"></i></a>Sending a Request</h4>
<p>User <strong>A</strong> executes <a href="/method/messages.getDhConfig">messages.getDhConfig</a> to obtain the Diffie-Hellman parameters: a prime <strong>p</strong>, and a high order element <strong>g</strong>.</p>
<p>Executing this method before each new key generation procedure is of vital importance. It makes sense to cache the values of the parameters together with the version in order to avoid having to receive all of the values every time. If the version stored on the client is still up-to-date, the server will return the constructor <a href="/constructor/messages.dhConfigNotModified">messages.dhConfigNotModified</a>.</p>
<p>Client is expected to check whether <strong>p</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 &lt; p &lt; 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 to avoid repeating lengthy computations in future. This cache might be shared with one used for <a href="/mtproto/auth_key">Authorization Key generation</a>.</p>
<p>If the client needs additional entropy for the random number generator, it can pass the <strong>random_length</strong> parameter (random_length&gt; 0) so the server generates its own random sequence <strong>random</strong> of the appropriate length.
<strong>Important</strong>: using the server's random sequence in its raw form may be unsafe, it must be combined with a client sequence.</p>
<p>Client <strong>A</strong> computes a 2048-bit number <strong>a</strong> (using sufficient entropy or the server's <strong>random</strong>; see above) and executes <a href="/method/messages.requestEncryption">messages.requestEncryption</a> after passing in <code>g_a := pow(g, a) mod dh_prime</code>.</p>
<p>User <strong>B</strong> receives the update <a href="/constructor/updateEncryption">updateEncryption</a> for all associated authorization keys (all authorized devices) with the chat constructor <a href="/constructor/encryptedChatRequested">encryptedChatRequested</a>. The user must be shown basic information about User <strong>A</strong> and must be prompted to accept or reject the request.</p>
<p>Both clients are to check that <strong>g</strong>, <strong>g_a</strong> and <strong>g_b</strong> are greater than one and smaller than <strong>p-1</strong>. We recommend checking that <strong>g_a</strong> and <strong>g_b</strong> are between <strong>2^{2048-64}</strong> and <strong>p - 2^{2048-64}</strong> as well.</p>
<h4><a class="anchor" href="#accepting-a-request" id="accepting-a-request" name="accepting-a-request"><i class="anchor-icon"></i></a>Accepting a Request</h4>
<p>After User <strong>B</strong> confirms the creation of a secret chat with <strong>A</strong> in the client interface, Client <strong>B</strong> also receives up-to-date configuration parameters for the Diffie-Hellman method. Thereafter, it generates a random 2048-bit number, <strong>b</strong>, using rules similar to those for <strong>a</strong>. </p>
<p>Having received <strong>g_a</strong> from the update with <a href="/constructor/encryptedChatRequested">encryptedChatRequested</a>, it can immediately generate the final shared key: <code>key = (pow(g_a, b) mod dh_prime)</code>. If key length &lt; 256 bytes, add several leading zero bytes as padding — so that the key is exactly 256 bytes long. Its fingerprint, <strong>key_fingerprint</strong>, is equal to the 64 last bits of SHA1 (key). </p>
<p><strong>Note 1:</strong> in this particular case SHA1 is used here even for MTProto 2.0 secret chats. </p>
<p><strong>Note 2:</strong> this fingerprint is used as a sanity check for the key exchange procedure to detect bugs when developing client software — it is not connected to the key visualization used on the clients as means of external authentication in secret chats. <a href="/api/end-to-end/pfs#key-visualization">Key visualizations</a> on the clients are generated using the first 128 bits of SHA1(initial key) followed by the first 160 bits of SHA256(key used when secret chat was updated to layer 46).</p>
<p>Client <strong>B</strong> executes <a href="/method/messages.acceptEncryption">messages.acceptEncryption</a> after passing it <code>g_b := pow(g, b) mod dh_prime</code> and <strong>key_fingerprint</strong>.</p>
<p>For all of Client <strong>B's</strong> authorized devices, except the current one, <a href="/constructor/updateEncryption">updateEncryption</a> updates are sent with the constructor <a href="/constructor/encryptedChatDiscarded">encryptedChatDiscarded</a>. Thereafter, the only device that will be able to access the secret chat is Device <strong>B</strong>, which made the call to <a href="/method/messages.acceptEncryption">messages.acceptEncryption</a>.</p>
<p>User <strong>A</strong> will be sent an <a href="/constructor/updateEncryption">updateEncryption</a> update with the constructor <a href="/constructor/encryptedChat">encryptedChat</a>, for the authorization key that initiated the chat.</p>
<p>With <strong>g_b</strong> from the update, Client <strong>A</strong> can also compute the shared key <code>key = (pow(g_b, a) mod dh_prime)</code>. If key length &lt; 256 bytes, add several leading zero bytes as padding — so that the key is exactly 256 bytes long. If the fingerprint for the received key is identical to the one that was passed to <a href="/constructor/encryptedChat">encryptedChat</a>, incoming messages can be sent and processed. Otherwise, <a href="/method/messages.discardEncryption">messages.discardEncryption</a> must be executed and the user notified.</p>
<h4><a class="anchor" href="#perfect-forward-secrecy" id="perfect-forward-secrecy" name="perfect-forward-secrecy"><i class="anchor-icon"></i></a>Perfect Forward Secrecy</h4>
<p>In order to keep past communications safe, official Telegram clients will initiate re-keying once a key has been used to decrypt and encrypt more than 100 messages, or has been in use for more than one week, provided the key has been used to encrypt at least one message. Old keys are then securely discarded and cannot be reconstructed, even with access to the new keys currently in use.</p>
<blockquote>
<p>The re-keying protocol is further described in this article: <a href="/api/end-to-end/pfs">Perfect Forward Secrecy in Secret Chats</a>.</p>
</blockquote>
<p>Please note that your client must support Forward Secrecy in Secret Chats to be compatible with official Telegram clients. </p>
<h3><a class="anchor" href="#sending-and-receiving-messages-in-a-secret-chat" id="sending-and-receiving-messages-in-a-secret-chat" name="sending-and-receiving-messages-in-a-secret-chat"><i class="anchor-icon"></i></a>Sending and Receiving Messages in a Secret Chat</h3>
<h4><a class="anchor" href="#serialization-and-encryption-of-outgoing-messages" id="serialization-and-encryption-of-outgoing-messages" name="serialization-and-encryption-of-outgoing-messages"><i class="anchor-icon"></i></a>Serialization and Encryption of Outgoing Messages</h4>
<p>A TL object of type <a href="/type/DecryptedMessage">DecryptedMessage</a> is created and contains the message in plain text. For backward compatibility, the object must be wrapped in the constructor <a href="/constructor/decryptedMessageLayer">decryptedMessageLayer</a> with an indication of the supported layer (starting with 46).</p>
<blockquote>
<p>The TL-Schema for the contents of end-to-end encrypted messages is available <a href="/schema/end-to-end">here »</a></p>
</blockquote>
<p>The resulting construct is serialized as an array of bytes using generic TL rules. The resulting array is prepended by 4 bytes containing the array length not counting these 4 bytes. </p>
<p>The byte array is padded with 12 to 1024 random padding bytes to make its length divisible by 16 bytes. (In the older MTProto 1.0 encryption, only 0 to 15 padding bytes were used.)</p>
<p>Message key, <strong>msg_key</strong>, is computed as the 128 middle bits of the SHA256 of the data obtained in the previous step, prepended by 32 bytes from the shared key <strong>key</strong>. (For the older MTProto 1.0 encryption, <strong>msg_key</strong> was computed differently, as the 128 lower bits of SHA1 of the data obtained in the previous steps, <em>excluding the padding bytes</em>.)</p>
<p>For MTProto 2.0, the AES key <strong>aes_key</strong> and initialization vector <strong>aes_iv</strong> are computed ( <strong>key</strong> is the shared key obtained during <a href="#key-generation">Key Generation</a> ) as follows:</p>
<ul>
<li>msg_key_large = SHA256 (substr (key, 88+x, 32) + plaintext + random_padding);</li>
<li>msg_key = substr (msg_key_large, 8, 16);</li>
<li>sha256_a = SHA256 (msg_key + substr (key, x, 36));</li>
<li>sha256_b = SHA256 (substr (key, 40+x, 36) + msg_key);</li>
<li>aes_key = substr (sha256_a, 0, 8) + substr (sha256_b, 8, 16) + substr (sha256_a, 24, 8);</li>
<li>aes_iv = substr (sha256_b, 0, 8) + substr (sha256_a, 8, 16) + substr (sha256_b, 24, 8);</li>
</ul>
<p>For MTProto 2.0, <strong>x=0</strong> for messages from the originator of the secret chat, <strong>x=8</strong> for the messages in the opposite direction.</p>
<p><em>For the obsolete MTProto 1.0, msg_key, aes_key, and aes_iv were computed differently (see <a href="/api/end-to-end_v1#serialization-and-encryption-of-outgoing-messages">this document</a> for reference).</em></p>
<p>Data is encrypted with a 256-bit key, <strong>aes_key</strong>, and a 256-bit initialization vector, <strong>aes-iv</strong>, using AES-256 encryption with infinite garble extension (IGE). Encryption key fingerprint <strong>key_fingerprint</strong> and the message key <strong>msg_key</strong> are added at the top of the resulting byte array.</p>
<p>Encrypted data is embedded into a <a href="/method/messages.sendEncrypted">messages.sendEncrypted</a> API call and passed to Telegram server for delivery to the other party of the Secret Chat.</p>
<h4><a class="anchor" href="#upgrading-to-mtproto-20-from-mtproto-10" id="upgrading-to-mtproto-20-from-mtproto-10" name="upgrading-to-mtproto-20-from-mtproto-10"><i class="anchor-icon"></i></a>Upgrading to MTProto 2.0 from MTProto 1.0</h4>
<p>As soon as both parties in a secret chat are using at least Layer 73, they should only use MTProto 2.0 for all outgoing messages. Some of the first received messages may use MTProto 1.0, if a sufficiently high starting layer has not been negotiated during the creation of the secret chat. After the first message encrypted with MTProto 2.0 (or the first message with Layer 73 or higher) is received, all messages with higher <a href="#sequence-numbers">sequence numbers</a> must be encrypted with MTProto 2.0 as well.</p>
<p>As long as the current layer is lower than 73, each party should try to decrypt received messages with MTProto 1.0, and if this is not successful (msg_key does not match), try MTProto 2.0. Once the first MTProto 2.0-encrypted message arrives (or the layer is upgraded to 73), there is no need to try MTProto 1.0 decryption for any of the further messages (unless the client is still waiting for some gaps to be closed).</p>
<h4><a class="anchor" href="#decrypting-an-incoming-message" id="decrypting-an-incoming-message" name="decrypting-an-incoming-message"><i class="anchor-icon"></i></a>Decrypting an Incoming Message</h4>
<p>The steps above are performed in reverse order.
When an encrypted message is received, you <strong>must</strong> check that msg_key is <strong>in fact</strong> equal to the 128 middle bits of the SHA256 hash of the decrypted message, prepended by 32 bytes taken from the shared <strong>key</strong>.
If the message layer is greater than the one supported by the client, the user must be notified that the client version is out of date and prompted to update.</p>
<h4><a class="anchor" href="#sequence-numbers" id="sequence-numbers" name="sequence-numbers"><i class="anchor-icon"></i></a>Sequence numbers</h4>
<p>It is necessary to interpret all messages in their original order to protect against possible manipulations. Secret chats support a special mechanism for handling seq_no counters independently from the server.</p>
<blockquote>
<p>Proper handling of these counters is further described in this article: <a href="/api/end-to-end/seq_no">Sequence numbers in Secret Chats</a>.</p>
</blockquote>
<p>Please note that your client must support sequence numbers in Secret Chats to be compatible with official Telegram clients. </p>
<h4><a class="anchor" href="#sending-encrypted-files" id="sending-encrypted-files" name="sending-encrypted-files"><i class="anchor-icon"></i></a>Sending Encrypted Files</h4>
<p>All files sent to secret chats are encrypted with one-time keys that are in no way related to the chat's shared key. Before an encrypted file is sent, it is assumed that the encrypted file's address will be attached to the outside of an encrypted message using the <strong>file</strong> parameter of the <a href="/method/messages.sendEncryptedFile">messages.sendEncryptedFile</a> method and that the key for direct decryption will be sent in the body of the message (the <strong>key</strong> parameter in the constructors <a href="/constructor/decryptedMessageMediaPhoto">decryptedMessageMediaPhoto</a>, <a href="/constructor/decryptedMessageMediaPhoto">decryptedMessageMediaVideo</a> and <a href="/constructor/decryptedMessageMediaPhoto">decryptedMessageMediaFile</a>.</p>
<p>Prior to a file being sent to a secret chat, 2 random 256-bit numbers are computed which will serve as the AES key and initialization vector used to encrypt the file. AES-256 encryption with infinite garble extension (IGE) is used in like manner.</p>
<p>The key fingerprint is computed as follows:</p>
<ul>
<li>digest = md5(key + iv)</li>
<li>fingerprint = substr(digest, 0, 4) XOR substr(digest, 4, 4)</li>
</ul>
<p>The encrypted contents of a file are stored on the server in much the same way as those of a <a href="/api/files">file in cloud chats</a>: piece by piece using calls to <a href="/method/upload.saveFilePart">upload.saveFilePart</a>.
A subsequent call to <a href="/method/messages.sendEncryptedFile">messages.sendEncryptedFile</a> will assign an identifier to the stored file and send the address together with the message. The recipient will receive an update with <a href="/constructor/encryptedMessage">encryptedMessage</a>, and the <strong>file</strong> parameter will contain file information.</p>
<p>Incoming and outgoing encrypted files can be forwarded to other secret chats using the constructor <a href="/constructor/inputEncryptedFile">inputEncryptedFile</a> to avoid saving the same content on the server twice.</p>
<h4><a class="anchor" href="#working-with-an-update-box" id="working-with-an-update-box" name="working-with-an-update-box"><i class="anchor-icon"></i></a>Working with an Update Box</h4>
<p>Secret chats are associated with specific devices (or rather with <a href="/mtproto/description#creating-an-authorization-key">authorization keys</a>), not users. A conventional message box, which uses <strong>pts</strong> to describe the client's status, is not suitable, because it is designed for long-term message storage and message access from different devices.</p>
<p>An additional temporary message queue is introduced as a solution to this problem. When an update regarding a message from a secret chat is sent, a new value of <strong>qts</strong> is sent, which helps reconstruct the difference if there has been a long break in the connection or in case of loss of an update.</p>
<p>As the number of events increases, the value of <strong>qts</strong> increases by 1 with each new event. The initial value may not (and will not) be equal to 0.</p>
<p>The fact that events from the temporary queue have been received and stored by the client is acknowledged explicitly by a call to the <a href="/method/messages.receivedQueue">messages.receivedQueue</a> method or implicitly by a call to <a href="/method/updates.getDifference">updates.getDifference</a> (the value of <strong>qts</strong> passed, not the final state). All messages acknowledged as delivered by the client, as well as any messages older than 7 days, may (and will) be deleted from the server.</p>
<p>Upon de-authorization, the event queue of the corresponding device will be forcibly cleared, and the value of <strong>qts</strong> will become irrelevant.</p>
<h2><a class="anchor" href="#updating-to-new-layers" id="updating-to-new-layers" name="updating-to-new-layers"><i class="anchor-icon"></i></a>Updating to new layers</h2>
<p>Your client should always store the maximal layer that is known to be supported by the client on the other side of a secret chat. When the secret chat is first created, this value should be initialized to 46. This remote layer value must always be updated immediately after receiving <em>any</em> packet containing information of an upper layer, i.e.:</p>
<ul>
<li>any secret chat message containing <em>layer_no</em> in its <code>decryptedMessageLayer</code> with <em>layer</em>&gt;=46, or</li>
<li>a <a href="/constructor/decryptedMessageActionNotifyLayer">decryptedMessageActionNotifyLayer</a> service message, wrapped as if it were the <a href="/constructor/decryptedMessageService">decryptedMessageService</a> constructor of the obsolete layer 8 (constructor <code>decryptedMessageService#aa48327d</code>).</li>
</ul>
<h4><a class="anchor" href="#notifying-the-remote-client-about-your-local-layer" id="notifying-the-remote-client-about-your-local-layer" name="notifying-the-remote-client-about-your-local-layer"><i class="anchor-icon"></i></a>Notifying the remote client about your local layer</h4>
<p>In order to notify the remote client of your local layer, your client must send a message of the <code>decryptedMessageActionNotifyLayer</code> type. This notification must be wrapped in a constructor of an appropriate layer.</p>
<p>There are two cases when your client must notify the remote client about its local layer:</p>
<ol>
<li>As soon as a new secret chat has been created, immediately after the secret key has been successfully exchanged.</li>
<li>Immediately after the local client has been updated to support a new secret chat layer. In this case notifications must be sent to <strong>all</strong> currently existing secret chats. Note that this is only necessary when updating to new layers that contain changes in the secret chats implementation (e.g. you don't need to do this when your client is updated from Layer 46 to Layer 47).</li>
</ol></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,179 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Perfect Forward Secrecy</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram supports Perfect Forward Secrecy (PFS) in Secret Chats as of Layer 20. See updating to new layers.
In order to…">
<meta property="og:title" content="Perfect Forward Secrecy">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram supports Perfect Forward Secrecy (PFS) in Secret Chats as of Layer 20. See updating to new layers.
In order to…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/end-to-end" >Secret Chats</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/end-to-end%2Fpfs" >Perfect Forward Secrecy</a></li></ul></div>
<h1 id="dev_page_title">Perfect Forward Secrecy</h1>
<div id="dev_page_content"><blockquote>
<p>Telegram supports Perfect Forward Secrecy (PFS) in Secret Chats as of Layer 20. See <a href="/api/end-to-end#updating-to-new-layers">updating to new layers</a>.</p>
</blockquote>
<p>In order to keep past communications safe, official Telegram clients will initiate re-keying once a key has been used to decrypt and encrypt more than 100 messages, or has been in use for more than one week, provided the key has been used to encrypt at least one message. Old keys are then securely discarded and cannot be reconstructed, even with access to the new keys currently in use.</p>
<p>Any client participating in a Secret Chat can initiate re-keying as soon as it perceives that the current key has been used for too long or for encrypting too many messages. Please note that you should never initiate a new instance of the re-keying protocol if an uncompleted instance exists, initiated by either party.</p>
<p><strong>Note:</strong> third-party developers are required to maintain the same level of security. All clients with secret chat support must be able to initiate re-keying and accept relevant service messages. See <a href="/mtproto/security_guidelines">Security Guidelines</a>.</p>
<h3><a class="anchor" href="#re-keying-protocol" id="re-keying-protocol" name="re-keying-protocol"><i class="anchor-icon"></i></a>Re-keying protocol</h3>
<p>New keys are generated by exchanging special messages, using previously established keys for encryption. The re-keying protocol between parties A and B normally consists of four steps:</p>
<h5><a class="anchor" href="#1-decryptedmessageactionrequestkey" id="1-decryptedmessageactionrequestkey" name="1-decryptedmessageactionrequestkey"><i class="anchor-icon"></i></a>1. decryptedMessageActionRequestKey</h5>
<p>A (re-keying initiator) generates a new value of <em>a</em>, subject to the same limitations as for the <a href="https://core.telegram.org/api/end-to-end#key-generation">initial Diffie-Hellman key exchange</a>, and sends the value of <em>pow(g,a)</em> to B, embedded in a <a href="/constructor/decryptedMessageService">decryptedMessageService</a>:</p>
<pre><code><a href='/constructor/decryptedMessageActionRequestKey'>decryptedMessageActionRequestKey</a> exchange_id:<a href='/type/long'>long</a> g_a:<a href='/type/string'>string</a> = <a href='/type/DecryptedMessageAction'>DecryptedMessageAction</a>;</code></pre>
<ul>
<li><em>exchange_id</em> is a random number identifying this instance of the Re-Keying Protocol for both parties</li>
<li><em>g_a</em> is the value of <em>pow(g,a) mod p</em></li>
</ul>
<p>Note that the same Diffie--Hellman parameters <em>(p,g)</em> as for the initial Diffie--Hellman key exchange in this secret chat are used. They do not need to be re-transmitted explicitly.</p>
<h5><a class="anchor" href="#2-decryptedmessageactionacceptkey" id="2-decryptedmessageactionacceptkey" name="2-decryptedmessageactionacceptkey"><i class="anchor-icon"></i></a>2. decryptedMessageActionAcceptKey</h5>
<p>Upon receipt of the above service message, B checks its content, and generates a response with same <em>exchange_id</em>, for a newly generated value of <em>b</em>:</p>
<pre><code><a href='/constructor/decryptedMessageActionAcceptKey'>decryptedMessageActionAcceptKey</a> exchange_id:<a href='/type/long'>long</a> g_b:<a href='/type/string'>string</a> key_fingerprint:<a href='/type/long'>long</a> = <a href='/type/DecryptedMessageAction'>DecryptedMessageAction</a>;</code></pre>
<ul>
<li><em>exchange_id</em> is the same as in the received <a href="/constructor/decryptedMessageActionRequestKey">decryptedMessageActionRequestKey</a></li>
<li><em>g_b</em> is the value of <em>pow(g,b) mod p</em></li>
<li><em>key_fingerprint</em> is the 64-bit fingerprint of the newly generated <em>key = pow(g_a, b) mod p</em>, used as a sanity check of the implementation</li>
</ul>
<p>At this stage, B can already compute the new key <em>key</em> = <em>pow(g_a, b) mod p</em> and its <em>key_fingerprint</em> (last 64 bits of its SHA-1). However, it continues using the previous key until the completion of the exchange.</p>
<p>Once side B sends <a href="/constructor/decryptedMessageActionAcceptKey">decryptedMessageActionAcceptKey</a>, it cannot abort the key exchange; it must be ready to switch to the new key immediately after a <code>decryptedMessageActionCommitKey</code> is received. Therefore, if side B wishes to delay the usage of new key, for example in order to fill some seq_no gaps first, it must delay the <code>decryptedMessageActionAcceptKey</code> answer accordingly.</p>
<h5><a class="anchor" href="#3-decryptedmessageactioncommitkey" id="3-decryptedmessageactioncommitkey" name="3-decryptedmessageactioncommitkey"><i class="anchor-icon"></i></a>3. decryptedMessageActionCommitKey</h5>
<p>Once A receives a valid <code>decryptedMessageActionAcceptKey</code>, it performs all necessary checks, and "commits" the new key by means of the following service message:</p>
<pre><code><a href='/constructor/decryptedMessageActionCommitKey'>decryptedMessageActionCommitKey</a> exchange_id:<a href='/type/long'>long</a> key_fingerprint:<a href='/type/long'>long</a> = <a href='/type/DecryptedMessageAction'>DecryptedMessageAction</a>;</code></pre>
<ul>
<li><em>exchange_id</em> is the same as in the two previous messages</li>
<li><em>key_fingerprint</em> is the value of the hash (last 64 bits of SHA-1) of the new key computed by A, for implementation sanity check</li>
</ul>
<p>After that, A can (and must) encrypt all following messages with the new key.</p>
<p>If side A wishes to delay installation of the new key, for example because there are some seq_no gaps that it wants to fill first, it must delay <a href="/constructor/decryptedMessageActionCommitKey">decryptedMessageActionCommitKey</a> answer accordingly.</p>
<h5><a class="anchor" href="#4-final-step" id="4-final-step" name="4-final-step"><i class="anchor-icon"></i></a>4. Final step</h5>
<p>When B receives either a <code>decryptedMessageActionCommitKey</code> or a message encrypted by the new key, recognized by the value of <em>key_fingerprint</em> prepended to the encrypted message (it may happen that the <code>decryptedMessageActionCommitKey</code> has been lost and will be re-requested later), it assumes that A has started using the new key for encryption, and does the same.</p>
<p>However, the previous key may be kept until there are no gaps in received messages up to the switch to the new key. Once all the gaps have been filled, the old key must be securely discarded.</p>
<p>There is one exception to this rule — the SHA-1 of the original key (generated during the establishment of Secret Chat in question) is always stored, in order to show <a href="#key-visualization">key visualizations</a> on the clients.</p>
<h4><a class="anchor" href="#aborting-protocol" id="aborting-protocol" name="aborting-protocol"><i class="anchor-icon"></i></a>Aborting protocol</h4>
<p>Any of the parties may abort any instance of an uncompleted re-keying protocol, unless <code>decryptedMessageActionCommitKey</code> or <code>decryptedMessageActionAcceptKey</code> has been already sent by the party in question. In order to abort re-keying, send</p>
<pre><code><a href='/constructor/decryptedMessageActionAbortKey'>decryptedMessageActionAbortKey</a> exchange_id:<a href='/type/long'>long</a> = <a href='/type/DecryptedMessageAction'>DecryptedMessageAction</a>;</code></pre>
<p>This could be done, for example, if the party is already participating in a different instance of the re-keying protocol, or if the received values of <em>g_a</em>, <em>g_b</em> and other parameters do not pass security checks. In the latter case, it might be advisable to abort the Secret Chat altogether.</p>
<h4><a class="anchor" href="#discarding-previous-keys" id="discarding-previous-keys" name="discarding-previous-keys"><i class="anchor-icon"></i></a>Discarding Previous Keys</h4>
<p>Once B receives <code>decryptedMessageActionCommitKey</code>, it can safely discard the previous key provided there are no gaps. However, A may only discard the previous key after a message encrypted with the new key has been received. If no ordinary messages are scheduled to be sent, a special <a href="/constructor/decryptedMessageActionNoop">no-op message</a> should sent by B for this purpose:</p>
<pre><code><a href='/constructor/decryptedMessageActionNoop'>decryptedMessageActionNoop</a> = <a href='/type/DecryptedMessageAction'>DecryptedMessageAction</a>;</code></pre>
<h4><a class="anchor" href="#concurrent-re-keying" id="concurrent-re-keying" name="concurrent-re-keying"><i class="anchor-icon"></i></a>Concurrent Re-Keying</h4>
<p>It may happen that both parties concurrently initiate re-keying by sending <code>decryptedMessageActionRequestKey</code> without knowing that the other party has already done so. If each side aborts re-keying because it is already participating in another instance of the protocol initiated by itself, the re-keying will never happen.</p>
<p>Because of this possibility, we suggest that only the instance with the smaller <em>exchange_id</em> is aborted, with the option to re-use its <em>(a,g_a)</em> for the re-keying protocol instance with the larger <em>exchange_id</em> (when compared as a <code>long</code>, i.e. signed little-endian 64-bit integer).</p>
<p>In other words, if a <code>decryptedMessageActionRequestKey</code> is received after A has sent its <code>decryptedMessageActionRequestKey</code>, but has not yet received <code>decryptedMessageActionAcceptKey</code>, the following is to be done:</p>
<ul>
<li>if <em>exchange_id</em> in the sent <code>decryptedMessageActionRequestKey</code> was larger than that in the <code>decryptionActionRequestKey</code> just received, abort the newly-suggested re-keying protocol instance without sending explicit <a href="/constructor/decryptedMessageActionAbortKey">decryptedMessageActionAbortKey</a> (the other side will do the same according to the next rule).</li>
<li>if <em>exchange_id</em> in our <code>decryptedMessageActionRequestKey</code> was smaller, respond to the newly-received <code>decryptedMessageActionRequestKey</code> with a <code>decryptedMessageActionAcceptKey</code>, and participate only in the re-keying protocol instance initiated by the other side. It is possible to re-use at this stage the value of <em>g_a</em> (now called <em>g_b</em>) that was generated for the original <code>decryptedMessageActionRequestKey</code>, now abandoned, or totally new <em>(b,g_b)</em> can be generated. </li>
<li>in the unlikely (2^{-64}) case both <em>exchange_id</em> are equal, abort both instances without sending an explicit <code>decryptedMessageActionAbortKey</code>. The other side will do the same.</li>
</ul>
<h5><a class="anchor" href="#key-visualization" id="key-visualization" name="key-visualization"><i class="anchor-icon"></i></a>Key Visualization</h5>
<p>Since all re-keying instances are carried over the secure channel established when the secret chat is created, it is necessary for the user to confirm that no MITM attack had taken place during the initial exchange. The key visualization on the clients uses the first 128-bits of the SHA-1 of the original key created when the Secret Chat was first established, followed by the first 160 bits of the SHA-256 of the key in use when the secret chat was updated to layer 46 (coincides with the original key if chat was created using layer 46).</p>
<blockquote>
<p>Please note that the <em>key_fingerprint</em> parameter was introduced as a maintenance tool (with a misleading name) and is <strong>not</strong> related to key visualization on the clients.</p>
</blockquote></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,176 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Sequence numbers in Secret Chats</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="It is necessary to interpret all messages in their original order to protect against reordering, reflection, replay, omission…">
<meta property="og:title" content="Sequence numbers in Secret Chats">
<meta property="og:image" content="">
<meta property="og:description" content="It is necessary to interpret all messages in their original order to protect against reordering, reflection, replay, omission…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/end-to-end" >Secret Chats</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/end-to-end%2Fseq_no" >Sequence numbers in Secret Chats</a></li></ul></div>
<h1 id="dev_page_title">Sequence numbers in Secret Chats</h1>
<div id="dev_page_content"><p>It is necessary to interpret <strong>all</strong> messages in their original order to protect against reordering, reflection, replay, omission and other manipulations (<a href="/constructor/decryptedMessageActionResend">decryptedMessageActionResend</a> messages are the only exception to this rule, see <a href="#avoiding-concurrent-gaps">avoiding concurrent gaps</a>). Secret chats support a special mechanism for handling <strong>seq_no</strong> counters independently from the server. Note that any <em>service messages</em> in secret chats must also increment the <strong>seq_no</strong>.</p>
<p>All Secret Chats messages in clients using Layer 17 or higher are wrapped in <a href="/constructor/decryptedMessageLayer">decryptedMessageLayer</a> and have <strong>seq_no</strong> (sequence number) counters attached to them. The <strong>seq_no</strong> counters in their raw form are initialized with <strong>(out_seq_no, in_seq_no) := (0,0)</strong>, and incremented strictly by 1 after any message (service or not) is sent/received and processed. They must be protected from mirroring before being sent to the remote client by transformation according to formula <strong>2*raw_seq_no+x</strong>, where <strong>x</strong> is 0 or 1, determined by the following rule:</p>
<table class="table">
<tbody>
<tr>
<td><strong>in_seq_no</strong></td>
<td><strong>out_seq_no</strong></td>
</tr>
<tr>
<td>secret chat initiated by sender</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>secret chat initiated by recipient</td>
<td>1</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>In this way the least significant bit of each <strong>seq_no</strong> field included in the message is different for incoming and outgoing messages. This is done to prevent a possible attacker from mirroring the messages. If any of the received <strong>in_seq_no</strong> or <strong>out_seq_no</strong> are not consistent in terms of parity (see table above), the client is required to immediately abort the secret chat.</p>
<blockquote>
<p>E.g., the first message the local client sends to any secret chat will have <strong>out_seq_no</strong> of <strong>0+x_out</strong>, the second one will have <strong>out_seq_no</strong> of <strong>2*1+x_out</strong>, and so on, where <strong>x_out</strong> is 0 if the chat was initiated by the remote client, 1 otherwise; similarly for the received messages, but there <strong>x_in</strong> is used instead of <strong>x_out</strong> and is equal to 0 if the chat was initiated by the local client, 1 otherwise. </p>
</blockquote>
<p>Raw sequence numbers will be used in the remaining part of this text, unless otherwise specified.</p>
<h4><a class="anchor" href="#preventing-gaps" id="preventing-gaps" name="preventing-gaps"><i class="anchor-icon"></i></a>Preventing gaps</h4>
<p>Your client must ensure that all outgoing secret chat messages are queued on the server in the correct order. This is achieved by correctly placing them into the <a href="/method/invokeAfterMsgs">invokeAfterMsgs</a> chain. Failure to do this may result in gaps on the remote client, which may in turn lead to aborted secret chats. The local client must maintain the correct sequence of <strong>in_seq_no</strong> for the remote client. To achieve this, assign <strong>in_seq_no</strong> and <strong>out_seq_no</strong> to each message at the <em>exact</em> moment when the message is created, and never change them in the future.</p>
<h2><a class="anchor" href="#security-checks" id="security-checks" name="security-checks"><i class="anchor-icon"></i></a>Security checks</h2>
<h4><a class="anchor" href="#checking-out-seq-no" id="checking-out-seq-no" name="checking-out-seq-no"><i class="anchor-icon"></i></a>Checking out_seq_no</h4>
<p>Your client must check that it has received <em>each</em> message with the sequence number <strong>out_seq_no</strong> starting from 0 to some current point <strong>C</strong>. It should then expect the next message to have the sequence number <strong>out_seq_no=C+1</strong>. If the <strong>out_seq_no</strong> in the received message does not match this, the following needs to be done:</p>
<ul>
<li>If the received <strong>out_seq_no&lt;=C</strong>, the local client must drop the message (repeated message). The client should not check the contents of the message because the original message could have been deleted (see <a href="#deleting-unacknowledged-messages">Deleting unacknowledged messages</a>).</li>
<li>If the received <strong>out_seq_no&gt;C+1</strong>, it most likely means that the server left out some messages due to a technical failure or due to the messages becoming obsolete. A temporary solution to this is to simply abort the secret chat. But since this may cause some existing older secret chats to be aborted, it is strongly recommended for the client to properly handle such <strong>seq_no</strong> gaps. Note that <strong>in_seq_no</strong> is not increased upon receipt of such a message; it is advanced only after all preceding gaps are filled.</li>
</ul>
<h4><a class="anchor" href="#proper-handling-of-gaps" id="proper-handling-of-gaps" name="proper-handling-of-gaps"><i class="anchor-icon"></i></a>Proper handling of gaps</h4>
<p>In order to correctly handle incoming messages after a hole has been identified (when received <strong>out_seq_no&gt;C+1</strong>), it is necessary to put received messages with the wrong <strong>seq_no</strong> into a "waiting queue" on the local client, and to re-request the missing messages using the special constructor <a href="/constructor/decryptedMessageActionResend">decryptedMessageActionResend</a> <code>start_seq_no:<a href='/type/int'>int</a> end_seq_no:<a href='/type/int'>int</a> = <a href='/type/DecryptedMessageAction'>DecryptedMessageAction</a>;</code>. The sequence numbers used in this constructor must be ready for interpretation by the remote client and therefore <em>cannot</em> be in their raw form: you can easily get the necessary <strong>start_seq_no</strong> by adding 2 to the <strong>out_seq_no</strong> of the last message before the hole and the <strong>end_seq_no</strong> by subtracting 2 from the <strong>out_seq_no</strong> of the received message with the wrong sequence number.</p>
<p>Each hole normally requires only one request to resend messages — if the remote client keeps sending out of sync messages, they should be put into the queue without sending a new request. Having received the missing messages, the local client must first interpret these messages in the right order by their <strong>seq_no</strong>. Once this is done, the client can proceed to interpret messages from the queue (again, in the right <strong>seq_no</strong> order).</p>
<p>Special cases:</p>
<ul>
<li>Note that having <em>two</em> gaps simultaneously is very rare (provided that the remote client and server are operating normally) and it is acceptable to abort the secret chat in this situation.</li>
<li>If a local client receives <a href="/constructor/decryptedMessageActionResend">decryptedMessageActionResend</a> but is unable to satisfy the request, it must abort the secret chat.</li>
</ul>
<h4><a class="anchor" href="#avoiding-concurrent-gaps" id="avoiding-concurrent-gaps" name="avoiding-concurrent-gaps"><i class="anchor-icon"></i></a>Avoiding concurrent gaps</h4>
<p>In order to avoid getting stuck with concurrent gaps on both sides, <a href="/constructor/decryptedMessageActionResend">decryptedMessageActionResend</a> must always be interpreted <em>immediately upon receipt</em> in all cases, even if its <strong>out_seq_no&gt;=C+1</strong>. Note that each <a href="/constructor/decryptedMessageActionResend">decryptedMessageActionResend</a> must only be handled once, it must not be interpreted again when we interpret messages in the queue.</p>
<h4><a class="anchor" href="#checking-and-handling-in-seq-no" id="checking-and-handling-in-seq-no" name="checking-and-handling-in-seq-no"><i class="anchor-icon"></i></a>Checking and handling in_seq_no</h4>
<p><strong>in_seq_no</strong> of all received messages must be <em>valid</em>. To ensure this, perform the following checks:</p>
<ul>
<li><strong>in_seq_no</strong> must form a non-decreasing sequence of non-negative integer numbers.</li>
<li><strong>in_seq_no</strong> must be valid at the moment of receiving the message, that is, if <strong>D</strong> is the <strong>out_seq_no</strong> of last message we sent, the received <strong>in_seq_no</strong> should not be greater than <strong>D + 1</strong>. This also allows us to insert the received message into its correct place in the secret chat. For example, imagine that the local client has sent 5 secret chat messages, and then receives a secret chat message with the text "Yes" and <strong>in_seq_no=2</strong>. In this situation the local client <em>must</em> place that message after the second message it sent. This makes manipulations with delayed messages impossible.</li>
</ul>
<p>If <code>in_seq_no</code> contradicts these criteria, the local client is required to immediately abort the secret chat. This could happen only in case of malicious or buggy behaviour on either server or remote client side.</p>
<h4><a class="anchor" href="#deleting-unacknowledged-messages" id="deleting-unacknowledged-messages" name="deleting-unacknowledged-messages"><i class="anchor-icon"></i></a>Deleting unacknowledged messages</h4>
<p>In case the user on the local client has deleted a message <em>before</em> the server (or the remote client, if <a href="/constructor/decryptedMessageActionResend">decryptedMessageActionResend</a> is handled correctly) could acknowledge the message, for security reasons, you must:</p>
<ul>
<li>securely destroy the contents of the message (as in case of any other deleted Secret Chat message);</li>
<li>change the local copy of the original message to <code>decryptedMessageActionDeleteMessages</code> with <strong>random_id</strong> equal to its own <strong>random_id</strong>;</li>
<li>create a new outgoing message deleting the original message.</li>
</ul>
<p>This must be done because your client doesn't know whether the remote client really received the message or not. In the case the message was already received, it will be deleted by the second message; otherwise it must arrive as a "self-delete" message to maintain the correct sequence of seq_no.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,218 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>End-to-End Encrypted Voice and Video Calls</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="This article describes the end-to-end encryption used for Telegram voice and video calls.
Related Articles
End-to-End Encryption…">
<meta property="og:title" content="End-to-End Encrypted Voice and Video Calls">
<meta property="og:image" content="">
<meta property="og:description" content="This article describes the end-to-end encryption used for Telegram voice and video calls.
Related Articles
End-to-End Encryption…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/end-to-end%2Fvideo-calls" >End-to-End Encrypted Voice and Video Calls</a></li></ul></div>
<h1 id="dev_page_title">End-to-End Encrypted Voice and Video Calls</h1>
<div id="dev_page_content"><p>This article describes the end-to-end encryption used for Telegram <strong>voice</strong> and <strong>video calls</strong>.</p>
<h5><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related Articles</h5>
<p><div class="dev_page_nav_wrap"></p>
<ul>
<li><a href="/api/end-to-end">End-to-End Encryption in Secret Chats</a></li>
<li><a href="/mtproto/security_guidelines">Security Guidelines for Client Developers</a>
</div></li>
</ul>
<hr>
<h2><a class="anchor" href="#establishing-calls" id="establishing-calls" name="establishing-calls"><i class="anchor-icon"></i></a>Establishing Calls</h2>
<p>Before a call is ready, some preliminary actions have to be performed. The calling party needs to contact the party to be called and check whether it is ready to accept the call. Besides that, the parties have to negotiate the protocols to be used, learn the IP addresses of each other or of the Telegram relay servers to be used (so-called <em>reflectors</em>), and generate a one-time encryption key for this voice call with the aid of <em>Diffie--Hellman key exchange</em>. All of this is accomplished in parallel with the aid of several Telegram API methods and related notifications. This document covers details related to key generation, encryption and security.</p>
<h2><a class="anchor" href="#key-generation" id="key-generation" name="key-generation"><i class="anchor-icon"></i></a>Key Generation</h2>
<p>The Diffie-Hellman key exchange, as well as the whole protocol used to create a new voice call, is quite similar to the one used for <a href="/api/end-to-end#key-generation">Secret Chats</a>. We recommend studying the linked article before proceeding.</p>
<p>However, we have introduced some important changes to facilitate the <a href="#key-verification">key verification process</a>. Below is the entire exchange between the two communicating parties, the Caller (A) and the Callee (B), through the Telegram servers (S).</p>
<ul>
<li><em>A</em> executes <a href="/method/messages.getDhConfig">messages.getDhConfig</a> to find out the 2048-bit Diffie-Hellman prime <em>p</em> and generator <em>g</em>. The client is expected to check whether <em>p</em> is a safe prime and perform all the <a href="/api/end-to-end#sending-a-request">security checks</a> necessary for secret chats.</li>
<li><em>A</em> chooses a random value of <em>a</em>, 1 &lt; a &lt; p-1, and computes <em>g_a:=power(g,a) mod p</em> (a 256-byte number) and <em>g_a_hash:=SHA256(g_a)</em> (32 bytes long).</li>
<li><em>A</em> invokes (sends to server <em>S</em>) <a href="/method/phone.requestCall">phone.requestCall</a>, which has the field <code>g_a_hash:bytes</code>, among others. For this call, this field is to be filled with <em>g_a_hash</em>, <strong>not</strong> <em>g_a</em> itself.</li>
<li>The Server <em>S</em> performs privacy checks and sends an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> update with a <a href="/constructor/phoneCallRequested">phoneCallRequested</a> constructor to all of <em>B</em>'s active devices. This update, apart from the identity of <em>A</em> and other relevant parameters, contains the <em>g_a_hash</em> field, filled with the value obtained from <em>A</em>.</li>
<li><em>B</em> accepts the call on one of their devices, stores the received value of <em>g_a_hash</em> for this instance of the voice call creation protocol, chooses a random value of <em>b</em>, 1 &lt; b &lt; p-1, computes <em>g_b:=power(g,b) mod p</em>, performs all the required security checks, and invokes the <a href="/method/phone.acceptCall">phone.acceptCall</a> method, which has a <em>g_b:bytes</em> field (among others), to be filled with the value of <em>g_b</em> itself (not its hash).</li>
<li>The Server <em>S</em> sends an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> with the <a href="/constructor/phoneCallDiscarded">phoneCallDiscarded</a> constructor to all other devices <em>B</em> has authorized, to prevent accepting the same call on any of the other devices. From this point on, the server <em>S</em> works only with that of <em>B</em>'s devices which has invoked <a href="/method/phone.acceptCall">phone.acceptCall</a> first.</li>
<li>The Server <em>S</em> sends to <em>A</em> an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> update with <a href="/constructor/phoneCallAccepted">phoneCallAccepted</a> constructor, containing the value of <em>g_b</em> received from <em>B</em>.</li>
<li><em>A</em> performs all the usual security checks on <em>g_b</em> and <em>a</em>, computes the Diffie--Hellman key <em>key:=power(g_b,a) mod p</em> and its fingerprint <em>key_fingerprint:long</em>, equal to the lower 64 bits of <em>SHA1(key)</em>, the same as with secret chats. Then <em>A</em> invokes the <a href="/method/phone.confirmCall">phone.confirmCall</a> method, containing <code>g_a:bytes</code> and <code>key_fingerprint:long</code>.</li>
<li>The Server <em>S</em> sends to <em>B</em> an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> update with the <a href="/constructor/phoneCall">phoneCall</a> constructor, containing the value of <em>g_a</em> in <em>g_a_or_b:bytes</em> field, and <em>key_fingerprint:long</em></li>
<li>At this point <em>B</em> receives the value of <em>g_a</em>. It checks that <em>SHA256(g_a)</em> is indeed equal to the previously received value of <em>g_a_hash</em>, performs all the <a href="/mtproto/security_guidelines">usual Diffie-Hellman security checks</a>, and computes the key <em>key:=power(g_a,b) mod p</em> and its fingerprint, equal to the lower 64 bits of <em>SHA1(key)</em>. Then it checks that this fingerprint equals the value of <code>key_fingerprint:long</code> received from the other side, as an implementation sanity check.</li>
</ul>
<p>At this point, the Diffie--Hellman key exchange is complete, and both parties have a 256-byte shared secret key <em>key</em> which is used to encrypt all further exchanges between <em>A</em> and <em>B</em>.</p>
<p>It is of paramount importance to accept each update only once for each instance of the key generation protocol, discarding any duplicates or alternative versions of already received and processed messages (updates).</p>
<h2><a class="anchor" href="#encryption" id="encryption" name="encryption"><i class="anchor-icon"></i></a>Encryption</h2>
<blockquote>
<p>This document describes encryption in <strong>voice and video calls</strong> as implemented in Telegram apps with versions <strong>7.0</strong> and above. See <a href="https://core.telegram.org/api/end-to-end/voice-calls">this document</a> for details on encryption used in <strong>voice calls</strong> in app versions released before <strong>August 14, 2020</strong>.</p>
</blockquote>
<p>The <a href="https://github.com/TelegramMessenger/tgcalls">Telegram Voice and Video Call Library</a> uses an optimized version of <a href="/">MTProto 2.0</a> to send and receive <strong>packets</strong>, consisting of one or more end-to-end encrypted <strong>messages</strong> of various types (<a href="https://webrtcglossary.com/ice/"><em>ice</em></a> <em>candidates list, video formats, remote video status, audio stream data, video stream data, message ack</em> or <em>empty</em>).</p>
<p>This document describes only the encryption process, leaving out encoding and network-dependent parts.</p>
<p>The library starts working with:</p>
<ul>
<li>An <a href="#encryption-key">encryption key</a> <code>key</code> shared between the parties, as generated above.</li>
<li>Information whether the call is <strong>outgoing</strong> or <strong>incoming</strong>.</li>
<li>Two data transfer channels: <strong>signaling</strong>, offered by the Telegram API, and <strong>transport</strong> based on WebRTC.</li>
</ul>
<p>Both data transfer channels are unreliable (messages may get lost), but <strong>signaling</strong> is slower and more reliable.</p>
<h3><a class="anchor" href="#encrypting-call-data" id="encrypting-call-data" name="encrypting-call-data"><i class="anchor-icon"></i></a>Encrypting Call Data</h3>
<p>The body of a packet (<code>decrypted_body</code>) consists of several messages and their respective <code>seq</code> numbers concatenated together.</p>
<ul>
<li>decrypted_body = message_seq1 + message_body1 + message_seq2 + message_body2</li>
</ul>
<p>Each <code>decrypted_body</code> is unique because no two <code>seq</code> numbers of the first message can be the same. If only old messages need to be re-sent, an <em>empty</em> message with new unique <code>seq</code> is added to the packet first.</p>
<p>The <a href="#key-generation">encryption key</a> <code>key</code> is used to compute a 128-bit <code>msg_key</code> and then a 256-bit <code>aes_key</code> and a 128-bit <code>aes_iv</code>:</p>
<ul>
<li>msg_key_large = SHA256 (substr(key, 88+x, 32) + decrypted_body);</li>
<li>msg_key = substr (msg_key_large, 8, 16);</li>
<li>sha256_a = SHA256 (msg_key + substr (key, x, 36));</li>
<li>sha256_b = SHA256 (substr (key, 40+x, 36) + msg_key);</li>
<li>aes_key = substr (sha256_a, 0, 8) + substr (sha256_b, 8, 16) + substr (sha256_a, 24, 8);</li>
<li>aes_iv = substr (sha256_b, 0, 4) + substr (sha256_a, 8, 8) + substr (sha256_b, 24, 4);</li>
</ul>
<p><code>x</code> depends on whether the call is <strong>outgoing</strong> or <strong>incoming</strong> and on the connection type:</p>
<ul>
<li>x = 0 for <strong>outgoing</strong> + <strong>transport</strong></li>
<li>x = 8 for <strong>incoming</strong> + <strong>transport</strong></li>
<li>x = 128 for <strong>outgoing</strong> + <strong>signaling</strong></li>
<li>x = 136 for <strong>incoming</strong> + <strong>signaling</strong></li>
</ul>
<p>This allows apps to decide which packet types will be sent to which connections and work in these connections independently (with each having its own <code>seq</code> counter).</p>
<p>The resulting <code>aes_key</code> and <code>aes_iv</code> are used to encrypt <code>decrypted_body</code>:</p>
<ul>
<li>encrypted_body = AES_CTR (decrypted_body, aes_key, aes_iv)</li>
</ul>
<p>The packet that gets sent consists of <code>msg_key</code> and <code>encrypted_body</code>:</p>
<ul>
<li>packet_bytes = msg_key + encrypted_body</li>
</ul>
<p>When received, the packet gets decrypted using <code>key</code> and <code>msg_key</code>, after which <code>msg_key</code> is checked against the relevant <code>SHA256</code> substring. If the check fails, the packet <strong>must</strong> be discarded.</p>
<h3><a class="anchor" href="#protecting-against-replay-attacks" id="protecting-against-replay-attacks" name="protecting-against-replay-attacks"><i class="anchor-icon"></i></a>Protecting Against Replay Attacks</h3>
<p>Each of the peers maintains its own 32-bit monotonically increasing counter for outgoing messages, <code>seq</code>, starting with <code>1</code>. This <code>seq</code> counter is prepended to each sent message and increased by <code>1</code> for each new message. No two <code>seq</code> numbers of the first message in a packet can be the same. If only old messages need to be re-sent, an <em>empty</em> message with a new unique <code>seq</code> is added to the packet first. When the <code>seq</code> counter reaches <code>2^30</code>, the call must be aborted. Each peer stores <code>seq</code> values of all the messages it has received (and processed) which are larger than <code>max_received_seq - 64</code>, where <code>max_received_seq</code> is the largest <code>seq</code> number received so far.</p>
<p>If a packet is received, the first message of which has a <code>seq</code> that is smaller or equal to <code>max_received_seq - 64</code> or its <code>seq</code> had already been received, the message is discarded. Otherwise, the <code>seq</code> values of all incoming messages are memorized and <code>max_received_seq</code> is adjusted. This guarantees that no two packets will be processed twice.</p>
<h2><a class="anchor" href="#key-verification" id="key-verification" name="key-verification"><i class="anchor-icon"></i></a>Key Verification</h2>
<p>To verify the key, and ensure that no MITM attack is taking place, both parties concatenate the secret key <em>key</em> with the value <em>g_a</em> of the Caller ( <em>A</em> ), compute SHA256 and use it to generate a sequence of emoticons. More precisely, the SHA256 hash is split into four 64-bit integers; each of them is divided by the total number of emoticons used (currently 333), and the remainder is used to select specific emoticons. The specifics of the protocol guarantee that comparing four emoticons out of a set of 333 is sufficient to prevent eavesdropping (MiTM attack on DH) with a probability of <strong>0.9999999999</strong>.</p>
<p>This is because instead of the standard Diffie-Hellman key exchange which requires only two messages between the parties:</p>
<ul>
<li>A-&gt;B : (generates a and) sends g_a := g^a</li>
<li>B-&gt;A : (generates b and true key (g_a)^b, then) sends g_b := g^b</li>
<li>A : computes key (g_b)^a</li>
</ul>
<p>we use a <strong>three-message modification</strong> thereof that works well when both parties are online (which also happens to be a requirement for voice calls):</p>
<ul>
<li>A-&gt;B : (generates a and) sends g_a_hash := hash(g^a)</li>
<li>B-&gt;A : (stores g_a_hash, generates b and) sends g_b := g^b</li>
<li>A-&gt;B : (computes key (g_b)^a, then) sends g_a := g^a</li>
<li>B : checks hash(g_a) == g_a_hash, then computes key (g_a)^b</li>
</ul>
<p>The idea here is that <em>A</em> commits to a specific value of <em>a</em> (and of <em>g_a</em>) without disclosing it to <em>B</em>. <em>B</em> has to choose its value of <em>b</em> and <em>g_b</em> without knowing the true value of <em>g_a</em>, so that it cannot try different values of <em>b</em> to force the final key <em>(g_a)^b</em> to have any specific properties (such as fixed lower 32 bits of SHA256(key)). At this point, <em>B</em> commits to a specific value of <em>g_b</em> without knowing <em>g_a</em>. Then <em>A</em> has to send its value <em>g_a</em>; it cannot change it even though it knows <em>g_b</em> now, because the other party <em>B</em> would accept only a value of <em>g_a</em> that has a hash specified in the very first message of the exchange.</p>
<p>If some impostor is pretending to be either <em>A</em> or <em>B</em> and tries to perform a Man-in-the-Middle Attack on this Diffie--Hellman key exchange, the above still holds. Party <em>A</em> will generate a shared key with <em>B</em> -- or whoever pretends to be <em>B</em> -- without having a second chance to change its exponent <em>a</em> depending on the value <em>g_b</em> received from the other side; and the impostor will not have a chance to adapt his value of <em>b</em> depending on <em>g_a</em>, because it has to commit to a value of <em>g_b</em> before learning <em>g_a</em>. The same is valid for the key generation between the impostor and the party <em>B</em>.</p>
<p>The use of hash commitment in the DH exchange constrains the attacker to only <strong>one guess</strong> to generate the correct visualization in their attack, which means that using just over 33 bits of entropy represented by four emoji in the visualization is enough to make a successful attack highly improbable.</p>
<blockquote>
<p>For a slightly more user-friendly explanation of the above see: <a href="https://core.telegram.org/techfaq#q-how-are-voice-calls-authenticated">How are calls authenticated?</a></p>
</blockquote></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,181 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>End-to-End Encrypted Voice Calls</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="This document describes encryption in voice calls as implemented in Telegram apps with versions &lt; 7.0. See this document…">
<meta property="og:title" content="End-to-End Encrypted Voice Calls">
<meta property="og:image" content="">
<meta property="og:description" content="This document describes encryption in voice calls as implemented in Telegram apps with versions &lt; 7.0. See this document…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/end-to-end%2Fvoice-calls" >End-to-End Encrypted Voice Calls</a></li></ul></div>
<h1 id="dev_page_title">End-to-End Encrypted Voice Calls</h1>
<div id="dev_page_content"><blockquote>
<p>This document describes encryption in <strong>voice calls</strong> as implemented in Telegram apps with versions <strong>&lt; 7.0</strong>. See <a href="https://core.telegram.org/api/end-to-end/video-calls">this document</a> for details on encryption used in <strong>voice and video calls</strong> in app versions released on <strong>August 14, 2020</strong> and later.</p>
</blockquote>
<h5><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related articles</h5>
<p><div class="dev_page_nav_wrap"></p>
<ul>
<li><a href="/api/end-to-end/video-calls">End-to-End Encryption in Voice and Video Calls</a></li>
<li><a href="/api/end-to-end">End-to-End Encryption in Secret Chats</a></li>
<li><a href="/mtproto/security_guidelines">Security Guidelines for Client Developers</a>
</div></li>
</ul>
<h2><a class="anchor" href="#establishing-voice-calls" id="establishing-voice-calls" name="establishing-voice-calls"><i class="anchor-icon"></i></a>Establishing voice calls</h2>
<p>Before a voice call is ready, some preliminary actions have to be performed. The calling party needs to contact the party to be called and check whether it is ready to accept the call. Besides that, the parties have to negotiate the protocols to be used, learn the IP addresses of each other or of the Telegram relay servers to be used (so-called <em>reflectors</em>), and generate a one-time encryption key for this voice call with the aid of <em>Diffie--Hellman key exchange</em>. All of this is accomplished in parallel with the aid of several Telegram API methods and related notifications. This document details the generation of the encryption key. Other negotiations will be eventually documented elsewhere.</p>
<h2><a class="anchor" href="#key-generation" id="key-generation" name="key-generation"><i class="anchor-icon"></i></a>Key Generation</h2>
<p>The Diffie-Hellman key exchange, as well as the whole protocol used to create a new voice call, is quite similar to the one used for <a href="/api/end-to-end#key-generation">Secret Chats</a>. We recommend studying the linked article before proceeding.</p>
<p>However, we have introduced some important changes to facilitate the <a href="#key-verification">key verification process</a>. Below is the entire exchange between the two communicating parties, the Caller (A) and the Callee (B), through the Telegram servers (S).</p>
<ul>
<li><em>A</em> executes <a href="/method/messages.getDhConfig">messages.getDhConfig</a> to find out the 2048-bit Diffie-Hellman prime <em>p</em> and generator <em>g</em>. The client is expected to check whether <em>p</em> is a safe prime and perform all the <a href="/api/end-to-end#sending-a-request">security checks</a> necessary for secret chats.</li>
<li><em>A</em> chooses a random value of <em>a</em>, 1 &lt; a &lt; p-1, and computes <em>g_a:=power(g,a) mod p</em> (a 256-byte number) and <em>g_a_hash:=SHA256(g_a)</em> (32 bytes long).</li>
<li><em>A</em> invokes (sends to server <em>S</em>) <a href="/method/phone.requestCall">phone.requestCall</a>, which has the field <code>g_a_hash:bytes</code>, among others. For this call, this field is to be filled with <em>g_a_hash</em>, <strong>not</strong> <em>g_a</em> itself.</li>
<li>The Server <em>S</em> performs privacy checks and sends an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> update with a <a href="/constructor/phoneCallRequested">phoneCallRequested</a> constructor to all of <em>B</em>'s active devices. This update, apart from the identity of <em>A</em> and other relevant parameters, contains the <em>g_a_hash</em> field, filled with the value obtained from <em>A</em>.</li>
<li><em>B</em> accepts the call on one of their devices, stores the received value of <em>g_a_hash</em> for this instance of the voice call creation protocol, chooses a random value of <em>b</em>, 1 &lt; b &lt; p-1, computes <em>g_b:=power(g,b) mod p</em>, performs all the required security checks, and invokes the <a href="/method/phone.acceptCall">phone.acceptCall</a> method, which has a <em>g_b:bytes</em> field (among others), to be filled with the value of <em>g_b</em> itself (not its hash).</li>
<li>The Server <em>S</em> sends an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> with the <a href="/constructor/phoneCallDiscarded">phoneCallDiscarded</a> constructor to all other devices <em>B</em> has authorized, to prevent accepting the same call on any of the other devices. From this point on, the server <em>S</em> works only with that of <em>B</em>'s devices which has invoked <a href="/method/phone.acceptCall">phone.acceptCall</a> first.</li>
<li>The Server <em>S</em> sends to <em>A</em> an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> update with <a href="/constructor/phoneCallAccepted">phoneCallAccepted</a> constructor, containing the value of <em>g_b</em> received from <em>B</em>.</li>
<li><em>A</em> performs all the usual security checks on <em>g_b</em> and <em>a</em>, computes the Diffie--Hellman key <em>key:=power(g_b,a) mod p</em> and its fingerprint <em>key_fingerprint:long</em>, equal to the lower 64 bits of <em>SHA1(key)</em>, the same as with secret chats. Then <em>A</em> invokes the <a href="/method/phone.confirmCall">phone.confirmCall</a> method, containing <code>g_a:bytes</code> and <code>key_fingerprint:long</code>.</li>
<li>The Server <em>S</em> sends to <em>B</em> an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> update with the <a href="/constructor/phoneCall">phoneCall</a> constructor, containing the value of <em>g_a</em> in <em>g_a_or_b:bytes</em> field, and <em>key_fingerprint:long</em></li>
<li>At this point <em>B</em> receives the value of <em>g_a</em>. It checks that <em>SHA256(g_a)</em> is indeed equal to the previously received value of <em>g_a_hash</em>, performs all the <a href="/mtproto/security_guidelines">usual Diffie-Hellman security checks</a>, and computes the key <em>key:=power(g_a,b) mod p</em> and its fingerprint, equal to the lower 64 bits of <em>SHA1(key)</em>. Then it checks that this fingerprint equals the value of <code>key_fingerprint:long</code> received from the other side, as an implementation sanity check.</li>
</ul>
<p>At this point, the Diffie--Hellman key exchange is complete, and both parties have a 256-byte shared secret key <em>key</em> which is used to encrypt all further exchanges between <em>A</em> and <em>B</em>.</p>
<p>It is of paramount importance to accept each update only once for each instance of the key generation protocol, discarding any duplicates or alternative versions of already received and processed messages (updates).</p>
<h2><a class="anchor" href="#encryption-of-voice-data" id="encryption-of-voice-data" name="encryption-of-voice-data"><i class="anchor-icon"></i></a>Encryption of voice data</h2>
<p>Both parties <em>A</em> (the Caller) and <em>B</em> (the Callee) transform the voice information into a sequence of small <em>chunks</em> or <em>packets</em>, not more than 1 kilobyte each. This information is to be encrypted using the shared key <em>key</em> generated during the initial exchange, and sent to the other party, either directly (P2P) or through Telegram's relay servers (so-called <em>reflectors</em>). This document describes only the encryption process for each chunk, leaving out voice encoding and the network-dependent parts.</p>
<h3><a class="anchor" href="#encapsulation-of-low-level-voice-data" id="encapsulation-of-low-level-voice-data" name="encapsulation-of-low-level-voice-data"><i class="anchor-icon"></i></a>Encapsulation of low-level voice data</h3>
<p>The low-level data chunk <code>raw_data:string</code>, obtained from voice encoder, is first encapsulated into one of the two constructors for the <a href="/type/DecryptedDataBlock">DecryptedDataBlock</a> type, similar to <a href="/type/DecryptedMessage">DecryptedMessage</a> used in secret chats:</p>
<pre><code><a href='/constructor/decryptedDataBlock'>decryptedDataBlock</a>#dbf948c1 random_id:<a href='/type/long'>long</a> random_bytes:<a href='/type/string'>string</a> flags:<a href='/type/%23'>#</a> voice_call_id:flags.2?<a href='/constructor/int128'>int128</a> in_seq_no:flags.4?<a href='/type/int'>int</a> out_seq_no:flags.4?<a href='/type/int'>int</a> recent_received_mask:flags.5?<a href='/type/int'>int</a> proto:flags.3?<a href='/type/int'>int</a> extra:flags.1?<a href='/type/string'>string</a> raw_data:flags.0?<a href='/type/string'>string</a> = <a href='/type/DecryptedDataBlock'>DecryptedDataBlock</a>;
<a href='/constructor/simpleDataBlock'>simpleDataBlock</a>#cc0d0e76 random_id:<a href='/type/long'>long</a> random_bytes:<a href='/type/string'>string</a> raw_data:<a href='/type/string'>string</a> = <a href='/type/DecryptedDataBlock'>DecryptedDataBlock</a>;</code></pre>
<p>Here <code>out_seq_no</code> is the chunk's sequence number among all sent by this party (starting from one), <code>in_seq_no</code> -- the highest known out_seq_no from the received packets. The parameter <code>recent_received_mask</code> is a 32-bit mask, used to track delivery of the last 32 packets sent by the other party. The bit <em>i</em> is set if a packet with <code>out_seq_no</code> equal to <code>in_seq_no</code>-<em>i</em> has been received.</p>
<p>The higher 8 bits in <code>flags</code> are reserved for use by the lower-level protocol (the one which generates and interprets <code>raw_data</code>), and will never be used for future extensions of <code>decryptedDataBlock</code>.</p>
<p>The parameters <code>voice_call_id</code> and <code>proto</code> are mandatory until the other side confirms reception of at least one packet by sending a packet with a non-zero <code>in_seq_no</code>. After that, they become optional, and the <code>simpleDataBlock</code> constructor can be used if the lower level protocol wants to.</p>
<p>The parameter <code>voice_call_id</code> is computed from the key <code>key</code> and equals the lower 128 bits of its SHA-256.</p>
<p>The <code>random_bytes</code> string should contain at least 7 bytes of random data. The field <code>random_id</code> also contains 8 random bytes, which can be used as a unique packet identifier if necessary.</p>
<h3><a class="anchor" href="#mtproto-encryption" id="mtproto-encryption" name="mtproto-encryption"><i class="anchor-icon"></i></a>MTProto encryption</h3>
<p>Once the data is encapsulated in <code>DecryptedDataBlock</code>, it is <a href="/mtproto/TL">TL-serialized</a> and encrypted with <a href="https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector">MTProto</a>, using <code>key</code> instead of <code>auth_key</code>; the parameter <em>x</em> is to be set to <em>0</em> for messages from <em>A</em> to <em>B</em>, and to <em>8</em> for messages in the opposite direction. Encrypted data are prepended by the 128-bit <code>msg_key</code> (usual for MTProto); before that, either the 128-bit <code>voice_call_id</code> (if P2P is used) or the <code>peer_tag</code> (if reflectors are used) is prepended. The resulting data packet is sent by UDP either directly to the other party (if P2P is possible) or to the Telegram relay servers (reflectors).</p>
<h2><a class="anchor" href="#key-verification" id="key-verification" name="key-verification"><i class="anchor-icon"></i></a>Key Verification</h2>
<p>To verify the key, both parties concatenate the secret key <em>key</em> with the value <em>g_a</em> of the Caller ( <em>A</em> ), compute SHA256 and use it to generate a sequence of emoticons. More precisely, the SHA256 hash is split into four 64-bit integers; each of them is divided by the total number of emoticons used (currently 333), and the remainder is used to select specific emoticons. The specifics of the protocol guarantee that comparing four emoticons out of a set of 333 is sufficient to prevent eavesdropping (MiTM attack on DH) with a probability of <strong>0.9999999999</strong>.</p>
<p>This is because instead of the standard Diffie-Hellman key exchange which requires only two messages between the parties:</p>
<ul>
<li>A-&gt;B : (generates a and) sends g_a := g^a</li>
<li>B-&gt;A : (generates b and true key (g_a)^b, then) sends g_b := g^b</li>
<li>A : computes key (g_b)^a</li>
</ul>
<p>we use a <strong>three-message modification</strong> thereof that works well when both parties are online (which also happens to be a requirement for voice calls):</p>
<ul>
<li>A-&gt;B : (generates a and) sends g_a_hash := hash(g^a)</li>
<li>B-&gt;A : (stores g_a_hash, generates b and) sends g_b := g^b</li>
<li>A-&gt;B : (computes key (g_b)^a, then) sends g_a := g^a</li>
<li>B : checks hash(g_a) == g_a_hash, then computes key (g_a)^b</li>
</ul>
<p>The idea here is that <em>A</em> commits to a specific value of <em>a</em> (and of <em>g_a</em>) without disclosing it to <em>B</em>. <em>B</em> has to choose its value of <em>b</em> and <em>g_b</em> without knowing the true value of <em>g_a</em>, so that it cannot try different values of <em>b</em> to force the final key <em>(g_a)^b</em> to have any specific properties (such as fixed lower 32 bits of SHA256(key)). At this point, <em>B</em> commits to a specific value of <em>g_b</em> without knowing <em>g_a</em>. Then <em>A</em> has to send its value <em>g_a</em>; it cannot change it even though it knows <em>g_b</em> now, because the other party <em>B</em> would accept only a value of <em>g_a</em> that has a hash specified in the very first message of the exchange.</p>
<p>If some impostor is pretending to be either <em>A</em> or <em>B</em> and tries to perform a Man-in-the-Middle Attack on this Diffie--Hellman key exchange, the above still holds. Party <em>A</em> will generate a shared key with <em>B</em> -- or whoever pretends to be <em>B</em> -- without having a second chance to change its exponent <em>a</em> depending on the value <em>g_b</em> received from the other side; and the impostor will not have a chance to adapt his value of <em>b</em> depending on <em>g_a</em>, because it has to commit to a value of <em>g_b</em> before learning <em>g_a</em>. The same is valid for the key generation between the impostor and the party <em>B</em>.</p>
<p>The use of hash commitment in the DH exchange constrains the attacker to only <strong>one guess</strong> to generate the correct visualization in their attack, which means that using just over 33 bits of entropy represented by four emoji in the visualization is enough to make a successful attack highly improbable.</p>
<blockquote>
<p>For a slightly more user-friendly explanation of the above see: <a href="https://core.telegram.org/techfaq#q-how-are-voice-calls-authenticated">How are calls authenticated?</a></p>
</blockquote></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,228 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Secret chats, end-to-end encryption (v. 1.0, DEPRECATED)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="This document describes end-to-end encrypted Secret Chats in MTProto 1.0, its status is DEPRECATED.
For information on…">
<meta property="og:title" content="Secret chats, end-to-end encryption (v. 1.0, DEPRECATED)">
<meta property="og:image" content="https://blogfork.telegram.org/file/811140845/3/3aEkph1_NYU/cf861ae5ea85912769">
<meta property="og:description" content="This document describes end-to-end encrypted Secret Chats in MTProto 1.0, its status is DEPRECATED.
For information on…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/end-to-end_v1" >Secret chats, end-to-end encryption (v.…</a></li></ul></div>
<h1 id="dev_page_title">Secret chats, end-to-end encryption (v. 1.0, DEPRECATED)</h1>
<div id="dev_page_content"><blockquote>
<p>This document describes end-to-end encrypted Secret Chats in MTProto 1.0, its status is <strong>DEPRECATED</strong>.
For information on end-to-end encryption used in up-to-date Telegram clients, kindly see <a href="/api/end-to-end">this document</a>.</p>
</blockquote>
<h5><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related articles</h5>
<p><div class="dev_page_nav_wrap"></p>
<ul>
<li><a href="/api/end-to-end">Secret Chats, MTProto 2.0</a></li>
<li><a href="/api/end-to-end/voice-calls">End-to-end-encryption in Voice Calls</a></li>
<li><a href="/mtproto/security_guidelines">Security guidelines for developers</a></li>
<li><a href="/api/end-to-end/pfs">Perfect Forward Secrecy in Secret Chats</a></li>
<li><a href="/api/end-to-end/seq_no">Sequence numbers in Secret Chats</a></li>
<li><a href="/schema/end-to-end">End-to-End TL Schema</a></li>
</ul>
<p></div></p>
<hr>
<p>Secret Chats are one-on-one chats wherein messages are encrypted with a key held only by the chat's participants. Please note that the <a href="/schema/end-to-end">schema</a> for end-to-end encrypted Secret Chats is different from what is used for <a href="/mtproto">cloud chats</a>:</p>
<div>
<a href="/file/811140845/3/3aEkph1_NYU/cf861ae5ea85912769" target="_blank"><img src="/file/811140845/3/3aEkph1_NYU/cf861ae5ea85912769" title="End-to-end encryption in MTProto (Secret Chats)" class="dev_page_image"></a>
</div>
<h3><a class="anchor" href="#key-generation" id="key-generation" name="key-generation"><i class="anchor-icon"></i></a>Key Generation</h3>
<p>The Diffie-Hellman protocol is used for key generation. For more information, see <a href="https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange">Wikipedia</a>.</p>
<p>Let us consider the following scenario: User <strong>A</strong> would like to initiate encrypted communication with User <strong>B</strong>.</p>
<h4><a class="anchor" href="#sending-a-request" id="sending-a-request" name="sending-a-request"><i class="anchor-icon"></i></a>Sending a Request</h4>
<p>User <strong>A</strong> executes <a href="/method/messages.getDhConfig">messages.getDhConfig</a> to obtain the Diffie-Hellman parameters: a prime <strong>p</strong>, and a high order element <strong>g</strong>.</p>
<p>Executing this method before each new key generation procedure is of vital importance. It makes sense to cache the values of the parameters together with the version in order to avoid having to receive all of the values every time. If the version stored on the client is still up-to-date, the server will return the constructor <a href="/constructor/messages.dhConfigNotModified">messages.dhConfigNotModified</a>.</p>
<p>Client is expected to check whether <strong>p</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 &lt; p &lt; 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 to avoid repeating lengthy computations in future. This cache might be shared with one used for <a href="/mtproto/auth_key">Authorization Key generation</a>.</p>
<p>If the client has an inadequate random number generator, it makes sense to pass the <strong>random_length</strong> parameter (random_length&gt; 0) so the server generates its own random sequence <strong>random</strong> of the appropriate length.
<strong>Important</strong>: using the server's random sequence in its raw form may be unsafe. It must be combined with a client sequence, for example, by generating a client random number of the same length (<strong>client_random</strong>) and using <code>final_random := random XOR client_random</code>.</p>
<p>Client <strong>A</strong> computes a 2048-bit number <strong>a</strong> (using sufficient entropy or the server's <strong>random</strong>; see above) and executes <a href="/method/messages.requestEncryption">messages.requestEncryption</a> after passing in <code>g_a := pow(g, a) mod dh_prime</code>.</p>
<p>User <strong>B</strong> receives the update <a href="/constructor/updateEncryption">updateEncryption</a> for all associated authorization keys (all authorized devices) with the chat constructor <a href="/constructor/encryptedChatRequested">encryptedChatRequested</a>. The user must be shown basic information about User <strong>A</strong> and must be prompted to accept or reject the request.</p>
<p>Both clients are to check that <strong>g</strong>, <strong>g_a</strong> and <strong>g_b</strong> are greater than one and smaller than <strong>p-1</strong>. We recommend checking that <strong>g_a</strong> and <strong>g_b</strong> are between <strong>2^{2048-64}</strong> and <strong>p - 2^{2048-64}</strong> as well.</p>
<h4><a class="anchor" href="#accepting-a-request" id="accepting-a-request" name="accepting-a-request"><i class="anchor-icon"></i></a>Accepting a Request</h4>
<p>After User <strong>B</strong> confirms the creation of a secret chat with <strong>A</strong> in the client interface, Client <strong>B</strong> also receives up-to-date configuration parameters for the Diffie-Hellman method. Thereafter, it generates a random 2048-bit number, <strong>b</strong>, using rules similar to those for <strong>a</strong>. </p>
<p>Having received <strong>g_a</strong> from the update with <a href="/constructor/encryptedChatRequested">encryptedChatRequested</a>, it can immediately generate the final shared key: <code>key = (pow(g_a, b) mod dh_prime)</code>. If key length &lt; 256 bytes, add several leading zero bytes as padding — so that the key is exactly 256 bytes long. Its fingerprint, <strong>key_fingerprint</strong>, is equal to the 64 last bits of SHA1 (key).</p>
<p><strong>Note:</strong> this fingerprint is used as a sanity check for the key exchange procedure to detect bugs while developing client software — it is not connected to the key visualization used on the clients as means of external authentication in secret chats. <a href="/api/end-to-end/pfs#key-visualization">Key visualizations</a> on the clients are generated using the first 128 bits of SHA1(initial key) followed by the first 160 bits of SHA256(key used when secret chat was updated to layer 46).</p>
<p>Client <strong>B</strong> executes <a href="/method/messages.acceptEncryption">messages.acceptEncryption</a> after passing it <code>g_b := pow(g, b) mod dh_prime</code> and <strong>key_fingerprint</strong>.</p>
<p>For all of Client <strong>B's</strong> authorized devices, except the current one, <a href="/constructor/updateEncryption">updateEncryption</a> updates are sent with the constructor <a href="/constructor/encryptedChatDiscarded">encryptedChatDiscarded</a>. Thereafter, the only device that will be able to access the secret chat is Device <strong>B</strong>, which made the call to <a href="/method/messages.acceptEncryption">messages.acceptEncryption</a>.</p>
<p>User <strong>A</strong> will be sent an <a href="/constructor/updateEncryption">updateEncryption</a> update with the constructor <a href="/constructor/encryptedChat">encryptedChat</a>, for the authorization key that initiated the chat.</p>
<p>With <strong>g_b</strong> from the update, Client <strong>A</strong> can also receive the shared key <code>key = (pow(g_b, a) mod dh_prime)</code>. If key length &lt; 256 bytes, add several leading zero bytes as padding — so that the key is exactly 256 bytes long. If the fingerprint for the received key is identical to the one that was passed to <a href="/constructor/encryptedChat">encryptedChat</a>, incoming messages can be sent and processed. Otherwise, <a href="/method/messages.discardEncryption">messages.discardEncryption</a> must be executed and the user notified.</p>
<h4><a class="anchor" href="#perfect-forward-secrecy" id="perfect-forward-secrecy" name="perfect-forward-secrecy"><i class="anchor-icon"></i></a>Perfect Forward Secrecy</h4>
<p>In order to keep past communications safe, official Telegram clients will initiate re-keying once a key has been used to decrypt and encrypt more than 100 messages, or has been in use for more than one week, provided the key has been used to encrypt at least one message. Old keys are then securely discarded and cannot be reconstructed, even with access to the new keys currently in use.</p>
<blockquote>
<p>The re-keying protocol is further described in this article: <a href="/api/end-to-end/pfs">Perfect Forward Secrecy in Secret Chats</a>.</p>
</blockquote>
<p>Please note that your client must support Forward Secrecy in Secret Chats to be compatible with official Telegram clients. </p>
<h3><a class="anchor" href="#sending-and-receiving-messages-in-a-secret-chat" id="sending-and-receiving-messages-in-a-secret-chat" name="sending-and-receiving-messages-in-a-secret-chat"><i class="anchor-icon"></i></a>Sending and Receiving Messages in a Secret Chat</h3>
<h4><a class="anchor" href="#serialization-and-encryption-of-outgoing-messages" id="serialization-and-encryption-of-outgoing-messages" name="serialization-and-encryption-of-outgoing-messages"><i class="anchor-icon"></i></a>Serialization and Encryption of Outgoing Messages</h4>
<p>A TL object of type <a href="/type/DecryptedMessage">DecryptedMessage</a> is created and contains the message in plain text. For backward compatibility, the object must be wrapped in the constructor <a href="/constructor/decryptedMessageLayer">decryptedMessageLayer</a> with an indication of the supported layer (starting with 8).
The TL-Schema for end-to-end encrypted messages contents is represented <a href="/schema/end-to-end">here »</a>.</p>
<p>The resulting construct is serialized as an array of bytes using generic TL rules. The resulting array is padded at the top with 4 bytes of the array length not counting these 4 bytes.
A message key, <strong>msg_key</strong>, is computed as the 128 low-order bits of the SHA1 of the data obtained in the previous step.
The byte array is padded with random data until its length is divisible by 16 bytes.
An AES key and an initialization vector are computed ( <strong>key</strong> is the shared key obtained during <a href="#key-generation">Key Generation</a>; in MTProto 1.0, <strong>x</strong> = 0 ):</p>
<ul>
<li>msg_key = substr (SHA1 (plaintext), 4, 16);</li>
<li>sha1_a = SHA1 (msg_key + substr (key, x, 32));</li>
<li>sha1_b = SHA1 (substr (key, 32+x, 16) + msg_key + substr (key, 48+x, 16));</li>
<li>sha1_с = SHA1 (substr (key, 64+x, 32) + msg_key);</li>
<li>sha1_d = SHA1 (msg_key + substr (key, 96+x, 32));</li>
<li>aes_key = substr (sha1_a, 0, 8) + substr (sha1_b, 8, 12) + substr (sha1_c, 4, 12);</li>
<li>aes_iv = substr (sha1_a, 8, 12) + substr (sha1_b, 0, 8) + substr (sha1_c, 16, 4) + substr (sha1_d, 0, 8);</li>
</ul>
<p>Data is encrypted with a 256-bit key, <strong>aes_key</strong>, and a 256-bit initialization vector, <strong>aes-iv</strong>, using AES-256 encryption with infinite garble extension (IGE). Encryption key fingerprint <strong>key_fingerprint</strong> and the message key <strong>msg_key</strong> are added at the top of the resulting byte array.</p>
<p>Encrypted data is embedded into a <a href="/method/messages.sendEncrypted">messages.sendEncrypted</a> API call and passed to Telegram server for delivery to the other party of the Secret Chat.</p>
<h4><a class="anchor" href="#decrypting-an-incoming-message" id="decrypting-an-incoming-message" name="decrypting-an-incoming-message"><i class="anchor-icon"></i></a>Decrypting an Incoming Message</h4>
<p>The steps above are performed in reverse order.
When an encrypted message is received, you <strong>must</strong> check that msg_key is <strong>in fact</strong> equal to the 128 low-order bits of the SHA1 hash of the decrypted message.
If the message layer is greater than the one supported by the client, the user must be notified that the client version is out of date and prompted to update.</p>
<h4><a class="anchor" href="#sequence-numbers" id="sequence-numbers" name="sequence-numbers"><i class="anchor-icon"></i></a>Sequence numbers</h4>
<p>It is necessary to interpret all messages in their original order to protect against possible manipulations. Secret chats support a special mechanism for handling seq_no counters independently from the server.</p>
<blockquote>
<p>Proper handling of these counters is further described in this article: <a href="/api/end-to-end/seq_no">Sequence numbers in Secret Chats</a>.</p>
</blockquote>
<p>Please note that your client must support sequence numbers in Secret Chats to be compatible with official Telegram clients. </p>
<h4><a class="anchor" href="#sending-encrypted-files" id="sending-encrypted-files" name="sending-encrypted-files"><i class="anchor-icon"></i></a>Sending Encrypted Files</h4>
<p>All files sent to secret chats are encrypted with one-time keys that are in no way related to the chat's shared key. Before an encrypted file is sent, it is assumed that the encrypted file's address will be attached to the outside of an encrypted message using the <strong>file</strong> parameter of the <a href="/method/messages.sendEncryptedFile">messages.sendEncryptedFile</a> method and that the key for direct decryption will be sent in the body of the message (the <strong>key</strong> parameter in the constructors <a href="/constructor/decryptedMessageMediaPhoto">decryptedMessageMediaPhoto</a>, <a href="/constructor/decryptedMessageMediaPhoto">decryptedMessageMediaVideo</a> and <a href="/constructor/decryptedMessageMediaPhoto">decryptedMessageMediaFile</a>.</p>
<p>Prior to a file being sent to a secret chat, 2 random 256-bit numbers are computed which will serve as the AES key and initialization vector used to encrypt the file. AES-256 encryption with infinite garble extension (IGE) is used in like manner.</p>
<p>The key fingerprint is computed as follows:</p>
<ul>
<li>digest = md5(key + iv)</li>
<li>fingerprint = substr(digest, 0, 4) XOR substr(digest, 4, 4)</li>
</ul>
<p>The encrypted contents of a file are stored on the server in much the same way as those of a <a href="/api/files">file in cloud chats</a>: piece by piece using calls to <a href="/method/upload.saveFilePart">upload.saveFilePart</a>.
A subsequent call to <a href="/method/messages.sendEncryptedFile">messages.sendEncryptedFile</a> will assign an identifier to the stored file and send the address together with the message. The recipient will receive an update with <a href="/constructor/encryptedMessage">encryptedMessage</a>, and the <strong>file</strong> parameter will contain file information.</p>
<p>Incoming and outgoing encrypted files can be forwarded to other secret chats using the constructor <a href="/constructor/inputEncryptedFile">inputEncryptedFile</a> to avoid saving the same content on the server twice.</p>
<h4><a class="anchor" href="#working-with-an-update-box" id="working-with-an-update-box" name="working-with-an-update-box"><i class="anchor-icon"></i></a>Working with an Update Box</h4>
<p>Secret chats are associated with specific devices (or rather with <a href="/mtproto/description_v1#authorization-key">authorization keys</a>), not users. A conventional message box, which uses <strong>pts</strong> to describe the client's status, is not suitable, because it is designed for long-term message storage and message access from different devices.</p>
<p>An additional temporary message queue is introduced as a solution to this problem. When an update regarding a message from a secret chat is sent, a new value of <strong>qts</strong> is sent, which helps reconstruct the difference if there has been a long break in the connection or in case of loss of an update.</p>
<p>As the number of events increases, the value of <strong>qts</strong> increases monotonically (not always by 1). The initial value may not (and will not) be equal to 0.</p>
<p>The fact that events from the temporary queue have been received and stored by the client is acknowledged explicitly by a call to the <a href="/method/messages.receivedQueue">messages.receivedQueue</a> method or implicitly by a call to <a href="/method/updates.getDifference">updates.getDifference</a> (the value of <strong>qts</strong> passed, not the final state). All messages acknowledged as delivered by the client, as well as any messages older than 7 days, may (and will) be deleted from the server.</p>
<p>Upon de-authorization, the event queue of the corresponding device will be forcibly cleared, and the value of <strong>qts</strong> will become irrelevant.</p>
<h2><a class="anchor" href="#updating-to-new-layers" id="updating-to-new-layers" name="updating-to-new-layers"><i class="anchor-icon"></i></a>Updating to new layers</h2>
<p>Your client should always store the maximal layer that is known to be supported by the client on the other side of a secret chat. When the secret chat is first created, this value should be initialized to 8, the first layer where Secret Chats became available. This remote layer value must always be updated immediately after receiving <em>any</em> packet containing information of an upper layer, i.e.:</p>
<ul>
<li>any secret chat message containing <em>layer_no</em> in its <code>decryptedMessageLayer</code> with <em>layer</em>&gt;=17, or</li>
<li>a <a href="/constructor/decryptedMessageActionNotifyLayer">decryptedMessageActionNotifyLayer</a> service message, wrapped as if it were the <a href="/constructor/decryptedMessageService">decryptedMessageService</a> constructor of the obsolete layer 8 (constructor <code>decryptedMessageService#aa48327d</code>).</li>
</ul>
<h4><a class="anchor" href="#notifying-the-remote-client-about-your-local-layer" id="notifying-the-remote-client-about-your-local-layer" name="notifying-the-remote-client-about-your-local-layer"><i class="anchor-icon"></i></a>Notifying the remote client about your local layer</h4>
<p>In order to notify the remote client of your local layer, your client must send a message of the <code>decryptedMessageActionNotifyLayer</code> type. This notification must be wrapped in a constructor of an appropriate layer. For instance, if the remote layer for the chat in question is deemed to be lower than 17, the notification must be wrapped as if it were the <code>decryptedMessageService</code> constructor of the obsolete layer 8 (constructor <code>decryptedMessageService#aa48327d</code>), despite the fact that the <code>decryptedMessageActionNotifyLayer</code> constructor is actually not present in Layer 8.</p>
<p>There are three cases when your client must notify the remote client about its local layer:</p>
<ol>
<li>As soon as a new secret chat has been created, immediately after the secret key has been successfully exchanged.</li>
<li>Immediately after the remote layer value is updated to layer 17 or higher. An exception to this case is when the secret chat in question has been created less than 15 seconds ago. In this case the notification was already sent (see 1).</li>
<li>Immediately after the local client has been updated to support a new secret chat layer. In this case notifications must be sent to <strong>all</strong> currently existing secret chats. Note that this is only necessary when updating to new layers that contain changes in the secret chats implementation (e.g. you don't need to do this when your client is updated from Layer 17 to Layer 18).</li>
</ol>
<blockquote>
<p>Note that all pending obsolete layer messages must be sent prior to the layer update notification (more on this in <a href="/api/end-to-end/seq_no#preventing-gaps">Handling Sequence numbers</a>).</p>
</blockquote></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,141 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Styled text with message entities</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to create styled text with message entities">
<meta property="og:title" content="Styled text with message entities">
<meta property="og:image" content="d2441cad7ecfa0d622">
<meta property="og:description" content="How to create styled text with message entities">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/entities" >Styled text with message entities</a></li></ul></div>
<h1 id="dev_page_title">Styled text with message entities</h1>
<div id="dev_page_content"><p>Telegram supports styled text using <a href="/type/MessageEntity">message entities</a>.</p>
<p>A client that wants to send styled messages would simply have to integrate a <a href="https://en.wikipedia.org/wiki/Markdown">Markdown</a>/<a href="https://en.wikipedia.org/wiki/HTML">HTML</a> parser, and generate an array of message entities by iterating through the parsed tags.</p>
<p>Special care must be taken to consider the UTF-8 length of strings when generating message entities, see example implementations: <a href="https://github.com/tdlib/td/tree/master/td/telegram/MessageEntity.cpp">tdlib</a>, <a href="https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/TL/Conversion/BotAPI.php">MadelineProto</a>.</p>
<p>Nested entities are supported.<br>
For example the following HTML/Markdown aliases for message entities can be used:</p>
<ul>
<li><a href="https://core.telegram.org/constructor/messageEntityBold"><strong>messageEntityBold</strong></a> =&gt; <code>&lt;b&gt;bold&lt;/b&gt;</code>, <code>&lt;strong&gt;bold&lt;/strong&gt;</code>, <code>**bold**</code></li>
<li><a href="https://core.telegram.org/constructor/messageEntityItalic"><em>messageEntityItalic</em></a> =&gt; <code>&lt;i&gt;italic&lt;/i&gt;</code>, <code>&lt;em&gt;italic&lt;/em&gt;</code> <code>*italic*</code></li>
<li><a href="https://core.telegram.org/constructor/messageEntityCode"><code>messageEntityCode</code></a> =&gt; <code>&lt;code&gt;code&lt;/code&gt;</code>, <code>`code`</code></li>
<li><a href="https://core.telegram.org/constructor/messageEntityStrike"><del>messageEntityStrike</del></a> =&gt; <code>&lt;s&gt;strike&lt;/s&gt;</code>, <code>&lt;strike&gt;strike&lt;/strike&gt;</code>, <code>&lt;del&gt;strike&lt;/del&gt;</code>, <code>~~strike~~</code></li>
<li><a href="https://core.telegram.org/constructor/messageEntityUnderline"><u>messageEntityUnderline</u></a> =&gt; <code>&lt;u&gt;underline&lt;/u&gt;</code></li>
<li><a href="https://core.telegram.org/constructor/messageEntityPre"><code>messageEntityPre</code></a> =&gt; <code>&lt;pre language="c++"&gt;code&lt;/pre&gt;</code>, </li>
</ul>
<pre>
```c++
code
```
</pre>
<p>The following entities can also be used to <a href="/api/mentions">mention</a> users:</p>
<ul>
<li><a href="/constructor/inputMessageEntityMentionName">inputMessageEntityMentionName</a> =&gt; <a href="https://t.me/botfather">Mention a user</a></li>
<li><a href="/constructor/inputMessageEntityMentionName">messageEntityMention</a> =&gt; <a href="https://t.me/botfather">@botfather</a> (this mention is generated automatically server-side for @usernames in messages)</li>
</ul>
<p>A number of other entities are also available, see the <a href="/type/MessageEntity">type page for the full list »</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,237 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Error handling </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to handle API return errors correctly.">
<meta property="og:title" content="Error handling ">
<meta property="og:image" content="80b44334eec2aec564">
<meta property="og:description" content="How to handle API return errors correctly.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/errors" >Error handling </a></li></ul></div>
<h1 id="dev_page_title">Error handling </h1>
<div id="dev_page_content"><p>There will be errors when working with the API, and they must be correctly handled on the client.</p>
<p>An error is characterized by several parameters:</p>
<h4><a class="anchor" href="#error-code" id="error-code" name="error-code"><i class="anchor-icon"></i></a>Error Code</h4>
<p>Numerical value similar to HTTP status. Contains information on the type of error that occurred: for example, a data input error, privacy error, or server error. This is a required parameter.</p>
<h4><a class="anchor" href="#error-type" id="error-type" name="error-type"><i class="anchor-icon"></i></a>Error Type</h4>
<p>A string literal in the form of <code>/[A-Z_0-9]+/</code>, which summarizes the problem. For example, <code>AUTH_KEY_UNREGISTERED</code>. This is an optional parameter.</p>
<h4><a class="anchor" href="#error-database" id="error-database" name="error-database"><i class="anchor-icon"></i></a>Error Database</h4>
<p>A full machine-readable JSON list of RPC errors that can be returned by all methods in the API can be found <a href="/file/464001971/11361/nCsgOjxdfxA.77184.json/a27921641b664931c6">here »</a>, what follows is a description of its fields: </p>
<ul>
<li><code>errors</code> - All error messages and codes for each method (object).<ul>
<li>Keys: Error codes as strings (numeric strings)</li>
<li>Values: All error messages for each method (object)<ul>
<li>Keys: Error messages (string)</li>
<li>Values: An array of methods which may emit this error (array of strings)</li>
</ul>
</li>
</ul>
</li>
<li><code>descriptions</code> - Descriptions for every error mentioned in <code>errors</code> (and a few other errors not related to a specific method)<ul>
<li>Keys: Error messages</li>
<li>Values: Error descriptions</li>
</ul>
</li>
<li><code>user_only</code> - A list of methods that can only be used by users, <strong>not</strong> bots.</li>
</ul>
<p>Error messages and error descriptions may contain <code>printf</code> placeholders in key positions, for now only <code>%d</code> is used to map durations contained in error messages to error descriptions.</p>
<p>Example:</p>
<pre><code class="language-json">{
"errors": {
"420": {
"2FA_CONFIRM_WAIT_%d": [
"account.deleteAccount"
],
"SLOWMODE_WAIT_%d": [
"messages.forwardMessages",
"messages.sendInlineBotResult",
"messages.sendMedia",
"messages.sendMessage",
"messages.sendMultiMedia"
]
}
},
"descriptions": {
"2FA_CONFIRM_WAIT_%d": "Since this account is active and protected by a 2FA password, we will delete it in 1 week for security purposes. You can cancel this process at any time, you'll be able to reset your account in %d seconds.",
"SLOWMODE_WAIT_%d": "Slowmode is enabled in this chat: wait %d seconds before sending another message to this chat.",
"FLOOD_WAIT_%d": "Please wait %d seconds before repeating the action."
},
"user_only": {
"account.deleteAccount"
}
}</code></pre>
<hr>
<h4><a class="anchor" href="#error-constructors" id="error-constructors" name="error-constructors"><i class="anchor-icon"></i></a>Error Constructors</h4>
<p>There should be a way to handle errors that are returned in <a href="/mtproto/service_messages#rpc-error">rpc_error</a> constructors.</p>
<p>Below is a list of error codes and their meanings:</p>
<h3><a class="anchor" href="#303-see-other" id="303-see-other" name="303-see-other"><i class="anchor-icon"></i></a>303 SEE_OTHER</h3>
<p>The request must be repeated, but directed to a different data center.</p>
<h4><a class="anchor" href="#examples-of-errors" id="examples-of-errors" name="examples-of-errors"><i class="anchor-icon"></i></a>Examples of Errors:</h4>
<ul>
<li>FILE_MIGRATE_X: the file to be accessed is currently stored in a different data center.</li>
<li>PHONE_MIGRATE_X: the phone number a user is trying to use for authorization is associated with a different data center.</li>
<li>NETWORK_MIGRATE_X: the source IP address is associated with a different data center (for registration)</li>
<li>USER_MIGRATE_X: the user whose identity is being used to execute queries is associated with a different data center (for registration)</li>
</ul>
<p>In all these cases, the error description's string literal contains the number of the data center (instead of the X) to which the repeated query must be sent.
<a href="/api/datacenter">More information about redirects between data centers »</a></p>
<h3><a class="anchor" href="#400-bad-request" id="400-bad-request" name="400-bad-request"><i class="anchor-icon"></i></a>400 BAD_REQUEST</h3>
<p>The query contains errors. In the event that a request was created using a form and contains user generated data, the user should be notified that the data must be corrected before the query is repeated.</p>
<h4><a class="anchor" href="#examples-of-errors" id="examples-of-errors" name="examples-of-errors"><i class="anchor-icon"></i></a>Examples of Errors:</h4>
<ul>
<li>FIRSTNAME_INVALID: The first name is invalid</li>
<li>LASTNAME_INVALID: The last name is invalid</li>
<li>PHONE_NUMBER_INVALID: The phone number is invalid</li>
<li>PHONE_CODE_HASH_EMPTY: phone_code_hash is missing</li>
<li>PHONE_CODE_EMPTY: phone_code is missing</li>
<li>PHONE_CODE_EXPIRED: The confirmation code has expired</li>
<li>API_ID_INVALID: The api_id/api_hash combination is invalid</li>
<li>PHONE_NUMBER_OCCUPIED: The phone number is already in use</li>
<li>PHONE_NUMBER_UNOCCUPIED: The phone number is not yet being used</li>
<li>USERS_TOO_FEW: Not enough users (to create a chat, for example)</li>
<li>USERS_TOO_MUCH: The maximum number of users has been exceeded (to create a chat, for example)</li>
<li>TYPE_CONSTRUCTOR_INVALID: The type constructor is invalid</li>
<li>FILE_PART_INVALID: The file part number is invalid</li>
<li>FILE_PARTS_INVALID: The number of file parts is invalid</li>
<li>FILE_PART_Х_MISSING: Part X (where X is a number) of the file is missing from storage</li>
<li>MD5_CHECKSUM_INVALID: The MD5 checksums do not match</li>
<li>PHOTO_INVALID_DIMENSIONS: The photo dimensions are invalid</li>
<li>FIELD_NAME_INVALID: The field with the name FIELD_NAME is invalid</li>
<li>FIELD_NAME_EMPTY: The field with the name FIELD_NAME is missing</li>
<li>MSG_WAIT_FAILED: A request that must be completed before processing the current request returned an error</li>
<li>MSG_WAIT_TIMEOUT: A request that must be completed before processing the current request didn't finish processing yet</li>
</ul>
<h3><a class="anchor" href="#401-unauthorized" id="401-unauthorized" name="401-unauthorized"><i class="anchor-icon"></i></a>401 UNAUTHORIZED</h3>
<p>There was an unauthorized attempt to use functionality available only to authorized users.</p>
<h4><a class="anchor" href="#examples-of-errors" id="examples-of-errors" name="examples-of-errors"><i class="anchor-icon"></i></a>Examples of Errors:</h4>
<ul>
<li>AUTH_KEY_UNREGISTERED: The key is not registered in the system</li>
<li>AUTH_KEY_INVALID: The key is invalid</li>
<li>USER_DEACTIVATED: The user has been deleted/deactivated</li>
<li>SESSION_REVOKED: The authorization has been invalidated, because of the user terminating all sessions</li>
<li>SESSION_EXPIRED: The authorization has expired</li>
<li>AUTH_KEY_PERM_EMPTY: The method is unavailable for temporary authorization key, not bound to permanent</li>
</ul>
<h3><a class="anchor" href="#403-forbidden" id="403-forbidden" name="403-forbidden"><i class="anchor-icon"></i></a>403 FORBIDDEN</h3>
<p>Privacy violation. For example, an attempt to write a message to someone who has blacklisted the current user.</p>
<h3><a class="anchor" href="#404-not-found" id="404-not-found" name="404-not-found"><i class="anchor-icon"></i></a>404 NOT_FOUND</h3>
<p>An attempt to invoke a non-existent object, such as a method.</p>
<h3><a class="anchor" href="#406-not-acceptable" id="406-not-acceptable" name="406-not-acceptable"><i class="anchor-icon"></i></a>406 NOT_ACCEPTABLE</h3>
<p>Similar to <a href="#400-bad-request">400 BAD_REQUEST</a>, but the app should not display any error messages to user in UI as a result of this response. The error message will be delivered via <a href="/constructor/updateServiceNotification">updateServiceNotification</a> instead.</p>
<h3><a class="anchor" href="#420-flood" id="420-flood" name="420-flood"><i class="anchor-icon"></i></a>420 FLOOD</h3>
<p>The maximum allowed number of attempts to invoke the given method with the given input parameters has been exceeded. For example, in an attempt to request a large number of text messages (SMS) for the same phone number.</p>
<h4><a class="anchor" href="#error-example" id="error-example" name="error-example"><i class="anchor-icon"></i></a>Error Example:</h4>
<ul>
<li>FLOOD_WAIT_X: A wait of X seconds is required (where X is a number)</li>
</ul>
<h3><a class="anchor" href="#500-internal" id="500-internal" name="500-internal"><i class="anchor-icon"></i></a>500 INTERNAL</h3>
<p>An internal server error occurred while a request was being processed; for example, there was a disruption while accessing a database or file storage.</p>
<p>If a client receives a 500 error, or you believe this error should not have occurred, please collect as much information as possible about the query and error and send it to the developers.</p>
<h3><a class="anchor" href="#other-error-codes" id="other-error-codes" name="other-error-codes"><i class="anchor-icon"></i></a>Other Error Codes</h3>
<p>If a server returns an error with a code other than the ones listed above, it may be considered the same as a 500 error and treated as an <a href="#500-internal">internal server error</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,128 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>File references</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to handle file references.">
<meta property="og:title" content="File references">
<meta property="og:image" content="c06d4e41a64b660b9f">
<meta property="og:description" content="How to handle file references.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/file_reference" >File references</a></li></ul></div>
<h1 id="dev_page_title">File references</h1>
<div id="dev_page_content"><p>File references are strings of bytes, that can be encountered in the <code>file_reference</code> fields of <a href="/constructor/document">document</a> and <a href="/constructor/photo">photo</a> objects.</p>
<p>They must be cached by the client, along with the <strong>origin context</strong> where the document/photo object was found, in order to be refetched when the file reference expires.</p>
<p>Example implementation of a reference database: <a href="https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/MTProtoTools/ReferenceDatabase.php">MadelineProto</a>, <a href="https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/messenger/FileRefController.java">android</a>, <a href="https://github.com/telegramdesktop/tdesktop/blob/bec39d89e19670eb436dc794a8f20b657cb87c71/Telegram/SourceFiles/data/data_file_origin.cpp">telegram desktop</a>, <a href="https://github.com/tdlib/td/blob/56163c2460a65afc4db2c57ece576b8c38ea194b/td/telegram/FileReferenceManager.cpp">tdlib</a>.</p>
<h4><a class="anchor" href="#another-example" id="another-example" name="another-example"><i class="anchor-icon"></i></a>Another example:</h4>
<p>Assume you receive a <a href="/constructor/message">message</a> from your friend: that message contains a <a href="/constructor/messageMediaPhoto">messageMediaPhoto</a> with a <a href="/constructor/photo">photo</a>.</p>
<p>Your client has to cache not only the <code>file_reference</code> field of the photo, but also the context in which the file reference was seen (in this case, a message coming from a specific user).</p>
<p>The context info is in this case, <a href="https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/MTProtoTools/ReferenceDatabase.php#L74">an origin context of type message</a>, containing the message ID and the peer ID of the chat/channel/user where the message was seen.</p>
<p>The context info has to be associated with the file reference: when downloading a file using <a href="/method/upload.getFile">upload.getFile</a>, a <code>FILE_REFERENCE_EXPIRED</code> error (or another error starting with <code>FILE_REFERENCE_</code>) may be returned.<br>
If this happens, the context info must be used to refetch the object that contained the file reference: in this example, the peer info and the message ID have to be used with <a href="/method/channels.getMessages">channels.getMessages</a> or <a href="/method/messages.getMessages">messages.getMessages</a> to <a href="https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/MTProtoTools/ReferenceDatabase.php#L481">refetch the message</a>, recache the file reference and use it in a new file download request.</p>
<p>More than one origin context can be associated to one file reference, for greater resilience (in the case of a message that was deleted in one chat but was also forwarded in another chat, the file reference can be refetched from the second chat, instead).</p>
<p>Origin contexts for objects returned by method calls with certain parameters can be considered, too (for example, in the case of favorited sticker sets returned by <a href="/method/messages.getFavedStickers">messages.getFavedStickers</a>).</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,571 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Uploading and Downloading Files</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to transfer large data batches correctly.">
<meta property="og:title" content="Uploading and Downloading Files">
<meta property="og:image" content="1937a1be855ea8fce8">
<meta property="og:description" content="How to transfer large data batches correctly.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/files" >Uploading and Downloading Files</a></li></ul></div>
<h1 id="dev_page_title">Uploading and Downloading Files</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>When working with the API, it is sometimes necessary to send a relatively large file to the server. For example, when sending a message with a photo/video attachment or when setting the current user's profile picture.</p>
<h3><a class="anchor" href="#uploading-files" id="uploading-files" name="uploading-files"><i class="anchor-icon"></i></a>Uploading files</h3>
<p>There are a number of API methods to save files. The schema of the types and methods used is presented below:</p>
<pre><code><a href='/constructor/inputFile'>inputFile</a>#f52ff27f id:<a href='/type/long'>long</a> parts:<a href='/type/int'>int</a> name:<a href='/type/string'>string</a> md5_checksum:<a href='/type/string'>string</a> = <a href='/type/InputFile'>InputFile</a>;
<a href='/constructor/inputFileBig'>inputFileBig</a>#fa4f0bb5 id:<a href='/type/long'>long</a> parts:<a href='/type/int'>int</a> name:<a href='/type/string'>string</a> = <a href='/type/InputFile'>InputFile</a>;
<a href='/constructor/inputEncryptedFileUploaded'>inputEncryptedFileUploaded</a>#64bd0306 id:<a href='/type/long'>long</a> parts:<a href='/type/int'>int</a> md5_checksum:<a href='/type/string'>string</a> key_fingerprint:<a href='/type/int'>int</a> = <a href='/type/InputEncryptedFile'>InputEncryptedFile</a>;
<a href='/constructor/inputEncryptedFileBigUploaded'>inputEncryptedFileBigUploaded</a>#2dc173c8 id:<a href='/type/long'>long</a> parts:<a href='/type/int'>int</a> key_fingerprint:<a href='/type/int'>int</a> = <a href='/type/InputEncryptedFile'>InputEncryptedFile</a>;
<a href='/constructor/inputSecureFileUploaded'>inputSecureFileUploaded</a>#3334b0f0 id:<a href='/type/long'>long</a> parts:<a href='/type/int'>int</a> md5_checksum:<a href='/type/string'>string</a> file_hash:<a href='/type/bytes'>bytes</a> secret:<a href='/type/bytes'>bytes</a> = <a href='/type/InputSecureFile'>InputSecureFile</a>;
<a href='/constructor/inputSecureFile'>inputSecureFile</a>#5367e5be id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputSecureFile'>InputSecureFile</a>;
<a href='/constructor/inputMediaUploadedPhoto'>inputMediaUploadedPhoto</a>#1e287d04 flags:<a href='/type/%23'>#</a> file:<a href='/type/InputFile'>InputFile</a> stickers:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputDocument'>InputDocument</a>&gt; ttl_seconds:flags.1?<a href='/type/int'>int</a> = <a href='/type/InputMedia'>InputMedia</a>;
<a href='/constructor/inputMediaUploadedDocument'>inputMediaUploadedDocument</a>#5b38c6c1 flags:<a href='/type/%23'>#</a> nosound_video:flags.3?<a href='/constructor/true'>true</a> force_file:flags.4?<a href='/constructor/true'>true</a> file:<a href='/type/InputFile'>InputFile</a> thumb:flags.2?<a href='/type/InputFile'>InputFile</a> mime_type:<a href='/type/string'>string</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; stickers:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputDocument'>InputDocument</a>&gt; ttl_seconds:flags.1?<a href='/type/int'>int</a> = <a href='/type/InputMedia'>InputMedia</a>;
<a href='/constructor/inputChatUploadedPhoto'>inputChatUploadedPhoto</a>#c642724e flags:<a href='/type/%23'>#</a> file:flags.0?<a href='/type/InputFile'>InputFile</a> video:flags.1?<a href='/type/InputFile'>InputFile</a> video_start_ts:flags.2?<a href='/type/double'>double</a> = <a href='/type/InputChatPhoto'>InputChatPhoto</a>;
---functions---
<a href='/method/messages.sendMedia'>messages.sendMedia</a>#e25ff8e0 flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> media:<a href='/type/InputMedia'>InputMedia</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.uploadMedia'>messages.uploadMedia</a>#519bc2b1 peer:<a href='/type/InputPeer'>InputPeer</a> media:<a href='/type/InputMedia'>InputMedia</a> = <a href='/type/MessageMedia'>MessageMedia</a>;
<a href='/method/messages.sendEncryptedFile'>messages.sendEncryptedFile</a>#5559481d flags:<a href='/type/%23'>#</a> silent:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/InputEncryptedChat'>InputEncryptedChat</a> random_id:<a href='/type/long'>long</a> data:<a href='/type/bytes'>bytes</a> file:<a href='/type/InputEncryptedFile'>InputEncryptedFile</a> = <a href='/type/messages.SentEncryptedMessage'>messages.SentEncryptedMessage</a>;
<a href='/method/photos.uploadProfilePhoto'>photos.uploadProfilePhoto</a>#89f30f69 flags:<a href='/type/%23'>#</a> file:flags.0?<a href='/type/InputFile'>InputFile</a> video:flags.1?<a href='/type/InputFile'>InputFile</a> video_start_ts:flags.2?<a href='/type/double'>double</a> = <a href='/type/photos.Photo'>photos.Photo</a>;
<a href='/method/upload.saveFilePart'>upload.saveFilePart</a>#b304a621 file_id:<a href='/type/long'>long</a> file_part:<a href='/type/int'>int</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/upload.saveBigFilePart'>upload.saveBigFilePart</a>#de7b673d file_id:<a href='/type/long'>long</a> file_part:<a href='/type/int'>int</a> file_total_parts:<a href='/type/int'>int</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Before transmitting the contents of the file itself, the file has to be assigned a unique 64-bit client identifier: <strong>file_id</strong>.</p>
<p>The file's binary content is then split into parts. All parts must have the same size ( <strong>part_size</strong> ) and the following conditions must be met:</p>
<ul>
<li><code>part_size % 1024 = 0</code> (divisible by 1KB)</li>
<li><code>524288 % part_size = 0</code> (512KB must be evenly divisible by <strong>part_size</strong>)</li>
</ul>
<p>The last part does not have to satisfy these conditions, provided its size is less than <strong>part_size</strong>.</p>
<p>Each part should have a sequence number, <strong>file_part</strong>, with a value ranging from 0 to 2,999.</p>
<p>After the file has been partitioned you need to choose a method for saving it on the server. Use <a href="/method/upload.saveBigFilePart">upload.saveBigFilePart</a> in case the full size of the file is more than <strong>10 MB</strong> and <a href="/method/upload.saveFilePart">upload.saveFilePart</a> for smaller files.</p>
<p>Each call saves a portion of the data in a temporary location on the server to be used later. The storage life of each portion of data is between several minutes and several hours (depending on how busy the storage area is). After this time, the file part will become unavailable. To increase the time efficiency of a file save operation, we recommend using a call queue, so X pieces of the file are being saved at any given moment in time. Each successful operation to save a part invokes the method call to save the next part. The value of X can be tuned to achieve maximum performance.</p>
<p>When using one of the methods mentioned above to save file parts, one of the following <a href="/api/errors#400-bad-request">data input errors</a> may be returned:</p>
<ul>
<li>FILE_PARTS_INVALID - Invalid number of parts. The value is not between <code>1..3000</code></li>
<li>FILE_PART_INVALID: The file part number is invalid. The value is not between <code>0 and 2,999</code>.</li>
<li>FILE_PART_TOO_BIG: The size limit (512 KB) for the content of the file part has been exceeded</li>
<li>FILE_PART_EMPTY: The file part sent is empty</li>
<li>FILE_PART_SIZE_INVALID - 512KB cannot be evenly divided by <strong>part_size</strong></li>
<li>FILE_PART_SIZE_CHANGED - The part size is different from the size of one of the previous parts in the same file</li>
</ul>
<p>While the parts are being uploaded, an <a href="https://en.wikipedia.org/wiki/MD5">MD5 hash</a> of the file contents can also be computed to be used later as the <strong>md5_checksum</strong> parameter in the <a href="/constructor/inputFile">inputFile</a> constructor (since it is checked only by the server, for encrypted secret chat files it must be generated from the encrypted file).
After the entire file is successfully saved, the final method may be called and passed the generated <a href="/type/InputFile">inputFile</a> object. In case the <a href="/method/upload.saveBigFilePart">upload.saveBigFilePart</a> method is used, the <a href="/constructor/inputFileBig">inputFileBig</a> constructor must be passed, in other cases use <a href="/constructor/inputFile">inputFile</a>.</p>
<ul>
<li><a href="/method/messages.sendMedia">messages.sendMedia</a> - Sends a media file to a chat</li>
<li><a href="/method/messages.uploadMedia">messages.uploadMedia</a> - Uploads a media file to a chat, without sending it, returning only a <a href="/type/MessageMedia">MessageMedia</a> constructor that can be used to later send the file to multiple chats, without reuploading it every time. </li>
<li><a href="/method/photos.uploadProfilePhoto">photos.uploadProfilePhoto</a> - Used to set a <a href="#uploading-profile-or-chat-pictures">profile or chat picture or video</a></li>
</ul>
<p>The file save operation may return one of the following <a href="/api/errors#400-bad-request">data input errors</a>:</p>
<ul>
<li>FILE_PARTS_INVALID: The number of file parts is invalid The value is not between 1 and 3,000.</li>
<li>FILE_PART_Х_MISSING: Part X (where X is a number) of the file is missing from storage. Try repeating the method call to resave the part.</li>
<li>MD5_CHECKSUM_INVALID: The file's checksum did not match the <strong>md5_checksum</strong> parameter</li>
</ul>
<h4><a class="anchor" href="#albums-grouped-media" id="albums-grouped-media" name="albums-grouped-media"><i class="anchor-icon"></i></a>Albums, grouped media</h4>
<pre><code><a href='/constructor/inputMediaUploadedPhoto'>inputMediaUploadedPhoto</a>#1e287d04 flags:<a href='/type/%23'>#</a> file:<a href='/type/InputFile'>InputFile</a> stickers:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputDocument'>InputDocument</a>&gt; ttl_seconds:flags.1?<a href='/type/int'>int</a> = <a href='/type/InputMedia'>InputMedia</a>;
<a href='/constructor/inputMediaUploadedDocument'>inputMediaUploadedDocument</a>#5b38c6c1 flags:<a href='/type/%23'>#</a> nosound_video:flags.3?<a href='/constructor/true'>true</a> force_file:flags.4?<a href='/constructor/true'>true</a> file:<a href='/type/InputFile'>InputFile</a> thumb:flags.2?<a href='/type/InputFile'>InputFile</a> mime_type:<a href='/type/string'>string</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; stickers:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputDocument'>InputDocument</a>&gt; ttl_seconds:flags.1?<a href='/type/int'>int</a> = <a href='/type/InputMedia'>InputMedia</a>;
<a href='/constructor/inputSingleMedia'>inputSingleMedia</a>#1cc6e91f flags:<a href='/type/%23'>#</a> media:<a href='/type/InputMedia'>InputMedia</a> random_id:<a href='/type/long'>long</a> message:<a href='/type/string'>string</a> entities:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; = <a href='/type/InputSingleMedia'>InputSingleMedia</a>;
---functions---
<a href='/method/messages.sendMultiMedia'>messages.sendMultiMedia</a>#f803138f flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> multi_media:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputSingleMedia'>InputSingleMedia</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>Telegram allows grouping photos into <a href="https://telegram.org/blog/albums-saved-messages">albums</a> and generic files (audio, docuemnts) into media groups. </p>
<p>To do this, <a href="/method/messages.sendMultiMedia">messages.sendMultiMedia</a> is used, wrapping each <a href="/type/InputMedia">InputMedia</a> constructor (uploaded or pre-existing, maximum 10 per media group) into an <a href="/constructor/inputSingleMedia">inputSingleMedia</a> constructor, optionally providing a custom per-file caption in <code>message</code>. </p>
<p>For photo albums, clients should display an album caption only if exactly one photo in the group has a caption, otherwise no album caption should be displayed, and only when viewing in detail a specific photo of the group the caption should be shown.<br>
Other grouped media can display a caption under each file. </p>
<h4><a class="anchor" href="#re-using-pre-uploaded-files" id="re-using-pre-uploaded-files" name="re-using-pre-uploaded-files"><i class="anchor-icon"></i></a>Re-using pre-uploaded files</h4>
<pre><code><a href='/constructor/document'>document</a>#1e87342b flags:<a href='/type/%23'>#</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> size:<a href='/type/int'>int</a> thumbs:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_thumbs:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; = <a href='/type/Document'>Document</a>;
---functions---
<a href='/method/messages.getDocumentByHash'>messages.getDocumentByHash</a>#338e2464 sha256:<a href='/type/bytes'>bytes</a> size:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> = <a href='/type/Document'>Document</a>;</code></pre>
<p>For some types of documents like GIFs, <a href="/method/messages.getDocumentByHash">messages.getDocumentByHash</a> can be used to search for the document on Telegram servers.
The SHA256 hash of the file is computed, and it is passed along with the file's mime type and size to the method: if the file type is correct and the file is found, a <a href="/constructor/document">document</a> is returned.</p>
<h3><a class="anchor" href="#uploading-profile-or-chat-pictures" id="uploading-profile-or-chat-pictures" name="uploading-profile-or-chat-pictures"><i class="anchor-icon"></i></a>Uploading profile or chat pictures</h3>
<pre><code><a href='/constructor/photo'>photo</a>#fb197a65 flags:<a href='/type/%23'>#</a> has_stickers:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> sizes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_sizes:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> = <a href='/type/Photo'>Photo</a>;
<a href='/constructor/photos.photo'>photos.photo</a>#20212ca8 photo:<a href='/type/Photo'>Photo</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/photos.Photo'>photos.Photo</a>;
<a href='/constructor/inputPhoto'>inputPhoto</a>#3bb3b94a id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> = <a href='/type/InputPhoto'>InputPhoto</a>;
<a href='/constructor/inputFile'>inputFile</a>#f52ff27f id:<a href='/type/long'>long</a> parts:<a href='/type/int'>int</a> name:<a href='/type/string'>string</a> md5_checksum:<a href='/type/string'>string</a> = <a href='/type/InputFile'>InputFile</a>;
<a href='/constructor/inputChatUploadedPhoto'>inputChatUploadedPhoto</a>#c642724e flags:<a href='/type/%23'>#</a> file:flags.0?<a href='/type/InputFile'>InputFile</a> video:flags.1?<a href='/type/InputFile'>InputFile</a> video_start_ts:flags.2?<a href='/type/double'>double</a> = <a href='/type/InputChatPhoto'>InputChatPhoto</a>;
<a href='/constructor/inputChatPhoto'>inputChatPhoto</a>#8953ad37 id:<a href='/type/InputPhoto'>InputPhoto</a> = <a href='/type/InputChatPhoto'>InputChatPhoto</a>;
---functions---
<a href='/method/photos.updateProfilePhoto'>photos.updateProfilePhoto</a>#72d4742c id:<a href='/type/InputPhoto'>InputPhoto</a> = <a href='/type/photos.Photo'>photos.Photo</a>;
<a href='/method/photos.uploadProfilePhoto'>photos.uploadProfilePhoto</a>#89f30f69 flags:<a href='/type/%23'>#</a> file:flags.0?<a href='/type/InputFile'>InputFile</a> video:flags.1?<a href='/type/InputFile'>InputFile</a> video_start_ts:flags.2?<a href='/type/double'>double</a> = <a href='/type/photos.Photo'>photos.Photo</a>;
<a href='/method/messages.editChatPhoto'>messages.editChatPhoto</a>#35ddd674 chat_id:<a href='/type/long'>long</a> photo:<a href='/type/InputChatPhoto'>InputChatPhoto</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.editPhoto'>channels.editPhoto</a>#f12e57c9 channel:<a href='/type/InputChannel'>InputChannel</a> photo:<a href='/type/InputChatPhoto'>InputChatPhoto</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>User profile pictures can be uploaded using the <a href="/method/photos.updateProfilePhoto">photos.uploadProfilePhoto</a> method: the actual profile picture has to be <a href="#uploading-files">uploaded as for normal files</a>.<br>
<a href="/method/photos.updateProfilePhoto">photos.uploadProfilePhoto</a> can also be used to reupload previously uploaded profile pictures. </p>
<h4><a class="anchor" href="#animated-profile-pictures" id="animated-profile-pictures" name="animated-profile-pictures"><i class="anchor-icon"></i></a>Animated profile pictures</h4>
<p>Animated profile pictures are also supported, by populating the <code>video</code> constructor: square MPEG4 videos up to <code>1080x1080</code> are supported, <code>800x800</code> is the recommended resolution.<br>
The <code>video_start_ts</code> is a floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. </p>
<p><a href="/api/channel">Chat, channel and supergroup</a> profile photos and videos can be uploaded using <a href="/method/messages.editChatPhoto">messages.editChatPhoto</a> (<a href="/api/channel#basic-groups">basic groups</a>) or <a href="/method/channels.editPhoto">channels.editPhoto</a> (<a href="/api/channel">channels, supergroups</a>).<br>
Use the <a href="/constructor/inputChatPhoto">inputChatPhoto</a> to reuse previously uploaded profile pictures. </p>
<h3><a class="anchor" href="#downloading-files" id="downloading-files" name="downloading-files"><i class="anchor-icon"></i></a>Downloading files</h3>
<p>There are methods available to download files which have been successfully uploaded. The schema of the types and methods used is presented below:</p>
<pre><code><a href='/constructor/upload.file'>upload.file</a>#96a18d5 type:<a href='/type/storage.FileType'>storage.FileType</a> mtime:<a href='/type/int'>int</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/upload.File'>upload.File</a>;
<a href='/constructor/upload.fileCdnRedirect'>upload.fileCdnRedirect</a>#f18cda44 dc_id:<a href='/type/int'>int</a> file_token:<a href='/type/bytes'>bytes</a> encryption_key:<a href='/type/bytes'>bytes</a> encryption_iv:<a href='/type/bytes'>bytes</a> file_hashes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/FileHash'>FileHash</a>&gt; = <a href='/type/upload.File'>upload.File</a>;
<a href='/constructor/storage.fileUnknown'>storage.fileUnknown</a>#aa963b05 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileJpeg'>storage.fileJpeg</a>#7efe0e = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileGif'>storage.fileGif</a>#cae1aadf = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.filePng'>storage.filePng</a>#a4f63c0 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileMp3'>storage.fileMp3</a>#528a0677 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileMov'>storage.fileMov</a>#4b09ebbc = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.filePartial'>storage.filePartial</a>#40bc6f52 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileMp4'>storage.fileMp4</a>#b3cea0e4 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileWebp'>storage.fileWebp</a>#1081464c = <a href='/type/storage.FileType'>storage.FileType</a>;
---functions---
<a href='/method/upload.getFile'>upload.getFile</a>#b15a9afc flags:<a href='/type/%23'>#</a> precise:flags.0?<a href='/constructor/true'>true</a> cdn_supported:flags.1?<a href='/constructor/true'>true</a> location:<a href='/type/InputFileLocation'>InputFileLocation</a> offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/upload.File'>upload.File</a>;</code></pre>
<p>Any file can be downloaded by calling <a href="/method/upload.getFile">upload.getFile</a>.
The data for the input parameter of the <a href="/type/InputFileLocation">InputFileLocation</a> type is generated as follows:</p>
<pre><code><a href='/constructor/inputFileLocation'>inputFileLocation</a>#dfdaabe1 volume_id:<a href='/type/long'>long</a> local_id:<a href='/type/int'>int</a> secret:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputEncryptedFileLocation'>inputEncryptedFileLocation</a>#f5235d55 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputDocumentFileLocation'>inputDocumentFileLocation</a>#bad07584 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> thumb_size:<a href='/type/string'>string</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputSecureFileLocation'>inputSecureFileLocation</a>#cbc7ee28 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputTakeoutFileLocation'>inputTakeoutFileLocation</a>#29be5899 = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputPhotoFileLocation'>inputPhotoFileLocation</a>#40181ffe id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> thumb_size:<a href='/type/string'>string</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputPhotoLegacyFileLocation'>inputPhotoLegacyFileLocation</a>#d83466f3 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> volume_id:<a href='/type/long'>long</a> local_id:<a href='/type/int'>int</a> secret:<a href='/type/long'>long</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputPeerPhotoFileLocation'>inputPeerPhotoFileLocation</a>#37257e99 flags:<a href='/type/%23'>#</a> big:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> photo_id:<a href='/type/long'>long</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputStickerSetThumb'>inputStickerSetThumb</a>#9d84f3db stickerset:<a href='/type/InputStickerSet'>InputStickerSet</a> thumb_version:<a href='/type/int'>int</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputGroupCallStream'>inputGroupCallStream</a>#598a92a flags:<a href='/type/%23'>#</a> call:<a href='/type/InputGroupCall'>InputGroupCall</a> time_ms:<a href='/type/long'>long</a> scale:<a href='/type/int'>int</a> video_channel:flags.0?<a href='/type/int'>int</a> video_quality:flags.0?<a href='/type/int'>int</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
<a href='/constructor/inputStickerSetEmpty'>inputStickerSetEmpty</a>#ffb62b95 = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/inputStickerSetID'>inputStickerSetID</a>#9de7a269 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/inputStickerSetShortName'>inputStickerSetShortName</a>#861cc8a0 short_name:<a href='/type/string'>string</a> = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/inputStickerSetAnimatedEmoji'>inputStickerSetAnimatedEmoji</a>#28703c8 = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/inputStickerSetDice'>inputStickerSetDice</a>#e67f520e emoticon:<a href='/type/string'>string</a> = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/inputStickerSetAnimatedEmojiAnimations'>inputStickerSetAnimatedEmojiAnimations</a>#cde3739 = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/inputPeerSelf'>inputPeerSelf</a>#7da07ec9 = <a href='/type/InputPeer'>InputPeer</a>;
<a href='/constructor/inputPeerChat'>inputPeerChat</a>#35a95cb9 chat_id:<a href='/type/long'>long</a> = <a href='/type/InputPeer'>InputPeer</a>;
<a href='/constructor/inputPeerUser'>inputPeerUser</a>#dde8a54c user_id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputPeer'>InputPeer</a>;
<a href='/constructor/inputPeerChannel'>inputPeerChannel</a>#27bcbbfc channel_id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputPeer'>InputPeer</a>;
<a href='/constructor/photo'>photo</a>#fb197a65 flags:<a href='/type/%23'>#</a> has_stickers:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> sizes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_sizes:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> = <a href='/type/Photo'>Photo</a>;
<a href='/constructor/document'>document</a>#1e87342b flags:<a href='/type/%23'>#</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> size:<a href='/type/int'>int</a> thumbs:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_thumbs:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; = <a href='/type/Document'>Document</a>;
<a href='/constructor/photoSize'>photoSize</a>#75c78e60 type:<a href='/type/string'>string</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> size:<a href='/type/int'>int</a> = <a href='/type/PhotoSize'>PhotoSize</a>;
<a href='/constructor/photoCachedSize'>photoCachedSize</a>#21e1ad6 type:<a href='/type/string'>string</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/PhotoSize'>PhotoSize</a>;
<a href='/constructor/chatPhoto'>chatPhoto</a>#1c6e1c11 flags:<a href='/type/%23'>#</a> has_video:flags.0?<a href='/constructor/true'>true</a> photo_id:<a href='/type/long'>long</a> stripped_thumb:flags.1?<a href='/type/bytes'>bytes</a> dc_id:<a href='/type/int'>int</a> = <a href='/type/ChatPhoto'>ChatPhoto</a>;
<a href='/constructor/userProfilePhoto'>userProfilePhoto</a>#82d1f706 flags:<a href='/type/%23'>#</a> has_video:flags.0?<a href='/constructor/true'>true</a> photo_id:<a href='/type/long'>long</a> stripped_thumb:flags.1?<a href='/type/bytes'>bytes</a> dc_id:<a href='/type/int'>int</a> = <a href='/type/UserProfilePhoto'>UserProfilePhoto</a>;</code></pre>
<ul>
<li>
<p>For photos, <a href="/constructor/inputPhotoFileLocation">inputPhotoFileLocation</a> is used:</p>
<ul>
<li><code>id</code>, <code>file_reference</code> and <code>access_hash</code> taken from the <a href="/constructor/photo">photo</a> constructor</li>
<li><code>thumb_size</code> taken from the <code>type</code> field of the desired <a href="/type/PhotoSize">PhotoSize</a> of the <a href="/constructor/photo">photo</a></li>
</ul>
</li>
<li>
<p>For profile pictures of users, channels, supergroups and groups, <a href="/constructor/inputPeerPhotoFileLocation">inputPeerPhotoFileLocation</a> has to be used:</p>
<ul>
<li><code>peer</code> is the identifier of the peer whose photo we want to download</li>
<li><code>big</code> is used to choose whether to download the full-resolution picture, or just the thumbnail</li>
<li><code>photo_id</code> is extracted from the <a href="/constructor/chatPhoto">chatPhoto</a> or <a href="/constructor/userProfilePhoto">userProfilePhoto</a> of the desired profile photo</li>
</ul>
</li>
<li>
<p>For documents, <a href="/constructor/inputDocumentFileLocation">inputDocumentFileLocation</a> is used:</p>
<ul>
<li><code>id</code>, <code>file_reference</code> and <code>access_hash</code> taken from the <a href="/constructor/document">document</a> constructor</li>
<li>If downloading the thumbnail of a document, <code>thumb_size</code> should be taken from the <code>type</code> field of the desired <a href="/type/PhotoSize">PhotoSize</a> of the <a href="/constructor/photo">photo</a>; otherwise, provide an empty string.</li>
</ul>
</li>
<li>
<p>For previews of sticker sets, <a href="/constructor/inputStickerSetThumb">inputStickerSetThumb</a> is used (note: to download stickers and previews of stickers use the document method described above for documents):</p>
<ul>
<li><code>stickerset</code> is set to the <a href="/type/InputStickerSet">InputStickerSet</a> constructor generated from <a href="/constructor/stickerSet">stickerSet</a></li>
<li><code>thumb_version</code> is copied from the same field in <a href="/constructor/stickerSet">stickerSet</a></li>
</ul>
</li>
<li>
<p>For encrypted secret chat and telegram passport documents, respectively <a href="/constructor/inputEncryptedFileLocation">inputEncryptedFileLocation</a> and <a href="/constructor/inputSecureFileLocation">inputSecureFileLocation</a> have to be used, with parameters extracted from <a href="/constructor/encryptedFile">encryptedFile</a> and <a href="/constructor/secureFile">secureFile</a> (<a href="/passport">passport docs</a>).</p>
</li>
<li>
<p>For livestream chunks, <a href="/constructor/inputGroupCallStream">inputGroupCallStream</a> is used:</p>
<ul>
<li><code>call</code> contains the related group call ID+access hash, taken from the <a href="/constructor/groupCall">groupCall</a> constructor.</li>
<li><code>time_ms</code> specifies the timestamp to fetch</li>
<li><code>scale</code> specifies the duration of the video segment to fetch in milliseconds, by bitshifting <code>1000</code> to the right <code>scale</code> times: <code>duration_ms := 1000 &gt;&gt; scale</code></li>
<li><code>video_channel</code> specifies the video channel to fetch</li>
<li><code>video_quality</code> specifies the selected video quality (0 = lowest, 1 = medium, 2 = best)</li>
</ul>
</li>
<li>
<p>For old <strong>deprecated</strong> photos, if the client has cached some old fileLocations with the <strong>deprecated</strong> <code>secret</code> identifier, <a href="/constructor/inputFileLocation">inputFileLocation</a> or <a href="/constructor/inputPhotoLegacyFileLocation">inputPhotoLegacyFileLocation</a> is used (this is mainly used for backwards compatibility with bot API file IDs, all user clients must use the modern <a href="/constructor/inputPhotoFileLocation">inputPhotoFileLocation</a> file IDs): </p>
<ul>
<li>All fields are taken from the previously cached fileLocation except for <code>file_reference</code>, <code>access_hash</code> and <code>id</code>, which are taken from the <a href="/constructor/photo">photo</a> constructor (the last two fields are used only if available, in which case <a href="/constructor/inputPhotoLegacyFileLocation">inputPhotoLegacyFileLocation</a> is used instead of <a href="/constructor/inputFileLocation">inputFileLocation</a>).</li>
</ul>
</li>
</ul>
<p>The size of each file in bytes is available, which makes it possible to download the file in parts using the parameters <strong>offset</strong> and <strong>limit</strong>, similar to the way files are uploaded.</p>
<p>If <strong>precise</strong> flag is not specified, then </p>
<ul>
<li>The parameter <strong>offset</strong> must be divisible by 4 KB.</li>
<li>The parameter <strong>limit</strong> must be divisible by 4 KB.</li>
<li>1048576 (1 MB) must be divisible by <strong>limit</strong>.</li>
</ul>
<p>If <strong>precise</strong> is specified, then</p>
<ul>
<li>The parameter <strong>offset</strong> must be divisible by 1 KB.</li>
<li>The parameter <strong>limit</strong> must be divisible by 1 KB.</li>
<li><strong>limit</strong> must not exceed 1048576 (1 MB).</li>
</ul>
<p>In any case the requested part should be within one 1 MB chunk from the beginning of the file, i. e.</p>
<ul>
<li><strong>offset</strong> / (1024 * 1024) == (<strong>offset</strong> + <strong>limit</strong> - 1) / (1024 * 1024).</li>
</ul>
<p>The file download operation may return a <code>FILE_REFERENCE_EXPIRED</code> error (or another error starting with <code>FILE_REFERENCE_</code>): in this case, the <code>file_reference</code> field of the input location must be <a href="/api/file_reference">refreshed</a>.
The file download operation may return an <a href="/constructor/upload.fileCdnRedirect">upload.fileCdnRedirect</a> constructor: in this case, <a href="/cdn">these</a> instructions must be followed for downloading CDN files.
The file download operation may also return one of the following <a href="/api/errors#400-bad-request">data input errors</a>:</p>
<ul>
<li>FILE_ID_INVALID: The file address is invalid</li>
<li>OFFSET_INVALID: The <strong>offset</strong> value is invalid</li>
<li>LIMIT_INVALID: The <strong>limit</strong> value is invalid</li>
<li>FILE_MIGRATE_X: The file is in the datacenter No. X</li>
</ul>
<h4><a class="anchor" href="#verifying-downloaded-chunks" id="verifying-downloaded-chunks" name="verifying-downloaded-chunks"><i class="anchor-icon"></i></a>Verifying downloaded chunks</h4>
<pre><code><a href='/constructor/fileHash'>fileHash</a>#6242c773 offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> hash:<a href='/type/bytes'>bytes</a> = <a href='/type/FileHash'>FileHash</a>;
---functions---
<a href='/method/upload.getFileHashes'>upload.getFileHashes</a>#c7025931 location:<a href='/type/InputFileLocation'>InputFileLocation</a> offset:<a href='/type/int'>int</a> = <a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/FileHash'>FileHash</a>&gt;;</code></pre>
<p>In order to confirm the integrity of the downloaded file, clients are recommended to verify hashes for each downloaded part, as for <a href="/cdn">CDN DCs</a>.
<a href="/method/upload.getFileHashes">upload.getFileHashes</a> contain <a href="/type/FileHash">FileHash</a> constructors. Each of these constructors contains the SHA-256 hash of a part of the file that starts with <code>offset</code> and takes <code>limit</code> bytes.</p>
<p>Before saving each portion of the data received from the DC into the file, the client can confirm that its hash matches the hash that was received from the master DC. If missing a hash for any file part, client developers must use the <a href="/method/upload.getFileHashes">upload.getFileHashes</a> method to obtain the missing hash.</p>
<h4><a class="anchor" href="#handling-audio-video-and-vector-previews" id="handling-audio-video-and-vector-previews" name="handling-audio-video-and-vector-previews"><i class="anchor-icon"></i></a>Handling audio, video and vector previews</h4>
<p>Schema:</p>
<pre><code><a href='/constructor/photoSizeEmpty'>photoSizeEmpty</a>#e17e23c type:<a href='/type/string'>string</a> = <a href='/type/PhotoSize'>PhotoSize</a>;
<a href='/constructor/photoSize'>photoSize</a>#75c78e60 type:<a href='/type/string'>string</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> size:<a href='/type/int'>int</a> = <a href='/type/PhotoSize'>PhotoSize</a>;
<a href='/constructor/photoCachedSize'>photoCachedSize</a>#21e1ad6 type:<a href='/type/string'>string</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/PhotoSize'>PhotoSize</a>;
<a href='/constructor/photoStrippedSize'>photoStrippedSize</a>#e0b0bc2e type:<a href='/type/string'>string</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/PhotoSize'>PhotoSize</a>;
<a href='/constructor/photoSizeProgressive'>photoSizeProgressive</a>#fa3efb95 type:<a href='/type/string'>string</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> sizes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/PhotoSize'>PhotoSize</a>;
<a href='/constructor/photoPathSize'>photoPathSize</a>#d8214d41 type:<a href='/type/string'>string</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/PhotoSize'>PhotoSize</a>;
<a href='/constructor/videoSize'>videoSize</a>#de33b094 flags:<a href='/type/%23'>#</a> type:<a href='/type/string'>string</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> size:<a href='/type/int'>int</a> video_start_ts:flags.0?<a href='/type/double'>double</a> = <a href='/type/VideoSize'>VideoSize</a>;
<a href='/constructor/document'>document</a>#1e87342b flags:<a href='/type/%23'>#</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> size:<a href='/type/int'>int</a> thumbs:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_thumbs:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; = <a href='/type/Document'>Document</a>;
<a href='/constructor/photo'>photo</a>#fb197a65 flags:<a href='/type/%23'>#</a> has_stickers:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> sizes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_sizes:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> = <a href='/type/Photo'>Photo</a>;
<a href='/constructor/photo'>photo</a>#fb197a65 flags:<a href='/type/%23'>#</a> has_stickers:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> sizes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_sizes:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> = <a href='/type/Photo'>Photo</a>;</code></pre>
<p>Telegram attaches a vector of thumbnails with reduced resolution to all uploaded media.<br>
The server also generates a trimmed and scaled down video preview for videos, GIFs and animated profile pictures. </p>
<h4><a class="anchor" href="#image-thumbnail-types" id="image-thumbnail-types" name="image-thumbnail-types"><i class="anchor-icon"></i></a>Image thumbnail types</h4>
<p>Each photo preview has a specific <code>type</code>, indicating the resolution and image transform that was applied server-side. </p>
<table class="table">
<thead>
<tr>
<th>Type</th>
<th>Image filter</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>s</code></td>
<td>box</td>
<td>100x100</td>
</tr>
<tr>
<td><code>m</code></td>
<td>box</td>
<td>320x320</td>
</tr>
<tr>
<td><code>x</code></td>
<td>box</td>
<td>800x800</td>
</tr>
<tr>
<td><code>y</code></td>
<td>box</td>
<td>1280x1280</td>
</tr>
<tr>
<td><code>w</code></td>
<td>box</td>
<td>2560x2560</td>
</tr>
<tr>
<td><code>a</code></td>
<td>crop</td>
<td>160x160</td>
</tr>
<tr>
<td><code>b</code></td>
<td>crop</td>
<td>320x320</td>
</tr>
<tr>
<td><code>c</code></td>
<td>crop</td>
<td>640x640</td>
</tr>
<tr>
<td><code>d</code></td>
<td>crop</td>
<td>1280x1280</td>
</tr>
</tbody>
</table>
<p>Special types:</p>
<table class="table">
<thead>
<tr>
<th>Type</th>
<th>Image filter</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>i</code></td>
<td>strip</td>
</tr>
<tr>
<td><code>j</code></td>
<td>outline</td>
</tr>
</tbody>
</table>
<h4><a class="anchor" href="#stripped-thumbnails" id="stripped-thumbnails" name="stripped-thumbnails"><i class="anchor-icon"></i></a>Stripped thumbnails</h4>
<pre><code><a href='/constructor/photoStrippedSize'>photoStrippedSize</a>#e0b0bc2e type:<a href='/type/string'>string</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/PhotoSize'>PhotoSize</a>;</code></pre>
<p>A <a href="/constructor/photoStrippedSize">photoStrippedSize</a> (with type <code>i</code>) is an extremely low-res thumbnail, embedded directly inside media location objects.<br>
It should be shown to the user in chat message previews, or while still downloading the most appropriately sized <a href="/constructor/photoSize">photoSize</a> through the media DCs as <a href="#downloading-files">described above</a>. </p>
<p>The stripped <code>bytes</code> payload should be inflated to a JPG payload as seen <a href="https://github.com/telegramdesktop/tdesktop/blob/1757dd856b84d23f83d4e562c94dde825f6eb40c/Telegram/SourceFiles/ui/image/image.cpp#L43">here »</a>.</p>
<h4><a class="anchor" href="#vector-thumbnails" id="vector-thumbnails" name="vector-thumbnails"><i class="anchor-icon"></i></a>Vector thumbnails</h4>
<pre><code><a href='/constructor/photoPathSize'>photoPathSize</a>#d8214d41 type:<a href='/type/string'>string</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/PhotoSize'>PhotoSize</a>;</code></pre>
<p>Messages with <a href="/animated_stickers">animated</a>, <a href="/stickers#video-stickers">video</a>, <a href="/stickers">normal</a> stickers can have a compressed svg (&lt; 300 bytes) to show the outline of the sticker before fetching the actual sticker.
Sticker outlines will have a <code>j</code> type <a href="/constructor/photoPathSize">photoPathSize</a> thumbnail. </p>
<p>This specific vector thumbnail consists of an <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths">SVG path</a>, specially encoded to save space.<br>
This path will be the outline of the animated sticker, and should be shown to the user while downloading the actual sticker. </p>
<p>As for stripped sizes, the payload should be inflated using the following algorithm:</p>
<pre><code>encoded := photoPathSize.bytes
lookup := "AACAAAAHAAALMAAAQASTAVAAAZaacaaaahaaalmaaaqastava.az0123456789-,"
path := "M"
len := strlen(encoded)
for (i = 0; i &lt; len; i++) {
num := ord(encoded[i])
if (num &gt;= 128 + 64) {
path += lookup[num - 128 - 64]
} else {
if (num &gt;= 128) {
path += ','
} else if (num &gt;= 64) {
path += '-'
}
path += itoa(num &amp; 63)
}
}
path += "z"</code></pre>
<p><code>path</code> will contain the actual SVG path that can be directly inserted in the <code>d</code> attribute of an <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path">svg &lt;path&gt; element</a>: </p>
<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 512 512" xml:space="preserve"&gt;
&lt;path d="{$path}"/&gt;
&lt;/svg&gt;</code></pre>
<h4><a class="anchor" href="#video-types" id="video-types" name="video-types"><i class="anchor-icon"></i></a>Video types</h4>
<pre><code><a href='/constructor/videoSize'>videoSize</a>#de33b094 flags:<a href='/type/%23'>#</a> type:<a href='/type/string'>string</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> size:<a href='/type/int'>int</a> video_start_ts:flags.0?<a href='/type/double'>double</a> = <a href='/type/VideoSize'>VideoSize</a>;</code></pre>
<p>A <a href="/constructor/videoSize">videoSize</a> constructor is typically used for <a href="#animated-profile-pictures">animated profile pictures</a> and video previews.</p>
<table class="table">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
<th>Format</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>u</code></td>
<td>Animated profile picture</td>
<td>MPEG4</td>
</tr>
<tr>
<td><code>v</code></td>
<td>Video preview</td>
<td>MPEG4</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#downloading-webfiles" id="downloading-webfiles" name="downloading-webfiles"><i class="anchor-icon"></i></a>Downloading webfiles</h3>
<p>Remote HTTP files sent by inline bots <a href="/type/BotInlineResult">in response to inline queries</a> and in other places are represented by <a href="/type/WebDocument">WebDocument</a> constructors.
When forwarding such remote HTTP files, they should be sent using <a href="/type/InputMedia">external InputMedia constructors</a>.
Remote HTTP files can only be downloaded directly by the client if contained in a <a href="/constructor/webDocumentNoProxy">webDocumentNoProxy</a> constructor: in this case, the file is deemed safe to download (this is the case for HTTPS files from certain trusted domains).</p>
<p>However, if the remote file is contained in a <a href="/constructor/webDocument">webDocument</a>, to avoid leaking sensitive information the file must be downloaded through telegram's servers.
This can be done in a manner similar to <a href="#downloading-files">normal files</a>, with the difference that <a href="/method/upload.getWebFile">upload.getWebFile</a> must be used, instead.</p>
<pre><code><a href='/constructor/upload.webFile'>upload.webFile</a>#21e753bc size:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> file_type:<a href='/type/storage.FileType'>storage.FileType</a> mtime:<a href='/type/int'>int</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/upload.WebFile'>upload.WebFile</a>;
<a href='/constructor/storage.fileUnknown'>storage.fileUnknown</a>#aa963b05 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileJpeg'>storage.fileJpeg</a>#7efe0e = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileGif'>storage.fileGif</a>#cae1aadf = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.filePng'>storage.filePng</a>#a4f63c0 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileMp3'>storage.fileMp3</a>#528a0677 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileMov'>storage.fileMov</a>#4b09ebbc = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.filePartial'>storage.filePartial</a>#40bc6f52 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileMp4'>storage.fileMp4</a>#b3cea0e4 = <a href='/type/storage.FileType'>storage.FileType</a>;
<a href='/constructor/storage.fileWebp'>storage.fileWebp</a>#1081464c = <a href='/type/storage.FileType'>storage.FileType</a>;
---functions---
<a href='/method/upload.getWebFile'>upload.getWebFile</a>#24e6818d location:<a href='/type/InputWebFileLocation'>InputWebFileLocation</a> offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/upload.WebFile'>upload.WebFile</a>;</code></pre>
<p>The <a href="/type/InputWebFileLocation">InputWebFileLocation</a> constructor is generated as follows.</p>
<pre><code><a href='/constructor/inputWebFileLocation'>inputWebFileLocation</a>#c239d686 url:<a href='/type/string'>string</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputWebFileLocation'>InputWebFileLocation</a>;
<a href='/constructor/inputWebFileGeoPointLocation'>inputWebFileGeoPointLocation</a>#9f2221c9 geo_point:<a href='/type/InputGeoPoint'>InputGeoPoint</a> access_hash:<a href='/type/long'>long</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> zoom:<a href='/type/int'>int</a> scale:<a href='/type/int'>int</a> = <a href='/type/InputWebFileLocation'>InputWebFileLocation</a>;
<a href='/constructor/webDocument'>webDocument</a>#1c570ed1 url:<a href='/type/string'>string</a> access_hash:<a href='/type/long'>long</a> size:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; = <a href='/type/WebDocument'>WebDocument</a>;
<a href='/constructor/inputGeoPoint'>inputGeoPoint</a>#48222faf flags:<a href='/type/%23'>#</a> lat:<a href='/type/double'>double</a> long:<a href='/type/double'>double</a> accuracy_radius:flags.0?<a href='/type/int'>int</a> = <a href='/type/InputGeoPoint'>InputGeoPoint</a>;
<a href='/constructor/geoPoint'>geoPoint</a>#b2a2f663 flags:<a href='/type/%23'>#</a> long:<a href='/type/double'>double</a> lat:<a href='/type/double'>double</a> access_hash:<a href='/type/long'>long</a> accuracy_radius:flags.0?<a href='/type/int'>int</a> = <a href='/type/GeoPoint'>GeoPoint</a>;</code></pre>
<ul>
<li><a href="/constructor/inputWebFileLocation">inputWebFileLocation</a> is simply generated by taking the <code>url</code> and <code>access_hash</code> fields of the <a href="/constructor/webDocument">webDocument</a> constructor.</li>
<li><a href="/constructor/inputWebFileGeoPointLocation">inputWebFileGeoPointLocation</a> is used to download a server-generated image with the map preview from a <a href="/constructor/geoPoint">geoPoint</a>.<ul>
<li><code>geo_point</code> is generated from the <code>lat</code>, <code>long</code> <code>accuracy_radius</code> parameters of the <a href="/constructor/geoPoint">geoPoint</a></li>
<li><code>access_hash</code> is the access hash of the <a href="/constructor/geoPoint">geoPoint</a></li>
<li><code>w</code> - Map width in pixels before applying scale; 16-1024</li>
<li><code>h</code> - Map height in pixels before applying scale; 16-1024</li>
<li><code>zoom</code> - Map zoom level; 13-20</li>
<li><code>scale</code> - Map scale; 1-3</li>
</ul>
</li>
</ul>
<h3><a class="anchor" href="#general-considerations" id="general-considerations" name="general-considerations"><i class="anchor-icon"></i></a>General Considerations</h3>
<p>It is recommended that large queries (<a href="/method/upload.getFile">upload.getFile</a>, <a href="/method/upload.saveFilePart">upload.saveFilePart</a>, <a href="/method/upload.getWebFile">upload.getWebFile</a>) be handled through a separate session and a separate connection, in which no methods other than these should be executed. If this is done, then data transfer will cause less interference with <a href="/api/updates">getting updates</a> and other method calls.</p>
<h3><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related articles</h3>
<h4><a class="anchor" href="#handling-file-references" id="handling-file-references" name="handling-file-references"><i class="anchor-icon"></i></a><a href="/api/file_reference">Handling file references</a></h4>
<p>How to handle file references.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,182 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Folders</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists.">
<meta property="og:title" content="Folders">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/folders" >Folders</a></li></ul></div>
<h1 id="dev_page_title">Folders</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists.<br>
In the API, folders are called "dialog filters"; in the UI, they are typically represented as tabs. </p>
<p>Schema:</p>
<pre><code><a href='/constructor/dialogFilter'>dialogFilter</a>#7438f7e8 flags:<a href='/type/%23'>#</a> contacts:flags.0?<a href='/constructor/true'>true</a> non_contacts:flags.1?<a href='/constructor/true'>true</a> groups:flags.2?<a href='/constructor/true'>true</a> broadcasts:flags.3?<a href='/constructor/true'>true</a> bots:flags.4?<a href='/constructor/true'>true</a> exclude_muted:flags.11?<a href='/constructor/true'>true</a> exclude_read:flags.12?<a href='/constructor/true'>true</a> exclude_archived:flags.13?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> title:<a href='/type/string'>string</a> emoticon:flags.25?<a href='/type/string'>string</a> pinned_peers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputPeer'>InputPeer</a>&gt; include_peers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputPeer'>InputPeer</a>&gt; exclude_peers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputPeer'>InputPeer</a>&gt; = <a href='/type/DialogFilter'>DialogFilter</a>;
<a href='/constructor/dialogFilterSuggested'>dialogFilterSuggested</a>#77744d4a filter:<a href='/type/DialogFilter'>DialogFilter</a> description:<a href='/type/string'>string</a> = <a href='/type/DialogFilterSuggested'>DialogFilterSuggested</a>;
<a href='/constructor/updateDialogFilter'>updateDialogFilter</a>#26ffde7d flags:<a href='/type/%23'>#</a> id:<a href='/type/int'>int</a> filter:flags.0?<a href='/type/DialogFilter'>DialogFilter</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/updateDialogFilterOrder'>updateDialogFilterOrder</a>#a5d72105 order:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/Update'>Update</a>;
<a href='/constructor/updateDialogFilters'>updateDialogFilters</a>#3504914f = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.getDialogFilters'>messages.getDialogFilters</a>#f19ed96d = <a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DialogFilter'>DialogFilter</a>&gt;;
<a href='/method/messages.getSuggestedDialogFilters'>messages.getSuggestedDialogFilters</a>#a29cd42c = <a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DialogFilterSuggested'>DialogFilterSuggested</a>&gt;;
<a href='/method/messages.updateDialogFilter'>messages.updateDialogFilter</a>#1ad4a04a flags:<a href='/type/%23'>#</a> id:<a href='/type/int'>int</a> filter:flags.0?<a href='/type/DialogFilter'>DialogFilter</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/messages.updateDialogFiltersOrder'>messages.updateDialogFiltersOrder</a>#c563c1e4 order:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/Bool'>Bool</a>;
<a href='/method/help.getAppConfig'>help.getAppConfig</a>#98914110 = <a href='/type/JSONValue'>JSONValue</a>;</code></pre>
<h3><a class="anchor" href="#folders" id="folders" name="folders"><i class="anchor-icon"></i></a>Folders</h3>
<p>On startup, clients call: </p>
<ul>
<li><a href="/method/messages.getDialogFilters">messages.getDialogFilters</a> to fetch a list of previously configured folders.</li>
<li><a href="/method/messages.getSuggestedDialogFilters">messages.getSuggestedDialogFilters</a> to fetch a list of suggested folder combinations.</li>
<li><a href="/method/help.getAppConfig">help.getAppConfig</a> to fetch app-specific configuration parameters. </li>
</ul>
<p>The boolean under the <code>dialog_filters_tooltip</code> JSON key in the result of <a href="/method/help.getAppConfig">help.getAppConfig</a> can be used to determine whether a folder tooltip should be presented to the user right away.<br>
The UI should then show a list of suggested folder combinations. </p>
<p>Once configuration is finished, apps call <a href="/method/messages.updateDialogFilter">messages.updateDialogFilter</a> to create or update existing folders.<br>
As per the <a href="/constructor/dialogFilter">dialogFilter</a> constructor, folders have multiple flags that can be combined to determine which chats should be included in (or excluded from) the folder.<br>
Folders can also have unlimited pinned chats, as determined by the <code>pinned_peers</code> field.</p>
<p>To reorder existing folders, <a href="/method/messages.updateDialogFiltersOrder">messages.updateDialogFiltersOrder</a> should be used with the IDs of the various dialog filters.</p>
<p>To delete folders, use <a href="/method/messages.updateDialogFilter">messages.updateDialogFilter</a> without populating the <code>filter</code> flag field. </p>
<p>Clients can receive <a href="/constructor/updateDialogFilter">updateDialogFilter</a>, <a href="/constructor/updateDialogFilterOrder">updateDialogFilterOrder</a> updates with new filter information, generated by other clients when modifying folder info.<br>
Clients can also receive <a href="/constructor/updateDialogFilters">updateDialogFilters</a>, in which case folder info should be refetched manually using <a href="/method/messages.getDialogFilters">messages.getDialogFilters</a>.</p>
<h3><a class="anchor" href="#peer-folders" id="peer-folders" name="peer-folders"><i class="anchor-icon"></i></a>Peer folders</h3>
<p>The API also has another method for identifying groups of peers, typically used only by archived chats.</p>
<p>Schema:</p>
<pre><code><a href='/constructor/inputDialogPeer'>inputDialogPeer</a>#fcaafeb7 peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/InputDialogPeer'>InputDialogPeer</a>;
<a href='/constructor/inputDialogPeerFolder'>inputDialogPeerFolder</a>#64600527 folder_id:<a href='/type/int'>int</a> = <a href='/type/InputDialogPeer'>InputDialogPeer</a>;
<a href='/constructor/dialogPeer'>dialogPeer</a>#e56dbf05 peer:<a href='/type/Peer'>Peer</a> = <a href='/type/DialogPeer'>DialogPeer</a>;
<a href='/constructor/dialogPeerFolder'>dialogPeerFolder</a>#514519e2 folder_id:<a href='/type/int'>int</a> = <a href='/type/DialogPeer'>DialogPeer</a>;
<a href='/constructor/updateFolderPeers'>updateFolderPeers</a>#19360dc0 folder_peers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/FolderPeer'>FolderPeer</a>&gt; pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/updates'>updates</a>#74ae4240 updates:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Update'>Update</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; date:<a href='/type/int'>int</a> seq:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
---functions---
<a href='/method/folders.editPeerFolders'>folders.editPeerFolders</a>#6847d0ab folder_peers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputFolderPeer'>InputFolderPeer</a>&gt; = <a href='/type/Updates'>Updates</a>;
<a href='/method/folders.deleteFolder'>folders.deleteFolder</a>#1c295881 folder_id:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>API peer folders are typically used only by <a href="https://telegram.org/blog/archive-and-new-design">archived chats</a>, and are really handy for distinguishing groups of peers, since most peer-related constructors (updates, chat info) will contain the <code>folder_id</code> assigned the the specified chat. </p>
<p>In Telegram apps, API peer folders are used only to implement the chat archive, identified by <code>folder_id</code> <code>1</code>; all other peers are in <code>folder_id</code> <code>0</code> by default; no other <code>folder_id</code> is allowed at the moment.</p>
<ul>
<li><a href="/method/folders.editPeerFolders">folders.editPeerFolders</a> can be used to add and remove peers from peer folders.</li>
<li><a href="/method/folders.deleteFolder">folders.deleteFolder</a> can be used to delete peer folders, moving all peers previously present in that folder to the default <code>0</code> folder.</li>
</ul>
<p>Both methods return an <a href="/constructor/updates">updates</a> constructor, containing a single <a href="/constructor/updateFolderPeers">updateFolderPeers</a> with the new <code>folder_id</code> of moved peers.<br>
Clients can also receive <a href="/constructor/updateFolderPeers">updateFolderPeers</a> as a normal <a href="/api/updates">update</a>, generated by other clients when modifying peer folders.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,176 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Imported messages</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows importing messages and media from foreign chat apps.">
<meta property="og:title" content="Imported messages">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows importing messages and media from foreign chat apps.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/import" >Imported messages</a></li></ul></div>
<h1 id="dev_page_title">Imported messages</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows importing messages and media from foreign chat apps.</p>
<blockquote>
<p>Note: This article is intended for MTProto API developers. If you're looking for a way to move history from other chat apps into Telegram, check out the related <a href="https://telegram.org/blog/move-history">Telegram blog post</a>.</p>
</blockquote>
<h3><a class="anchor" href="#1-validate-the-chat-export-file" id="1-validate-the-chat-export-file" name="1-validate-the-chat-export-file"><i class="anchor-icon"></i></a>1. Validate the chat export file</h3>
<pre><code><a href='/constructor/messages.historyImportParsed'>messages.historyImportParsed</a>#5e0fb7b9 flags:<a href='/type/%23'>#</a> pm:flags.0?<a href='/constructor/true'>true</a> group:flags.1?<a href='/constructor/true'>true</a> title:flags.2?<a href='/type/string'>string</a> = <a href='/type/messages.HistoryImportParsed'>messages.HistoryImportParsed</a>;
---functions---
<a href='/method/messages.checkHistoryImport'>messages.checkHistoryImport</a>#43fe19f3 import_head:<a href='/type/string'>string</a> = <a href='/type/messages.HistoryImportParsed'>messages.HistoryImportParsed</a>;</code></pre>
<p>The import process begins by calling <a href="/method/messages.checkHistoryImport">messages.checkHistoryImport</a>, passing to <code>import_head</code> up to 100 lines of the chat export file, starting from the beginning of the file.</p>
<p>The returned constructor contains information about the exported chat, including its title or type.
If the <code>pm</code> flag is set, the chat export file was generated from a private chat.
If the <code>group</code> flag is set, the chat export file was generated from a group chat.
If neither the <code>pm</code> or <code>group</code> flags are set, the specified chat export was generated from a chat of unknown type.</p>
<h3><a class="anchor" href="#2-choosing-a-destination-telegram-chat" id="2-choosing-a-destination-telegram-chat" name="2-choosing-a-destination-telegram-chat"><i class="anchor-icon"></i></a>2. Choosing a destination Telegram chat</h3>
<pre><code><a href='/constructor/messages.checkedHistoryImportPeer'>messages.checkedHistoryImportPeer</a>#a24de717 confirm_text:<a href='/type/string'>string</a> = <a href='/type/messages.CheckedHistoryImportPeer'>messages.CheckedHistoryImportPeer</a>;
---functions---
<a href='/method/messages.checkHistoryImportPeer'>messages.checkHistoryImportPeer</a>#5dc60f03 peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/messages.CheckedHistoryImportPeer'>messages.CheckedHistoryImportPeer</a>;</code></pre>
<p>Using <a href="/method/messages.checkHistoryImportPeer">messages.checkHistoryImportPeer</a>, check whether chat history exported from another chat app can be imported into a specific Telegram <code>peer</code>, chosen by the user.<br>
Typically, history imports are allowed for private chats with a mutual contact or <a href="/api/channel">supergroups</a> with <a href="/api/rights"><code>change_info</code> administrator rights »</a>.</p>
<p>If the check succeeds, and no RPC errors are returned, a <a href="/type/messages.CheckedHistoryImportPeer">messages.CheckedHistoryImportPeer</a> constructor will be returned, with a confirmation text to be shown to the user in a confirmation prompt.<br>
Upon final user confirmation, <a href="#3-initialize-the-import">the import process is initialized</a>. </p>
<h3><a class="anchor" href="#3-initialize-the-import" id="3-initialize-the-import" name="3-initialize-the-import"><i class="anchor-icon"></i></a>3. Initialize the import</h3>
<pre><code><a href='/constructor/messages.historyImport'>messages.historyImport</a>#1662af0b id:<a href='/type/long'>long</a> = <a href='/type/messages.HistoryImport'>messages.HistoryImport</a>;
---functions---
<a href='/method/messages.initHistoryImport'>messages.initHistoryImport</a>#34090c3b peer:<a href='/type/InputPeer'>InputPeer</a> file:<a href='/type/InputFile'>InputFile</a> media_count:<a href='/type/int'>int</a> = <a href='/type/messages.HistoryImport'>messages.HistoryImport</a>;</code></pre>
<p>Use <a href="/method/messages.initHistoryImport">messages.initHistoryImport</a> to initialize the import process, passing the following parameters: </p>
<ul>
<li><code>peer</code> - The Telegram chat where the history should be imported.</li>
<li><code>file</code> - The chat export file.</li>
<li><code>media_count</code> - The number of media files associated with the export, to be uploaded in <a href="#4-uploading-media">the next step</a>. </li>
</ul>
<h3><a class="anchor" href="#4-uploading-media" id="4-uploading-media" name="4-uploading-media"><i class="anchor-icon"></i></a>4. Uploading media</h3>
<pre><code>---functions---
<a href='/method/messages.uploadImportedMedia'>messages.uploadImportedMedia</a>#2a862092 peer:<a href='/type/InputPeer'>InputPeer</a> import_id:<a href='/type/long'>long</a> file_name:<a href='/type/string'>string</a> media:<a href='/type/InputMedia'>InputMedia</a> = <a href='/type/MessageMedia'>MessageMedia</a>;</code></pre>
<p>Use <a href="/method/messages.uploadImportedMedia">messages.uploadImportedMedia</a> to upload media files eventually associated with the chat export.<br>
<code>import_id</code> is the <code>id</code> contained in the <a href="/constructor/messages.historyImport">messages.historyImport</a> constructor, returned by <a href="/method/messages.initHistoryImport">messages.initHistoryImport</a> <a href="#3-initialize-the-import">in the previous step</a>. </p>
<h3><a class="anchor" href="#5-finalize-the-import" id="5-finalize-the-import" name="5-finalize-the-import"><i class="anchor-icon"></i></a>5. Finalize the import</h3>
<pre><code><a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/messageFwdHeader'>messageFwdHeader</a>#5f777dce flags:<a href='/type/%23'>#</a> imported:flags.7?<a href='/constructor/true'>true</a> from_id:flags.0?<a href='/type/Peer'>Peer</a> from_name:flags.5?<a href='/type/string'>string</a> date:<a href='/type/int'>int</a> channel_post:flags.2?<a href='/type/int'>int</a> post_author:flags.3?<a href='/type/string'>string</a> saved_from_peer:flags.4?<a href='/type/Peer'>Peer</a> saved_from_msg_id:flags.4?<a href='/type/int'>int</a> psa_type:flags.6?<a href='/type/string'>string</a> = <a href='/type/MessageFwdHeader'>MessageFwdHeader</a>;
---functions---
<a href='/method/messages.startHistoryImport'>messages.startHistoryImport</a>#b43df344 peer:<a href='/type/InputPeer'>InputPeer</a> import_id:<a href='/type/long'>long</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Finally, invoke <a href="/method/messages.startHistoryImport">messages.startHistoryImport</a> to complete the <a href="/api/import">history import process</a>, importing all messages into the chat.<br>
As usual, <code>import_id</code> is the <code>id</code> contained in the <a href="/constructor/messages.historyImport">messages.historyImport</a> constructor, returned by <a href="/method/messages.initHistoryImport">messages.initHistoryImport</a>. </p>
<p>Imported messages will show in the chat history as <a href="/constructor/message">messages</a> containing a <code>fwd_from</code> <a href="/constructor/messageFwdHeader">messageFwdHeader</a> constructor with the <code>imported</code> flag, and should be appropriately marked in the UI as messages imported from a foreign chat app.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,216 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Invites</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Chats and channels may have a public username or a private invite link: private invite links may be further enhanced with per-user join requests.">
<meta property="og:title" content="Invites">
<meta property="og:image" content="">
<meta property="og:description" content="Chats and channels may have a public username or a private invite link: private invite links may be further enhanced with per-user join requests.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/invites" >Invites</a></li></ul></div>
<h1 id="dev_page_title">Invites</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p><a href="/api/channel">Chats and channels</a> may have a public username or a private invite link: private invite links may be further enhanced with per-user <a href="https://telegram.org/blog/shared-media-scrolling-calendar-join-requests-and-more#join-requests-for-groups-and-channels">join requests</a>.</p>
<h2><a class="anchor" href="#public-usernames" id="public-usernames" name="public-usernames"><i class="anchor-icon"></i></a>Public usernames</h2>
<pre><code><a href='/constructor/contacts.resolvedPeer'>contacts.resolvedPeer</a>#7f077ad9 peer:<a href='/type/Peer'>Peer</a> chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/contacts.ResolvedPeer'>contacts.ResolvedPeer</a>;
---functions---
<a href='/method/contacts.resolveUsername'>contacts.resolveUsername</a>#f93ccba3 username:<a href='/type/string'>string</a> = <a href='/type/contacts.ResolvedPeer'>contacts.ResolvedPeer</a>;
<a href='/method/channels.joinChannel'>channels.joinChannel</a>#24b524c5 channel:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.checkUsername'>channels.checkUsername</a>#10e6bd2c channel:<a href='/type/InputChannel'>InputChannel</a> username:<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/channels.updateUsername'>channels.updateUsername</a>#3514b3de channel:<a href='/type/InputChannel'>InputChannel</a> username:<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Only <a href="/api/channel">supergroups and channels</a> may have a public usernames: <a href="/api/channel">normal groups</a> must be migrated to a <a href="/api/channel">supergroup</a> before they can be assigned a username, see the <a href="/api/channel#migration">migration docs »</a> for more info. </p>
<p><a href="/method/channels.updateUsername">channels.updateUsername</a> can be used to directly assign or change the public username of a supergroup or channel.<br>
You can use <a href="/method/channels.updateUsername">channels.checkUsername</a> before assigning the username to make sure that the specified username is valid and available. </p>
<p><a href="/method/channels.joinChannel">channels.joinChannel</a> can be used to join a supergroup or channel using peer information obtained using <a href="/method/contacts.resolveUsername">contacts.resolveUsername</a>.</p>
<h2><a class="anchor" href="#invite-links" id="invite-links" name="invite-links"><i class="anchor-icon"></i></a>Invite links</h2>
<pre><code><a href='/constructor/chatInviteExported'>chatInviteExported</a>#ab4a819 flags:<a href='/type/%23'>#</a> revoked:flags.0?<a href='/constructor/true'>true</a> permanent:flags.5?<a href='/constructor/true'>true</a> request_needed:flags.6?<a href='/constructor/true'>true</a> link:<a href='/type/string'>string</a> admin_id:<a href='/type/long'>long</a> date:<a href='/type/int'>int</a> start_date:flags.4?<a href='/type/int'>int</a> expire_date:flags.1?<a href='/type/int'>int</a> usage_limit:flags.2?<a href='/type/int'>int</a> usage:flags.3?<a href='/type/int'>int</a> requested:flags.7?<a href='/type/int'>int</a> title:flags.8?<a href='/type/string'>string</a> = <a href='/type/ExportedChatInvite'>ExportedChatInvite</a>;
<a href='/constructor/messages.exportedChatInvites'>messages.exportedChatInvites</a>#bdc62dcc count:<a href='/type/int'>int</a> invites:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ExportedChatInvite'>ExportedChatInvite</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ExportedChatInvites'>messages.ExportedChatInvites</a>;
<a href='/constructor/messages.exportedChatInvite'>messages.exportedChatInvite</a>#1871be50 invite:<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ExportedChatInvite'>messages.ExportedChatInvite</a>;
<a href='/constructor/messages.exportedChatInviteReplaced'>messages.exportedChatInviteReplaced</a>#222600ef invite:<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> new_invite:<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ExportedChatInvite'>messages.ExportedChatInvite</a>;
<a href='/constructor/chatInviteImporter'>chatInviteImporter</a>#8c5adfd9 flags:<a href='/type/%23'>#</a> requested:flags.0?<a href='/constructor/true'>true</a> user_id:<a href='/type/long'>long</a> date:<a href='/type/int'>int</a> about:flags.2?<a href='/type/string'>string</a> approved_by:flags.1?<a href='/type/long'>long</a> = <a href='/type/ChatInviteImporter'>ChatInviteImporter</a>;
<a href='/constructor/messages.chatInviteImporters'>messages.chatInviteImporters</a>#81b6b00a count:<a href='/type/int'>int</a> importers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ChatInviteImporter'>ChatInviteImporter</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ChatInviteImporters'>messages.ChatInviteImporters</a>;
<a href='/constructor/chatAdminWithInvites'>chatAdminWithInvites</a>#f2ecef23 admin_id:<a href='/type/long'>long</a> invites_count:<a href='/type/int'>int</a> revoked_invites_count:<a href='/type/int'>int</a> = <a href='/type/ChatAdminWithInvites'>ChatAdminWithInvites</a>;
<a href='/constructor/messages.chatAdminsWithInvites'>messages.chatAdminsWithInvites</a>#b69b72d7 admins:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ChatAdminWithInvites'>ChatAdminWithInvites</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ChatAdminsWithInvites'>messages.ChatAdminsWithInvites</a>;
<a href='/constructor/chatInviteAlready'>chatInviteAlready</a>#5a686d7c chat:<a href='/type/Chat'>Chat</a> = <a href='/type/ChatInvite'>ChatInvite</a>;
<a href='/constructor/chatInvite'>chatInvite</a>#300c44c1 flags:<a href='/type/%23'>#</a> channel:flags.0?<a href='/constructor/true'>true</a> broadcast:flags.1?<a href='/constructor/true'>true</a> public:flags.2?<a href='/constructor/true'>true</a> megagroup:flags.3?<a href='/constructor/true'>true</a> request_needed:flags.6?<a href='/constructor/true'>true</a> title:<a href='/type/string'>string</a> about:flags.5?<a href='/type/string'>string</a> photo:<a href='/type/Photo'>Photo</a> participants_count:<a href='/type/int'>int</a> participants:flags.4?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/ChatInvite'>ChatInvite</a>;
<a href='/constructor/chatInvitePeek'>chatInvitePeek</a>#61695cb0 chat:<a href='/type/Chat'>Chat</a> expires:<a href='/type/int'>int</a> = <a href='/type/ChatInvite'>ChatInvite</a>;
---functions---
<a href='/method/messages.exportChatInvite'>messages.exportChatInvite</a>#a02ce5d5 flags:<a href='/type/%23'>#</a> legacy_revoke_permanent:flags.2?<a href='/constructor/true'>true</a> request_needed:flags.3?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> expire_date:flags.0?<a href='/type/int'>int</a> usage_limit:flags.1?<a href='/type/int'>int</a> title:flags.4?<a href='/type/string'>string</a> = <a href='/type/ExportedChatInvite'>ExportedChatInvite</a>;
<a href='/method/messages.getExportedChatInvites'>messages.getExportedChatInvites</a>#a2b5a3f6 flags:<a href='/type/%23'>#</a> revoked:flags.3?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> admin_id:<a href='/type/InputUser'>InputUser</a> offset_date:flags.2?<a href='/type/int'>int</a> offset_link:flags.2?<a href='/type/string'>string</a> limit:<a href='/type/int'>int</a> = <a href='/type/messages.ExportedChatInvites'>messages.ExportedChatInvites</a>;
<a href='/method/messages.getExportedChatInvite'>messages.getExportedChatInvite</a>#73746f5c peer:<a href='/type/InputPeer'>InputPeer</a> link:<a href='/type/string'>string</a> = <a href='/type/messages.ExportedChatInvite'>messages.ExportedChatInvite</a>;
<a href='/method/messages.editExportedChatInvite'>messages.editExportedChatInvite</a>#bdca2f75 flags:<a href='/type/%23'>#</a> revoked:flags.2?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> link:<a href='/type/string'>string</a> expire_date:flags.0?<a href='/type/int'>int</a> usage_limit:flags.1?<a href='/type/int'>int</a> request_needed:flags.3?<a href='/type/Bool'>Bool</a> title:flags.4?<a href='/type/string'>string</a> = <a href='/type/messages.ExportedChatInvite'>messages.ExportedChatInvite</a>;
<a href='/method/messages.deleteRevokedExportedChatInvites'>messages.deleteRevokedExportedChatInvites</a>#56987bd5 peer:<a href='/type/InputPeer'>InputPeer</a> admin_id:<a href='/type/InputUser'>InputUser</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/messages.deleteExportedChatInvite'>messages.deleteExportedChatInvite</a>#d464a42b peer:<a href='/type/InputPeer'>InputPeer</a> link:<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/messages.getAdminsWithInvites'>messages.getAdminsWithInvites</a>#3920e6ef peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/messages.ChatAdminsWithInvites'>messages.ChatAdminsWithInvites</a>;
<a href='/method/messages.getChatInviteImporters'>messages.getChatInviteImporters</a>#df04dd4e flags:<a href='/type/%23'>#</a> requested:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> link:flags.1?<a href='/type/string'>string</a> q:flags.2?<a href='/type/string'>string</a> offset_date:<a href='/type/int'>int</a> offset_user:<a href='/type/InputUser'>InputUser</a> limit:<a href='/type/int'>int</a> = <a href='/type/messages.ChatInviteImporters'>messages.ChatInviteImporters</a>;
<a href='/method/messages.checkChatInvite'>messages.checkChatInvite</a>#3eadb1bb hash:<a href='/type/string'>string</a> = <a href='/type/ChatInvite'>ChatInvite</a>;
<a href='/method/messages.importChatInvite'>messages.importChatInvite</a>#6c50051c hash:<a href='/type/string'>string</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>Private invite links can optionally have an expiration date, a usage limit, and can even be set to only allow users into the channel, supergroup or group upon explicit approval of an admin: see <a href="#join-requests">join requests »</a> for more info.</p>
<p>Invite links match the following regex: <code>@(?:t|telegram)\.(?:me|dog)/(joinchat/|\+)?([\w-]+)@i</code>.<br>
The first matching group can be passed to the <code>hash</code> parameter of <a href="/method/messages.checkChatInvite">messages.checkChatInvite</a> to get info about the chat, and <a href="/method/messages.importChatInvite">messages.importChatInvite</a> to join the chat.<br>
<a href="/method/messages.checkChatInvite">messages.checkChatInvite</a> may return <a href="/constructor/chatInvitePeek">chatInvitePeek</a> only for <a href="/api/channel">supergroups and channels</a>, in which case the user may directly fetch chat messages using <a href="/api/updates">updates</a>, <a href="/method/messages.getHistory">messages.getHistory</a> and <a href="/method/channels.getMessages">channels.getMessages</a> until the time indicated by the <code>expires</code> unixtime field.</p>
<p>Newly created groups, supergroups and channel already have a default invite link.<br>
To generate a new one, use <a href="/method/messages.exportChatInvite">messages.exportChatInvite</a>.<br>
To get info about existing chat invites, optionally filtering only links created by a given admin, use <a href="/method/messages.getExportedChatInvites">messages.getExportedChatInvites</a>.<br>
<a href="/method/messages.getExportedChatInvite">messages.getExportedChatInvite</a> can be used to obtain info about a specific invite link. </p>
<p><a href="/method/messages.editExportedChatInvite">messages.editExportedChatInvite</a> is used to edit or revoke existing invite links: revoked links cannot be used by users to join the group, but info about revoked links can still be fetched using <a href="/method/messages.getExportedChatInvites">messages.getExportedChatInvites</a> with the <code>revoked</code> flag set.<br>
Use <a href="/method/messages.deleteExportedChatInvite">messages.deleteExportedChatInvite</a> to permanently remove an invite link, and <a href="/method/messages.deleteRevokedExportedChatInvites">messages.deleteRevokedExportedChatInvites</a> to permanently remove a revoked invite link. </p>
<p><a href="/method/messages.getChatInviteImporters">messages.getChatInviteImporters</a> can be used to fetch info about users that joined using a specific invite link. </p>
<p>Some basic stats about the number of invite links generated by a given admin can be fetched using <a href="/method/messages.getAdminsWithInvites">messages.getAdminsWithInvites</a>. </p>
<h2><a class="anchor" href="#join-requests" id="join-requests" name="join-requests"><i class="anchor-icon"></i></a>Join requests</h2>
<pre><code><a href='/constructor/chatInvite'>chatInvite</a>#300c44c1 flags:<a href='/type/%23'>#</a> channel:flags.0?<a href='/constructor/true'>true</a> broadcast:flags.1?<a href='/constructor/true'>true</a> public:flags.2?<a href='/constructor/true'>true</a> megagroup:flags.3?<a href='/constructor/true'>true</a> request_needed:flags.6?<a href='/constructor/true'>true</a> title:<a href='/type/string'>string</a> about:flags.5?<a href='/type/string'>string</a> photo:<a href='/type/Photo'>Photo</a> participants_count:<a href='/type/int'>int</a> participants:flags.4?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/ChatInvite'>ChatInvite</a>;
<a href='/constructor/updatePendingJoinRequests'>updatePendingJoinRequests</a>#7063c3db peer:<a href='/type/Peer'>Peer</a> requests_pending:<a href='/type/int'>int</a> recent_requesters:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; = <a href='/type/Update'>Update</a>;
<a href='/constructor/updateBotChatInviteRequester'>updateBotChatInviteRequester</a>#11dfa986 peer:<a href='/type/Peer'>Peer</a> date:<a href='/type/int'>int</a> user_id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> invite:<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> qts:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/messages.chatInviteImporters'>messages.chatInviteImporters</a>#81b6b00a count:<a href='/type/int'>int</a> importers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ChatInviteImporter'>ChatInviteImporter</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ChatInviteImporters'>messages.ChatInviteImporters</a>;
<a href='/constructor/peerSettings'>peerSettings</a>#a518110d flags:<a href='/type/%23'>#</a> report_spam:flags.0?<a href='/constructor/true'>true</a> add_contact:flags.1?<a href='/constructor/true'>true</a> block_contact:flags.2?<a href='/constructor/true'>true</a> share_contact:flags.3?<a href='/constructor/true'>true</a> need_contacts_exception:flags.4?<a href='/constructor/true'>true</a> report_geo:flags.5?<a href='/constructor/true'>true</a> autoarchived:flags.7?<a href='/constructor/true'>true</a> invite_members:flags.8?<a href='/constructor/true'>true</a> request_chat_broadcast:flags.10?<a href='/constructor/true'>true</a> geo_distance:flags.6?<a href='/type/int'>int</a> request_chat_title:flags.9?<a href='/type/string'>string</a> request_chat_date:flags.9?<a href='/type/int'>int</a> = <a href='/type/PeerSettings'>PeerSettings</a>;
<a href='/constructor/messageActionChatJoinedByRequest'>messageActionChatJoinedByRequest</a>#ebbca3cb = <a href='/type/MessageAction'>MessageAction</a>;
<a href='/constructor/channelAdminLogEventActionParticipantJoinByRequest'>channelAdminLogEventActionParticipantJoinByRequest</a>#afb6144a invite:<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> approved_by:<a href='/type/long'>long</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
---functions---
<a href='/method/messages.checkChatInvite'>messages.checkChatInvite</a>#3eadb1bb hash:<a href='/type/string'>string</a> = <a href='/type/ChatInvite'>ChatInvite</a>;
<a href='/method/messages.importChatInvite'>messages.importChatInvite</a>#6c50051c hash:<a href='/type/string'>string</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.getChatInviteImporters'>messages.getChatInviteImporters</a>#df04dd4e flags:<a href='/type/%23'>#</a> requested:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> link:flags.1?<a href='/type/string'>string</a> q:flags.2?<a href='/type/string'>string</a> offset_date:<a href='/type/int'>int</a> offset_user:<a href='/type/InputUser'>InputUser</a> limit:<a href='/type/int'>int</a> = <a href='/type/messages.ChatInviteImporters'>messages.ChatInviteImporters</a>;
<a href='/method/messages.hideChatJoinRequest'>messages.hideChatJoinRequest</a>#7fe7e815 flags:<a href='/type/%23'>#</a> approved:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> user_id:<a href='/type/InputUser'>InputUser</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.hideAllChatJoinRequests'>messages.hideAllChatJoinRequests</a>#e085f4ea flags:<a href='/type/%23'>#</a> approved:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> link:flags.1?<a href='/type/string'>string</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>If the <code>request_needed</code> flag is set when <a href="#invite-links">generating or editing an invite link</a>, users importing the invite link using <a href="/method/messages.importChatInvite">messages.importChatInvite</a> will receive an <code>INVITE_REQUEST_SENT</code> RPC error, indicating that an join request was successfully sent to the chat admins. </p>
<p>Bot administrators will receive a <a href="/constructor/updateBotChatInviteRequester">updateBotChatInviteRequester</a> update for each separate join request.<br>
User administrators will receive an <a href="/constructor/updatePendingJoinRequests">updatePendingJoinRequests</a>, and should invoke <a href="/method/messages.getChatInviteImporters">messages.getChatInviteImporters</a> with the <code>requested</code> flag set to obtain a list of users waiting to be admitted into the group. </p>
<p>Administrators can then use <a href="/method/messages.hideChatJoinRequest">messages.hideChatJoinRequest</a> to approve or dismiss a join request, and <a href="/method/messages.hideAllChatJoinRequests">messages.hideAllChatJoinRequests</a> to approve or dismiss in bulk multiple join requests. </p>
<p>Administrators can also choose send a message to the user before admitting them into the group: in this case, graphical clients <em>on the user side</em> should display a message on the dialog bar of the chat with the admin, indicating that the chat was initiated by the admin of a chat/channel they have recently requested to join, according to the information contained in the <a href="/constructor/peerSettings">peerSettings »</a>. </p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,157 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Calling API Methods</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Additional options for calling methods.">
<meta property="og:title" content="Calling API Methods">
<meta property="og:image" content="5901cb4c908e540453">
<meta property="og:description" content="Additional options for calling methods.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/invoking" >Calling API Methods</a></li></ul></div>
<h1 id="dev_page_title">Calling API Methods</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<h3><a class="anchor" href="#layers" id="layers" name="layers"><i class="anchor-icon"></i></a>Layers</h3>
<p>Versioning in the API is supported by so-called TL layers.</p>
<p>The need to add a new object constructor or to add/remove a field in a constructor creates a backwards compatibility problem for previous versions of API clients. After all, simply changing a constructor in a schema also changes its number. To address this problem, each schema update is separated into a layer.</p>
<p>A layer is a collection of updated methods or constructors in a TL schema. Each layer is numbered with sequentially increasing numbers starting with 2. The first layer is the base layer -- the TL schema without any changes.</p>
<p>There is a helper method to let the API know that a client supports the Layer <code>layer</code>:</p>
<pre><code>invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;</code></pre>
<p>The helper method <strong><a href="/method/invokeWithLayer">invokeWithLayer</a></strong> can be used only together with <a href="/method/initConnection">initConnection</a>: the present layer will be saved with all other parameters of the client and any future requests will be using this saved value. <a href="#saving-client-info">See more below</a>.</p>
<h4><a class="anchor" href="#list-of-available-layers" id="list-of-available-layers" name="list-of-available-layers"><i class="anchor-icon"></i></a><a href="/api/layers">List of Available Layers</a></h4>
<h3><a class="anchor" href="#saving-client-info" id="saving-client-info" name="saving-client-info"><i class="anchor-icon"></i></a>Saving Client Info</h3>
<p>It is possible to save information about the current client on the server in conjunction with an authorization key. This may help eliminate client-side problems with certain releases on certain devices or with certain localizations, as well as eliminate the need for sending layer information in each request.</p>
<p>The helper method <strong><a href="/method/initConnection">initConnection</a></strong> accepts client parameters. This method must be called when first calling the API after the application has restarted or in case the value of one of the parameters could have changed.</p>
<p><strong>initConnection</strong> must also be called after each <a href="/method/auth.bindTempAuthKey">auth.bindTempAuthKey</a>.</p>
<p>When calling this method, the current layer used by the client is also saved (the layer in which <a href="/method/initConnection">initConnection</a> was wrapped is used). After a successful call to <a href="/method/initConnection">initConnection</a> it is no longer necessary to wrap each API call in <strong>invokeWithLayerN</strong>.</p>
<h3><a class="anchor" href="#disabling-updates" id="disabling-updates" name="disabling-updates"><i class="anchor-icon"></i></a>Disabling updates</h3>
<pre><code>invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;</code></pre>
<p><a href="/method/invokeWithoutUpdates">invokeWithoutUpdates</a> can be used to invoke a request without subscribing the used connection for <a href="/api/updates">updates</a> (this is enabled by default for <a href="/api/files">file queries</a>).</p>
<h3><a class="anchor" href="#sequential-requests" id="sequential-requests" name="sequential-requests"><i class="anchor-icon"></i></a>Sequential Requests</h3>
<p>By default, the server processes parallel requests in arbitrary order. Two helper methods exist for cases when the client needs certain requests to be processed in a certain order and intends to send a new request before the previous one is completed:</p>
<div class="richcode">
<p><a href="/method/invokeAfterMsg">invokeAfterMsg</a>#cb9f372d {X:Type} msg_id:long query:!X = X;<br>
<a href="/method/invokeAfterMsgs">invokeAfterMsgs</a>#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X; </long></p>
</div>
<p>They may be used, for example, when a client attempts to send messages that accumulated while waiting for the Internet connection to be restored for a long time. In this case, the 32-bit number <code>0xcb9f372d</code> must be added before the method number in each request, followed by a 64-bit message identifier, msg_id, which contains the previous request in the queue. </p>
<p>The second method is similar, except it takes several messages that must be successfully processed before the current one.</p>
<p>If the waiting period exceeds 0.5 seconds (this value may change in the future) and no result has appeared, the method will return the <a href="/api/errors#400-bad-request">400 MSG_WAIT_TIMEOUT</a> error.</p>
<h4><a class="anchor" href="#helper-method-sequence" id="helper-method-sequence" name="helper-method-sequence"><i class="anchor-icon"></i></a>Helper Method Sequence</h4>
<p><strong>Important:</strong> if the helper methods <strong>invokeAfterMsg</strong> / <strong>invokeAfterMsgs</strong> are used together with <strong>invokeWithLayerN</strong> or other helper methods, <strong>invokeAfterMsg</strong> / <strong>invokeAfterMsgs</strong> must always be the outermost wrapper.</p>
<h3><a class="anchor" href="#data-compression" id="data-compression" name="data-compression"><i class="anchor-icon"></i></a>Data Compression</h3>
<p>We recommend using gzip compression when calling methods to reduce the amount of network traffic.</p>
<p>The schema and constructor information are given in the <a href="/mtproto/service_messages#packed-object">protocol documentation</a>.</p>
<h4><a class="anchor" href="#data-compression-when-making-a-request" id="data-compression-when-making-a-request" name="data-compression-when-making-a-request"><i class="anchor-icon"></i></a>Data Compression when Making a Request</h4>
<p>Before transmitting a query, the string containing the entire body of the serialized high-level query (starting with the method number) must be compressed using gzip. If the resulting string is smaller than the original, it makes sense to transmit the <a href="/mtproto/service_messages#pakovannyy-obekt">gzip_packed</a> constructor.</p>
<p>There is no point in doing the above when transmitting binary multimedia data (photos, videos) or small messages (up to 255 bytes).</p>
<h4><a class="anchor" href="#decompressing-data" id="decompressing-data" name="decompressing-data"><i class="anchor-icon"></i></a>Decompressing Data</h4>
<p>By default, the server compresses the response to any request as well as <a href="/api/updates">updates</a>, in accordance with the rules stated above. If the <a href="/mtproto/service_messages#packed-object">gzip_packed</a> constructor is received as a response in rpc_result, then the string that follows must be extracted and uncompressed. Processing then continues on the resulting new string.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,510 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Layers</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Below you will find information on schema changes. For more details on the use of layers, see Invoking API methods.
Layer…">
<meta property="og:title" content="Layers">
<meta property="og:image" content="">
<meta property="og:description" content="Below you will find information on schema changes. For more details on the use of layers, see Invoking API methods.
Layer…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/layers" >Layers</a></li></ul></div>
<h1 id="dev_page_title">Layers</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Below you will find information on schema changes. For more details on the use of layers, see <a href="/api/invoking#layers">Invoking API methods</a>.</p>
<h3><a class="anchor" href="#layer-139" id="layer-139" name="layer-139"><i class="anchor-icon"></i></a><a href="/schema?layer=139">Layer 139</a></h3>
<p><a href="https://telegram.org/blog/downloads-attachments-streaming#live-streaming-with-other-apps">RTMP streams in group calls and livestreams</a>, <a href="https://telegram.org/blog/downloads-attachments-streaming#phone-number-links">link to users by their phone number</a>, <a href="https://telegram.org/blog/downloads-attachments-streaming#new-attachment-menu">browse recently sent media</a> and new report options for illegal drugs and personal details.</p>
<p>The <a href="/api/errors#error-database">RPC error database »</a> was also updated.</p>
<h4><a class="anchor" href="#schema-changes" id="schema-changes" name="schema-changes"><i class="anchor-icon"></i></a>Schema changes</h4>
<h5><a class="anchor" href="#new-methods" id="new-methods" name="new-methods"><i class="anchor-icon"></i></a>New Methods</h5>
<ul>
<li>Added <a href="/method/contacts.resolvePhone">contacts.resolvePhone</a> - Resolve a phone number to get user info, if their privacy settings allow it.</li>
<li>Added <a href="/method/phone.getGroupCallStreamChannels">phone.getGroupCallStreamChannels</a> - Get info about RTMP streams in a group call or livestream. </li>
<li>Added <a href="/method/phone.getGroupCallStreamRtmpUrl">phone.getGroupCallStreamRtmpUrl</a> - Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with <a href="/method/phone.createGroupCall">phone.createGroupCall</a> (the <code>rtmp_stream</code> flag must be set).</li>
<li>Added <a href="/method/messages.searchSentMedia">messages.searchSentMedia</a> - View and search recently sent media. </li>
</ul>
<h5><a class="anchor" href="#changed-methods" id="changed-methods" name="changed-methods"><i class="anchor-icon"></i></a>Changed Methods</h5>
<ul>
<li>Added <strong>rtmp_stream</strong> parameter in <a href="/method/phone.createGroupCall">phone.createGroupCall</a></li>
</ul>
<h5><a class="anchor" href="#new-constructors" id="new-constructors" name="new-constructors"><i class="anchor-icon"></i></a>New Constructors</h5>
<ul>
<li>Added <a href="/constructor/groupCallStreamChannel">groupCallStreamChannel</a> - Info about an RTMP stream in a group call or livestream</li>
<li>Added <a href="/constructor/phone.groupCallStreamChannels">phone.groupCallStreamChannels</a> - Info about RTMP streams in a group call or livestream</li>
<li>Added <a href="/constructor/inputReportReasonIllegalDrugs">inputReportReasonIllegalDrugs</a> - Report for illegal drugs</li>
<li>Added <a href="/constructor/inputReportReasonPersonalDetails">inputReportReasonPersonalDetails</a> - Report for divulgation of personal details</li>
<li>Added <a href="/constructor/phone.groupCallStreamRtmpUrl">phone.groupCallStreamRtmpUrl</a> - RTMP URL and stream key to be used in streaming software</li>
</ul>
<h5><a class="anchor" href="#changed-constructors" id="changed-constructors" name="changed-constructors"><i class="anchor-icon"></i></a>Changed Constructors</h5>
<ul>
<li>Added <strong>rtmp_stream</strong>, <strong>listeners_hidden</strong> parameters in <a href="/constructor/groupCall">groupCall</a></li>
</ul>
<h4><a class="anchor" href="#schema" id="schema" name="schema"><i class="anchor-icon"></i></a>Schema</h4>
<div><pre><code><a href="/constructor/groupCall">groupCall</a>#d597650c flags:<a href="/type/%23">#</a> join_muted:flags.1?<a href="/constructor/true">true</a> can_change_join_muted:flags.2?<a href="/constructor/true">true</a> join_date_asc:flags.6?<a href="/constructor/true">true</a> schedule_start_subscribed:flags.8?<a href="/constructor/true">true</a> can_start_video:flags.9?<a href="/constructor/true">true</a> record_video_active:flags.11?<a href="/constructor/true">true</a> rtmp_stream:flags.12?<a href="/constructor/true">true</a> listeners_hidden:flags.13?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> access_hash:<a href="/type/long">long</a> participants_count:<a href="/type/int">int</a> title:flags.3?<a href="/type/string">string</a> stream_dc_id:flags.4?<a href="/type/int">int</a> record_start_date:flags.5?<a href="/type/int">int</a> schedule_date:flags.7?<a href="/type/int">int</a> unmuted_video_count:flags.10?<a href="/type/int">int</a> unmuted_video_limit:<a href="/type/int">int</a> version:<a href="/type/int">int</a> = <a href="/type/GroupCall">GroupCall</a>;
<a href="/constructor/groupCallStreamChannel">groupCallStreamChannel</a>#80eb48af channel:<a href="/type/int">int</a> scale:<a href="/type/int">int</a> last_timestamp_ms:<a href="/type/long">long</a> = <a href="/type/GroupCallStreamChannel">GroupCallStreamChannel</a>;<br>
<a href="/constructor/phone.groupCallStreamChannels">phone.groupCallStreamChannels</a>#d0e482b2 channels:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/GroupCallStreamChannel">GroupCallStreamChannel</a>&gt; = <a href="/type/phone.GroupCallStreamChannels">phone.GroupCallStreamChannels</a>;<br>
<a href="/constructor/inputReportReasonIllegalDrugs">inputReportReasonIllegalDrugs</a>#0a8eb2be = <a href="/type/ReportReason">ReportReason</a>;
<a href="/constructor/inputReportReasonPersonalDetails">inputReportReasonPersonalDetails</a>#9ec7863d = <a href="/type/ReportReason">ReportReason</a>;<br>
<a href="/constructor/phone.groupCallStreamRtmpUrl">phone.groupCallStreamRtmpUrl</a>#2dbf3432 url:<a href="/type/string">string</a> key:<a href="/type/string">string</a> = <a href="/type/phone.GroupCallStreamRtmpUrl">phone.GroupCallStreamRtmpUrl</a>;<br>
---functions---<br>
<a href="/method/phone.createGroupCall">phone.createGroupCall</a>#48cdc6d8 flags:<a href="/type/%23">#</a> rtmp_stream:flags.2?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> random_id:<a href="/type/int">int</a> title:flags.0?<a href="/type/string">string</a> schedule_date:flags.1?<a href="/type/int">int</a> = <a href="/type/Updates">Updates</a>;<br>
<a href="/method/contacts.resolvePhone">contacts.resolvePhone</a>#8af94344 phone:<a href="/type/string">string</a> = <a href="/type/contacts.ResolvedPeer">contacts.ResolvedPeer</a>;<br>
<a href="/method/phone.getGroupCallStreamChannels">phone.getGroupCallStreamChannels</a>#1ab21940 call:<a href="/type/InputGroupCall">InputGroupCall</a> = <a href="/type/phone.GroupCallStreamChannels">phone.GroupCallStreamChannels</a>;
<a href="/method/phone.getGroupCallStreamRtmpUrl">phone.getGroupCallStreamRtmpUrl</a>#deb3abbf peer:<a href="/type/InputPeer">InputPeer</a> revoke:<a href="/type/Bool">Bool</a> = <a href="/type/phone.GroupCallStreamRtmpUrl">phone.GroupCallStreamRtmpUrl</a>;<br>
<a href="/method/messages.searchSentMedia">messages.searchSentMedia</a>#107e31a0 q:<a href="/type/string">string</a> filter:<a href="/type/MessagesFilter">MessagesFilter</a> limit:<a href="/type/int">int</a> = <a href="/type/messages.Messages">messages.Messages</a>;<br></code></pre></div>
<h3><a class="anchor" href="#layer-138" id="layer-138" name="layer-138"><i class="anchor-icon"></i></a><a href="/schema?layer=138">Layer 138</a></h3>
<p><a href="https://telegram.org/blog/video-stickers-better-reactions#video-stickers">Video stickers</a>, <a href="https://telegram.org/blog/video-stickers-better-reactions#better-reactions">better reactions</a>.</p>
<h4><a class="anchor" href="#schema-changes" id="schema-changes" name="schema-changes"><i class="anchor-icon"></i></a>Schema changes</h4>
<h5><a class="anchor" href="#new-methods" id="new-methods" name="new-methods"><i class="anchor-icon"></i></a>New Methods</h5>
<ul>
<li>Added <a href="/method/messages.getUnreadReactions">messages.getUnreadReactions</a> - Get unread reactions to messages you sent</li>
<li>Added <a href="/method/messages.readReactions">messages.readReactions</a> - Mark <a href="/api/reactions">message reactions »</a> as read</li>
</ul>
<h5><a class="anchor" href="#changed-methods" id="changed-methods" name="changed-methods"><i class="anchor-icon"></i></a>Changed Methods</h5>
<ul>
<li>Added <strong>videos</strong> parameter in <a href="/method/stickers.createStickerSet">stickers.createStickerSet</a></li>
</ul>
<h5><a class="anchor" href="#new-constructors" id="new-constructors" name="new-constructors"><i class="anchor-icon"></i></a>New Constructors</h5>
<ul>
<li>Added <a href="/constructor/messagePeerReaction">messagePeerReaction</a> - How a certain peer reacted to the message</li>
</ul>
<h5><a class="anchor" href="#changed-constructors" id="changed-constructors" name="changed-constructors"><i class="anchor-icon"></i></a>Changed Constructors</h5>
<ul>
<li>Added <strong>unread_reactions_count</strong> parameter in <a href="/constructor/dialog">dialog</a></li>
<li>Added <strong>videos</strong> parameter in <a href="/constructor/stickerSet">stickerSet</a></li>
<li>Added <strong>recent_reactions</strong> parameter, removed <strong>recent_reactons</strong> parameter in <a href="/constructor/messageReactions">messageReactions</a></li>
<li>Added <strong>chats</strong> parameter, changed type of <strong>reactions</strong> from <strong>Vector&lt;MessageUserReaction&gt;</strong> to <strong>Vector&lt;MessagePeerReaction&gt;</strong> in <a href="/constructor/messages.messageReactionsList">messages.messageReactionsList</a></li>
</ul>
<h5><a class="anchor" href="#deleted-constructors" id="deleted-constructors" name="deleted-constructors"><i class="anchor-icon"></i></a>Deleted Constructors</h5>
<ul>
<li>Removed messageUserReaction</li>
</ul>
<h4><a class="anchor" href="#schema" id="schema" name="schema"><i class="anchor-icon"></i></a>Schema</h4>
<div><pre><code><a href="/constructor/dialog">dialog</a>#a8edd0f5 flags:<a href="/type/%23">#</a> pinned:flags.2?<a href="/constructor/true">true</a> unread_mark:flags.3?<a href="/constructor/true">true</a> peer:<a href="/type/Peer">Peer</a> top_message:<a href="/type/int">int</a> read_inbox_max_id:<a href="/type/int">int</a> read_outbox_max_id:<a href="/type/int">int</a> unread_count:<a href="/type/int">int</a> unread_mentions_count:<a href="/type/int">int</a> unread_reactions_count:<a href="/type/int">int</a> notify_settings:<a href="/type/PeerNotifySettings">PeerNotifySettings</a> pts:flags.0?<a href="/type/int">int</a> draft:flags.1?<a href="/type/DraftMessage">DraftMessage</a> folder_id:flags.4?<a href="/type/int">int</a> = <a href="/type/Dialog">Dialog</a>;<br>
<a href="/constructor/stickerSet">stickerSet</a>#d7df217a flags:<a href="/type/%23">#</a> archived:flags.1?<a href="/constructor/true">true</a> official:flags.2?<a href="/constructor/true">true</a> masks:flags.3?<a href="/constructor/true">true</a> animated:flags.5?<a href="/constructor/true">true</a> videos:flags.6?<a href="/constructor/true">true</a> installed_date:flags.0?<a href="/type/int">int</a> id:<a href="/type/long">long</a> access_hash:<a href="/type/long">long</a> title:<a href="/type/string">string</a> short_name:<a href="/type/string">string</a> thumbs:flags.4?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/PhotoSize">PhotoSize</a>&gt; thumb_dc_id:flags.4?<a href="/type/int">int</a> thumb_version:flags.4?<a href="/type/int">int</a> count:<a href="/type/int">int</a> hash:<a href="/type/int">int</a> = <a href="/type/StickerSet">StickerSet</a>;<br>
<a href="/constructor/messageReactions">messageReactions</a>#4f2b9479 flags:<a href="/type/%23">#</a> min:flags.0?<a href="/constructor/true">true</a> can_see_list:flags.2?<a href="/constructor/true">true</a> results:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/ReactionCount">ReactionCount</a>&gt; recent_reactions:flags.1?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessagePeerReaction">MessagePeerReaction</a>&gt; = <a href="/type/MessageReactions">MessageReactions</a>;
<a href="/constructor/messages.messageReactionsList">messages.messageReactionsList</a>#31bd492d flags:<a href="/type/%23">#</a> count:<a href="/type/int">int</a> reactions:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessagePeerReaction">MessagePeerReaction</a>&gt; chats:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Chat">Chat</a>&gt; users:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt; next_offset:flags.0?<a href="/type/string">string</a> = <a href="/type/messages.MessageReactionsList">messages.MessageReactionsList</a>;
<a href="/constructor/messagePeerReaction">messagePeerReaction</a>#51b67eff flags:<a href="/type/%23">#</a> big:flags.0?<a href="/constructor/true">true</a> unread:flags.1?<a href="/constructor/true">true</a> peer_id:<a href="/type/Peer">Peer</a> reaction:<a href="/type/string">string</a> = <a href="/type/MessagePeerReaction">MessagePeerReaction</a>;<br>
---functions---<br>
<a href="/method/stickers.createStickerSet">stickers.createStickerSet</a>#9021ab67 flags:<a href="/type/%23">#</a> masks:flags.0?<a href="/constructor/true">true</a> animated:flags.1?<a href="/constructor/true">true</a> videos:flags.4?<a href="/constructor/true">true</a> user_id:<a href="/type/InputUser">InputUser</a> title:<a href="/type/string">string</a> short_name:<a href="/type/string">string</a> thumb:flags.2?<a href="/type/InputDocument">InputDocument</a> stickers:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/InputStickerSetItem">InputStickerSetItem</a>&gt; software:flags.3?<a href="/type/string">string</a> = <a href="/type/messages.StickerSet">messages.StickerSet</a>;<br>
<a href="/method/messages.getUnreadReactions">messages.getUnreadReactions</a>#e85bae1a peer:<a href="/type/InputPeer">InputPeer</a> offset_id:<a href="/type/int">int</a> add_offset:<a href="/type/int">int</a> limit:<a href="/type/int">int</a> max_id:<a href="/type/int">int</a> min_id:<a href="/type/int">int</a> = <a href="/type/messages.Messages">messages.Messages</a>;
<a href="/method/messages.readReactions">messages.readReactions</a>#82e251d7 peer:<a href="/type/InputPeer">InputPeer</a> = <a href="/type/messages.AffectedHistory">messages.AffectedHistory</a>;<br></code></pre></div>
<h3><a class="anchor" href="#layer-137" id="layer-137" name="layer-137"><i class="anchor-icon"></i></a><a href="/schema?layer=137">Layer 137</a></h3>
<p><a href="https://telegram.org/blog/reactions-spoilers-translations#spoilers">Message translation</a>.</p>
<h4><a class="anchor" href="#schema-changes" id="schema-changes" name="schema-changes"><i class="anchor-icon"></i></a>Schema changes</h4>
<h5><a class="anchor" href="#new-methods" id="new-methods" name="new-methods"><i class="anchor-icon"></i></a>New Methods</h5>
<ul>
<li>Added <a href="/method/messages.translateText">messages.translateText</a> - Translate a given text</li>
</ul>
<h5><a class="anchor" href="#new-constructors" id="new-constructors" name="new-constructors"><i class="anchor-icon"></i></a>New Constructors</h5>
<ul>
<li>Added <a href="/constructor/messages.translateNoResult">messages.translateNoResult</a> - No translation is available</li>
<li>Added <a href="/constructor/messages.translateResultText">messages.translateResultText</a> - Translated text</li>
</ul>
<h5><a class="anchor" href="#changed-constructors" id="changed-constructors" name="changed-constructors"><i class="anchor-icon"></i></a>Changed Constructors</h5>
<ul>
<li>Added <strong>around_animation</strong>, <strong>center_icon</strong> parameters in <a href="/constructor/availableReaction">availableReaction</a></li>
</ul>
<h4><a class="anchor" href="#schema" id="schema" name="schema"><i class="anchor-icon"></i></a>Schema</h4>
<div><pre><code><a href="/constructor/availableReaction">availableReaction</a>#c077ec01 flags:<a href="/type/%23">#</a> inactive:flags.0?<a href="/constructor/true">true</a> reaction:<a href="/type/string">string</a> title:<a href="/type/string">string</a> static_icon:<a href="/type/Document">Document</a> appear_animation:<a href="/type/Document">Document</a> select_animation:<a href="/type/Document">Document</a> activate_animation:<a href="/type/Document">Document</a> effect_animation:<a href="/type/Document">Document</a> around_animation:flags.1?<a href="/type/Document">Document</a> center_icon:flags.1?<a href="/type/Document">Document</a> = <a href="/type/AvailableReaction">AvailableReaction</a>;<br>
<a href="/constructor/messages.translateNoResult">messages.translateNoResult</a>#67ca4737 = <a href="/type/messages.TranslatedText">messages.TranslatedText</a>;
<a href="/constructor/messages.translateResultText">messages.translateResultText</a>#a214f7d0 text:<a href="/type/string">string</a> = <a href="/type/messages.TranslatedText">messages.TranslatedText</a>;<br>
---functions---<br>
<a href="/method/messages.translateText">messages.translateText</a>#24ce6dee flags:<a href="/type/%23">#</a> peer:flags.0?<a href="/type/InputPeer">InputPeer</a> msg_id:flags.0?<a href="/type/int">int</a> text:flags.1?<a href="/type/string">string</a> from_lang:flags.2?<a href="/type/string">string</a> to_lang:<a href="/type/string">string</a> = <a href="/type/messages.TranslatedText">messages.TranslatedText</a>;<br></code></pre></div>
<h3><a class="anchor" href="#layer-136" id="layer-136" name="layer-136"><i class="anchor-icon"></i></a><a href="/schema?layer=136">Layer 136</a></h3>
<p><a href="https://telegram.org/blog/reactions-spoilers-translations#reactions">Reactions</a>, <a href="https://telegram.org/blog/reactions-spoilers-translations#spoilers">spoilers</a> and sponsored message improvements.</p>
<h4><a class="anchor" href="#schema-changes" id="schema-changes" name="schema-changes"><i class="anchor-icon"></i></a>Schema changes</h4>
<h5><a class="anchor" href="#new-methods" id="new-methods" name="new-methods"><i class="anchor-icon"></i></a>New Methods</h5>
<ul>
<li>Added <a href="/method/messages.sendReaction">messages.sendReaction</a> - React to message</li>
<li>Added <a href="/method/messages.getMessagesReactions">messages.getMessagesReactions</a> - Get <a href="/api/reactions">message reactions »</a></li>
<li>Added <a href="/method/messages.getMessageReactionsList">messages.getMessageReactionsList</a> - Get <a href="/api/reactions">message reaction</a> list, along with the sender of each reaction.</li>
<li>Added <a href="/method/messages.setChatAvailableReactions">messages.setChatAvailableReactions</a> - Change the set of <a href="/api/reactions">message reactions »</a> that can be used in a certain group, supergroup or channel</li>
<li>Added <a href="/method/messages.getAvailableReactions">messages.getAvailableReactions</a> - Obtain available <a href="/api/reactions">message reactions »</a></li>
<li>Added <a href="/method/messages.setDefaultReaction">messages.setDefaultReaction</a> - Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using <a href="/api/config#client-configuration">help.getAppConfig, <code>reactions_default</code> field</a>.</li>
</ul>
<h5><a class="anchor" href="#new-constructors" id="new-constructors" name="new-constructors"><i class="anchor-icon"></i></a>New Constructors</h5>
<ul>
<li>Added <a href="/constructor/updateMessageReactions">updateMessageReactions</a> - New <a href="/api/reactions">message reactions »</a> are available</li>
<li>Added <a href="/constructor/reactionCount">reactionCount</a> - Reactions</li>
<li>Added <a href="/constructor/messageReactions">messageReactions</a> - <a href="/api/reactions">Message reactions »</a></li>
<li>Added <a href="/constructor/messageUserReaction">messageUserReaction</a> - Message reaction</li>
<li>Added <a href="/constructor/messages.messageReactionsList">messages.messageReactionsList</a> - List of peers that reacted to a specific message</li>
<li>Added <a href="/constructor/availableReaction">availableReaction</a> - Animations associated with a message reaction</li>
<li>Added <a href="/constructor/messages.availableReactionsNotModified">messages.availableReactionsNotModified</a> - No new reactions are available</li>
<li>Added <a href="/constructor/messages.availableReactions">messages.availableReactions</a> - Animations and metadata associated with <a href="/api/reactions">message reactions »</a></li>
<li>Added <a href="/constructor/messageEntitySpoiler">messageEntitySpoiler</a> - Message entity representing a spoiler</li>
<li>Added <a href="/constructor/channelAdminLogEventActionChangeAvailableReactions">channelAdminLogEventActionChangeAvailableReactions</a> - The set of allowed <a href="/api/reactions">message reactions »</a> for this channel has changed</li>
</ul>
<h5><a class="anchor" href="#changed-constructors" id="changed-constructors" name="changed-constructors"><i class="anchor-icon"></i></a>Changed Constructors</h5>
<ul>
<li>Added <strong>available_reactions</strong> parameter in <a href="/constructor/chatFull">chatFull</a></li>
<li>Added <strong>reactions</strong> parameter in <a href="/constructor/message">message</a></li>
<li>Added <strong>available_reactions</strong> parameter in <a href="/constructor/channelFull">channelFull</a></li>
<li>Added <strong>chat_invite</strong>, <strong>chat_invite_hash</strong> parameters, changed type of <strong>from_id</strong> from <strong>Peer</strong> to <strong>flags.3?Peer</strong> in <a href="/constructor/sponsoredMessage">sponsoredMessage</a></li>
</ul>
<h4><a class="anchor" href="#push-notification-changes" id="push-notification-changes" name="push-notification-changes"><i class="anchor-icon"></i></a>PUSH notification changes</h4>
<h5><a class="anchor" href="#new-push-notifications" id="new-push-notifications" name="new-push-notifications"><i class="anchor-icon"></i></a>New PUSH notifications</h5>
<ul>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_AUDIO</a> - <code>{1}: {3} to your voice message in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_CONTACT</a> - <code>{1}: {3} to your contact {4} in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_DOC</a> - <code>{1}: {3} to your file in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_GAME</a> - <code>{1}: {3} to your game in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_GEO</a> - <code>{1}: {3} to your map in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_GEOLIVE</a> - <code>{1}: {3} to your live location in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_GIF</a> - <code>{1}: {3} to your GIF in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_INVOICE</a> - <code>{1}: {3} to your invoice in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_NOTEXT</a> - <code>{1}: {3} to your message in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_PHOTO</a> - <code>{1}: {3} to your photo in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_POLL</a> - <code>{1}: {3} to your poll {4} in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_QUIZ</a> - <code>{1}: {3} to your quiz {4} in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_ROUND</a> - <code>{1}: {3} to your video message in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_STICKER</a> - <code>{1}: {3} to your {4} sticker in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_TEXT</a> - <code>{1}: {3} in {2} to your "{4}"</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REACT_VIDEO</a> - <code>{1}: {3} to your video in {2}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_AUDIO</a> - <code>{1}: {2} to your voice message</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_CONTACT</a> - <code>{1}: {2} to your contact {3}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_DOC</a> - <code>{1}: {2} to your file</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_GAME</a> - <code>{1}: {2} to your game</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_GEO</a> - <code>{1}: {2} to your map</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_GEOLIVE</a> - <code>{1}: {2} to your live location</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_GIF</a> - <code>{1}: {2} to your GIF</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_INVOICE</a> - <code>{1}: {2} to your invoice</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_NOTEXT</a> - <code>{1}: {2} to your message</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_PHOTO</a> - <code>{1}: {2} to your photo</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_POLL</a> - <code>{1}: {2} to your poll {3}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_QUIZ</a> - <code>{1}: {2} to your quiz {3}</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_ROUND</a> - <code>{1}: {2} to your video message</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_STICKER</a> - <code>{1}: {2} to your {3} sticker</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_TEXT</a> - <code>{1}: {2} to your "{3}"</code></li>
<li>Added <a href="/api/push-updates#possible-notifications">REACT_VIDEO</a> - <code>{1}: {2} to your video</code></li>
</ul>
<h4><a class="anchor" href="#schema" id="schema" name="schema"><i class="anchor-icon"></i></a>Schema</h4>
<div><pre><code><a href="/constructor/chatFull">chatFull</a>#d18ee226 flags:<a href="/type/%23">#</a> can_set_username:flags.7?<a href="/constructor/true">true</a> has_scheduled:flags.8?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> about:<a href="/type/string">string</a> participants:<a href="/type/ChatParticipants">ChatParticipants</a> chat_photo:flags.2?<a href="/type/Photo">Photo</a> notify_settings:<a href="/type/PeerNotifySettings">PeerNotifySettings</a> exported_invite:flags.13?<a href="/type/ExportedChatInvite">ExportedChatInvite</a> bot_info:flags.3?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/BotInfo">BotInfo</a>&gt; pinned_msg_id:flags.6?<a href="/type/int">int</a> folder_id:flags.11?<a href="/type/int">int</a> call:flags.12?<a href="/type/InputGroupCall">InputGroupCall</a> ttl_period:flags.14?<a href="/type/int">int</a> groupcall_default_join_as:flags.15?<a href="/type/Peer">Peer</a> theme_emoticon:flags.16?<a href="/type/string">string</a> requests_pending:flags.17?<a href="/type/int">int</a> recent_requesters:flags.17?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/long">long</a>&gt; available_reactions:flags.18?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/string">string</a>&gt; = <a href="/type/ChatFull">ChatFull</a>;<br>
<a href="/constructor/message">message</a>#38116ee0 flags:<a href="/type/%23">#</a> out:flags.1?<a href="/constructor/true">true</a> mentioned:flags.4?<a href="/constructor/true">true</a> media_unread:flags.5?<a href="/constructor/true">true</a> silent:flags.13?<a href="/constructor/true">true</a> post:flags.14?<a href="/constructor/true">true</a> from_scheduled:flags.18?<a href="/constructor/true">true</a> legacy:flags.19?<a href="/constructor/true">true</a> edit_hide:flags.21?<a href="/constructor/true">true</a> pinned:flags.24?<a href="/constructor/true">true</a> noforwards:flags.26?<a href="/constructor/true">true</a> id:<a href="/type/int">int</a> from_id:flags.8?<a href="/type/Peer">Peer</a> peer_id:<a href="/type/Peer">Peer</a> fwd_from:flags.2?<a href="/type/MessageFwdHeader">MessageFwdHeader</a> via_bot_id:flags.11?<a href="/type/long">long</a> reply_to:flags.3?<a href="/type/MessageReplyHeader">MessageReplyHeader</a> date:<a href="/type/int">int</a> message:<a href="/type/string">string</a> media:flags.9?<a href="/type/MessageMedia">MessageMedia</a> reply_markup:flags.6?<a href="/type/ReplyMarkup">ReplyMarkup</a> entities:flags.7?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessageEntity">MessageEntity</a>&gt; views:flags.10?<a href="/type/int">int</a> forwards:flags.10?<a href="/type/int">int</a> replies:flags.23?<a href="/type/MessageReplies">MessageReplies</a> edit_date:flags.15?<a href="/type/int">int</a> post_author:flags.16?<a href="/type/string">string</a> grouped_id:flags.17?<a href="/type/long">long</a> reactions:flags.20?<a href="/type/MessageReactions">MessageReactions</a> restriction_reason:flags.22?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/RestrictionReason">RestrictionReason</a>&gt; ttl_period:flags.25?<a href="/type/int">int</a> = <a href="/type/Message">Message</a>;<br>
<a href="/constructor/channelFull">channelFull</a>#e13c3d20 flags:<a href="/type/%23">#</a> can_view_participants:flags.3?<a href="/constructor/true">true</a> can_set_username:flags.6?<a href="/constructor/true">true</a> can_set_stickers:flags.7?<a href="/constructor/true">true</a> hidden_prehistory:flags.10?<a href="/constructor/true">true</a> can_set_location:flags.16?<a href="/constructor/true">true</a> has_scheduled:flags.19?<a href="/constructor/true">true</a> can_view_stats:flags.20?<a href="/constructor/true">true</a> blocked:flags.22?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> about:<a href="/type/string">string</a> participants_count:flags.0?<a href="/type/int">int</a> admins_count:flags.1?<a href="/type/int">int</a> kicked_count:flags.2?<a href="/type/int">int</a> banned_count:flags.2?<a href="/type/int">int</a> online_count:flags.13?<a href="/type/int">int</a> read_inbox_max_id:<a href="/type/int">int</a> read_outbox_max_id:<a href="/type/int">int</a> unread_count:<a href="/type/int">int</a> chat_photo:<a href="/type/Photo">Photo</a> notify_settings:<a href="/type/PeerNotifySettings">PeerNotifySettings</a> exported_invite:flags.23?<a href="/type/ExportedChatInvite">ExportedChatInvite</a> bot_info:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/BotInfo">BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href="/type/long">long</a> migrated_from_max_id:flags.4?<a href="/type/int">int</a> pinned_msg_id:flags.5?<a href="/type/int">int</a> stickerset:flags.8?<a href="/type/StickerSet">StickerSet</a> available_min_id:flags.9?<a href="/type/int">int</a> folder_id:flags.11?<a href="/type/int">int</a> linked_chat_id:flags.14?<a href="/type/long">long</a> location:flags.15?<a href="/type/ChannelLocation">ChannelLocation</a> slowmode_seconds:flags.17?<a href="/type/int">int</a> slowmode_next_send_date:flags.18?<a href="/type/int">int</a> stats_dc:flags.12?<a href="/type/int">int</a> pts:<a href="/type/int">int</a> call:flags.21?<a href="/type/InputGroupCall">InputGroupCall</a> ttl_period:flags.24?<a href="/type/int">int</a> pending_suggestions:flags.25?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/string">string</a>&gt; groupcall_default_join_as:flags.26?<a href="/type/Peer">Peer</a> theme_emoticon:flags.27?<a href="/type/string">string</a> requests_pending:flags.28?<a href="/type/int">int</a> recent_requesters:flags.28?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/long">long</a>&gt; default_send_as:flags.29?<a href="/type/Peer">Peer</a> available_reactions:flags.30?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/string">string</a>&gt; = <a href="/type/ChatFull">ChatFull</a>;<br>
<a href="/constructor/sponsoredMessage">sponsoredMessage</a>#3a836df8 flags:<a href="/type/%23">#</a> random_id:<a href="/type/bytes">bytes</a> from_id:flags.3?<a href="/type/Peer">Peer</a> chat_invite:flags.4?<a href="/type/ChatInvite">ChatInvite</a> chat_invite_hash:flags.4?<a href="/type/string">string</a> channel_post:flags.2?<a href="/type/int">int</a> start_param:flags.0?<a href="/type/string">string</a> message:<a href="/type/string">string</a> entities:flags.1?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessageEntity">MessageEntity</a>&gt; = <a href="/type/SponsoredMessage">SponsoredMessage</a>;<br>
<a href="/constructor/updateMessageReactions">updateMessageReactions</a>#154798c3 peer:<a href="/type/Peer">Peer</a> msg_id:<a href="/type/int">int</a> reactions:<a href="/type/MessageReactions">MessageReactions</a> = <a href="/type/Update">Update</a>;<br>
<a href="/constructor/reactionCount">reactionCount</a>#6fb250d1 flags:<a href="/type/%23">#</a> chosen:flags.0?<a href="/constructor/true">true</a> reaction:<a href="/type/string">string</a> count:<a href="/type/int">int</a> = <a href="/type/ReactionCount">ReactionCount</a>;<br>
<a href="/constructor/messageReactions">messageReactions</a>#087b6e36 flags:<a href="/type/%23">#</a> min:flags.0?<a href="/constructor/true">true</a> can_see_list:flags.2?<a href="/constructor/true">true</a> results:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/ReactionCount">ReactionCount</a>&gt; recent_reactons:flags.1?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessageUserReaction">MessageUserReaction</a>&gt; = <a href="/type/MessageReactions">MessageReactions</a>;
<a href="/constructor/messageUserReaction">messageUserReaction</a>#932844fa user_id:<a href="/type/long">long</a> reaction:<a href="/type/string">string</a> = <a href="/type/MessageUserReaction">MessageUserReaction</a>;
<a href="/constructor/messages.messageReactionsList">messages.messageReactionsList</a>#a366923c flags:<a href="/type/%23">#</a> count:<a href="/type/int">int</a> reactions:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessageUserReaction">MessageUserReaction</a>&gt; users:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt; next_offset:flags.0?<a href="/type/string">string</a> = <a href="/type/messages.MessageReactionsList">messages.MessageReactionsList</a>;<br>
<a href="/constructor/availableReaction">availableReaction</a>#021d7c4b flags:<a href="/type/%23">#</a> inactive:flags.0?<a href="/constructor/true">true</a> reaction:<a href="/type/string">string</a> title:<a href="/type/string">string</a> static_icon:<a href="/type/Document">Document</a> appear_animation:<a href="/type/Document">Document</a> select_animation:<a href="/type/Document">Document</a> activate_animation:<a href="/type/Document">Document</a> effect_animation:<a href="/type/Document">Document</a> = <a href="/type/AvailableReaction">AvailableReaction</a>;<br>
<a href="/constructor/messages.availableReactionsNotModified">messages.availableReactionsNotModified</a>#9f071957 = <a href="/type/messages.AvailableReactions">messages.AvailableReactions</a>;
<a href="/constructor/messages.availableReactions">messages.availableReactions</a>#768e3aad hash:<a href="/type/int">int</a> reactions:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/AvailableReaction">AvailableReaction</a>&gt; = <a href="/type/messages.AvailableReactions">messages.AvailableReactions</a>;
<a href="/constructor/messageEntitySpoiler">messageEntitySpoiler</a>#32ca960f offset:<a href="/type/int">int</a> length:<a href="/type/int">int</a> = <a href="/type/MessageEntity">MessageEntity</a>;<br>
<a href="/constructor/channelAdminLogEventActionChangeAvailableReactions">channelAdminLogEventActionChangeAvailableReactions</a>#9cf7f76a prev_value:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/string">string</a>&gt; new_value:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/string">string</a>&gt; = <a href="/type/ChannelAdminLogEventAction">ChannelAdminLogEventAction</a>;<br>
---functions---<br>
<a href="/method/messages.sendReaction">messages.sendReaction</a>#25690ce4 flags:<a href="/type/%23">#</a> big:flags.1?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> msg_id:<a href="/type/int">int</a> reaction:flags.0?<a href="/type/string">string</a> = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.getMessagesReactions">messages.getMessagesReactions</a>#8bba90e6 peer:<a href="/type/InputPeer">InputPeer</a> id:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/int">int</a>&gt; = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.getMessageReactionsList">messages.getMessageReactionsList</a>#e0ee6b77 flags:<a href="/type/%23">#</a> peer:<a href="/type/InputPeer">InputPeer</a> id:<a href="/type/int">int</a> reaction:flags.0?<a href="/type/string">string</a> offset:flags.1?<a href="/type/string">string</a> limit:<a href="/type/int">int</a> = <a href="/type/messages.MessageReactionsList">messages.MessageReactionsList</a>;
<a href="/method/messages.setChatAvailableReactions">messages.setChatAvailableReactions</a>#14050ea6 peer:<a href="/type/InputPeer">InputPeer</a> available_reactions:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/string">string</a>&gt; = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.getAvailableReactions">messages.getAvailableReactions</a>#18dea0ac hash:<a href="/type/int">int</a> = <a href="/type/messages.AvailableReactions">messages.AvailableReactions</a>;
<a href="/method/messages.setDefaultReaction">messages.setDefaultReaction</a>#d960c4d4 reaction:<a href="/type/string">string</a> = <a href="/type/Bool">Bool</a>;<br></code></pre></div>
<h3><a class="anchor" href="#layer-135" id="layer-135" name="layer-135"><i class="anchor-icon"></i></a><a href="/schema?layer=135">Layer 135</a></h3>
<p><a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#anonymous-posting-in-public-groups">Anonymous posting in public groups</a>, <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#protected-content-in-groups-and-channels">protected content</a>, <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#manage-connected-devices">device management</a>, <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#new-ways-to-log-in-via-call">login via missed call</a>, <a href="/constructor/inputKeyboardButtonUserProfile">mention users in inline buttons even if they don't have a username</a>, <a href="/api/auth#logout-tokens">logout tokens</a>, improvements to join requests and stickers.</p>
<h4><a class="anchor" href="#schema-changes" id="schema-changes" name="schema-changes"><i class="anchor-icon"></i></a>Schema changes</h4>
<h5><a class="anchor" href="#new-methods" id="new-methods" name="new-methods"><i class="anchor-icon"></i></a>New Methods</h5>
<ul>
<li>Added <a href="/method/messages.hideAllChatJoinRequests">messages.hideAllChatJoinRequests</a> - Dismiss or approve all <a href="/api/invites#join-requests">join requests</a> related to a specific chat or channel.</li>
<li>Added <a href="/method/messages.toggleNoForwards">messages.toggleNoForwards</a> - Enable or disable <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more">content protection</a> on a channel or chat</li>
<li>Added <a href="/method/messages.saveDefaultSendAs">messages.saveDefaultSendAs</a> - Change the default peer that should be used when sending messages to a specific group</li>
<li>Added <a href="/method/channels.getSendAs">channels.getSendAs</a> - Obtains a list of peers that can be used to send messages in a specific group</li>
<li>Added <a href="/method/account.setAuthorizationTTL">account.setAuthorizationTTL</a> - Set time-to-live of current session</li>
<li>Added <a href="/method/account.changeAuthorizationSettings">account.changeAuthorizationSettings</a> - Change authorization settings</li>
<li>Added <a href="/method/channels.deleteParticipantHistory">channels.deleteParticipantHistory</a> - Delete all messages sent by a specific participant of a given supergroup</li>
</ul>
<h5><a class="anchor" href="#changed-methods" id="changed-methods" name="changed-methods"><i class="anchor-icon"></i></a>Changed Methods</h5>
<ul>
<li>Changed type of <a href="/method/auth.logOut">auth.logOut</a> from <strong>Bool</strong> to <strong>auth.LoggedOut</strong></li>
<li>Changed type of <a href="/method/users.getFullUser">users.getFullUser</a> from <strong>UserFull</strong> to <strong>users.UserFull</strong></li>
<li>Added <strong>noforwards</strong>, <strong>send_as</strong> parameters in <a href="/method/messages.sendMessage">messages.sendMessage</a></li>
<li>Added <strong>noforwards</strong>, <strong>send_as</strong> parameters in <a href="/method/messages.sendMedia">messages.sendMedia</a></li>
<li>Added <strong>noforwards</strong>, <strong>send_as</strong> parameters in <a href="/method/messages.forwardMessages">messages.forwardMessages</a></li>
<li>Changed type of <a href="/method/messages.getPeerSettings">messages.getPeerSettings</a> from <strong>PeerSettings</strong> to <strong>messages.PeerSettings</strong></li>
<li>Added <strong>hash</strong> parameter in <a href="/method/messages.getStickerSet">messages.getStickerSet</a></li>
<li>Added <strong>participant</strong> parameter, removed <strong>user_id</strong> parameter in <a href="/method/channels.reportSpam">channels.reportSpam</a></li>
<li>Added <strong>send_as</strong> parameter in <a href="/method/messages.sendInlineBotResult">messages.sendInlineBotResult</a></li>
<li>Added <strong>noforwards</strong>, <strong>send_as</strong> parameters in <a href="/method/messages.sendMultiMedia">messages.sendMultiMedia</a></li>
</ul>
<h5><a class="anchor" href="#deleted-methods" id="deleted-methods" name="deleted-methods"><i class="anchor-icon"></i></a>Deleted Methods</h5>
<ul>
<li>Removed channels.deleteUserHistory</li>
</ul>
<h5><a class="anchor" href="#new-constructors" id="new-constructors" name="new-constructors"><i class="anchor-icon"></i></a>New Constructors</h5>
<ul>
<li>Added <a href="/constructor/inputKeyboardButtonUserProfile">inputKeyboardButtonUserProfile</a> - Button that links directly to a user profile</li>
<li>Added <a href="/constructor/keyboardButtonUserProfile">keyboardButtonUserProfile</a> - Button that links directly to a user profile</li>
<li>Added <a href="/constructor/channels.sendAsPeers">channels.sendAsPeers</a> - A list of peers that can be used to send messages in a specific group</li>
<li>Added <a href="/constructor/channelAdminLogEventActionToggleNoForwards">channelAdminLogEventActionToggleNoForwards</a> - Forwards were enabled or disabled</li>
<li>Added <a href="/constructor/messages.stickerSetNotModified">messages.stickerSetNotModified</a> - The stickerset hasn't changed</li>
<li>Added <a href="/constructor/users.userFull">users.userFull</a> - Full user information</li>
<li>Added <a href="/constructor/messages.peerSettings">messages.peerSettings</a> - Peer settings</li>
<li>Added <a href="/constructor/channelAdminLogEventActionSendMessage">channelAdminLogEventActionSendMessage</a> - A message was posted in a channel</li>
<li>Added <a href="/constructor/auth.codeTypeMissedCall">auth.codeTypeMissedCall</a> - The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user.</li>
<li>Added <a href="/constructor/auth.sentCodeTypeMissedCall">auth.sentCodeTypeMissedCall</a> - The code will be sent via a flash phone call, that will be closed immediately. The last digits of the phone number that calls are the code that must be entered manually by the user.</li>
<li>Added <a href="/constructor/auth.loggedOut">auth.loggedOut</a> - <a href="/api/auth#logout-tokens">Logout token »</a> to be used on subsequent authorizations</li>
</ul>
<h5><a class="anchor" href="#changed-constructors" id="changed-constructors" name="changed-constructors"><i class="anchor-icon"></i></a>Changed Constructors</h5>
<ul>
<li>Added <strong>noforwards</strong> parameter in <a href="/constructor/chat">chat</a></li>
<li>Added <strong>noforwards</strong> parameter in <a href="/constructor/message">message</a></li>
<li>Added <strong>setup_password_required</strong>, <strong>otherwise_relogin_days</strong> parameters in <a href="/constructor/auth.authorization">auth.authorization</a></li>
<li>Added <strong>request_chat_broadcast</strong>, <strong>request_chat_title</strong>, <strong>request_chat_date</strong> parameters in <a href="/constructor/peerSettings">peerSettings</a></li>
<li>Added <strong>id</strong>, <strong>private_forward_name</strong> parameters, removed <strong>user</strong> parameter in <a href="/constructor/userFull">userFull</a></li>
<li>Added <strong>encrypted_requests_disabled</strong>, <strong>call_requests_disabled</strong> parameters in <a href="/constructor/authorization">authorization</a></li>
<li>Added <strong>authorization_ttl_days</strong> parameter in <a href="/constructor/account.authorizations">account.authorizations</a></li>
<li>Added <strong>noforwards</strong> parameter in <a href="/constructor/channel">channel</a></li>
<li>Added <strong>default_send_as</strong> parameter in <a href="/constructor/channelFull">channelFull</a></li>
<li>Added <strong>allow_missed_call</strong>, <strong>logout_tokens</strong> parameters in <a href="/constructor/codeSettings">codeSettings</a></li>
</ul>
<h4><a class="anchor" href="#schema" id="schema" name="schema"><i class="anchor-icon"></i></a>Schema</h4>
<div><pre><code><a href="/constructor/chat">chat</a>#41cbf256 flags:<a href="/type/%23">#</a> creator:flags.0?<a href="/constructor/true">true</a> kicked:flags.1?<a href="/constructor/true">true</a> left:flags.2?<a href="/constructor/true">true</a> deactivated:flags.5?<a href="/constructor/true">true</a> call_active:flags.23?<a href="/constructor/true">true</a> call_not_empty:flags.24?<a href="/constructor/true">true</a> noforwards:flags.25?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> title:<a href="/type/string">string</a> photo:<a href="/type/ChatPhoto">ChatPhoto</a> participants_count:<a href="/type/int">int</a> date:<a href="/type/int">int</a> version:<a href="/type/int">int</a> migrated_to:flags.6?<a href="/type/InputChannel">InputChannel</a> admin_rights:flags.14?<a href="/type/ChatAdminRights">ChatAdminRights</a> default_banned_rights:flags.18?<a href="/type/ChatBannedRights">ChatBannedRights</a> = <a href="/type/Chat">Chat</a>;<br>
<a href="/constructor/message">message</a>#85d6cbe2 flags:<a href="/type/%23">#</a> out:flags.1?<a href="/constructor/true">true</a> mentioned:flags.4?<a href="/constructor/true">true</a> media_unread:flags.5?<a href="/constructor/true">true</a> silent:flags.13?<a href="/constructor/true">true</a> post:flags.14?<a href="/constructor/true">true</a> from_scheduled:flags.18?<a href="/constructor/true">true</a> legacy:flags.19?<a href="/constructor/true">true</a> edit_hide:flags.21?<a href="/constructor/true">true</a> pinned:flags.24?<a href="/constructor/true">true</a> noforwards:flags.26?<a href="/constructor/true">true</a> id:<a href="/type/int">int</a> from_id:flags.8?<a href="/type/Peer">Peer</a> peer_id:<a href="/type/Peer">Peer</a> fwd_from:flags.2?<a href="/type/MessageFwdHeader">MessageFwdHeader</a> via_bot_id:flags.11?<a href="/type/long">long</a> reply_to:flags.3?<a href="/type/MessageReplyHeader">MessageReplyHeader</a> date:<a href="/type/int">int</a> message:<a href="/type/string">string</a> media:flags.9?<a href="/type/MessageMedia">MessageMedia</a> reply_markup:flags.6?<a href="/type/ReplyMarkup">ReplyMarkup</a> entities:flags.7?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessageEntity">MessageEntity</a>&gt; views:flags.10?<a href="/type/int">int</a> forwards:flags.10?<a href="/type/int">int</a> replies:flags.23?<a href="/type/MessageReplies">MessageReplies</a> edit_date:flags.15?<a href="/type/int">int</a> post_author:flags.16?<a href="/type/string">string</a> grouped_id:flags.17?<a href="/type/long">long</a> restriction_reason:flags.22?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/RestrictionReason">RestrictionReason</a>&gt; ttl_period:flags.25?<a href="/type/int">int</a> = <a href="/type/Message">Message</a>;<br>
<a href="/constructor/auth.authorization">auth.authorization</a>#33fb7bb8 flags:<a href="/type/%23">#</a> setup_password_required:flags.1?<a href="/constructor/true">true</a> otherwise_relogin_days:flags.1?<a href="/type/int">int</a> tmp_sessions:flags.0?<a href="/type/int">int</a> user:<a href="/type/User">User</a> = <a href="/type/auth.Authorization">auth.Authorization</a>;<br>
<a href="/constructor/peerSettings">peerSettings</a>#a518110d flags:<a href="/type/%23">#</a> report_spam:flags.0?<a href="/constructor/true">true</a> add_contact:flags.1?<a href="/constructor/true">true</a> block_contact:flags.2?<a href="/constructor/true">true</a> share_contact:flags.3?<a href="/constructor/true">true</a> need_contacts_exception:flags.4?<a href="/constructor/true">true</a> report_geo:flags.5?<a href="/constructor/true">true</a> autoarchived:flags.7?<a href="/constructor/true">true</a> invite_members:flags.8?<a href="/constructor/true">true</a> request_chat_broadcast:flags.10?<a href="/constructor/true">true</a> geo_distance:flags.6?<a href="/type/int">int</a> request_chat_title:flags.9?<a href="/type/string">string</a> request_chat_date:flags.9?<a href="/type/int">int</a> = <a href="/type/PeerSettings">PeerSettings</a>;<br>
<a href="/constructor/userFull">userFull</a>#cf366521 flags:<a href="/type/%23">#</a> blocked:flags.0?<a href="/constructor/true">true</a> phone_calls_available:flags.4?<a href="/constructor/true">true</a> phone_calls_private:flags.5?<a href="/constructor/true">true</a> can_pin_message:flags.7?<a href="/constructor/true">true</a> has_scheduled:flags.12?<a href="/constructor/true">true</a> video_calls_available:flags.13?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> about:flags.1?<a href="/type/string">string</a> settings:<a href="/type/PeerSettings">PeerSettings</a> profile_photo:flags.2?<a href="/type/Photo">Photo</a> notify_settings:<a href="/type/PeerNotifySettings">PeerNotifySettings</a> bot_info:flags.3?<a href="/type/BotInfo">BotInfo</a> pinned_msg_id:flags.6?<a href="/type/int">int</a> common_chats_count:<a href="/type/int">int</a> folder_id:flags.11?<a href="/type/int">int</a> ttl_period:flags.14?<a href="/type/int">int</a> theme_emoticon:flags.15?<a href="/type/string">string</a> private_forward_name:flags.16?<a href="/type/string">string</a> = <a href="/type/UserFull">UserFull</a>;<br>
<a href="/constructor/authorization">authorization</a>#ad01d61d flags:<a href="/type/%23">#</a> current:flags.0?<a href="/constructor/true">true</a> official_app:flags.1?<a href="/constructor/true">true</a> password_pending:flags.2?<a href="/constructor/true">true</a> encrypted_requests_disabled:flags.3?<a href="/constructor/true">true</a> call_requests_disabled:flags.4?<a href="/constructor/true">true</a> hash:<a href="/type/long">long</a> device_model:<a href="/type/string">string</a> platform:<a href="/type/string">string</a> system_version:<a href="/type/string">string</a> api_id:<a href="/type/int">int</a> app_name:<a href="/type/string">string</a> app_version:<a href="/type/string">string</a> date_created:<a href="/type/int">int</a> date_active:<a href="/type/int">int</a> ip:<a href="/type/string">string</a> country:<a href="/type/string">string</a> region:<a href="/type/string">string</a> = <a href="/type/Authorization">Authorization</a>;
<a href="/constructor/account.authorizations">account.authorizations</a>#4bff8ea0 authorization_ttl_days:<a href="/type/int">int</a> authorizations:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Authorization">Authorization</a>&gt; = <a href="/type/account.Authorizations">account.Authorizations</a>;<br>
<a href="/constructor/channel">channel</a>#8261ac61 flags:<a href="/type/%23">#</a> creator:flags.0?<a href="/constructor/true">true</a> left:flags.2?<a href="/constructor/true">true</a> broadcast:flags.5?<a href="/constructor/true">true</a> verified:flags.7?<a href="/constructor/true">true</a> megagroup:flags.8?<a href="/constructor/true">true</a> restricted:flags.9?<a href="/constructor/true">true</a> signatures:flags.11?<a href="/constructor/true">true</a> min:flags.12?<a href="/constructor/true">true</a> scam:flags.19?<a href="/constructor/true">true</a> has_link:flags.20?<a href="/constructor/true">true</a> has_geo:flags.21?<a href="/constructor/true">true</a> slowmode_enabled:flags.22?<a href="/constructor/true">true</a> call_active:flags.23?<a href="/constructor/true">true</a> call_not_empty:flags.24?<a href="/constructor/true">true</a> fake:flags.25?<a href="/constructor/true">true</a> gigagroup:flags.26?<a href="/constructor/true">true</a> noforwards:flags.27?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> access_hash:flags.13?<a href="/type/long">long</a> title:<a href="/type/string">string</a> username:flags.6?<a href="/type/string">string</a> photo:<a href="/type/ChatPhoto">ChatPhoto</a> date:<a href="/type/int">int</a> restriction_reason:flags.9?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/RestrictionReason">RestrictionReason</a>&gt; admin_rights:flags.14?<a href="/type/ChatAdminRights">ChatAdminRights</a> banned_rights:flags.15?<a href="/type/ChatBannedRights">ChatBannedRights</a> default_banned_rights:flags.18?<a href="/type/ChatBannedRights">ChatBannedRights</a> participants_count:flags.17?<a href="/type/int">int</a> = <a href="/type/Chat">Chat</a>;
<a href="/constructor/channelFull">channelFull</a>#56662e2e flags:<a href="/type/%23">#</a> can_view_participants:flags.3?<a href="/constructor/true">true</a> can_set_username:flags.6?<a href="/constructor/true">true</a> can_set_stickers:flags.7?<a href="/constructor/true">true</a> hidden_prehistory:flags.10?<a href="/constructor/true">true</a> can_set_location:flags.16?<a href="/constructor/true">true</a> has_scheduled:flags.19?<a href="/constructor/true">true</a> can_view_stats:flags.20?<a href="/constructor/true">true</a> blocked:flags.22?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> about:<a href="/type/string">string</a> participants_count:flags.0?<a href="/type/int">int</a> admins_count:flags.1?<a href="/type/int">int</a> kicked_count:flags.2?<a href="/type/int">int</a> banned_count:flags.2?<a href="/type/int">int</a> online_count:flags.13?<a href="/type/int">int</a> read_inbox_max_id:<a href="/type/int">int</a> read_outbox_max_id:<a href="/type/int">int</a> unread_count:<a href="/type/int">int</a> chat_photo:<a href="/type/Photo">Photo</a> notify_settings:<a href="/type/PeerNotifySettings">PeerNotifySettings</a> exported_invite:flags.23?<a href="/type/ExportedChatInvite">ExportedChatInvite</a> bot_info:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/BotInfo">BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href="/type/long">long</a> migrated_from_max_id:flags.4?<a href="/type/int">int</a> pinned_msg_id:flags.5?<a href="/type/int">int</a> stickerset:flags.8?<a href="/type/StickerSet">StickerSet</a> available_min_id:flags.9?<a href="/type/int">int</a> folder_id:flags.11?<a href="/type/int">int</a> linked_chat_id:flags.14?<a href="/type/long">long</a> location:flags.15?<a href="/type/ChannelLocation">ChannelLocation</a> slowmode_seconds:flags.17?<a href="/type/int">int</a> slowmode_next_send_date:flags.18?<a href="/type/int">int</a> stats_dc:flags.12?<a href="/type/int">int</a> pts:<a href="/type/int">int</a> call:flags.21?<a href="/type/InputGroupCall">InputGroupCall</a> ttl_period:flags.24?<a href="/type/int">int</a> pending_suggestions:flags.25?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/string">string</a>&gt; groupcall_default_join_as:flags.26?<a href="/type/Peer">Peer</a> theme_emoticon:flags.27?<a href="/type/string">string</a> requests_pending:flags.28?<a href="/type/int">int</a> recent_requesters:flags.28?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/long">long</a>&gt; default_send_as:flags.29?<a href="/type/Peer">Peer</a> = <a href="/type/ChatFull">ChatFull</a>;
<a href="/constructor/codeSettings">codeSettings</a>#8a6469c2 flags:<a href="/type/%23">#</a> allow_flashcall:flags.0?<a href="/constructor/true">true</a> current_number:flags.1?<a href="/constructor/true">true</a> allow_app_hash:flags.4?<a href="/constructor/true">true</a> allow_missed_call:flags.5?<a href="/constructor/true">true</a> logout_tokens:flags.6?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/bytes">bytes</a>&gt; = <a href="/type/CodeSettings">CodeSettings</a>;<br>
<a href="/constructor/inputKeyboardButtonUserProfile">inputKeyboardButtonUserProfile</a>#e988037b text:<a href="/type/string">string</a> user_id:<a href="/type/InputUser">InputUser</a> = <a href="/type/KeyboardButton">KeyboardButton</a>;<br>
<a href="/constructor/keyboardButtonUserProfile">keyboardButtonUserProfile</a>#308660c1 text:<a href="/type/string">string</a> user_id:<a href="/type/long">long</a> = <a href="/type/KeyboardButton">KeyboardButton</a>;<br>
<a href="/constructor/channels.sendAsPeers">channels.sendAsPeers</a>#8356cda9 peers:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Peer">Peer</a>&gt; chats:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Chat">Chat</a>&gt; users:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt; = <a href="/type/channels.SendAsPeers">channels.SendAsPeers</a>;
<a href="/constructor/channelAdminLogEventActionToggleNoForwards">channelAdminLogEventActionToggleNoForwards</a>#cb2ac766 new_value:<a href="/type/Bool">Bool</a> = <a href="/type/ChannelAdminLogEventAction">ChannelAdminLogEventAction</a>;<br>
<a href="/constructor/messages.stickerSetNotModified">messages.stickerSetNotModified</a>#d3f924eb = <a href="/type/messages.StickerSet">messages.StickerSet</a>;<br>
<a href="/constructor/users.userFull">users.userFull</a>#3b6d152e full_user:<a href="/type/UserFull">UserFull</a> chats:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Chat">Chat</a>&gt; users:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt; = <a href="/type/users.UserFull">users.UserFull</a>;<br>
<a href="/constructor/messages.peerSettings">messages.peerSettings</a>#6880b94d settings:<a href="/type/PeerSettings">PeerSettings</a> chats:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Chat">Chat</a>&gt; users:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt; = <a href="/type/messages.PeerSettings">messages.PeerSettings</a>;<br>
<a href="/constructor/channelAdminLogEventActionSendMessage">channelAdminLogEventActionSendMessage</a>#278f2868 message:<a href="/type/Message">Message</a> = <a href="/type/ChannelAdminLogEventAction">ChannelAdminLogEventAction</a>;<br>
<a href="/constructor/auth.codeTypeMissedCall">auth.codeTypeMissedCall</a>#d61ad6ee = <a href="/type/auth.CodeType">auth.CodeType</a>;
<a href="/constructor/auth.sentCodeTypeMissedCall">auth.sentCodeTypeMissedCall</a>#82006484 prefix:<a href="/type/string">string</a> length:<a href="/type/int">int</a> = <a href="/type/auth.SentCodeType">auth.SentCodeType</a>;
<a href="/constructor/auth.loggedOut">auth.loggedOut</a>#c3a2835f flags:<a href="/type/%23">#</a> future_auth_token:flags.0?<a href="/type/bytes">bytes</a> = <a href="/type/auth.LoggedOut">auth.LoggedOut</a>;<br>
---functions---<br>
<a href="/method/auth.logOut">auth.logOut</a>#3e72ba19 = <a href="/type/auth.LoggedOut">auth.LoggedOut</a>;<br>
<a href="/method/users.getFullUser">users.getFullUser</a>#b60f5918 id:<a href="/type/InputUser">InputUser</a> = <a href="/type/users.UserFull">users.UserFull</a>;<br>
<a href="/method/messages.sendMessage">messages.sendMessage</a>#0d9d75a4 flags:<a href="/type/%23">#</a> no_webpage:flags.1?<a href="/constructor/true">true</a> silent:flags.5?<a href="/constructor/true">true</a> background:flags.6?<a href="/constructor/true">true</a> clear_draft:flags.7?<a href="/constructor/true">true</a> noforwards:flags.14?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> reply_to_msg_id:flags.0?<a href="/type/int">int</a> message:<a href="/type/string">string</a> random_id:<a href="/type/long">long</a> reply_markup:flags.2?<a href="/type/ReplyMarkup">ReplyMarkup</a> entities:flags.3?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessageEntity">MessageEntity</a>&gt; schedule_date:flags.10?<a href="/type/int">int</a> send_as:flags.13?<a href="/type/InputPeer">InputPeer</a> = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.sendMedia">messages.sendMedia</a>#e25ff8e0 flags:<a href="/type/%23">#</a> silent:flags.5?<a href="/constructor/true">true</a> background:flags.6?<a href="/constructor/true">true</a> clear_draft:flags.7?<a href="/constructor/true">true</a> noforwards:flags.14?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> reply_to_msg_id:flags.0?<a href="/type/int">int</a> media:<a href="/type/InputMedia">InputMedia</a> message:<a href="/type/string">string</a> random_id:<a href="/type/long">long</a> reply_markup:flags.2?<a href="/type/ReplyMarkup">ReplyMarkup</a> entities:flags.3?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessageEntity">MessageEntity</a>&gt; schedule_date:flags.10?<a href="/type/int">int</a> send_as:flags.13?<a href="/type/InputPeer">InputPeer</a> = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.forwardMessages">messages.forwardMessages</a>#cc30290b flags:<a href="/type/%23">#</a> silent:flags.5?<a href="/constructor/true">true</a> background:flags.6?<a href="/constructor/true">true</a> with_my_score:flags.8?<a href="/constructor/true">true</a> drop_author:flags.11?<a href="/constructor/true">true</a> drop_media_captions:flags.12?<a href="/constructor/true">true</a> noforwards:flags.14?<a href="/constructor/true">true</a> from_peer:<a href="/type/InputPeer">InputPeer</a> id:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/int">int</a>&gt; random_id:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/long">long</a>&gt; to_peer:<a href="/type/InputPeer">InputPeer</a> schedule_date:flags.10?<a href="/type/int">int</a> send_as:flags.13?<a href="/type/InputPeer">InputPeer</a> = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.getPeerSettings">messages.getPeerSettings</a>#efd9a6a2 peer:<a href="/type/InputPeer">InputPeer</a> = <a href="/type/messages.PeerSettings">messages.PeerSettings</a>;
<a href="/method/messages.getStickerSet">messages.getStickerSet</a>#c8a0ec74 stickerset:<a href="/type/InputStickerSet">InputStickerSet</a> hash:<a href="/type/int">int</a> = <a href="/type/messages.StickerSet">messages.StickerSet</a>;<br>
<a href="/method/channels.reportSpam">channels.reportSpam</a>#f44a8315 channel:<a href="/type/InputChannel">InputChannel</a> participant:<a href="/type/InputPeer">InputPeer</a> id:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/int">int</a>&gt; = <a href="/type/Bool">Bool</a>;<br>
<a href="/method/messages.sendInlineBotResult">messages.sendInlineBotResult</a>#7aa11297 flags:<a href="/type/%23">#</a> silent:flags.5?<a href="/constructor/true">true</a> background:flags.6?<a href="/constructor/true">true</a> clear_draft:flags.7?<a href="/constructor/true">true</a> hide_via:flags.11?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> reply_to_msg_id:flags.0?<a href="/type/int">int</a> random_id:<a href="/type/long">long</a> query_id:<a href="/type/long">long</a> id:<a href="/type/string">string</a> schedule_date:flags.10?<a href="/type/int">int</a> send_as:flags.13?<a href="/type/InputPeer">InputPeer</a> = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.sendMultiMedia">messages.sendMultiMedia</a>#f803138f flags:<a href="/type/%23">#</a> silent:flags.5?<a href="/constructor/true">true</a> background:flags.6?<a href="/constructor/true">true</a> clear_draft:flags.7?<a href="/constructor/true">true</a> noforwards:flags.14?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> reply_to_msg_id:flags.0?<a href="/type/int">int</a> multi_media:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/InputSingleMedia">InputSingleMedia</a>&gt; schedule_date:flags.10?<a href="/type/int">int</a> send_as:flags.13?<a href="/type/InputPeer">InputPeer</a> = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.hideAllChatJoinRequests">messages.hideAllChatJoinRequests</a>#e085f4ea flags:<a href="/type/%23">#</a> approved:flags.0?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> link:flags.1?<a href="/type/string">string</a> = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.toggleNoForwards">messages.toggleNoForwards</a>#b11eafa2 peer:<a href="/type/InputPeer">InputPeer</a> enabled:<a href="/type/Bool">Bool</a> = <a href="/type/Updates">Updates</a>;
<a href="/method/messages.saveDefaultSendAs">messages.saveDefaultSendAs</a>#ccfddf96 peer:<a href="/type/InputPeer">InputPeer</a> send_as:<a href="/type/InputPeer">InputPeer</a> = <a href="/type/Bool">Bool</a>;<br>
<a href="/method/channels.getSendAs">channels.getSendAs</a>#0dc770ee peer:<a href="/type/InputPeer">InputPeer</a> = <a href="/type/channels.SendAsPeers">channels.SendAsPeers</a>;<br>
<a href="/method/account.setAuthorizationTTL">account.setAuthorizationTTL</a>#bf899aa0 authorization_ttl_days:<a href="/type/int">int</a> = <a href="/type/Bool">Bool</a>;
<a href="/method/account.changeAuthorizationSettings">account.changeAuthorizationSettings</a>#40f48462 flags:<a href="/type/%23">#</a> hash:<a href="/type/long">long</a> encrypted_requests_disabled:flags.0?<a href="/type/Bool">Bool</a> call_requests_disabled:flags.1?<a href="/type/Bool">Bool</a> = <a href="/type/Bool">Bool</a>;<br>
<a href="/method/channels.deleteParticipantHistory">channels.deleteParticipantHistory</a>#367544db channel:<a href="/type/InputChannel">InputChannel</a> participant:<a href="/type/InputPeer">InputPeer</a> = <a href="/type/messages.AffectedHistory">messages.AffectedHistory</a>;<br></code></pre></div>
<h3><a class="anchor" href="#layer-134" id="layer-134" name="layer-134"><i class="anchor-icon"></i></a><a href="/schema?layer=134">Layer 134</a></h3>
<p><a href="/api/invites#join-requests">Join requests</a>, <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#delete-messages-by-date">delete by date</a>, <a href="https://telegram.org/blog/shared-media-scrolling-calendar-join-requests-and-more#global-chat-themes-on-ios">global chat themes</a>, <a href="https://telegram.org/blog/shared-media-scrolling-calendar-join-requests-and-more">hyper-speed scrolling and calendar view for shared media</a>, sponsored channel posts.</p>
<h4><a class="anchor" href="#schema-changes" id="schema-changes" name="schema-changes"><i class="anchor-icon"></i></a>Schema changes</h4>
<h5><a class="anchor" href="#new-methods" id="new-methods" name="new-methods"><i class="anchor-icon"></i></a>New Methods</h5>
<ul>
<li>Added <a href="/method/messages.getSearchResultsCalendar">messages.getSearchResultsCalendar</a> - Returns information about the next messages of the specified type in the chat split by days.</li>
<li>Added <a href="/method/messages.getSearchResultsPositions">messages.getSearchResultsPositions</a> - Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation.</li>
<li>Added <a href="/method/messages.hideChatJoinRequest">messages.hideChatJoinRequest</a> - Dismiss or approve a chat <a href="/api/invites#join-requests">join request</a> related to a specific chat or channel.</li>
</ul>
<h5><a class="anchor" href="#changed-methods" id="changed-methods" name="changed-methods"><i class="anchor-icon"></i></a>Changed Methods</h5>
<ul>
<li>Added <strong>min_date</strong>, <strong>max_date</strong> parameters in <a href="/method/messages.deleteHistory">messages.deleteHistory</a></li>
<li>Added <strong>request_needed</strong>, <strong>title</strong> parameters in <a href="/method/messages.exportChatInvite">messages.exportChatInvite</a></li>
<li>Changed type of <strong>settings</strong> from <strong>flags.3?InputThemeSettings</strong> to <strong>flags.3?Vector&lt;InputThemeSettings&gt;</strong> in <a href="/method/account.createTheme">account.createTheme</a></li>
<li>Changed type of <strong>settings</strong> from <strong>flags.3?InputThemeSettings</strong> to <strong>flags.3?Vector&lt;InputThemeSettings&gt;</strong> in <a href="/method/account.updateTheme">account.updateTheme</a></li>
<li>Added <strong>base_theme</strong> parameter, changed type of <strong>format</strong> from <strong>flags.1?string</strong> to <strong>flags.2?string</strong> in <a href="/method/account.installTheme">account.installTheme</a></li>
<li>Added <strong>request_needed</strong>, <strong>title</strong> parameters in <a href="/method/messages.editExportedChatInvite">messages.editExportedChatInvite</a></li>
<li>Added <strong>flags</strong>, <strong>requested</strong>, <strong>q</strong> parameters, changed type of <strong>link</strong> from <strong>string</strong> to <strong>flags.1?string</strong> in <a href="/method/messages.getChatInviteImporters">messages.getChatInviteImporters</a></li>
<li>Changed type of <a href="/method/account.getChatThemes">account.getChatThemes</a> from <strong>account.ChatThemes</strong> to <strong>account.Themes</strong></li>
<li>Changed type of <strong>hash</strong> from <strong>int</strong> to <strong>long</strong> in <a href="/method/account.getChatThemes">account.getChatThemes</a></li>
</ul>
<h5><a class="anchor" href="#new-constructors" id="new-constructors" name="new-constructors"><i class="anchor-icon"></i></a>New Constructors</h5>
<ul>
<li>Added <a href="/constructor/searchResultsCalendarPeriod">searchResultsCalendarPeriod</a> - Information about found messages sent on a specific day, used to split the <code>messages</code> in <a href="/constructor/messages.searchResultsCalendar">messages.searchResultsCalendar</a> constructors by days.</li>
<li>Added <a href="/constructor/messages.searchResultsCalendar">messages.searchResultsCalendar</a> - Information about found messages sent on a specific day</li>
<li>Added <a href="/constructor/searchResultPosition">searchResultPosition</a> - Information about a message in a specific position</li>
<li>Added <a href="/constructor/messages.searchResultsPositions">messages.searchResultsPositions</a> - Information about sparse positions of messages</li>
<li>Added <a href="/constructor/messageActionChatJoinedByRequest">messageActionChatJoinedByRequest</a> - A user was accepted into the group by an admin</li>
<li>Added <a href="/constructor/updatePendingJoinRequests">updatePendingJoinRequests</a> - Someone has requested to join a chat or channel</li>
<li>Added <a href="/constructor/updateBotChatInviteRequester">updateBotChatInviteRequester</a> - Someone has requested to join a chat or channel (bots only, users will receive an <a href="/constructor/updatePendingJoinRequests">updatePendingJoinRequests</a>, instead)</li>
<li>Added <a href="/constructor/channelAdminLogEventActionParticipantJoinByRequest">channelAdminLogEventActionParticipantJoinByRequest</a> - A new member was accepted to the chat by an admin</li>
</ul>
<h5><a class="anchor" href="#changed-constructors" id="changed-constructors" name="changed-constructors"><i class="anchor-icon"></i></a>Changed Constructors</h5>
<ul>
<li>Added <strong>requests_pending</strong>, <strong>recent_requesters</strong> parameters in <a href="/constructor/chatFull">chatFull</a></li>
<li>Added <strong>request_needed</strong>, <strong>requested</strong>, <strong>title</strong> parameters in <a href="/constructor/chatInviteExported">chatInviteExported</a></li>
<li>Added <strong>request_needed</strong>, <strong>about</strong> parameters in <a href="/constructor/chatInvite">chatInvite</a></li>
<li>Added <strong>requests_pending</strong>, <strong>recent_requesters</strong> parameters in <a href="/constructor/channelFull">channelFull</a></li>
<li>Added <strong>flags</strong>, <strong>via_request</strong> parameters in <a href="/constructor/channelParticipantSelf">channelParticipantSelf</a></li>
<li>Added <strong>send</strong> parameter in <a href="/constructor/channelAdminLogEventsFilter">channelAdminLogEventsFilter</a></li>
<li>Added <strong>emoticon</strong> parameter, changed type of <strong>settings</strong> from <strong>flags.3?ThemeSettings</strong> to <strong>flags.3?Vector&lt;ThemeSettings&gt;</strong> in <a href="/constructor/theme">theme</a></li>
<li>Added <strong>flags</strong>, <strong>requested</strong>, <strong>about</strong>, <strong>approved_by</strong> parameters in <a href="/constructor/chatInviteImporter">chatInviteImporter</a></li>
<li>Added <strong>channel_post</strong> parameter in <a href="/constructor/sponsoredMessage">sponsoredMessage</a></li>
</ul>
<h5><a class="anchor" href="#deleted-constructors" id="deleted-constructors" name="deleted-constructors"><i class="anchor-icon"></i></a>Deleted Constructors</h5>
<ul>
<li>Removed chatTheme</li>
<li>Removed account.chatThemesNotModified</li>
<li>Removed account.chatThemes</li>
</ul>
<h4><a class="anchor" href="#push-notification-changes" id="push-notification-changes" name="push-notification-changes"><i class="anchor-icon"></i></a>PUSH notification changes</h4>
<h5><a class="anchor" href="#new-push-notifications" id="new-push-notifications" name="new-push-notifications"><i class="anchor-icon"></i></a>New PUSH notifications</h5>
<ul>
<li>Added <a href="/api/push-updates#possible-notifications">CHAT_REQ_JOINED</a> - <code>{2}|{1} was accepted into the group</code></li>
</ul>
<h4><a class="anchor" href="#schema" id="schema" name="schema"><i class="anchor-icon"></i></a>Schema</h4>
<div><pre><code><a href="/constructor/chatFull">chatFull</a>#46a6ffb4 flags:<a href="/type/%23">#</a> can_set_username:flags.7?<a href="/constructor/true">true</a> has_scheduled:flags.8?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> about:<a href="/type/string">string</a> participants:<a href="/type/ChatParticipants">ChatParticipants</a> chat_photo:flags.2?<a href="/type/Photo">Photo</a> notify_settings:<a href="/type/PeerNotifySettings">PeerNotifySettings</a> exported_invite:flags.13?<a href="/type/ExportedChatInvite">ExportedChatInvite</a> bot_info:flags.3?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/BotInfo">BotInfo</a>&gt; pinned_msg_id:flags.6?<a href="/type/int">int</a> folder_id:flags.11?<a href="/type/int">int</a> call:flags.12?<a href="/type/InputGroupCall">InputGroupCall</a> ttl_period:flags.14?<a href="/type/int">int</a> groupcall_default_join_as:flags.15?<a href="/type/Peer">Peer</a> theme_emoticon:flags.16?<a href="/type/string">string</a> requests_pending:flags.17?<a href="/type/int">int</a> recent_requesters:flags.17?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/long">long</a>&gt; = <a href="/type/ChatFull">ChatFull</a>;
<a href="/constructor/chatInviteExported">chatInviteExported</a>#0ab4a819 flags:<a href="/type/%23">#</a> revoked:flags.0?<a href="/constructor/true">true</a> permanent:flags.5?<a href="/constructor/true">true</a> request_needed:flags.6?<a href="/constructor/true">true</a> link:<a href="/type/string">string</a> admin_id:<a href="/type/long">long</a> date:<a href="/type/int">int</a> start_date:flags.4?<a href="/type/int">int</a> expire_date:flags.1?<a href="/type/int">int</a> usage_limit:flags.2?<a href="/type/int">int</a> usage:flags.3?<a href="/type/int">int</a> requested:flags.7?<a href="/type/int">int</a> title:flags.8?<a href="/type/string">string</a> = <a href="/type/ExportedChatInvite">ExportedChatInvite</a>;
<a href="/constructor/chatInvite">chatInvite</a>#300c44c1 flags:<a href="/type/%23">#</a> channel:flags.0?<a href="/constructor/true">true</a> broadcast:flags.1?<a href="/constructor/true">true</a> public:flags.2?<a href="/constructor/true">true</a> megagroup:flags.3?<a href="/constructor/true">true</a> request_needed:flags.6?<a href="/constructor/true">true</a> title:<a href="/type/string">string</a> about:flags.5?<a href="/type/string">string</a> photo:<a href="/type/Photo">Photo</a> participants_count:<a href="/type/int">int</a> participants:flags.4?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt; = <a href="/type/ChatInvite">ChatInvite</a>;
<a href="/constructor/channelFull">channelFull</a>#59cff963 flags:<a href="/type/%23">#</a> can_view_participants:flags.3?<a href="/constructor/true">true</a> can_set_username:flags.6?<a href="/constructor/true">true</a> can_set_stickers:flags.7?<a href="/constructor/true">true</a> hidden_prehistory:flags.10?<a href="/constructor/true">true</a> can_set_location:flags.16?<a href="/constructor/true">true</a> has_scheduled:flags.19?<a href="/constructor/true">true</a> can_view_stats:flags.20?<a href="/constructor/true">true</a> blocked:flags.22?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> about:<a href="/type/string">string</a> participants_count:flags.0?<a href="/type/int">int</a> admins_count:flags.1?<a href="/type/int">int</a> kicked_count:flags.2?<a href="/type/int">int</a> banned_count:flags.2?<a href="/type/int">int</a> online_count:flags.13?<a href="/type/int">int</a> read_inbox_max_id:<a href="/type/int">int</a> read_outbox_max_id:<a href="/type/int">int</a> unread_count:<a href="/type/int">int</a> chat_photo:<a href="/type/Photo">Photo</a> notify_settings:<a href="/type/PeerNotifySettings">PeerNotifySettings</a> exported_invite:flags.23?<a href="/type/ExportedChatInvite">ExportedChatInvite</a> bot_info:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/BotInfo">BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href="/type/long">long</a> migrated_from_max_id:flags.4?<a href="/type/int">int</a> pinned_msg_id:flags.5?<a href="/type/int">int</a> stickerset:flags.8?<a href="/type/StickerSet">StickerSet</a> available_min_id:flags.9?<a href="/type/int">int</a> folder_id:flags.11?<a href="/type/int">int</a> linked_chat_id:flags.14?<a href="/type/long">long</a> location:flags.15?<a href="/type/ChannelLocation">ChannelLocation</a> slowmode_seconds:flags.17?<a href="/type/int">int</a> slowmode_next_send_date:flags.18?<a href="/type/int">int</a> stats_dc:flags.12?<a href="/type/int">int</a> pts:<a href="/type/int">int</a> call:flags.21?<a href="/type/InputGroupCall">InputGroupCall</a> ttl_period:flags.24?<a href="/type/int">int</a> pending_suggestions:flags.25?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/string">string</a>&gt; groupcall_default_join_as:flags.26?<a href="/type/Peer">Peer</a> theme_emoticon:flags.27?<a href="/type/string">string</a> requests_pending:flags.28?<a href="/type/int">int</a> recent_requesters:flags.28?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/long">long</a>&gt; = <a href="/type/ChatFull">ChatFull</a>;
<a href="/constructor/channelParticipantSelf">channelParticipantSelf</a>#35a8bfa7 flags:<a href="/type/%23">#</a> via_request:flags.0?<a href="/constructor/true">true</a> user_id:<a href="/type/long">long</a> inviter_id:<a href="/type/long">long</a> date:<a href="/type/int">int</a> = <a href="/type/ChannelParticipant">ChannelParticipant</a>;
<a href="/constructor/channelAdminLogEventsFilter">channelAdminLogEventsFilter</a>#ea107ae4 flags:<a href="/type/%23">#</a> join:flags.0?<a href="/constructor/true">true</a> leave:flags.1?<a href="/constructor/true">true</a> invite:flags.2?<a href="/constructor/true">true</a> ban:flags.3?<a href="/constructor/true">true</a> unban:flags.4?<a href="/constructor/true">true</a> kick:flags.5?<a href="/constructor/true">true</a> unkick:flags.6?<a href="/constructor/true">true</a> promote:flags.7?<a href="/constructor/true">true</a> demote:flags.8?<a href="/constructor/true">true</a> info:flags.9?<a href="/constructor/true">true</a> settings:flags.10?<a href="/constructor/true">true</a> pinned:flags.11?<a href="/constructor/true">true</a> edit:flags.12?<a href="/constructor/true">true</a> delete:flags.13?<a href="/constructor/true">true</a> group_call:flags.14?<a href="/constructor/true">true</a> invites:flags.15?<a href="/constructor/true">true</a> send:flags.16?<a href="/constructor/true">true</a> = <a href="/type/ChannelAdminLogEventsFilter">ChannelAdminLogEventsFilter</a>;<br>
<a href="/constructor/theme">theme</a>#a00e67d6 flags:<a href="/type/%23">#</a> creator:flags.0?<a href="/constructor/true">true</a> default:flags.1?<a href="/constructor/true">true</a> for_chat:flags.5?<a href="/constructor/true">true</a> id:<a href="/type/long">long</a> access_hash:<a href="/type/long">long</a> slug:<a href="/type/string">string</a> title:<a href="/type/string">string</a> document:flags.2?<a href="/type/Document">Document</a> settings:flags.3?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/ThemeSettings">ThemeSettings</a>&gt; emoticon:flags.6?<a href="/type/string">string</a> installs_count:flags.4?<a href="/type/int">int</a> = <a href="/type/Theme">Theme</a>;<br>
<a href="/constructor/chatInviteImporter">chatInviteImporter</a>#8c5adfd9 flags:<a href="/type/%23">#</a> requested:flags.0?<a href="/constructor/true">true</a> user_id:<a href="/type/long">long</a> date:<a href="/type/int">int</a> about:flags.2?<a href="/type/string">string</a> approved_by:flags.1?<a href="/type/long">long</a> = <a href="/type/ChatInviteImporter">ChatInviteImporter</a>;<br>
<a href="/constructor/sponsoredMessage">sponsoredMessage</a>#d151e19a flags:<a href="/type/%23">#</a> random_id:<a href="/type/bytes">bytes</a> from_id:<a href="/type/Peer">Peer</a> channel_post:flags.2?<a href="/type/int">int</a> start_param:flags.0?<a href="/type/string">string</a> message:<a href="/type/string">string</a> entities:flags.1?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/MessageEntity">MessageEntity</a>&gt; = <a href="/type/SponsoredMessage">SponsoredMessage</a>;
<a href="/constructor/searchResultsCalendarPeriod">searchResultsCalendarPeriod</a>#c9b0539f date:<a href="/type/int">int</a> min_msg_id:<a href="/type/int">int</a> max_msg_id:<a href="/type/int">int</a> count:<a href="/type/int">int</a> = <a href="/type/SearchResultsCalendarPeriod">SearchResultsCalendarPeriod</a>;<br>
<a href="/constructor/messages.searchResultsCalendar">messages.searchResultsCalendar</a>#147ee23c flags:<a href="/type/%23">#</a> inexact:flags.0?<a href="/constructor/true">true</a> count:<a href="/type/int">int</a> min_date:<a href="/type/int">int</a> min_msg_id:<a href="/type/int">int</a> offset_id_offset:flags.1?<a href="/type/int">int</a> periods:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/SearchResultsCalendarPeriod">SearchResultsCalendarPeriod</a>&gt; messages:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Message">Message</a>&gt; chats:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Chat">Chat</a>&gt; users:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt; = <a href="/type/messages.SearchResultsCalendar">messages.SearchResultsCalendar</a>;<br>
<a href="/constructor/searchResultPosition">searchResultPosition</a>#7f648b67 msg_id:<a href="/type/int">int</a> date:<a href="/type/int">int</a> offset:<a href="/type/int">int</a> = <a href="/type/SearchResultsPosition">SearchResultsPosition</a>;<br>
<a href="/constructor/messages.searchResultsPositions">messages.searchResultsPositions</a>#53b22baf count:<a href="/type/int">int</a> positions:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/SearchResultsPosition">SearchResultsPosition</a>&gt; = <a href="/type/messages.SearchResultsPositions">messages.SearchResultsPositions</a>;
<a href="/constructor/messageActionChatJoinedByRequest">messageActionChatJoinedByRequest</a>#ebbca3cb = <a href="/type/MessageAction">MessageAction</a>;<br>
<a href="/constructor/updatePendingJoinRequests">updatePendingJoinRequests</a>#7063c3db peer:<a href="/type/Peer">Peer</a> requests_pending:<a href="/type/int">int</a> recent_requesters:<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/long">long</a>&gt; = <a href="/type/Update">Update</a>;
<a href="/constructor/updateBotChatInviteRequester">updateBotChatInviteRequester</a>#11dfa986 peer:<a href="/type/Peer">Peer</a> date:<a href="/type/int">int</a> user_id:<a href="/type/long">long</a> about:<a href="/type/string">string</a> invite:<a href="/type/ExportedChatInvite">ExportedChatInvite</a> qts:<a href="/type/int">int</a> = <a href="/type/Update">Update</a>;<br>
<a href="/constructor/channelAdminLogEventActionParticipantJoinByRequest">channelAdminLogEventActionParticipantJoinByRequest</a>#afb6144a invite:<a href="/type/ExportedChatInvite">ExportedChatInvite</a> approved_by:<a href="/type/long">long</a> = <a href="/type/ChannelAdminLogEventAction">ChannelAdminLogEventAction</a>;<br>
---functions---<br>
<a href="/method/messages.deleteHistory">messages.deleteHistory</a>#b08f922a flags:<a href="/type/%23">#</a> just_clear:flags.0?<a href="/constructor/true">true</a> revoke:flags.1?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> max_id:<a href="/type/int">int</a> min_date:flags.2?<a href="/type/int">int</a> max_date:flags.3?<a href="/type/int">int</a> = <a href="/type/messages.AffectedHistory">messages.AffectedHistory</a>;
<a href="/method/messages.exportChatInvite">messages.exportChatInvite</a>#a02ce5d5 flags:<a href="/type/%23">#</a> legacy_revoke_permanent:flags.2?<a href="/constructor/true">true</a> request_needed:flags.3?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> expire_date:flags.0?<a href="/type/int">int</a> usage_limit:flags.1?<a href="/type/int">int</a> title:flags.4?<a href="/type/string">string</a> = <a href="/type/ExportedChatInvite">ExportedChatInvite</a>;<br>
<a href="/method/account.createTheme">account.createTheme</a>#652e4400 flags:<a href="/type/%23">#</a> slug:<a href="/type/string">string</a> title:<a href="/type/string">string</a> document:flags.2?<a href="/type/InputDocument">InputDocument</a> settings:flags.3?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/InputThemeSettings">InputThemeSettings</a>&gt; = <a href="/type/Theme">Theme</a>;
<a href="/method/account.updateTheme">account.updateTheme</a>#2bf40ccc flags:<a href="/type/%23">#</a> format:<a href="/type/string">string</a> theme:<a href="/type/InputTheme">InputTheme</a> slug:flags.0?<a href="/type/string">string</a> title:flags.1?<a href="/type/string">string</a> document:flags.2?<a href="/type/InputDocument">InputDocument</a> settings:flags.3?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/InputThemeSettings">InputThemeSettings</a>&gt; = <a href="/type/Theme">Theme</a>;
<a href="/method/account.installTheme">account.installTheme</a>#c727bb3b flags:<a href="/type/%23">#</a> dark:flags.0?<a href="/constructor/true">true</a> theme:flags.1?<a href="/type/InputTheme">InputTheme</a> format:flags.2?<a href="/type/string">string</a> base_theme:flags.3?<a href="/type/BaseTheme">BaseTheme</a> = <a href="/type/Bool">Bool</a>;<br>
<a href="/method/messages.editExportedChatInvite">messages.editExportedChatInvite</a>#bdca2f75 flags:<a href="/type/%23">#</a> revoked:flags.2?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> link:<a href="/type/string">string</a> expire_date:flags.0?<a href="/type/int">int</a> usage_limit:flags.1?<a href="/type/int">int</a> request_needed:flags.3?<a href="/type/Bool">Bool</a> title:flags.4?<a href="/type/string">string</a> = <a href="/type/messages.ExportedChatInvite">messages.ExportedChatInvite</a>;
<a href="/method/messages.getChatInviteImporters">messages.getChatInviteImporters</a>#df04dd4e flags:<a href="/type/%23">#</a> requested:flags.0?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> link:flags.1?<a href="/type/string">string</a> q:flags.2?<a href="/type/string">string</a> offset_date:<a href="/type/int">int</a> offset_user:<a href="/type/InputUser">InputUser</a> limit:<a href="/type/int">int</a> = <a href="/type/messages.ChatInviteImporters">messages.ChatInviteImporters</a>;<br>
<a href="/method/account.getChatThemes">account.getChatThemes</a>#d638de89 hash:<a href="/type/long">long</a> = <a href="/type/account.Themes">account.Themes</a>;<br>
<a href="/method/messages.getSearchResultsCalendar">messages.getSearchResultsCalendar</a>#49f0bde9 peer:<a href="/type/InputPeer">InputPeer</a> filter:<a href="/type/MessagesFilter">MessagesFilter</a> offset_id:<a href="/type/int">int</a> offset_date:<a href="/type/int">int</a> = <a href="/type/messages.SearchResultsCalendar">messages.SearchResultsCalendar</a>;
<a href="/method/messages.getSearchResultsPositions">messages.getSearchResultsPositions</a>#6e9583a3 peer:<a href="/type/InputPeer">InputPeer</a> filter:<a href="/type/MessagesFilter">MessagesFilter</a> offset_id:<a href="/type/int">int</a> limit:<a href="/type/int">int</a> = <a href="/type/messages.SearchResultsPositions">messages.SearchResultsPositions</a>;
<a href="/method/messages.hideChatJoinRequest">messages.hideChatJoinRequest</a>#7fe7e815 flags:<a href="/type/%23">#</a> approved:flags.0?<a href="/constructor/true">true</a> peer:<a href="/type/InputPeer">InputPeer</a> user_id:<a href="/type/InputUser">InputUser</a> = <a href="/type/Updates">Updates</a>;<br></code></pre></div>
<h3><a class="anchor" href="#layer-133" id="layer-133" name="layer-133"><i class="anchor-icon"></i></a><a href="/schema?layer=133">Layer 133</a></h3>
<p>Group message receipts, <a href="/api/animated-emojis#emoji-reactions">animated emoji reactions »</a> and switch to 64-bit identifiers for users, groups, supergroups and channels.</p>
<p>Over 160 constructors and methods were changed, changing parameter types from <a href="/type/int">int</a> to <a href="/type/long">long</a>, including <a href="/constructor/user">user</a>, <a href="/constructor/chat">chat</a> and <a href="/constructor/channel">channel</a>: the full changelog is elided for space reasons.<br>
You can visit <a href="/schema">the schema</a> for an updated list of constructors.</p>
<p>Also note that the <a href="/api/offsets#hash-generation">hashing algorithm for pagination</a> was also changed to account for 64-bit IDs.</p>
<p>All layers 1-132 are deprecated due to impossible backwards compatibility between 32-bit and 64-bit IDs.</p>
<h4><a class="anchor" href="#changes" id="changes" name="changes"><i class="anchor-icon"></i></a>Changes</h4>
<ul>
<li>Added <a href="/method/messages.getMessageReadParticipants">messages.getMessageReadParticipants</a> - Get which users read a specific message</li>
<li>Added <a href="/constructor/inputStickerSetAnimatedEmojiAnimations">inputStickerSetAnimatedEmojiAnimations</a> - Animated emoji reaction stickerset (contains animations to play when a user clicks on a given animated emoji)</li>
<li>Added <a href="/constructor/sendMessageEmojiInteraction">sendMessageEmojiInteraction</a> - User has clicked on an animated emoji triggering a <a href="/api/animated-emojis#emoji-reactions">reaction, click here for more info »</a>.</li>
<li>Added <a href="/constructor/sendMessageEmojiInteractionSeen">sendMessageEmojiInteractionSeen</a> - User is watching an animated emoji reaction triggered by another user, <a href="/api/animated-emojis#emoji-reactions">click here for more info »</a>.</li>
<li>Added <a href="/constructor/inputBotInlineMessageID64">inputBotInlineMessageID64</a> - Represents a sent inline message from the perspective of a bot</li>
</ul></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,181 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Live geolocation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows sending the live geolocation of a user in a chat, optionally setting a proximity alert.">
<meta property="og:title" content="Live geolocation">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows sending the live geolocation of a user in a chat, optionally setting a proximity alert.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/live-location" >Live geolocation</a></li></ul></div>
<h1 id="dev_page_title">Live geolocation</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows sending the live geolocation of a user in a chat, optionally setting a proximity alert. </p>
<h3><a class="anchor" href="#sending-live-locations" id="sending-live-locations" name="sending-live-locations"><i class="anchor-icon"></i></a>Sending live locations</h3>
<pre><code><a href='/constructor/inputGeoPointEmpty'>inputGeoPointEmpty</a>#e4c123d6 = <a href='/type/InputGeoPoint'>InputGeoPoint</a>;
<a href='/constructor/inputGeoPoint'>inputGeoPoint</a>#48222faf flags:<a href='/type/%23'>#</a> lat:<a href='/type/double'>double</a> long:<a href='/type/double'>double</a> accuracy_radius:flags.0?<a href='/type/int'>int</a> = <a href='/type/InputGeoPoint'>InputGeoPoint</a>;
<a href='/constructor/inputMediaGeoLive'>inputMediaGeoLive</a>#971fa843 flags:<a href='/type/%23'>#</a> stopped:flags.0?<a href='/constructor/true'>true</a> geo_point:<a href='/type/InputGeoPoint'>InputGeoPoint</a> heading:flags.2?<a href='/type/int'>int</a> period:flags.1?<a href='/type/int'>int</a> proximity_notification_radius:flags.3?<a href='/type/int'>int</a> = <a href='/type/InputMedia'>InputMedia</a>;
---functions---
<a href='/method/messages.sendMedia'>messages.sendMedia</a>#e25ff8e0 flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> media:<a href='/type/InputMedia'>InputMedia</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.editMessage'>messages.editMessage</a>#48f71778 flags:<a href='/type/%23'>#</a> no_webpage:flags.1?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/int'>int</a> message:flags.11?<a href='/type/string'>string</a> media:flags.14?<a href='/type/InputMedia'>InputMedia</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.15?<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>To send a live geolocation, use <a href="/method/messages.sendMedia">messages.sendMedia</a> with an <a href="/constructor/inputMediaGeoLive">inputMediaGeoLive</a> <code>media</code> . </p>
<p>The <a href="/constructor/inputMediaGeoLive">inputMediaGeoLive</a> allows sending the geolocation as an <a href="/constructor/inputGeoPoint">inputGeoPoint</a> with floating point latitude and longitude, with an optional <code>accuracy_radius</code> in meters.<br>
Clients can also provide a <code>heading</code>, a direction in degrees (1-360) that can be used to indicate the direction of the user, a validity <code>period</code> for the current location, and a <code>proximity_notification_radius</code> . </p>
<p>The sent geolocation should be updated periodically using <a href="/method/messages.editMessage">messages.editMessage</a> <strong>at most</strong> every <code>period</code> seconds, in order to implement the "live" part of live geolocations. </p>
<p>To stop sharing the location, pass <a href="/constructor/inputGeoPointEmpty">inputGeoPointEmpty</a> as location and set the <code>stopped</code> flag to true in a last <a href="/method/messages.editMessage">messages.editMessage</a> call. </p>
<h3><a class="anchor" href="#receiving-live-locations" id="receiving-live-locations" name="receiving-live-locations"><i class="anchor-icon"></i></a>Receiving live locations</h3>
<pre><code><a href='/constructor/geoPoint'>geoPoint</a>#b2a2f663 flags:<a href='/type/%23'>#</a> long:<a href='/type/double'>double</a> lat:<a href='/type/double'>double</a> access_hash:<a href='/type/long'>long</a> accuracy_radius:flags.0?<a href='/type/int'>int</a> = <a href='/type/GeoPoint'>GeoPoint</a>;
<a href='/constructor/messageMediaGeoLive'>messageMediaGeoLive</a>#b940c666 flags:<a href='/type/%23'>#</a> geo:<a href='/type/GeoPoint'>GeoPoint</a> heading:flags.0?<a href='/type/int'>int</a> period:<a href='/type/int'>int</a> proximity_notification_radius:flags.1?<a href='/type/int'>int</a> = <a href='/type/MessageMedia'>MessageMedia</a>;
<a href='/constructor/updateGeoLiveViewed'>updateGeoLiveViewed</a>#871fb939 peer:<a href='/type/Peer'>Peer</a> msg_id:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;</code></pre>
<p>Clients will receive a message with a <a href="/constructor/messageMediaGeoLive">messageMediaGeoLive</a>, containing the information passed by the sender; when the geolocation message is marked as read, an <a href="/constructor/updateGeoLiveViewed">updateGeoLiveViewed</a> is generated. </p>
<p>Periodically, the geolocation will be updated with <a href="/constructor/updateEditMessage">updateEditMessage</a>/<a href="/constructor/updateEditChannelMessage">updateEditChannelMessage</a> updates. </p>
<h4><a class="anchor" href="#live-location-previews" id="live-location-previews" name="live-location-previews"><i class="anchor-icon"></i></a>Live location previews</h4>
<pre><code><a href='/constructor/inputWebFileGeoPointLocation'>inputWebFileGeoPointLocation</a>#9f2221c9 geo_point:<a href='/type/InputGeoPoint'>InputGeoPoint</a> access_hash:<a href='/type/long'>long</a> w:<a href='/type/int'>int</a> h:<a href='/type/int'>int</a> zoom:<a href='/type/int'>int</a> scale:<a href='/type/int'>int</a> = <a href='/type/InputWebFileLocation'>InputWebFileLocation</a>;
<a href='/constructor/inputGeoPoint'>inputGeoPoint</a>#48222faf flags:<a href='/type/%23'>#</a> lat:<a href='/type/double'>double</a> long:<a href='/type/double'>double</a> accuracy_radius:flags.0?<a href='/type/int'>int</a> = <a href='/type/InputGeoPoint'>InputGeoPoint</a>;
---functions---
<a href='/method/upload.getWebFile'>upload.getWebFile</a>#24e6818d location:<a href='/type/InputWebFileLocation'>InputWebFileLocation</a> offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/upload.WebFile'>upload.WebFile</a>;</code></pre>
<p>A map preview can be generated by passing the received <a href="/constructor/geoPoint">geoPoint</a> to <a href="/api/files#downloading-webfiles">upload.getWebFile</a>, to download an image preview of the map. </p>
<ul>
<li><code>geo_point</code> is generated from the <code>lat</code> , <code>long</code> <code>accuracy_radius</code> parameters of the <a href="/constructor/geoPoint">geoPoint</a></li>
<li><code>access_hash</code> is the access hash of the <a href="/constructor/geoPoint">geoPoint</a></li>
<li><code>w</code> - Map width in pixels before applying scale; 16-1024</li>
<li><code>h</code> - Map height in pixels before applying scale; 16-1024</li>
<li><code>zoom</code> - Map zoom level; 13-20</li>
<li><code>scale</code> - Map scale; 1-3</li>
</ul>
<p>The image is then downloaded as specified <a href="/api/files">here » </a></p>
<h3><a class="anchor" href="#proximity-alert" id="proximity-alert" name="proximity-alert"><i class="anchor-icon"></i></a>Proximity alert</h3>
<pre><code><a href='/constructor/messageActionGeoProximityReached'>messageActionGeoProximityReached</a>#98e0d697 from_id:<a href='/type/Peer'>Peer</a> to_id:<a href='/type/Peer'>Peer</a> distance:<a href='/type/int'>int</a> = <a href='/type/MessageAction'>MessageAction</a>;
<a href='/constructor/messageService'>messageService</a>#2b085862 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> action:<a href='/type/MessageAction'>MessageAction</a> ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;</code></pre>
<p>If:</p>
<ul>
<li>A user sets a <code>proximity_notification_radius</code> when sending a location</li>
<li>Multiple users share their location within the same chat</li>
<li>One of the other users comes within <code>proximity_notification_radius</code> meters of the first user, and updates their location accordingly</li>
</ul>
<p>An <a href="/constructor/updateNewMessage">updateNewMessage</a>/<a href="/constructor/updateNewChannelMessage">updateNewChannelMessage</a> is generated for all chat members, containing a <a href="/constructor/messageService">messageService</a> with action <a href="/constructor/messageActionGeoProximityReached">messageActionGeoProximityReached</a>:</p>
<ul>
<li><code>messageActionGeoProximityReached.to_id</code> is the peer that enabled proximity alerts</li>
<li><code>messageActionGeoProximityReached.from_id</code> is the peer that is now in proximity of <code>messageActionGeoProximityReached.to_id</code></li>
<li><code>messageActionGeoProximityReached.distance</code> is the distance between them, in meters</li>
</ul></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Mentions</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows mentioning other users in case of urgent duckling matters, and quickly navigating to those mentions in order to read them as swiftly as possible.">
<meta property="og:title" content="Mentions">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows mentioning other users in case of urgent duckling matters, and quickly navigating to those mentions in order to read them as swiftly as possible.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/mentions" >Mentions</a></li></ul></div>
<h1 id="dev_page_title">Mentions</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows mentioning other users in case of urgent duckling matters, and quickly navigating to those mentions in order to read them as swiftly as possible.</p>
<pre><code><a href='/constructor/messageEntityMention'>messageEntityMention</a>#fa04579d offset:<a href='/type/int'>int</a> length:<a href='/type/int'>int</a> = <a href='/type/MessageEntity'>MessageEntity</a>;
<a href='/constructor/messageEntityMentionName'>messageEntityMentionName</a>#dc7b1140 offset:<a href='/type/int'>int</a> length:<a href='/type/int'>int</a> user_id:<a href='/type/long'>long</a> = <a href='/type/MessageEntity'>MessageEntity</a>;
<a href='/constructor/inputMessageEntityMentionName'>inputMessageEntityMentionName</a>#208e68c9 offset:<a href='/type/int'>int</a> length:<a href='/type/int'>int</a> user_id:<a href='/type/InputUser'>InputUser</a> = <a href='/type/MessageEntity'>MessageEntity</a>;
<a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/channelParticipantsMentions'>channelParticipantsMentions</a>#e04b5ceb flags:<a href='/type/%23'>#</a> q:flags.0?<a href='/type/string'>string</a> top_msg_id:flags.1?<a href='/type/int'>int</a> = <a href='/type/ChannelParticipantsFilter'>ChannelParticipantsFilter</a>;
---functions---
<a href='/method/messages.sendMessage'>messages.sendMessage</a>#d9d75a4 flags:<a href='/type/%23'>#</a> no_webpage:flags.1?<a href='/constructor/true'>true</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.getParticipants'>channels.getParticipants</a>#77ced9d0 channel:<a href='/type/InputChannel'>InputChannel</a> filter:<a href='/type/ChannelParticipantsFilter'>ChannelParticipantsFilter</a> offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> hash:<a href='/type/long'>long</a> = <a href='/type/channels.ChannelParticipants'>channels.ChannelParticipants</a>;</code></pre>
<p>Mentions are implemented as <a href="/api/entities">message entities</a>, passed to the <a href="/method/messages.sendMessage">messages.sendMessage</a> method:</p>
<ul>
<li><a href="/constructor/inputMessageEntityMentionName">inputMessageEntityMentionName</a> - Used when sending messages, allows mentioning a user <a href="https://t.me/botfather">inline, even for users that don't have a @username</a></li>
<li><a href="/constructor/messageEntityMentionName">messageEntityMentionName</a> - Incoming message counterpart of <a href="/constructor/inputMessageEntityMentionName">inputMessageEntityMentionName</a></li>
<li><a href="/constructor/messageEntityMention">messageEntityMention</a> - <a href="https://t.me/botfather">@botfather</a> (this entity is generated automatically server-side for @usernames in messages, no need to provide it manually)</li>
</ul>
<p>Incoming <a href="/constructor/message">messages</a> mentioning to the current user will have the <code>mentioned</code> flag set, and will contain one or more <a href="/constructor/messageEntityMention">messageEntityMention</a> and <a href="/constructor/messageEntityMentionName">messageEntityMentionName</a> constructors. </p>
<p>Graphical clients can show a list of mentionable users when the user starts entering an <code>@</code> in the text bar; for this purpose, the <a href="/constructor/channelParticipantsMentions">channelParticipantsMentions</a> filter can be used in <a href="/method/channels.getParticipants">channels.getParticipants</a>.<br>
This filter can be enhanced by providing an additional query string <code>q</code> (anything the user enters after <code>@</code>); it will also return non-participant users, in case of channel users commenting in <a href="/api/discussion">post comment sections</a>. </p>
<h3><a class="anchor" href="#dialog-mentions" id="dialog-mentions" name="dialog-mentions"><i class="anchor-icon"></i></a>Dialog mentions</h3>
<pre><code><a href='/constructor/dialog'>dialog</a>#a8edd0f5 flags:<a href='/type/%23'>#</a> pinned:flags.2?<a href='/constructor/true'>true</a> unread_mark:flags.3?<a href='/constructor/true'>true</a> peer:<a href='/type/Peer'>Peer</a> top_message:<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> unread_mentions_count:<a href='/type/int'>int</a> unread_reactions_count:<a href='/type/int'>int</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> pts:flags.0?<a href='/type/int'>int</a> draft:flags.1?<a href='/type/DraftMessage'>DraftMessage</a> folder_id:flags.4?<a href='/type/int'>int</a> = <a href='/type/Dialog'>Dialog</a>;
---functions---
<a href='/method/messages.getUnreadMentions'>messages.getUnreadMentions</a>#46578472 peer:<a href='/type/InputPeer'>InputPeer</a> offset_id:<a href='/type/int'>int</a> add_offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> max_id:<a href='/type/int'>int</a> min_id:<a href='/type/int'>int</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/method/messages.readMentions'>messages.readMentions</a>#f0189d3 peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/messages.AffectedHistory'>messages.AffectedHistory</a>;</code></pre>
<p>Graphical clients are supposed to show a blue mention indicator next to the message counter of chats in the dialog list.<br>
The <a href="/constructor/dialog">dialog</a> constructor contains an <code>unread_mentions_count</code> field to isolate chats with unread mentions; the actual mention counter should be shown inside of the chat itself, above an <code>@</code> button that can be used, by clicking multiple times, to navigate back (using <a href="/method/messages.getUnreadMentions">messages.getUnreadMentions</a>) through the mention history. </p>
<p>When the last unread mention is read, or when long-clicking on the <code>@</code> button, all mentions for a chat should marked as read using <a href="/method/messages.readMentions">messages.readMentions</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,145 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Min constructors</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="In some situations user and channel constructors have reduced set of fields present (although id is always there) and min flag set. ">
<meta property="og:title" content="Min constructors">
<meta property="og:image" content="8440249ddd84efacd0">
<meta property="og:description" content="In some situations user and channel constructors have reduced set of fields present (although id is always there) and min flag set. ">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/min" >Min constructors</a></li></ul></div>
<h1 id="dev_page_title">Min constructors</h1>
<div id="dev_page_content"><p>In some situations <a href="/constructor/user">user</a> and <a href="/constructor/channel">channel</a> constructors have reduced set of fields present (although <code>id</code> is always there) and <code>min</code> flag set. This is done for performance and privacy reasons. </p>
<p>When receiving said constructors, the client must first check if user or chat object without <code>min</code> flag is already present in local cache. If it is present, then the client should just ignore constructors with <code>min</code> flag and use local one instead.</p>
<p><strong>The rest of article assumes the client receives min-constructor without full object in local cache.</strong></p>
<p>The client must store the context (similar to <a href="/api/file_reference">file references</a>) in which the user/channel was seen. Later, when the client needs to pass the user/channel as input argument (e.g. fetch profile, mute, ban etc), the context is used to generate the <code>input*FromMessage</code> constructor, instead of normal <code>inputUser</code>, <code>inputChannel</code> or <code>inputPeer</code>.</p>
<ul>
<li><a href="/constructor/inputPeerUserFromMessage">inputPeerUserFromMessage</a></li>
<li><a href="/constructor/inputPeerChannelFromMessage">inputPeerChannelFromMessage</a></li>
<li><a href="/constructor/inputUserFromMessage">inputUserFromMessage</a></li>
<li><a href="/constructor/inputChannelFromMessage">inputChannelFromMessage</a></li>
</ul>
<p>The <code>access_hash</code> value, if present, is only suitable to use in <a href="/constructor/inputPeerPhotoFileLocation"><code>inputPeerPhotoFileLocation</code></a>, to directly <a href="/api/files">download the profile pictures</a> of channels and users <strong>without</strong> having to generate an <code>inputPeer*FromMessage</code>, simply using <code>inputPeer*</code> with the specified access hash. </p>
<p>Usually <code>min</code> constructors are encountered in messages inside of groups or channels.
When a message mentioning (sender, forwarder or forwardee, et cetera) such a user or channel is found, the constuctor must be associated with the message ID of the message and with the chat where the message was seen.</p>
<h4><a class="anchor" href="#example" id="example" name="example"><i class="anchor-icon"></i></a>Example</h4>
<p>Assume a <a href="/constructor/message">message</a> with id <code>34</code> is received from supergroup (<a href="/api/channel">actually channel</a>) <code>123456789</code>.
Said message was sent by <code>from_id</code> <code>102424212</code>.
The <a href="/api/updates">updates</a> container that contained the message has a user with ID <code>102424212</code> in the <code>users</code> field, but it has the <code>min</code> flag set, and the provided <code>access_hash</code> may be absent, or otherwise can't be used to generate a typical <a href="/constructor/inputPeerUser">inputPeerUser</a> constructor to send messages or do other actions.</p>
<p>What the client does is associate <code>102424212</code> with the channel <code>123456789</code> and message ID <code>34</code>.
When and if the client will need to interact with user <code>102424212</code>, it will generate one of the <code>*FromMessage</code> constructors mentioned above, setting:</p>
<ul>
<li><code>msg_id</code> to <code>34</code></li>
<li><code>peer</code> to the <a href="/type/InputPeer">InputPeer</a> associated with channel <code>123456789</code></li>
<li><code>user_id</code> to <code>102424212</code></li>
</ul>
<p><code>user_id</code> can also be set to the IDs of users met in the <code>fwd_header</code> (messages forwarded from a user can be used to interact with the original sender, if they don't have privacy settings for forwards enabled).
Users mentioned via <a href="/constructor/messageEntityMentionName">messageEntityMentionName</a> in a message can also be used.</p>
<p>The same can be done with <code>min</code> <a href="/api/channel">channels</a>.</p>
<p>Example implementations: <a href="https://github.com/peter-iakovlev/Telegram-iOS">Telegram for iOS</a>, <a href="https://github.com/tdlib/td">tdlib</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,143 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Creating your Telegram Application</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to get your application identifier and create a new Telegram app.">
<meta property="og:title" content="Creating your Telegram Application">
<meta property="og:image" content="06c229ff662379138f">
<meta property="og:description" content="How to get your application identifier and create a new Telegram app.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/obtaining_api_id" >Creating your Telegram Application</a></li></ul></div>
<h1 id="dev_page_title">Creating your Telegram Application</h1>
<div id="dev_page_content"><p>We welcome all developers to use our <a href="https://core.telegram.org/api#telegram-api">API</a> and source code to create Telegram-like messaging applications on our platform free of charge.</p>
<blockquote>
<p>In order to ensure consistency and security across the Telegram ecosystem,
<strong>all third-party client apps</strong> must comply with the <a href="/api/terms"><strong>API Terms of Service</strong></a>.</p>
</blockquote>
<h3><a class="anchor" href="#obtaining-api-id" id="obtaining-api-id" name="obtaining-api-id"><i class="anchor-icon"></i></a>Obtaining api_id</h3>
<p>In order to obtain an <strong>API id</strong> and develop your own application using the Telegram API you need to do the following:</p>
<ul>
<li>Sign up for Telegram using any application.</li>
<li>Log in to your Telegram core: <a href="https://my.telegram.org">https://my.telegram.org</a>.</li>
<li>Go to <a href="https://my.telegram.org/apps">"API development tools"</a> and fill out the form.</li>
<li>You will get basic addresses as well as the <strong>api_id</strong> and <strong>api_hash</strong> parameters required for user authorization.</li>
<li>For the moment each number can only have one api_id connected to it.</li>
</ul>
<p>We will be sending important developer notifications to the phone number that you use in this process, so please use an up-to-date number connected to your active Telegram account.</p>
<h3><a class="anchor" href="#using-the-api-id" id="using-the-api-id" name="using-the-api-id"><i class="anchor-icon"></i></a>Using the api_id</h3>
<p>Before using the MTProto Telegram API, please note that all API client libraries are strictly monitored to prevent abuse.</p>
<p>If you use the Telegram API for flooding, spamming, faking subscriber and view counters of channels, you <strong>will be banned forever</strong>. </p>
<p>Due to excessive abuse of the Telegram API, <strong>all accounts</strong> that sign up or log in using unofficial Telegram API clients are automatically put <strong>under observation</strong> to avoid violations of the <a href="/api/terms">Terms of Service</a>. </p>
<p>If you didn't violate the Terms of Service but your account does get banned after using the API, write to <a href="mailto:recover@telegram.org">recover@telegram.org</a> explaining what you intend to do with the API, asking to unban your account.<br>
Please note that emails are checked by a human, so automatically generated emails will be detected and banned.</p>
<h3><a class="anchor" href="#using-telegrams-open-source-code" id="using-telegrams-open-source-code" name="using-telegrams-open-source-code"><i class="anchor-icon"></i></a>Using Telegram's open source code</h3>
<p>Everyone is welcome to use our open source code. We have included a sample API id with the code. This API id is limited on the server side and is not suitable for apps released to end-users — using it for anything but testing purposes will result in the API_ID_PUBLISHED_FLOOD error for your users. It is necessary that you obtain your <strong>own API id</strong> before you publish your app.</p>
<blockquote>
<p>Please remember to publish your code as well in order to comply with the GNU GPL licences.</p>
</blockquote></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,173 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Pagination in the API</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to fetch results from large lists of objects.">
<meta property="og:title" content="Pagination in the API">
<meta property="og:image" content="4dd378cd0f58b0b820">
<meta property="og:description" content="How to fetch results from large lists of objects.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/offsets" >Pagination in the API</a></li></ul></div>
<h1 id="dev_page_title">Pagination in the API</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Lots of Telegram API methods provide access to potentially large lists of objects, which requires pagination.</p>
<p>In order to fetch only relevant subset of results for each request there is a number of available input parameters. Here is a list in order how they are applied in API.</p>
<p>Typically, results are returned in reverse chronological order with descending object ID values.</p>
<h3><a class="anchor" href="#limit-parameter" id="limit-parameter" name="limit-parameter"><i class="anchor-icon"></i></a><code>limit</code> parameter</h3>
<p>A limit on the number of objects to be returned, typically between 1 and 100. When 0 is provided the limit will often default to an intermediate value like ~20.</p>
<h3><a class="anchor" href="#offset-based-pagination" id="offset-based-pagination" name="offset-based-pagination"><i class="anchor-icon"></i></a><code>offset</code>-based pagination</h3>
<p>For a few methods with mostly static data this parameter allows to skip <code>offset</code> elements from the beginning of list; negative values are ignored.</p>
<h3><a class="anchor" href="#offset-id-based-pagination" id="offset-id-based-pagination" name="offset-id-based-pagination"><i class="anchor-icon"></i></a><code>offset_id</code>-based pagination</h3>
<p>For most methods where results are real-time data (e.g. any chat history) <code>offset</code> value is not passed directly. Instead it is calculated from the passed <code>offset_id</code> and <code>add_offset</code> parameter values as <code>offsetFromID(offset_id) + add_offset</code>, where <code>offsetFromID(offset_id)</code> is a number of results from the beginning of list up to the result with ID <code>offset_id</code>, inclusive.</p>
<p>Sample use cases:</p>
<ul>
<li>
<p>Loading 20 messages, older than message with ID <code>MSGID</code>:</p>
<p>messages.getHistory({offset_id: MSGID, add_offset: 0, limit: 20})</p>
</li>
<li>
<p>Loading 20 messages, newer than message with ID <code>MSGID</code>:</p>
<p>messages.getHistory({offset_id: MSGID, add_offset: -20, limit: 20})</p>
</li>
<li>
<p>Loading 20 messages around message with ID <code>MSGID</code>:</p>
<p>messages.getHistory({offset_id: MSGID, add_offset: -10, limit: 20})</p>
</li>
</ul>
<h3><a class="anchor" href="#additional-filtering" id="additional-filtering" name="additional-filtering"><i class="anchor-icon"></i></a>Additional filtering</h3>
<p>There is a number of parameters, which are applied to the list after slicing with offset and limit, to reduce the result subset even more:</p>
<ul>
<li><strong>max_id</strong>: Can be used to only return results with ID strictly smaller than <code>max_id</code> (e.g. message ID)</li>
<li><strong>min_id</strong>: Can be used to only return results with ID strictly greater than <code>min_id</code>(e.g. message ID)</li>
<li><strong>max_date</strong>: Can be used to only return results that are older than <code>max_date</code>:</li>
<li><strong>min_date</strong>: Can be used to only return results with are newer than <code>min_date</code>:</li>
<li><strong>hash</strong>: See below.</li>
</ul>
<h3><a class="anchor" href="#hash-generation" id="hash-generation" name="hash-generation"><i class="anchor-icon"></i></a>Hash generation</h3>
<p>To further reduce the result subset, there is a mechanism to avoid fetching data if the resulting list hasn't changed from the one stored on client, similar to <a href="https://en.wikipedia.org/wiki/HTTP_ETag">ETag</a>.</p>
<p>When the client has cached results for API request, it can calculate the <code>hash</code> value for it by taking the result IDs (message IDs or other fields with name <code>id</code>) and using them to compute a 64-bit hash with the following algorithm:</p>
<pre><code># Here, ^ indicates a bitwise XOR
hash = 0
for id in ids:
hash = hash ^ (id &gt;&gt; 21)
hash = hash ^ (id &lt;&lt; 35)
hash = hash ^ (id &gt;&gt; 4)
hash = hash + id</code></pre>
<p>In some cases, the result container already has a <code>hash</code> field, that can be used instead.</p>
<p>When the client passes a correct value, the API will return one of <code>*NotModified</code> constructors, e.g. <a href="/constructor/messages.messagesNotModified">messages.messagesNotModified</a> instead of the actual results.</p>
<h3><a class="anchor" href="#example-methods" id="example-methods" name="example-methods"><i class="anchor-icon"></i></a>Example methods</h3>
<ul>
<li><a href="/method/messages.getHistory">messages.getHistory</a> supports all result navigation parameters including message ID hashes and except filters</li>
<li><a href="/method/channels.getParticipants">channels.getParticipants</a> supports simple navigation using <strong>limit</strong> and <strong>offset</strong>, along with filtering and <code>hash</code> reducing using the user IDs of returned participants</li>
</ul></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,153 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Client-Side Optimization</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Ways to boost API interactions.">
<meta property="og:title" content="Client-Side Optimization">
<meta property="og:image" content="cc8d9aa19196b9a2dd">
<meta property="og:description" content="Ways to boost API interactions.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/optimisation" >Client-Side Optimization</a></li></ul></div>
<h1 id="dev_page_title">Client-Side Optimization</h1>
<div id="dev_page_content"><h3><a class="anchor" href="#simplified-acknowledgment-of-message-delivery" id="simplified-acknowledgment-of-message-delivery" name="simplified-acknowledgment-of-message-delivery"><i class="anchor-icon"></i></a>Simplified Acknowledgment of Message Delivery</h3>
<p>An outgoing message may be considered sent once the server has assigned it an identifier. Normally, a client would learn of this from the result of the <a href="/method/messages.sendMessage">messages.sendMessage</a> method.
The MTProto server provides a mechanism for <a href="/mtproto/mtproto-transports#quick-ack">“quick acknowledgments"</a>. Upon receiving such an acknowledgment, the client may be certain that the call to the send message method has at least been fully received by the server and placed in a processing queue, and can inform the user that the delivery was successful.
It is possible that the server's actual response will never be received by the client (an interrupted connection; or the app restarts at exactly the wrong time). To correctly handle these situations, you can use a special type of notification generated by the server when <a href="/method/updates.getDifference">updates.getDifference</a> is called: <a href="/constructor/updateMessageID">updateMessageID</a>. When processing this notification, the client can use the <strong>random_id</strong> identifier to associate the previously transmitted message with the one delivered to the server.
If such a notification is not issued when <a href="/method/updates.getDifference">updates.getDifference</a> is called for one of the previously sent messages, the message must be marked as undelivered.</p>
<h3><a class="anchor" href="#server-salt" id="server-salt" name="server-salt"><i class="anchor-icon"></i></a>Server Salt</h3>
<p>Server salt is a 64-bit number added to every outgoing and incoming message. At present, a single salt's lifespan is 1 hour, following which it is considered invalid and the server will return an error for all the messages that contain it. The error message will contain the correct salt, which may be immediately used for sending. Given this approach, there will always be a period of waiting before the client receives a new salt if it connects to the server less frequently than once an hour.
For improved performance, there is a special <a href="/mtproto/service_messages#request-for-several-future-salts">get_future_salts</a> method, which fetches in advance a list of the salts that will be valid during the course of a specified period of time following the call (1 day, for example). A start time and an end time are specified for each salt. The salts overlap one another by half an hour. We recommend always using the record with the longest remaining lifespan.</p>
<h3><a class="anchor" href="#downloading-files-and-uploading-data-to-the-server" id="downloading-files-and-uploading-data-to-the-server" name="downloading-files-and-uploading-data-to-the-server"><i class="anchor-icon"></i></a>Downloading Files and Uploading Data to the Server</h3>
<p>We recommend that separate connections and sessions be created for these tasks. Remember that the extra sessions must be deleted when no longer needed.
It makes sense to download files over several connections (optimally to have a pool). When uploading data to a server one connection is enough to achieve the best results.</p>
<p>The file handling API is designed to perform data operations in parts. In its simplest implementation, the process of uploading files to a server looks like this: send a query, wait for a response, send the next query, etc. This approach does not optimize the use of network resources and the ping time has a huge effect.
The upload and download process is optimal when two or more queries are continuously being executed through one connection. In this arrangement, uploading to the server would look like this:</p>
<ol>
<li>Send Query 1</li>
<li>Send Query 2</li>
<li>Wait for a response to Query 1</li>
<li>Send Query 3</li>
<li>Wait for a response to Query 2</li>
<li>Send Query 4</li>
<li>etc.</li>
</ol>
<p>This will help reduce the effect of ping latency and maximize the channel workload.</p>
<h3><a class="anchor" href="#sending-messages-in-bulk" id="sending-messages-in-bulk" name="sending-messages-in-bulk"><i class="anchor-icon"></i></a>Sending Messages in Bulk</h3>
<p>Sometimes a client needs to transmit several send message method calls to the server all at once in a single message or in several consecutive messages. However, the server may execute these requests out of order (queries are handled by different servers to improve performance, which introduces a degree of randomness to the process).
This requires that dependencies be explicitly stated when processing queries by using the function</p>
<pre><code>invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;</code></pre>
<p>Actually, this means padding the beginning of the query with the 32-bit number <code>0xcb9f372d</code> and the 64-bit message identifier of the query on which the current query is dependent.</p>
<h3><a class="anchor" href="#grouping-updates" id="grouping-updates" name="grouping-updates"><i class="anchor-icon"></i></a>Grouping Updates</h3>
<p>Generating updates (notifications about various server events) and delivering them to the client form two different parts of the system (respectively, the messenger API and MTProto). By itself, MTProto cannot modify in any way the data transmitted to the client, and the server API cannot respond to client-MTProto connection events.
Imagine the situation where a client loses its connection (or is intentionally disconnected from the network) for some time. If lots of different events occur before a new connection is established (contacts come online, typing event messages are sent), then when a connection is established the client will receive lots of data containing all of the intervening events, despite the fact that most of the data is obsolete.
The grouping of messages has been introduced to optimize such situations. If new events occur and the client has not managed to “collect” the previously generated updates, then the server API can combine them into a single package.</p>
<p>A client is able to control when the MTProto server begins to consider that the connection has been lost and grouping can begin (the earlier this occurs when there is no connection, the better for the client). This functionality is implemented through a special type of Ping message, <a href="/mtproto/service_messages#deferred-connection-closure-ping">ping_delay_disconnect</a>, which specifies a time delay following which the server will close the current connection and start grouping messages. </p>
<p>It makes sense to combine the transmission of <a href="/mtproto/service_messages#deferred-connection-closure-ping">ping_delay_disconnect</a> with that of other recurring tasks, such as updating the user status (<a href="/method/account.updateStatus">account.updateStatus</a>).</p>
<h3><a class="anchor" href="#setting-the-typing-status" id="setting-the-typing-status" name="setting-the-typing-status"><i class="anchor-icon"></i></a>Setting the Typing Status</h3>
<p>If a contact is not online, there is no need to invoke <a href="/method/messages.setTyping">messages.setTyping</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,677 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Telegram passport</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Client-side passport flow">
<meta property="og:title" content="Telegram passport">
<meta property="og:image" content="127528a6974e1bc1ac">
<meta property="og:description" content="Client-side passport flow">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/passport" >Telegram passport</a></li></ul></div>
<h1 id="dev_page_title">Telegram passport</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p><strong>Telegram Passport</strong> is a unified authorization method for services that require personal identification. Users can upload their documents once, then instantly share their data with services that require real-world ID (finance, ICOs, etc.). Telegram doesn't have access to the users' personal information thanks to end-to-end encryption.</p>
<p>This page describes the request flow that client apps must used to send the requested data to the service.</p>
<h3><a class="anchor" href="#overview" id="overview" name="overview"><i class="anchor-icon"></i></a>Overview</h3>
<p>From the perspective of a service that requires real-world ID, the process looks like this:</p>
<ul>
<li>A user presses “Log in with Telegram” on your website or in your app.</li>
<li>You request the data you need.</li>
<li>The user accepts your privacy policy and agrees to share their data.</li>
<li>The user's Telegram app downloads and decrypts the data you requested from the end-to-end encrypted storage on Telegram.</li>
<li>If some of the data you requested is missing, the user can add it to their Telegram Passport at this point.</li>
<li>The user's app encrypts the data with your public key and sends it to you.</li>
<li>You decrypt the data, check it for errors and re-request any missing or invalid information.</li>
<li>You sign the user up for your service. Tada!</li>
</ul>
<p>See <a href="#as-a-bot">As a bot</a> to see how to request passport data using a bot, through the MTProto API.
Look at the <a href="/passport">Passport Manual</a> to see how to request passport data using a bot, through the simplified bot API.</p>
<p>From the perspective of a user, the process looks something like this:</p>
<ul>
<li>Your app <a href="#receiving-requests">receives an event/intent</a> from one of the <a href="/passport#sdk">SDKs</a>, or from a custom source.</li>
<li>The user accepts your privacy policy and agrees to share their data.</li>
<li>The user's Telegram app <a href="/passport/encryption#fetching-and-deleting-stored-passport-data">downloads the data you requested</a> from the end-to-end encrypted storage on Telegram.</li>
<li>If some of the data you requested is missing, the user can <a href="/passport/encryption#encryption">add it to their Telegram Passport</a> at this point.</li>
<li>The user's app encrypts the data with your public key and sends it to the service.</li>
<li>You sign the user up for your service. Tada!</li>
</ul>
<p>See <a href="#as-a-user">As a user</a> to see how user client apps should send passport data to a service, through the MTProto API.</p>
<h3><a class="anchor" href="#as-a-bot" id="as-a-bot" name="as-a-bot"><i class="anchor-icon"></i></a>As a bot</h3>
<p>A simplified version of this process can be used using the bot API, for more info see the <a href="/passport">Passport Manual</a>.</p>
<p>Using the MTProto API, the process is pretty much the same, up until the actual API calls.</p>
<blockquote>
<p>Note that all binary fields are in raw binary format, unlike in the bot API where they are base64-encoded</p>
</blockquote>
<h4><a class="anchor" href="#setting-up-telegram-passport" id="setting-up-telegram-passport" name="setting-up-telegram-passport"><i class="anchor-icon"></i></a>Setting Up Telegram Passport</h4>
<p><a href="/passport#setting-up-telegram-passport">As per the bot API</a>.</p>
<h4><a class="anchor" href="#requesting-information" id="requesting-information" name="requesting-information"><i class="anchor-icon"></i></a>Requesting Information</h4>
<p><a href="/passport#requesting-information">As per the bot API</a>.</p>
<h4><a class="anchor" href="#receiving-information" id="receiving-information" name="receiving-information"><i class="anchor-icon"></i></a>Receiving information</h4>
<p>Schema:</p>
<pre><code><a href='/constructor/secureData'>secureData</a>#8aeabec3 data:<a href='/type/bytes'>bytes</a> data_hash:<a href='/type/bytes'>bytes</a> secret:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureData'>SecureData</a>;
<a href='/constructor/securePlainPhone'>securePlainPhone</a>#7d6099dd phone:<a href='/type/string'>string</a> = <a href='/type/SecurePlainData'>SecurePlainData</a>;
<a href='/constructor/securePlainEmail'>securePlainEmail</a>#21ec5a5f email:<a href='/type/string'>string</a> = <a href='/type/SecurePlainData'>SecurePlainData</a>;
<a href='/constructor/secureFile'>secureFile</a>#e0277a62 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> size:<a href='/type/int'>int</a> dc_id:<a href='/type/int'>int</a> date:<a href='/type/int'>int</a> file_hash:<a href='/type/bytes'>bytes</a> secret:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureFile'>SecureFile</a>;
<a href='/constructor/secureValueTypePersonalDetails'>secureValueTypePersonalDetails</a>#9d2a81e3 = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypePassport'>secureValueTypePassport</a>#3dac6a00 = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypeDriverLicense'>secureValueTypeDriverLicense</a>#6e425c4 = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypeIdentityCard'>secureValueTypeIdentityCard</a>#a0d0744b = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypeInternalPassport'>secureValueTypeInternalPassport</a>#99a48f23 = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypeAddress'>secureValueTypeAddress</a>#cbe31e26 = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypeUtilityBill'>secureValueTypeUtilityBill</a>#fc36954e = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypeBankStatement'>secureValueTypeBankStatement</a>#89137c0d = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypeRentalAgreement'>secureValueTypeRentalAgreement</a>#8b883488 = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypePassportRegistration'>secureValueTypePassportRegistration</a>#99e3806a = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypeTemporaryRegistration'>secureValueTypeTemporaryRegistration</a>#ea02ec33 = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypePhone'>secureValueTypePhone</a>#b320aadb = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValueTypeEmail'>secureValueTypeEmail</a>#8e3ca7ee = <a href='/type/SecureValueType'>SecureValueType</a>;
<a href='/constructor/secureValue'>secureValue</a>#187fa0ca flags:<a href='/type/%23'>#</a> type:<a href='/type/SecureValueType'>SecureValueType</a> data:flags.0?<a href='/type/SecureData'>SecureData</a> front_side:flags.1?<a href='/type/SecureFile'>SecureFile</a> reverse_side:flags.2?<a href='/type/SecureFile'>SecureFile</a> selfie:flags.3?<a href='/type/SecureFile'>SecureFile</a> translation:flags.6?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureFile'>SecureFile</a>&gt; files:flags.4?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureFile'>SecureFile</a>&gt; plain_data:flags.5?<a href='/type/SecurePlainData'>SecurePlainData</a> hash:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureValue'>SecureValue</a>;
<a href='/constructor/secureCredentialsEncrypted'>secureCredentialsEncrypted</a>#33f0ea47 data:<a href='/type/bytes'>bytes</a> hash:<a href='/type/bytes'>bytes</a> secret:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureCredentialsEncrypted'>SecureCredentialsEncrypted</a>;
<a href='/constructor/messageActionSecureValuesSentMe'>messageActionSecureValuesSentMe</a>#1b287353 values:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureValue'>SecureValue</a>&gt; credentials:<a href='/type/SecureCredentialsEncrypted'>SecureCredentialsEncrypted</a> = <a href='/type/MessageAction'>MessageAction</a>;
<a href='/constructor/messageService'>messageService</a>#2b085862 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> action:<a href='/type/MessageAction'>MessageAction</a> ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/updateNewMessage'>updateNewMessage</a>#1f2b0afd message:<a href='/type/Message'>Message</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;</code></pre>
<p>When the user confirms your request by pressing the "Authorize" button, the MTProto API sends an <a href="/constructor/updateNewMessage">updateNewMessage</a> from the user, with a <a href="/constructor/messageService">messageService</a> constructor, containing a <a href="/constructor/messageActionSecureValuesSentMe">messageActionSecureValuesSentMe</a> constructor that contains the encrypted Telegram Passport data.</p>
<h4><a class="anchor" href="#decrypting-data" id="decrypting-data" name="decrypting-data"><i class="anchor-icon"></i></a>Decrypting data</h4>
<pre><code><a href='/constructor/secureCredentialsEncrypted'>secureCredentialsEncrypted</a>#33f0ea47 data:<a href='/type/bytes'>bytes</a> hash:<a href='/type/bytes'>bytes</a> secret:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureCredentialsEncrypted'>SecureCredentialsEncrypted</a>;
<a href='/constructor/messageActionSecureValuesSentMe'>messageActionSecureValuesSentMe</a>#1b287353 values:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureValue'>SecureValue</a>&gt; credentials:<a href='/type/SecureCredentialsEncrypted'>SecureCredentialsEncrypted</a> = <a href='/type/MessageAction'>MessageAction</a>; </code></pre>
<p>To decrypt the received data, first, decrypt the credentials contained in <a href="/constructor/secureCredentialsEncrypted">secureCredentialsEncrypted</a>.</p>
<ol>
<li>
<p>Decrypt the credentials secret ( <em>secret</em> field in <a href="/constructor/secureCredentialsEncrypted">secureCredentialsEncrypted</a>) using your <strong>private</strong> key (set OAEP padding option, e.g. <code>OPENSSL_PKCS1_OAEP_PADDING</code> in PHP)</p>
</li>
<li>
<p>Use this secret and the credentials hash ( <em>hash</em> field in <a href="/constructor/secureCredentialsEncrypted">secureCredentialsEncrypted</a>) to calculate <em>credentials_key</em> and <em>credentials_iv</em> as described below:</p>
<pre><code> credentials_secret_hash = SHA512( credentials_secret + credentials_hash )
credentials_key = slice( credentials_secret_hash, 0, 32 )
credentials_iv = slice( credentials_secret_hash, 32, 16 )</code></pre>
</li>
<li>
<p>Decrypt the credentials data ( <em>data</em> field in <a href="/constructor/secureCredentialsEncrypted">secureCredentialsEncrypted</a>) by AES256-CBC using these <em>credentials_key</em> and <em>credentials_iv</em>. <strong>IMPORTANT:</strong> At this step, make sure that the credentials hash is equal to <code>SHA256( credentials_data )</code></p>
</li>
<li>
<p>Credentials data is padded with 32 to 255 random padding bytes to make its length divisible by 16 bytes. The first byte contains the length of this padding (including this byte). Remove the padding to get the data.</p>
</li>
</ol>
<blockquote>
<p>Note that all hashes are raw binary data, not hexits</p>
</blockquote>
<h4><a class="anchor" href="#credentials" id="credentials" name="credentials"><i class="anchor-icon"></i></a>Credentials</h4>
<p>The credentials are a JSON-serialized object, structured exactly as in the <a href="/passport#credentials">bot API »</a>.
Since decryption credentials are E2E encrypted, apps have to store the decryption credentials as JSON and not TL payloads.</p>
<p>The credentials are used as described in the <a href="/passport#credentials">Passport Manual</a> to decrypt the files attached to the <a href="/constructor/secureValue">secureValue</a>.
In this case, the container for the E2E encrypted data is in TL, while the encrypted data itself is in JSON.</p>
<h5><a class="anchor" href="#securevalue" id="securevalue" name="securevalue"><i class="anchor-icon"></i></a><a href="/constructor/secureValue">secureValue</a></h5>
<pre><code><a href='/constructor/secureValue'>secureValue</a>#187fa0ca flags:<a href='/type/%23'>#</a> type:<a href='/type/SecureValueType'>SecureValueType</a> data:flags.0?<a href='/type/SecureData'>SecureData</a> front_side:flags.1?<a href='/type/SecureFile'>SecureFile</a> reverse_side:flags.2?<a href='/type/SecureFile'>SecureFile</a> selfie:flags.3?<a href='/type/SecureFile'>SecureFile</a> translation:flags.6?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureFile'>SecureFile</a>&gt; files:flags.4?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureFile'>SecureFile</a>&gt; plain_data:flags.5?<a href='/type/SecurePlainData'>SecurePlainData</a> hash:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureValue'>SecureValue</a>;
<a href='/constructor/messageActionSecureValuesSentMe'>messageActionSecureValuesSentMe</a>#1b287353 values:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureValue'>SecureValue</a>&gt; credentials:<a href='/type/SecureCredentialsEncrypted'>SecureCredentialsEncrypted</a> = <a href='/type/MessageAction'>MessageAction</a>; </code></pre>
<p>The schema for the <a href="/constructor/inputSecureValue">secureValue</a> constructor defines the constructor that can be found in each field.</p>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>type</strong></td>
<td><a href="/type/SecureValueType">SecureValueType</a></td>
<td>Secure <a href="/passport">passport</a> value type</td>
</tr>
<tr>
<td><strong>data</strong></td>
<td><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/type/SecureData">SecureData</a></td>
<td>Encrypted <a href="/passport">Telegram Passport</a> element data</td>
</tr>
<tr>
<td><strong>front_side</strong></td>
<td><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.1?<a href="/type/SecureFile">SecureFile</a></td>
<td>Encrypted <a href="/passport">passport</a> file with the front side of the document</td>
</tr>
<tr>
<td><strong>reverse_side</strong></td>
<td><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.2?<a href="/type/SecureFile">SecureFile</a></td>
<td>Encrypted <a href="/passport">passport</a> file with the reverse side of the document</td>
</tr>
<tr>
<td><strong>selfie</strong></td>
<td><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.3?<a href="/type/SecureFile">SecureFile</a></td>
<td>Encrypted <a href="/passport">passport</a> file with a selfie of the user holding the document</td>
</tr>
<tr>
<td><strong>translation</strong></td>
<td><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.6?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/SecureFile">SecureFile</a>&gt;</td>
<td>Array of encrypted <a href="/passport">passport</a> files with translated versions of the provided documents</td>
</tr>
<tr>
<td><strong>files</strong></td>
<td><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.4?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/SecureFile">SecureFile</a>&gt;</td>
<td>Array of encrypted <a href="/passport">passport</a> files with photos the of the documents</td>
</tr>
<tr>
<td><strong>plain_data</strong></td>
<td><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.5?<a href="/type/SecurePlainData">SecurePlainData</a></td>
<td>Plaintext verified <a href="/passport">passport</a> data</td>
</tr>
<tr>
<td><strong>hash</strong></td>
<td><a href="/type/bytes">bytes</a></td>
<td>Data hash</td>
</tr>
</tbody>
</table>
<p>Here's a list of possible <a href="/type/SecureValueType">SecureValueTypes</a>, and the parameters that can be set/requested when using each type.</p>
<table class="table">
<thead>
<tr>
<th>Type</th>
<th>Allowed fields</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="/constructor/secureValueTypeEmail">secureValueTypeEmail</a></td>
<td><code>plain_data</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeEmail">secureValueTypePhone</a></td>
<td><code>plain_data</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypePersonalDetails">secureValueTypePersonalDetails</a></td>
<td><code>data</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypePassport">secureValueTypePassport</a></td>
<td><code>data</code>, <code>front_side</code>, <code>selfie</code>, <code>translation</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeDriverLicense">secureValueTypeDriverLicense</a></td>
<td><code>data</code>, <code>front_side</code>, <code>reverse_side</code>, <code>selfie</code>, <code>translation</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeIdentityCard">secureValueTypeIdentityCard</a></td>
<td><code>data</code>, <code>front_side</code>, <code>reverse_side</code>, <code>selfie</code>, <code>translation</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeInternalPassport">secureValueTypeInternalPassport</a></td>
<td><code>data</code>, <code>front_side</code>, <code>selfie</code>, <code>translation</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeAddress">secureValueTypeAddress</a></td>
<td><code>data</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeUtilityBill">secureValueTypeUtilityBill</a></td>
<td><code>files</code>, <code>translation</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeBankStatement">secureValueTypeBankStatement</a></td>
<td><code>files</code>, <code>translation</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeRentalAgreement">secureValueTypeRentalAgreement</a></td>
<td><code>files</code>, <code>translation</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypePassportRegistration">secureValueTypePassportRegistration</a></td>
<td><code>files</code>, <code>translation</code></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeTemporaryRegistration">secureValueTypeTemporaryRegistration</a></td>
<td><code>files</code>, <code>translation</code></td>
</tr>
</tbody>
</table>
<h5><a class="anchor" href="#securedata" id="securedata" name="securedata"><i class="anchor-icon"></i></a><a href="/type/SecureData">SecureData</a></h5>
<pre><code><a href='/constructor/secureData'>secureData</a>#8aeabec3 data:<a href='/type/bytes'>bytes</a> data_hash:<a href='/type/bytes'>bytes</a> secret:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureData'>SecureData</a>;</code></pre>
<p>Data is an encrypted and padded JSON-serialized object of one of the specified JSON types, depending on the chosen <a href="/type/SecureValueType">type</a>.</p>
<table class="table">
<thead>
<tr>
<th>Chosen type</th>
<th>JSON object</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="/constructor/secureValueTypePersonalDetails">secureValueTypePersonalDetails</a></td>
<td><a href="/passport#personaldetails">PersonalDetails</a></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypePassport">secureValueTypePassport</a></td>
<td><a href="/passport#iddocumentdata">IdDocumentData</a></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeDriverLicense">secureValueTypeDriverLicense</a></td>
<td><a href="/passport#iddocumentdata">IdDocumentData</a></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeIdentityCard">secureValueTypeIdentityCard</a></td>
<td><a href="/passport#iddocumentdata">IdDocumentData</a></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeInternalPassport">secureValueTypeInternalPassport</a></td>
<td><a href="/passport#iddocumentdata">IdDocumentData</a></td>
</tr>
<tr>
<td><a href="/constructor/secureValueTypeAddress">secureValueTypeAddress</a></td>
<td><a href="/passport#residentialaddress">ResidentialAddress</a></td>
</tr>
</tbody>
</table>
<p><a href="/passport#datacredentials">DataCredentials</a> extracted <a href="#credentials">from the credentials</a> can then be used to decrypt encrypted data from the <em>data</em> field in <a href="/constructor/secureData">secureData</a>.
For more info on how to decrypt the <em>data</em> field, see the <a href="/passport#datacredentials">passport manual</a>.</p>
<h5><a class="anchor" href="#securefile" id="securefile" name="securefile"><i class="anchor-icon"></i></a><a href="/type/SecureFile">SecureFile</a></h5>
<pre><code><a href='/constructor/secureFile'>secureFile</a>#e0277a62 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> size:<a href='/type/int'>int</a> dc_id:<a href='/type/int'>int</a> date:<a href='/type/int'>int</a> file_hash:<a href='/type/bytes'>bytes</a> secret:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureFile'>SecureFile</a>;
<a href='/constructor/inputSecureFileLocation'>inputSecureFileLocation</a>#cbc7ee28 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputFileLocation'>InputFileLocation</a>;
---functions---
<a href='/method/upload.getFile'>upload.getFile</a>#b15a9afc flags:<a href='/type/%23'>#</a> precise:flags.0?<a href='/constructor/true'>true</a> cdn_supported:flags.1?<a href='/constructor/true'>true</a> location:<a href='/type/InputFileLocation'>InputFileLocation</a> offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/upload.File'>upload.File</a>;</code></pre>
<p>Files (JPG format when decrypted, max. 10 MB) are downloaded chunk by chunk as described in <a href="/api/files">files »</a>, except that instead of generating an <a href="/constructor/inputFile">inputFileLocation</a>, an <a href="/constructor/inputFileLocation">inputFileLocation</a> should be generated, instead.</p>
<ul>
<li>The <code>id</code> field is the <code>id</code> of the <a href="/constructor/secureFile">secureFile</a></li>
<li>The <code>access_hash</code> field is the <code>access_hash</code> of the <a href="/constructor/secureFile">secureFile</a></li>
</ul>
<p><a href="/passport#filecredentials">FileCredentials</a> extracted <a href="#credentials">from the credentials</a> can then be used to decrypt downloaded encrypted data.
For more info on how to decrypt passport files, see the <a href="/passport#filecredentials">passport manual</a>.</p>
<h5><a class="anchor" href="#secureplaindata" id="secureplaindata" name="secureplaindata"><i class="anchor-icon"></i></a><a href="/type/SecurePlainData">SecurePlainData</a></h5>
<pre><code><a href='/constructor/securePlainPhone'>securePlainPhone</a>#7d6099dd phone:<a href='/type/string'>string</a> = <a href='/type/SecurePlainData'>SecurePlainData</a>;
<a href='/constructor/securePlainEmail'>securePlainEmail</a>#21ec5a5f email:<a href='/type/string'>string</a> = <a href='/type/SecurePlainData'>SecurePlainData</a>;</code></pre>
<p>The email/phone is passed in plaintext using the respective <a href="/type/SecurePlainData">SecurePlainData</a> constructor.
Emails and phone numbers sent using telegram passport are <em>already verified</em> as described in the <a href="/passport/encryption#secureplaindata">passport manual</a>.</p>
<h4><a class="anchor" href="#fixing-errors" id="fixing-errors" name="fixing-errors"><i class="anchor-icon"></i></a>Fixing errors</h4>
<pre><code><a href='/constructor/secureValueErrorData'>secureValueErrorData</a>#e8a40bd9 type:<a href='/type/SecureValueType'>SecureValueType</a> data_hash:<a href='/type/bytes'>bytes</a> field:<a href='/type/string'>string</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorFrontSide'>secureValueErrorFrontSide</a>#be3dfa type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorReverseSide'>secureValueErrorReverseSide</a>#868a2aa5 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorSelfie'>secureValueErrorSelfie</a>#e537ced6 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorFile'>secureValueErrorFile</a>#7a700873 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorFiles'>secureValueErrorFiles</a>#666220e9 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/bytes'>bytes</a>&gt; text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueError'>secureValueError</a>#869d758f type:<a href='/type/SecureValueType'>SecureValueType</a> hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorTranslationFile'>secureValueErrorTranslationFile</a>#a1144770 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorTranslationFiles'>secureValueErrorTranslationFiles</a>#34636dd8 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/bytes'>bytes</a>&gt; text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/inputUser'>inputUser</a>#f21158c6 user_id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputUser'>InputUser</a>;
---functions---
<a href='/method/users.setSecureValueErrors'>users.setSecureValueErrors</a>#90c894b5 id:<a href='/type/InputUser'>InputUser</a> errors:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureValueError'>SecureValueError</a>&gt; = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>If the data you received contains errors, the bot can use the <a href="/method/users.setSecureValueErrors">users.setSecureValueErrors</a> method to inform the user and <a href="#requesting-information">request information</a> again. The user will not be able to resend the data, until all errors are fixed.</p>
<p>Descriptions of the method parameters can be found in the method's <a href="/method/users.setSecureValueErrors">documentation page »</a>.</p>
<h3><a class="anchor" href="#as-a-user" id="as-a-user" name="as-a-user"><i class="anchor-icon"></i></a>As a user</h3>
<h4><a class="anchor" href="#receiving-requests" id="receiving-requests" name="receiving-requests"><i class="anchor-icon"></i></a>Receiving requests</h4>
<p>The process starts when your app receives an event from one of the <a href="/passport#sdk">SDKs</a>, or from a custom source.</p>
<h4><a class="anchor" href="#uri-format" id="uri-format" name="uri-format"><i class="anchor-icon"></i></a>URI format</h4>
<p>The SDKs trigger a passport authorization request by opening the following Telegram-specific URI:</p>
<pre><code>tg://resolve?params</code></pre>
<p>With the following query string parameters:</p>
<table class="table">
<tbody>
<tr>
<td><strong>Parameters</strong></td>
<td><strong>Type</strong></td>
<td><strong>Required</strong></td>
</tr>
<tr>
<td>domain</td>
<td>String</td>
<td>Yes</td>
</tr>
<tr>
<td>bot_id</td>
<td>Integer</td>
<td>Yes</td>
</tr>
<tr>
<td>scope</td>
<td><a href="#uripassportscope">UriPassportScope</a></td>
<td>Yes</td>
</tr>
<tr>
<td>public_key</td>
<td>String</td>
<td>Yes</td>
</tr>
<tr>
<td>nonce</td>
<td>String</td>
<td>Yes</td>
</tr>
<tr>
<td>callback_url</td>
<td>String</td>
<td>Optional</td>
</tr>
<tr>
<td>payload</td>
<td>String</td>
<td>Optional</td>
</tr>
</tbody>
</table>
<p>Example URI, generated by the <a href="/passport/example">Telegram Passport Example page</a>:</p>
<pre><code>tg://resolve?domain=telegrampassport&amp;bot_id=543260180&amp;scope=%7B%22v%22%3A1%2C%22d%22%3A%5B%7B%22_%22%3A%22pd%22%2C%22n%22%3A1%7D%2C%22ad%22%2C%22pn%22%2C%22em%22%2C%7B%22_%22%3A%5B%7B%22_%22%3A%22pp%22%2C%22s%22%3A1%2C%22t%22%3A1%7D%2C%22ip%22%2C%22dl%22%2C%22ic%22%5D%7D%2C%7B%22_%22%3A%5B%22ub%22%2C%22bs%22%2C%22ra%22%2C%22pr%22%2C%22tr%22%5D%7D%5D%7D&amp;public_key=-----BEGIN%20PUBLIC%20KEY-----%0AMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv6m1zBF8lZOCqcxf8hnj%0AkvHwuWdU8s4rBWaxKXH%2FvDDUklcCS5uhSnmjhxWca9suubaG3lW4HxlCilkeJPVf%0Ajimg5Q8ZqWrR3OoOihEpcG9iJZTOEpsEk7VtEiabgacBG3Quv9JslTrDe95Fn801%0At9d21HXwgMrHeHpWDOn31Dr%2BwoEH%2BkwySUWa6L%2FZbnGwSNP7eeDTE7Amz1RMDk3t%0A8EWGq58u0IQatPcEH09aUQlKzk6MIiALkZ9ILBKCBk6d2WCokKnsdBctovNbxwSx%0AhP1qst1r%2BYc8iPBZozsDC0ZsC5jXCkcODI3OC0tkNtYzN2XKalW5R0DjDRUDmGhT%0AzQIDAQAB%0A-----END%20PUBLIC%20KEY-----%0A&amp;nonce=b8e892dc2e0afe63424d101b964f1256_32858210_708614a4585b84872e&amp;callback_url=https%3A%2F%2Fcore.telegram.org%2Fpassport%2Fexample%3Fpassport_ssid%3Db8e892dc2e0afe63424d101b964f1256_32858210_db259b427f200751ce&amp;payload=b8e892dc2e0afe63424d101b964f1256_32858210_708614a4585b84872e</code></pre>
<h4><a class="anchor" href="#uripassportscope" id="uripassportscope" name="uripassportscope"><i class="anchor-icon"></i></a>UriPassportScope</h4>
<p>This object represents the data to be requested.</p>
<table class="table">
<tbody>
<tr>
<td><strong>Field</strong></td>
<td><strong>Type</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td>d</td>
<td>Array of <a href="#uripassportscopeelement">UriPassportScopeElement</a></td>
<td>List of requested elements, each type may be used only once in the entire array of UriPassportScopeElement objects</td>
</tr>
<tr>
<td>v</td>
<td>Integer</td>
<td>Scope version, must be <em>1</em></td>
</tr>
</tbody>
</table>
<h5><a class="anchor" href="#uripassportscopeelement" id="uripassportscopeelement" name="uripassportscopeelement"><i class="anchor-icon"></i></a>UriPassportScopeElement</h5>
<p>This object represents a requested element, should be one of:</p>
<ul>
<li><a href="#uripassportscopeelementoneofseveral">UriPassportScopeElementOneOfSeveral</a> - use to request any one of the documents included in the scope.</li>
<li><a href="#uripassportscopeelementone">UriPassportScopeElementOne</a> use to request one particular document.</li>
</ul>
<p>Passport document type identifiers are aliased with the following reduced type identifiers:</p>
<table class="table">
<thead>
<tr>
<th><strong>Full</strong></th>
<th><strong>Alias</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>personal_details</code></td>
<td><code>pd</code></td>
</tr>
<tr>
<td><code>passport</code></td>
<td><code>pp</code></td>
</tr>
<tr>
<td><code>driver_license</code></td>
<td><code>dl</code></td>
</tr>
<tr>
<td><code>identity_card</code></td>
<td><code>ic</code></td>
</tr>
<tr>
<td><code>internal_passport</code></td>
<td><code>ip</code></td>
</tr>
<tr>
<td><code>id_document</code></td>
<td><code>idd</code></td>
</tr>
<tr>
<td><code>address</code></td>
<td><code>ad</code></td>
</tr>
<tr>
<td><code>utility_bill</code></td>
<td><code>ub</code></td>
</tr>
<tr>
<td><code>bank_statement</code></td>
<td><code>bs</code></td>
</tr>
<tr>
<td><code>rental_agreement</code></td>
<td><code>ra</code></td>
</tr>
<tr>
<td><code>passport_registration</code></td>
<td><code>pr</code></td>
</tr>
<tr>
<td><code>temporary_registration</code></td>
<td><code>tr</code></td>
</tr>
<tr>
<td><code>address_document</code></td>
<td><code>add</code></td>
</tr>
<tr>
<td><code>phone_number</code></td>
<td><code>pn</code></td>
</tr>
<tr>
<td><code>email</code></td>
<td><code>em</code></td>
</tr>
</tbody>
</table>
<p>You can use the special type "idd" as an alias for one of "pp", "dl", "ic" and the special type "add" as an alias for one of "ub", "bs", "ra". </p>
<h4><a class="anchor" href="#uripassportscopeelementoneofseveral" id="uripassportscopeelementoneofseveral" name="uripassportscopeelementoneofseveral"><i class="anchor-icon"></i></a>UriPassportScopeElementOneOfSeveral</h4>
<p>This object represents several elements one of which must be provided.</p>
<table class="table">
<tbody>
<tr>
<td><strong>Field</strong></td>
<td><strong>Type</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td>_</td>
<td>Array of <a href="#uripassportscopeelementone">UriPassportScopeElementOne</a></td>
<td>List of elements one of which must be provided; must contain either several of “pp”, “dl”, “ic”, “ip” <strong>or</strong> several of “ub”, “bs”, “ra”, “pr”, “tr”</td>
</tr>
<tr>
<td>s</td>
<td>Boolean</td>
<td><em>Optional.</em> Use this parameter if you want to request a selfie with the document from this list that the user chooses to upload.</td>
</tr>
<tr>
<td>t</td>
<td>Boolean</td>
<td><em>Optional.</em> Use this parameter if you want to request a translation of the document from this list that the user chooses to upload. <strong>Note:</strong> We suggest to only request translations <em>after</em> you have received a valid document that requires one.</td>
</tr>
</tbody>
</table>
<h4><a class="anchor" href="#uripassportscopeelementone" id="uripassportscopeelementone" name="uripassportscopeelementone"><i class="anchor-icon"></i></a>UriPassportScopeElementOne</h4>
<p>This object represents one particular element that must be provided. If no options are needed, <em>String</em> can be used instead of this object to specify the type of the element.</p>
<table class="table">
<tbody>
<tr>
<td><strong>Field</strong></td>
<td><strong>Type</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td>_</td>
<td>String</td>
<td>Element type. One of "pd", "pp", "dl", "ic", "ip", "ad", "ub", "bs", "ra", "pr", "tr", "pn", "em"</td>
</tr>
<tr>
<td>s</td>
<td>Boolean</td>
<td><em>Optional.</em> Use this parameter if you want to request a selfie with the document as well. Available for "pp", "dl", "ic" and "ip"</td>
</tr>
<tr>
<td>t</td>
<td>Boolean</td>
<td><em>Optional.</em> Use this parameter if you want to request a translation of the document as well. Available for "pp", "dl", "ic", "ip", "ub", "bs", "ra", "pr" and "tr". <strong>Note:</strong> We suggest to only request translations <em>after</em> you have received a valid document that requires one.</td>
</tr>
<tr>
<td>n</td>
<td>Boolean</td>
<td><em>Optional.</em> Use this parameter to request the first, last and middle name of the user in the language of the user's country of residence. Available for "pd"</td>
</tr>
</tbody>
</table>
<p>You can also use the special type "idd" as an alias for one of "pp", "dl", "ic" and the special type "add" as an alias for one of "ub", "bs", "ra". </p>
<h4><a class="anchor" href="#setting-up-telegram-passport" id="setting-up-telegram-passport" name="setting-up-telegram-passport"><i class="anchor-icon"></i></a>Setting up Telegram Passport</h4>
<p>The next step for the client app is to request the user's 2FA passport, and configure Telegram Passport/fetch and decrypt remotely saved Telegram Passport parameters as described in the <a href="/passport/encryption">Encryption article »</a>.</p>
<h4><a class="anchor" href="#fetching-the-passport-form" id="fetching-the-passport-form" name="fetching-the-passport-form"><i class="anchor-icon"></i></a>Fetching the passport form</h4>
<pre><code><a href='/constructor/account.authorizationForm'>account.authorizationForm</a>#ad2e1cd8 flags:<a href='/type/%23'>#</a> required_types:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureRequiredType'>SecureRequiredType</a>&gt; values:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureValue'>SecureValue</a>&gt; errors:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureValueError'>SecureValueError</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; privacy_policy_url:flags.0?<a href='/type/string'>string</a> = <a href='/type/account.AuthorizationForm'>account.AuthorizationForm</a>;
---functions---
<a href='/method/account.getAuthorizationForm'>account.getAuthorizationForm</a>#a929597a bot_id:<a href='/type/long'>long</a> scope:<a href='/type/string'>string</a> public_key:<a href='/type/string'>string</a> = <a href='/type/account.AuthorizationForm'>account.AuthorizationForm</a>;</code></pre>
<p>Then, the client app passes the bot ID, scope and public key from the <a href="#receiving-requests">passport authorization request</a> to the Telegram servers using the <a href="/method/account.getAuthorizationForm">account.getAuthorizationForm</a> method.</p>
<p>The response will be an <a href="/constructor/account.authorizationForm">account.authorizationForm</a> constructor, with info about the required document types, the URL of the service's privacy policy, as well as info about the bot to which the form should be sent.
If the form was already submitted at least once, the constructor will also contain a list of already submitted data, along with eventual errors. </p>
<p>The user should accept the privacy policy and proceed to fill in the required data, and the client should encrypt and upload it as described in the <a href="/passport/encryption">Encryption article »</a>.</p>
<h4><a class="anchor" href="#submitting-the-passport-form" id="submitting-the-passport-form" name="submitting-the-passport-form"><i class="anchor-icon"></i></a>Submitting the passport form</h4>
<pre><code><a href='/constructor/secureCredentialsEncrypted'>secureCredentialsEncrypted</a>#33f0ea47 data:<a href='/type/bytes'>bytes</a> hash:<a href='/type/bytes'>bytes</a> secret:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureCredentialsEncrypted'>SecureCredentialsEncrypted</a>;
<a href='/constructor/secureValueHash'>secureValueHash</a>#ed1ecdb0 type:<a href='/type/SecureValueType'>SecureValueType</a> hash:<a href='/type/bytes'>bytes</a> = <a href='/type/SecureValueHash'>SecureValueHash</a>;
---functions---
<a href='/method/account.acceptAuthorization'>account.acceptAuthorization</a>#f3ed4c73 bot_id:<a href='/type/long'>long</a> scope:<a href='/type/string'>string</a> public_key:<a href='/type/string'>string</a> value_hashes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureValueHash'>SecureValueHash</a>&gt; credentials:<a href='/type/SecureCredentialsEncrypted'>SecureCredentialsEncrypted</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Once the user finishes uploading the required documents and clicks on the submit button, the client calls <a href="/method/account.acceptAuthorization">account.acceptAuthorization</a>, submitting the documents to the bot associated to the service.</p>
<ul>
<li>As before, <code>bot_id</code>, <code>scope</code> and <code>public_key</code> are taken from the authorization request URI.</li>
<li><code>value_hashes</code> is used by the server to choose which document of which type to send to the bot: the <code>type</code> field should be set to the document type, and the <code>hash</code> field should be set to the <code>data_hash</code>/<code>file_hash</code> generated when <a href="/passport/encryption#encryption">uploading encrypting the data »</a>.</li>
<li><code>credentials</code> contains the encrypted credentials required by the service to decrypt the sent E2E encrypted secure values: it is generated as described in <a href="/passport/encryption#passport-credentials">Passport Credentials »</a>.</li>
</ul>
<p>Finally, the client opens the callback URL (if present).</p>
<h4><a class="anchor" href="#handling-invalid-forms" id="handling-invalid-forms" name="handling-invalid-forms"><i class="anchor-icon"></i></a>Handling invalid forms</h4>
<pre><code><a href='/constructor/secureValueErrorData'>secureValueErrorData</a>#e8a40bd9 type:<a href='/type/SecureValueType'>SecureValueType</a> data_hash:<a href='/type/bytes'>bytes</a> field:<a href='/type/string'>string</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorFrontSide'>secureValueErrorFrontSide</a>#be3dfa type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorReverseSide'>secureValueErrorReverseSide</a>#868a2aa5 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorSelfie'>secureValueErrorSelfie</a>#e537ced6 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorFile'>secureValueErrorFile</a>#7a700873 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorFiles'>secureValueErrorFiles</a>#666220e9 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/bytes'>bytes</a>&gt; text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueError'>secureValueError</a>#869d758f type:<a href='/type/SecureValueType'>SecureValueType</a> hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorTranslationFile'>secureValueErrorTranslationFile</a>#a1144770 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/bytes'>bytes</a> text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/secureValueErrorTranslationFiles'>secureValueErrorTranslationFiles</a>#34636dd8 type:<a href='/type/SecureValueType'>SecureValueType</a> file_hash:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/bytes'>bytes</a>&gt; text:<a href='/type/string'>string</a> = <a href='/type/SecureValueError'>SecureValueError</a>;
<a href='/constructor/account.authorizationForm'>account.authorizationForm</a>#ad2e1cd8 flags:<a href='/type/%23'>#</a> required_types:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureRequiredType'>SecureRequiredType</a>&gt; values:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureValue'>SecureValue</a>&gt; errors:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/SecureValueError'>SecureValueError</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; privacy_policy_url:flags.0?<a href='/type/string'>string</a> = <a href='/type/account.AuthorizationForm'>account.AuthorizationForm</a>;
---functions---
<a href='/method/account.getAuthorizationForm'>account.getAuthorizationForm</a>#a929597a bot_id:<a href='/type/long'>long</a> scope:<a href='/type/string'>string</a> public_key:<a href='/type/string'>string</a> = <a href='/type/account.AuthorizationForm'>account.AuthorizationForm</a>;</code></pre>
<p>If any of the values of the submitted form are rejected by the service, the bot <a href="/api/passport#fixing-errors">calls the appropriate method to set information about errors</a>.</p>
<p>The user can find out about these errors directly from the service, or, if they decide to <a href="#receiving-requests">restart the process</a> and resend the corrected data, directly from the authorization form (<code>errors</code> field).</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,125 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Pattern matching</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Some methods require the client to verify if the data obtained from an external source matches a certain pattern.">
<meta property="og:title" content="Pattern matching">
<meta property="og:image" content="1baa7ad499da786561">
<meta property="og:description" content="Some methods require the client to verify if the data obtained from an external source matches a certain pattern.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/pattern" >Pattern matching</a></li></ul></div>
<h1 id="dev_page_title">Pattern matching</h1>
<div id="dev_page_content"><p>Some methods require the client to verify if the data obtained from an external source matches a certain pattern.</p>
<p>For example, when <a href="/api/auth">requesting a login code</a>, if the chosen verification method is a <a href="/constructor/auth.sentCodeTypeFlashCall">flash call</a>, it is required that the phone number (which is the login code) matches the specified pattern.</p>
<p>Same with <a href="/constructor/account.sentEmailCode">email verification codes</a>.</p>
<p>In all cases, the pattern is a string of the same length as the string to verify: and matching is as simple as checking if all chars in the source string are the same as in the pattern string.
Some chars in the pattern string may be censored using an asterisk <code>*</code>, in this case any char in the source string is considered valid.</p>
<p>The pattern string can also be a single asterisk, in this case all patterns are considered valid.</p>
<p>If the source string is a phone number, it has to be sanitized first to include only the following chars: <code>0123456789</code>.</p>
<p>Example implementation: <a href="https://github.com/DrKLO/Telegram/blob/9ffc7787d6ed4386363fad001334ae411c2877d9/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java#L1341">telegram for android</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,369 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Payments API</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="You can accept payments from Telegram users via Telegram Bots.
Note: This article is intended for MTProto API developers.…">
<meta property="og:title" content="Payments API">
<meta property="og:image" content="">
<meta property="og:description" content="You can accept payments from Telegram users via Telegram Bots.
Note: This article is intended for MTProto API developers.…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/payments" >Payments API</a></li></ul></div>
<h1 id="dev_page_title">Payments API</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>You can accept payments from Telegram users via <a href="/bots">Telegram Bots</a>.</p>
<blockquote>
<p>Note: This article is intended for MTProto API developers. If you're looking for a general overview of Telegram Payments, check out the <a href="https://telegram.org/blog/payments">Telegram blog</a> and the <a href="/bots/payments">bot API payment manual</a>.</p>
</blockquote>
<h3><a class="anchor" href="#introducing-payments" id="introducing-payments" name="introducing-payments"><i class="anchor-icon"></i></a>Introducing Payments</h3>
<p>Telegram bots can accept payments for goods and services from users.
For more info on how payments work, check out the <a href="https://telegram.org/blog/payments">Telegram Blog</a> and the <a href="/bots/payments">bot API payment manual</a>.</p>
<p>This page will elaborate on the actions required to work with payments using the <strong>MTProto API</strong>.</p>
<blockquote>
<p>A simplified version of the process is available only for bots using the <a href="/bots/payments">bot API</a>.</p>
</blockquote>
<p>The first step for bots is <a href="/bots/payments#the-payments-api">enable payments as described here »</a>.</p>
<p>Then, we work with payments as follows.</p>
<h3><a class="anchor" href="#1-create-invoice" id="1-create-invoice" name="1-create-invoice"><i class="anchor-icon"></i></a>1. Create Invoice</h3>
<pre><code><a href='/constructor/inputWebDocument'>inputWebDocument</a>#9bed434d url:<a href='/type/string'>string</a> size:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; = <a href='/type/InputWebDocument'>InputWebDocument</a>;
<a href='/constructor/labeledPrice'>labeledPrice</a>#cb296bf8 label:<a href='/type/string'>string</a> amount:<a href='/type/long'>long</a> = <a href='/type/LabeledPrice'>LabeledPrice</a>;
<a href='/constructor/invoice'>invoice</a>#cd886e0 flags:<a href='/type/%23'>#</a> test:flags.0?<a href='/constructor/true'>true</a> name_requested:flags.1?<a href='/constructor/true'>true</a> phone_requested:flags.2?<a href='/constructor/true'>true</a> email_requested:flags.3?<a href='/constructor/true'>true</a> shipping_address_requested:flags.4?<a href='/constructor/true'>true</a> flexible:flags.5?<a href='/constructor/true'>true</a> phone_to_provider:flags.6?<a href='/constructor/true'>true</a> email_to_provider:flags.7?<a href='/constructor/true'>true</a> currency:<a href='/type/string'>string</a> prices:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/LabeledPrice'>LabeledPrice</a>&gt; max_tip_amount:flags.8?<a href='/type/long'>long</a> suggested_tip_amounts:flags.8?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; = <a href='/type/Invoice'>Invoice</a>;
<a href='/constructor/inputMediaInvoice'>inputMediaInvoice</a>#d9799874 flags:<a href='/type/%23'>#</a> title:<a href='/type/string'>string</a> description:<a href='/type/string'>string</a> photo:flags.0?<a href='/type/InputWebDocument'>InputWebDocument</a> invoice:<a href='/type/Invoice'>Invoice</a> payload:<a href='/type/bytes'>bytes</a> provider:<a href='/type/string'>string</a> provider_data:<a href='/type/DataJSON'>DataJSON</a> start_param:flags.1?<a href='/type/string'>string</a> = <a href='/type/InputMedia'>InputMedia</a>;
---functions---
<a href='/method/messages.sendMedia'>messages.sendMedia</a>#e25ff8e0 flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> media:<a href='/type/InputMedia'>InputMedia</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>The user contacts the bot and requests to purchase something.
The bot forms an <a href="/constructor/inputMediaInvoice">inputMediaInvoice</a> with an <a href="/constructor/invoice">invoice</a> constructor with a description of the goods or service, amount to be paid, as well as requested shipping info.
The <code>provider</code> parameter of the <a href="/constructor/inputMediaInvoice">inputMediaInvoice</a> constructor is where you put the token value that <a href="/bots/payments#the-payments-api">you've obtained earlier via Botfather</a>. It is possible for one merchant bot to use several different tokens for different users or different goods and services.</p>
<p>Use the <a href="/method/messages.sendMedia">messages.sendMedia</a> method to send the <a href="/constructor/invoice">invoice</a>.
You can also attach an inline keyboard to the message using the <code>reply_markup</code> field: if provided, the first button must be a <a href="/constructor/keyboardButtonBuy">keyboardButtonBuy</a> button. Otherwise, an inline keyboard will be generated automatically, with a <code>Pay 'total price'</code> <a href="/constructor/keyboardButtonBuy">keyboardButtonBuy</a> as only button.</p>
<p>An invoice message with a pay button can only be sent to a private chat with the user. Groups and channels are not supported.</p>
<h3><a class="anchor" href="#2-order-information" id="2-order-information" name="2-order-information"><i class="anchor-icon"></i></a>2. Order information</h3>
<h4><a class="anchor" href="#21-invoice-message" id="21-invoice-message" name="21-invoice-message"><i class="anchor-icon"></i></a>2.1 Invoice message</h4>
<pre><code><a href='/constructor/keyboardButtonBuy'>keyboardButtonBuy</a>#afd93fbb text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRow'>keyboardButtonRow</a>#77608b83 buttons:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/KeyboardButton'>KeyboardButton</a>&gt; = <a href='/type/KeyboardButtonRow'>KeyboardButtonRow</a>;
<a href='/constructor/replyInlineMarkup'>replyInlineMarkup</a>#48a30254 rows:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/KeyboardButtonRow'>KeyboardButtonRow</a>&gt; = <a href='/type/ReplyMarkup'>ReplyMarkup</a>;
<a href='/constructor/webDocument'>webDocument</a>#1c570ed1 url:<a href='/type/string'>string</a> access_hash:<a href='/type/long'>long</a> size:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; = <a href='/type/WebDocument'>WebDocument</a>;
<a href='/constructor/webDocumentNoProxy'>webDocumentNoProxy</a>#f9c8bcc6 url:<a href='/type/string'>string</a> size:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; = <a href='/type/WebDocument'>WebDocument</a>;
<a href='/constructor/messageMediaInvoice'>messageMediaInvoice</a>#84551347 flags:<a href='/type/%23'>#</a> shipping_address_requested:flags.1?<a href='/constructor/true'>true</a> test:flags.3?<a href='/constructor/true'>true</a> title:<a href='/type/string'>string</a> description:<a href='/type/string'>string</a> photo:flags.0?<a href='/type/WebDocument'>WebDocument</a> receipt_msg_id:flags.2?<a href='/type/int'>int</a> currency:<a href='/type/string'>string</a> total_amount:<a href='/type/long'>long</a> start_param:<a href='/type/string'>string</a> = <a href='/type/MessageMedia'>MessageMedia</a>;
<a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/updateNewMessage'>updateNewMessage</a>#1f2b0afd message:<a href='/type/Message'>Message</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;</code></pre>
<p>The user receives an <a href="/constructor/updateNewMessage">updateNewMessage</a> constructor from the bot, containing a <a href="/constructor/messageMediaInvoice">messageMediaInvoice</a> constructor with basic info about the product.</p>
<p>The <a href="/constructor/message">message</a> will also have a <a href="/constructor/replyInlineMarkup">replyInlineMarkup</a> keyboard attached to it.
The the first button of the keyboard will always be a <a href="/constructor/keyboardButtonBuy">keyboardButtonBuy</a> button.</p>
<h4><a class="anchor" href="#22-getting-invoice-info-about-the-product" id="22-getting-invoice-info-about-the-product" name="22-getting-invoice-info-about-the-product"><i class="anchor-icon"></i></a>2.2 Getting invoice info about the product</h4>
<pre><code><a href='/constructor/invoice'>invoice</a>#cd886e0 flags:<a href='/type/%23'>#</a> test:flags.0?<a href='/constructor/true'>true</a> name_requested:flags.1?<a href='/constructor/true'>true</a> phone_requested:flags.2?<a href='/constructor/true'>true</a> email_requested:flags.3?<a href='/constructor/true'>true</a> shipping_address_requested:flags.4?<a href='/constructor/true'>true</a> flexible:flags.5?<a href='/constructor/true'>true</a> phone_to_provider:flags.6?<a href='/constructor/true'>true</a> email_to_provider:flags.7?<a href='/constructor/true'>true</a> currency:<a href='/type/string'>string</a> prices:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/LabeledPrice'>LabeledPrice</a>&gt; max_tip_amount:flags.8?<a href='/type/long'>long</a> suggested_tip_amounts:flags.8?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; = <a href='/type/Invoice'>Invoice</a>;
<a href='/constructor/paymentRequestedInfo'>paymentRequestedInfo</a>#909c3f94 flags:<a href='/type/%23'>#</a> name:flags.0?<a href='/type/string'>string</a> phone:flags.1?<a href='/type/string'>string</a> email:flags.2?<a href='/type/string'>string</a> shipping_address:flags.3?<a href='/type/PostAddress'>PostAddress</a> = <a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a>;
<a href='/constructor/paymentSavedCredentialsCard'>paymentSavedCredentialsCard</a>#cdc27a1f id:<a href='/type/string'>string</a> title:<a href='/type/string'>string</a> = <a href='/type/PaymentSavedCredentials'>PaymentSavedCredentials</a>;
<a href='/constructor/payments.paymentForm'>payments.paymentForm</a>#1694761b flags:<a href='/type/%23'>#</a> can_save_credentials:flags.2?<a href='/constructor/true'>true</a> password_missing:flags.3?<a href='/constructor/true'>true</a> form_id:<a href='/type/long'>long</a> bot_id:<a href='/type/long'>long</a> invoice:<a href='/type/Invoice'>Invoice</a> provider_id:<a href='/type/long'>long</a> url:<a href='/type/string'>string</a> native_provider:flags.4?<a href='/type/string'>string</a> native_params:flags.4?<a href='/type/DataJSON'>DataJSON</a> saved_info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> saved_credentials:flags.1?<a href='/type/PaymentSavedCredentials'>PaymentSavedCredentials</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/payments.PaymentForm'>payments.PaymentForm</a>;
---functions---
<a href='/method/payments.getPaymentForm'>payments.getPaymentForm</a>#8a333c8d flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> msg_id:<a href='/type/int'>int</a> theme_params:flags.0?<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/payments.PaymentForm'>payments.PaymentForm</a>;</code></pre>
<p>If the user clicks on the <a href="/constructor/keyboardButtonBuy">keyboardButtonBuy</a> button, the client proceeds to call <a href="/method/payments.getPaymentForm">payments.getPaymentForm</a> with the message ID of the invoice preview message to get the <a href="/constructor/payments.paymentForm">payment form</a>.</p>
<p>The returned form will contain fields that should be passed to the payment provider along with the full <a href="/constructor/invoice">invoice</a>.
The payment form also contains info about previously saved payment credentials and order information (name, phone number, email, shipping address &amp; so on).</p>
<p>The full <a href="/constructor/invoice">invoice</a> contains info about the information required for the order, the price and the currency, and whether this is a <code>test</code> order.</p>
<h4><a class="anchor" href="#23-verifying-information" id="23-verifying-information" name="23-verifying-information"><i class="anchor-icon"></i></a>2.3 Verifying information</h4>
<pre><code><a href='/constructor/invoice'>invoice</a>#cd886e0 flags:<a href='/type/%23'>#</a> test:flags.0?<a href='/constructor/true'>true</a> name_requested:flags.1?<a href='/constructor/true'>true</a> phone_requested:flags.2?<a href='/constructor/true'>true</a> email_requested:flags.3?<a href='/constructor/true'>true</a> shipping_address_requested:flags.4?<a href='/constructor/true'>true</a> flexible:flags.5?<a href='/constructor/true'>true</a> phone_to_provider:flags.6?<a href='/constructor/true'>true</a> email_to_provider:flags.7?<a href='/constructor/true'>true</a> currency:<a href='/type/string'>string</a> prices:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/LabeledPrice'>LabeledPrice</a>&gt; max_tip_amount:flags.8?<a href='/type/long'>long</a> suggested_tip_amounts:flags.8?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; = <a href='/type/Invoice'>Invoice</a>;
<a href='/constructor/postAddress'>postAddress</a>#1e8caaeb street_line1:<a href='/type/string'>string</a> street_line2:<a href='/type/string'>string</a> city:<a href='/type/string'>string</a> state:<a href='/type/string'>string</a> country_iso2:<a href='/type/string'>string</a> post_code:<a href='/type/string'>string</a> = <a href='/type/PostAddress'>PostAddress</a>;
<a href='/constructor/paymentRequestedInfo'>paymentRequestedInfo</a>#909c3f94 flags:<a href='/type/%23'>#</a> name:flags.0?<a href='/type/string'>string</a> phone:flags.1?<a href='/type/string'>string</a> email:flags.2?<a href='/type/string'>string</a> shipping_address:flags.3?<a href='/type/PostAddress'>PostAddress</a> = <a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a>;
<a href='/constructor/payments.validatedRequestedInfo'>payments.validatedRequestedInfo</a>#d1451883 flags:<a href='/type/%23'>#</a> id:flags.0?<a href='/type/string'>string</a> shipping_options:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ShippingOption'>ShippingOption</a>&gt; = <a href='/type/payments.ValidatedRequestedInfo'>payments.ValidatedRequestedInfo</a>;
---functions---
<a href='/method/payments.validateRequestedInfo'>payments.validateRequestedInfo</a>#db103170 flags:<a href='/type/%23'>#</a> save:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> msg_id:<a href='/type/int'>int</a> info:<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> = <a href='/type/payments.ValidatedRequestedInfo'>payments.ValidatedRequestedInfo</a>;</code></pre>
<p>If any data at all is requested by the <a href="/constructor/invoice"><strong>invoice</strong></a> (<code>name_requested</code>, <code>phone_requested</code>, <code>email_requested</code>, <code>shipping_address_requested</code>), the user must call <a href="/method/payments.validateRequestedInfo">payments.validateRequestedInfo</a>, providing the required data (as usual, <code>msg_id</code> is the ID of the invoice message).
The user can choose to save order information for future use by setting the <code>save</code> flag.
Data can be autofilled as described in <a href="#2-3-1-autofill">autofill</a>.</p>
<p>If no errors are found in the submitted info, the <a href="/constructor/payments.ValidatedRequestedInfo">response</a> of the method will contain an <code>id</code> flag, to be used later to complete the payment.</p>
<p>If the <code>flexible</code> flag of the invoice is set, calling the <a href="/method/payments.validateRequestedInfo">payments.validateRequestedInfo</a> method will send a <a href="/constructor/updateBotShippingQuery">shipping query update</a> to the bot, to which the bot will reply with the available shipping options for the specified address <a href="#2-4-select-delivery-option">as described here »</a>.
The return value in this case will also contain a <code>shipping_options</code> field with the available shipping options.</p>
<p>If any errors are found in the submitted data, a <a href="/constructor/updateServiceNotification">service notification</a> will be sent to the user, with a description of the error from the bot.</p>
<h4><a class="anchor" href="#231-autofill" id="231-autofill" name="231-autofill"><i class="anchor-icon"></i></a>2.3.1 Autofill</h4>
<pre><code><a href='/constructor/payments.savedInfo'>payments.savedInfo</a>#fb8fe43c flags:<a href='/type/%23'>#</a> has_saved_credentials:flags.1?<a href='/constructor/true'>true</a> saved_info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> = <a href='/type/payments.SavedInfo'>payments.SavedInfo</a>;
---functions---
<a href='/method/payments.getSavedInfo'>payments.getSavedInfo</a>#227d824b = <a href='/type/payments.SavedInfo'>payments.SavedInfo</a>;
<a href='/method/payments.clearSavedInfo'>payments.clearSavedInfo</a>#d83d70c1 flags:<a href='/type/%23'>#</a> credentials:flags.0?<a href='/constructor/true'>true</a> info:flags.1?<a href='/constructor/true'>true</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>The requested fields can be autofilled with the info provided in the <code>saved_info</code> field of the <a href="/constructor/payments.paymentForm">payment form</a>, or with the info fetched manually using <a href="/method/payments.getSavedInfo">payments.getSavedInfo</a>.</p>
<p>Saved order information can also be cleared using <a href="/method/payments.clearSavedInfo">payments.clearSavedInfo</a>.</p>
<h4><a class="anchor" href="#24-select-delivery-option" id="24-select-delivery-option" name="24-select-delivery-option"><i class="anchor-icon"></i></a>2.4 Select delivery option</h4>
<pre><code><a href='/constructor/labeledPrice'>labeledPrice</a>#cb296bf8 label:<a href='/type/string'>string</a> amount:<a href='/type/long'>long</a> = <a href='/type/LabeledPrice'>LabeledPrice</a>;
<a href='/constructor/shippingOption'>shippingOption</a>#b6213cdf id:<a href='/type/string'>string</a> title:<a href='/type/string'>string</a> prices:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/LabeledPrice'>LabeledPrice</a>&gt; = <a href='/type/ShippingOption'>ShippingOption</a>;
<a href='/constructor/updateBotShippingQuery'>updateBotShippingQuery</a>#b5aefd7d query_id:<a href='/type/long'>long</a> user_id:<a href='/type/long'>long</a> payload:<a href='/type/bytes'>bytes</a> shipping_address:<a href='/type/PostAddress'>PostAddress</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.setBotShippingResults'>messages.setBotShippingResults</a>#e5f672fa flags:<a href='/type/%23'>#</a> query_id:<a href='/type/long'>long</a> error:flags.0?<a href='/type/string'>string</a> shipping_options:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ShippingOption'>ShippingOption</a>&gt; = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>If a shipping address was requested and the bot included the parameter <code>flexible</code>, when the user <a href="#2-3-verifying-information">validates order information</a> the Telegram API will send an <a href="/constructor/updateBotShippingQuery">updateBotShippingQuery</a> to the bot.
The bot must respond using <a href="/method/messages.setBotShippingResults">messages.setBotShippingResults</a> either with a list of possible delivery options and the relevant delivery prices, or with an error (for example, if delivery to the specified address is not possible).</p>
<p>The returned shipping options or the shipping error will be returned to the user while <a href="#2-3-verifying-information">validating order information</a>.</p>
<h3><a class="anchor" href="#3-payment" id="3-payment" name="3-payment"><i class="anchor-icon"></i></a>3. Payment</h3>
<pre><code><a href='/constructor/inputPaymentCredentialsSaved'>inputPaymentCredentialsSaved</a>#c10eb2cf id:<a href='/type/string'>string</a> tmp_password:<a href='/type/bytes'>bytes</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/inputPaymentCredentials'>inputPaymentCredentials</a>#3417d728 flags:<a href='/type/%23'>#</a> save:flags.0?<a href='/constructor/true'>true</a> data:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/inputPaymentCredentialsApplePay'>inputPaymentCredentialsApplePay</a>#aa1c39f payment_data:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/inputPaymentCredentialsGooglePay'>inputPaymentCredentialsGooglePay</a>#8ac32801 payment_token:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/payments.paymentForm'>payments.paymentForm</a>#1694761b flags:<a href='/type/%23'>#</a> can_save_credentials:flags.2?<a href='/constructor/true'>true</a> password_missing:flags.3?<a href='/constructor/true'>true</a> form_id:<a href='/type/long'>long</a> bot_id:<a href='/type/long'>long</a> invoice:<a href='/type/Invoice'>Invoice</a> provider_id:<a href='/type/long'>long</a> url:<a href='/type/string'>string</a> native_provider:flags.4?<a href='/type/string'>string</a> native_params:flags.4?<a href='/type/DataJSON'>DataJSON</a> saved_info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> saved_credentials:flags.1?<a href='/type/PaymentSavedCredentials'>PaymentSavedCredentials</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/payments.PaymentForm'>payments.PaymentForm</a>;</code></pre>
<h4><a class="anchor" href="#31-web-payment" id="31-web-payment" name="31-web-payment"><i class="anchor-icon"></i></a>3.1 Web payment</h4>
<pre><code><a href='/constructor/inputPaymentCredentials'>inputPaymentCredentials</a>#3417d728 flags:<a href='/type/%23'>#</a> save:flags.0?<a href='/constructor/true'>true</a> data:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/payments.paymentForm'>payments.paymentForm</a>#1694761b flags:<a href='/type/%23'>#</a> can_save_credentials:flags.2?<a href='/constructor/true'>true</a> password_missing:flags.3?<a href='/constructor/true'>true</a> form_id:<a href='/type/long'>long</a> bot_id:<a href='/type/long'>long</a> invoice:<a href='/type/Invoice'>Invoice</a> provider_id:<a href='/type/long'>long</a> url:<a href='/type/string'>string</a> native_provider:flags.4?<a href='/type/string'>string</a> native_params:flags.4?<a href='/type/DataJSON'>DataJSON</a> saved_info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> saved_credentials:flags.1?<a href='/type/PaymentSavedCredentials'>PaymentSavedCredentials</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/payments.PaymentForm'>payments.PaymentForm</a>;</code></pre>
<p>Typically, payment takes place by opening the <code>url</code> in the specified <a href="/constructor/payments.paymentForm">payment form</a>, which leads to a payment form on the website of the payment gateway.
Once the user finishes entering their payment credentials, a <a href="/api/web-events"><code>payment_form_submit</code> web event</a> is generated by the payment gateway, containing <code>data</code> and <code>title</code> JSON fields.</p>
<p>The <code>title</code> is used by the client app to represent the payment credentials (typically a censored version of credit card information).
The <code>data</code> is used to generate an <a href="/constructor/inputPaymentCredentials">inputPaymentCredentials</a> constructor.
Eventually, you can set the <code>save</code> flag to save the credit card info for future use, only if <a href="/api/srp">2FA</a> is enabled.</p>
<p>Telegram <strong>does not</strong> have access to your card information. Credit card details will be handled only by the payment system.</p>
<h4><a class="anchor" href="#32-native-payment" id="32-native-payment" name="32-native-payment"><i class="anchor-icon"></i></a>3.2 Native payment</h4>
<pre><code><a href='/constructor/inputPaymentCredentials'>inputPaymentCredentials</a>#3417d728 flags:<a href='/type/%23'>#</a> save:flags.0?<a href='/constructor/true'>true</a> data:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/payments.paymentForm'>payments.paymentForm</a>#1694761b flags:<a href='/type/%23'>#</a> can_save_credentials:flags.2?<a href='/constructor/true'>true</a> password_missing:flags.3?<a href='/constructor/true'>true</a> form_id:<a href='/type/long'>long</a> bot_id:<a href='/type/long'>long</a> invoice:<a href='/type/Invoice'>Invoice</a> provider_id:<a href='/type/long'>long</a> url:<a href='/type/string'>string</a> native_provider:flags.4?<a href='/type/string'>string</a> native_params:flags.4?<a href='/type/DataJSON'>DataJSON</a> saved_info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> saved_credentials:flags.1?<a href='/type/PaymentSavedCredentials'>PaymentSavedCredentials</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/payments.PaymentForm'>payments.PaymentForm</a>;</code></pre>
<p>Most telegram apps support working natively with the native APIs of some payment providers, without opening the website of the payment and receiving a JS event.</p>
<p>This is done using the JSON <code>native_params</code> parameters field of the <a href="/constructor/payments.paymentForm">payments.paymentForm</a> constructor, which contains an object, which can contain one or more of the following fields:</p>
<ul>
<li><code>publishable_key</code>: Stripe API publishable key</li>
<li><code>apple_pay_merchant_id</code>: Apple Pay merchant ID</li>
<li><code>android_pay_public_key</code>: Android Pay public key</li>
<li><code>android_pay_bgcolor</code>: Android Pay form background color</li>
<li><code>android_pay_inverse</code>: Whether to use the dark theme in the Android Pay form</li>
<li><code>need_country</code>: True, if the user country must be provided,</li>
<li><code>need_zip</code>: True, if the user ZIP/postal code must be provided,</li>
<li><code>need_cardholder_name</code>: True, if the cardholder name must be provided</li>
</ul>
<p>The payment gateway to use is decided based on the value of the <code>native_provider</code> field.</p>
<h5><a class="anchor" href="#321-stripe" id="321-stripe" name="321-stripe"><i class="anchor-icon"></i></a>3.2.1 Stripe</h5>
<pre><code><a href='/constructor/inputPaymentCredentials'>inputPaymentCredentials</a>#3417d728 flags:<a href='/type/%23'>#</a> save:flags.0?<a href='/constructor/true'>true</a> data:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/payments.paymentForm'>payments.paymentForm</a>#1694761b flags:<a href='/type/%23'>#</a> can_save_credentials:flags.2?<a href='/constructor/true'>true</a> password_missing:flags.3?<a href='/constructor/true'>true</a> form_id:<a href='/type/long'>long</a> bot_id:<a href='/type/long'>long</a> invoice:<a href='/type/Invoice'>Invoice</a> provider_id:<a href='/type/long'>long</a> url:<a href='/type/string'>string</a> native_provider:flags.4?<a href='/type/string'>string</a> native_params:flags.4?<a href='/type/DataJSON'>DataJSON</a> saved_info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> saved_credentials:flags.1?<a href='/type/PaymentSavedCredentials'>PaymentSavedCredentials</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/payments.PaymentForm'>payments.PaymentForm</a>;</code></pre>
<p>If the <code>native_provider</code> field is set and equal to <code>stripe</code>, the client can make use of the <a href="https://stripe.com/docs/api/tokens/object">native Stripe token APIs</a> with the <code>publishable_key</code> from the <code>native_params</code> to add a payment method to Stripe, and then use the token <code>type</code> and <code>id</code> to generate a JSON object:</p>
<pre><code>{"type":"token.type", "id":"token.id"}"</code></pre>
<p>The generated JSON object can then be passed to the <code>data</code> field of the <a href="/constructor/inputPaymentCredentials">inputPaymentCredentials</a>.
Eventually, you can set the <code>save</code> flag to save the credit card info for future use, only if <a href="/api/srp">2FA</a> is enabled.</p>
<p>Telegram <strong>does not</strong> have access to your card information. Credit card details will be handled only by the payment system.</p>
<p>Example implementation: <a href="https://github.com/DrKLO/Telegram">Telegram for Android</a>.</p>
<h4><a class="anchor" href="#33-apple-pay" id="33-apple-pay" name="33-apple-pay"><i class="anchor-icon"></i></a>3.3 Apple pay</h4>
<pre><code><a href='/constructor/inputPaymentCredentialsApplePay'>inputPaymentCredentialsApplePay</a>#aa1c39f payment_data:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;</code></pre>
<p>On iOS devices, Apple Pay can be used to generate payment data, which is then sent using the <a href="/constructor/inputPaymentCredentialsApplePay">inputPaymentCredentialsApplePay</a> constructor.</p>
<p>Example implementation: <a href="https://github.com/TelegramMessenger/Telegram-iOS/">Telegram for iOS</a>.</p>
<h4><a class="anchor" href="#34-android-pay" id="34-android-pay" name="34-android-pay"><i class="anchor-icon"></i></a>3.4 Android pay</h4>
<pre><code><a href='/constructor/inputPaymentCredentialsGooglePay'>inputPaymentCredentialsGooglePay</a>#8ac32801 payment_token:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;</code></pre>
<p>On Android devices, Google Pay can be used to generate payment data, which is then sent using the <a href="/constructor/inputPaymentCredentialsApplePay">inputPaymentCredentialsGooglePay</a> constructor.</p>
<p>Example implementation: <a href="https://github.com/DrKLO/Telegram/blob/ff5735503e068a6f1cada09b977f633df7caf98d/TMessagesProj/src/main/java/org/telegram/ui/PaymentFormActivity.java">Telegram for Android</a>.</p>
<h4><a class="anchor" href="#35-using-saved-payment-credentials" id="35-using-saved-payment-credentials" name="35-using-saved-payment-credentials"><i class="anchor-icon"></i></a>3.5 Using saved payment credentials</h4>
<pre><code><a href='/constructor/inputPaymentCredentialsSaved'>inputPaymentCredentialsSaved</a>#c10eb2cf id:<a href='/type/string'>string</a> tmp_password:<a href='/type/bytes'>bytes</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/paymentSavedCredentialsCard'>paymentSavedCredentialsCard</a>#cdc27a1f id:<a href='/type/string'>string</a> title:<a href='/type/string'>string</a> = <a href='/type/PaymentSavedCredentials'>PaymentSavedCredentials</a>;
<a href='/constructor/payments.paymentForm'>payments.paymentForm</a>#1694761b flags:<a href='/type/%23'>#</a> can_save_credentials:flags.2?<a href='/constructor/true'>true</a> password_missing:flags.3?<a href='/constructor/true'>true</a> form_id:<a href='/type/long'>long</a> bot_id:<a href='/type/long'>long</a> invoice:<a href='/type/Invoice'>Invoice</a> provider_id:<a href='/type/long'>long</a> url:<a href='/type/string'>string</a> native_provider:flags.4?<a href='/type/string'>string</a> native_params:flags.4?<a href='/type/DataJSON'>DataJSON</a> saved_info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> saved_credentials:flags.1?<a href='/type/PaymentSavedCredentials'>PaymentSavedCredentials</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/payments.PaymentForm'>payments.PaymentForm</a>;
<a href='/constructor/account.tmpPassword'>account.tmpPassword</a>#db64fd34 tmp_password:<a href='/type/bytes'>bytes</a> valid_until:<a href='/type/int'>int</a> = <a href='/type/account.TmpPassword'>account.TmpPassword</a>;
---functions---
<a href='/method/account.getTmpPassword'>account.getTmpPassword</a>#449e0b51 password:<a href='/type/InputCheckPasswordSRP'>InputCheckPasswordSRP</a> period:<a href='/type/int'>int</a> = <a href='/type/account.TmpPassword'>account.TmpPassword</a>;</code></pre>
<p>To reuse saved payment methods, the <code>saved_credentials</code> field of the <a href="/constructor/payments.paymentForm">payment form</a> is used.
The <code>title</code> of the <a href="/constructor/paymentSavedCredentialsCard">paymentSavedCredentialsCard</a> can be used to preview a censored version of credit card info.
The <code>id</code> field is provided by the payment provider directly to the Telegram servers when saving the payment method, and identifies the payment method.
Full credit card info <strong>is not</strong> saved on Telegram Servers, and cannot be fetched by the user.</p>
<p>In order to <strong>use</strong> the saved payment method, <a href="/api/srp">2FA</a> must be enabled: the user must verify their identity by entering their <a href="/api/srp">2FA</a> password, which is then used as described in the <a href="/api/srp">SRP docs</a> to generate SRP parameters which must be passed to <a href="/method/account.getTmpPassword">account.getTmpPassword</a>.</p>
<p>The generated temporary password can then be used to make payments using the saved credentials using the <a href="/constructor/inputPaymentCredentialsSaved">inputPaymentCredentialsSaved</a> constructor.</p>
<ul>
<li>The <code>id</code> field is the <a href="/constructor/paymentSavedCredentialsCard">paymentSavedCredentialsCard</a> <code>id</code>.</li>
<li>The <code>tmp_password</code> is the temporary payment password generated by the server, if the user provided a correct <a href="/api/srp">2FA password</a>.</li>
</ul>
<p>Example implementation: <a href="https://github.com/DrKLO/Telegram">Telegram for Android</a>.</p>
<h3><a class="anchor" href="#4-pre-checkout" id="4-pre-checkout" name="4-pre-checkout"><i class="anchor-icon"></i></a>4. Pre-Checkout</h3>
<pre><code><a href='/constructor/inputPaymentCredentialsSaved'>inputPaymentCredentialsSaved</a>#c10eb2cf id:<a href='/type/string'>string</a> tmp_password:<a href='/type/bytes'>bytes</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/inputPaymentCredentials'>inputPaymentCredentials</a>#3417d728 flags:<a href='/type/%23'>#</a> save:flags.0?<a href='/constructor/true'>true</a> data:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/inputPaymentCredentialsApplePay'>inputPaymentCredentialsApplePay</a>#aa1c39f payment_data:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/inputPaymentCredentialsGooglePay'>inputPaymentCredentialsGooglePay</a>#8ac32801 payment_token:<a href='/type/DataJSON'>DataJSON</a> = <a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a>;
<a href='/constructor/payments.paymentResult'>payments.paymentResult</a>#4e5f810d updates:<a href='/type/Updates'>Updates</a> = <a href='/type/payments.PaymentResult'>payments.PaymentResult</a>;
<a href='/constructor/payments.paymentVerificationNeeded'>payments.paymentVerificationNeeded</a>#d8411139 url:<a href='/type/string'>string</a> = <a href='/type/payments.PaymentResult'>payments.PaymentResult</a>;
---functions---
<a href='/method/payments.sendPaymentForm'>payments.sendPaymentForm</a>#30c3bc9d flags:<a href='/type/%23'>#</a> form_id:<a href='/type/long'>long</a> peer:<a href='/type/InputPeer'>InputPeer</a> msg_id:<a href='/type/int'>int</a> requested_info_id:flags.0?<a href='/type/string'>string</a> shipping_option_id:flags.1?<a href='/type/string'>string</a> credentials:<a href='/type/InputPaymentCredentials'>InputPaymentCredentials</a> tip_amount:flags.2?<a href='/type/long'>long</a> = <a href='/type/payments.PaymentResult'>payments.PaymentResult</a>;</code></pre>
<p>After <a href="#2-3-verifying-information">verifying order information</a>, the final step for the client is to call <a href="/method/payments.sendPaymentForm">payments.sendPaymentForm</a>, with the following parameters:</p>
<ul>
<li>The <code>msg_id</code> is set to the ID of the invoice message</li>
<li><code>requested_info_id</code> is set to the <code>id</code> of the <a href="#2-3-verifying-information">verified order information</a>, if it was requested</li>
<li><code>shipping_option_id</code> is set to the <a href="#2-5-select-delivery-option">selected delivery option</a>, if shipping was requested.</li>
<li><code>credentials</code> are the payment credentials generated by the payment provider, required to complete the order.</li>
</ul>
<p>Payment method info can also be saved to the Telegram Servers and reused, by setting the <code>save</code> flag of <a href="/constructor/inputPaymentCredentials">inputPaymentCredentials</a> when sending the form.
This is only possible on accounts with <a href="/api/srp">2FA</a> enabled.</p>
<p>The bot then <a href="#4-1-receiving-pre-checkout-query">replies to the received precheckout query</a>, finally the user <a href="#5-checkout">proceeds to checkout</a>.</p>
<p>Please note that if the result of the method is a <a href="/constructor/payments.paymentVerificationNeeded">payments.paymentVerificationNeeded</a>, before <a href="#5-checkout">proceeding to checkout</a> the payment provider requires the user to verify his identity by opening the provided <code>url</code> and following instructions.
Once the user finishes working with the webpage, the client can <a href="#5-checkout">proceed to checkout</a>.</p>
<p>Eventual errors are returned in the form of RPC errors, with the description of the error by the bot contained in <a href="/constructor/updateServiceNotification">service updates</a>.</p>
<h4><a class="anchor" href="#41-receiving-pre-checkout-query" id="41-receiving-pre-checkout-query" name="41-receiving-pre-checkout-query"><i class="anchor-icon"></i></a>4.1 Receiving pre-checkout query</h4>
<pre><code><a href='/constructor/paymentRequestedInfo'>paymentRequestedInfo</a>#909c3f94 flags:<a href='/type/%23'>#</a> name:flags.0?<a href='/type/string'>string</a> phone:flags.1?<a href='/type/string'>string</a> email:flags.2?<a href='/type/string'>string</a> shipping_address:flags.3?<a href='/type/PostAddress'>PostAddress</a> = <a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a>;
<a href='/constructor/updateBotPrecheckoutQuery'>updateBotPrecheckoutQuery</a>#8caa9a96 flags:<a href='/type/%23'>#</a> query_id:<a href='/type/long'>long</a> user_id:<a href='/type/long'>long</a> payload:<a href='/type/bytes'>bytes</a> info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> shipping_option_id:flags.1?<a href='/type/string'>string</a> currency:<a href='/type/string'>string</a> total_amount:<a href='/type/long'>long</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.setBotPrecheckoutResults'>messages.setBotPrecheckoutResults</a>#9c2dd95 flags:<a href='/type/%23'>#</a> success:flags.1?<a href='/constructor/true'>true</a> query_id:<a href='/type/long'>long</a> error:flags.0?<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>The user enters their payment information as described above and presses the final pay button.
At this moment the Telegram API sends an <a href="/constructor/updateBotPrecheckoutQuery">updateBotPrecheckoutQuery</a> constructor that contains all the available information about the order to the bot.
The bot must reply using <a href="/method/messages.setBotPrecheckoutResults">messages.setBotPrecheckoutResults</a> <strong>within 10 seconds</strong> after receiving this update or the transaction is canceled.</p>
<p>The bot may return an error if it can't process the order for any reason. We highly recommend specifying a reason for failure to complete the order in human readable form (e.g. "Sorry, we're all out of rubber ducks! Would you be interested in a steel bear instead?"). Telegram will display this reason to the user.</p>
<h3><a class="anchor" href="#5-checkout" id="5-checkout" name="5-checkout"><i class="anchor-icon"></i></a>5. Checkout</h3>
<pre><code><a href='/constructor/keyboardButtonBuy'>keyboardButtonBuy</a>#afd93fbb text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
<a href='/constructor/keyboardButtonRow'>keyboardButtonRow</a>#77608b83 buttons:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/KeyboardButton'>KeyboardButton</a>&gt; = <a href='/type/KeyboardButtonRow'>KeyboardButtonRow</a>;
<a href='/constructor/replyInlineMarkup'>replyInlineMarkup</a>#48a30254 rows:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/KeyboardButtonRow'>KeyboardButtonRow</a>&gt; = <a href='/type/ReplyMarkup'>ReplyMarkup</a>;
<a href='/constructor/messageMediaInvoice'>messageMediaInvoice</a>#84551347 flags:<a href='/type/%23'>#</a> shipping_address_requested:flags.1?<a href='/constructor/true'>true</a> test:flags.3?<a href='/constructor/true'>true</a> title:<a href='/type/string'>string</a> description:<a href='/type/string'>string</a> photo:flags.0?<a href='/type/WebDocument'>WebDocument</a> receipt_msg_id:flags.2?<a href='/type/int'>int</a> currency:<a href='/type/string'>string</a> total_amount:<a href='/type/long'>long</a> start_param:<a href='/type/string'>string</a> = <a href='/type/MessageMedia'>MessageMedia</a>;
<a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/updateNewMessage'>updateNewMessage</a>#1f2b0afd message:<a href='/type/Message'>Message</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/payments.paymentReceipt'>payments.paymentReceipt</a>#70c4fe03 flags:<a href='/type/%23'>#</a> date:<a href='/type/int'>int</a> bot_id:<a href='/type/long'>long</a> provider_id:<a href='/type/long'>long</a> title:<a href='/type/string'>string</a> description:<a href='/type/string'>string</a> photo:flags.2?<a href='/type/WebDocument'>WebDocument</a> invoice:<a href='/type/Invoice'>Invoice</a> info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> shipping:flags.1?<a href='/type/ShippingOption'>ShippingOption</a> tip_amount:flags.3?<a href='/type/long'>long</a> currency:<a href='/type/string'>string</a> total_amount:<a href='/type/long'>long</a> credentials_title:<a href='/type/string'>string</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/payments.PaymentReceipt'>payments.PaymentReceipt</a>;
---functions---
<a href='/method/payments.getPaymentReceipt'>payments.getPaymentReceipt</a>#2478d1cc peer:<a href='/type/InputPeer'>InputPeer</a> msg_id:<a href='/type/int'>int</a> = <a href='/type/payments.PaymentReceipt'>payments.PaymentReceipt</a>;</code></pre>
<p>In case the bot confirms the order, Telegram requests the payment provider to complete the transaction. If the payment information was entered correctly and the payment goes through, the Telegram API will modify the invoice message and send a service message as described below. Once your bot receives this message, it should proceed with delivering the goods or services purchased by the user.</p>
<p>If all is OK, the user receives a <a href="/constructor/payments.paymentResult">payments.paymentResult</a> in reply to the <a href="/method/payments.sendPaymentForm">payments.sendPaymentForm</a> query, containing info about the updated invoice message in the form of an <a href="/constructor/updateEditMessage">updateEditMessage</a>.</p>
<p>The invoice message will be updated as follows: the attached <a href="/constructor/messageMediaInvoice">messageMediaInvoice</a> will now have a <code>receipt_msg_id</code> field.
Clients should treat invoice messages with a <code>receipt_msg_id</code> field as receipt messages, <strong>locally</strong> modifying the label of the <a href="/constructor/keyboardButtonBuy">keyboardButtonBuy</a> button to a localized version of the word <code>Receipt</code>.
From this point, clicking on the <code>Receipt</code> button should trigger a call to <a href="/method/payments.getPaymentReceipt">payments.getPaymentReceipt</a>, providing the <code>receipt_msg_id</code> to the <code>msg_id</code> field, which will return info about the transaction.</p>
<p>The payment will also generate one service message of type <a href="/constructor/messageActionPaymentSent">messageActionPaymentSent</a> or <a href="/constructor/messageActionPaymentSentMe">messageActionPaymentSentMe</a>, replying to the invoice.
For bots, the service message will be of type <a href="/constructor/messageActionPaymentSentMe">messageActionPaymentSentMe</a>, for users it will be a <a href="/constructor/messageActionPaymentSent">messageActionPaymentSent</a>.</p>
<pre><code><a href='/constructor/messageActionPaymentSentMe'>messageActionPaymentSentMe</a>#8f31b327 flags:<a href='/type/%23'>#</a> currency:<a href='/type/string'>string</a> total_amount:<a href='/type/long'>long</a> payload:<a href='/type/bytes'>bytes</a> info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> shipping_option_id:flags.1?<a href='/type/string'>string</a> charge:<a href='/type/PaymentCharge'>PaymentCharge</a> = <a href='/type/MessageAction'>MessageAction</a>;
<a href='/constructor/messageActionPaymentSent'>messageActionPaymentSent</a>#40699cd0 currency:<a href='/type/string'>string</a> total_amount:<a href='/type/long'>long</a> = <a href='/type/MessageAction'>MessageAction</a>;</code></pre></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,141 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Perfect Forward Secrecy</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Binding temporary authorization key to permanent ones.">
<meta property="og:title" content="Perfect Forward Secrecy">
<meta property="og:image" content="a2b9f721d645a85533">
<meta property="og:description" content="Binding temporary authorization key to permanent ones.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/pfs" >Perfect Forward Secrecy</a></li></ul></div>
<h1 id="dev_page_title">Perfect Forward Secrecy</h1>
<div id="dev_page_content"><h5><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related articles</h5>
<p><div class="dev_page_nav_wrap"></p>
<ul>
<li><a href="/api/end-to-end/pfs">Perfect Forward Secrecy in Secret Chats</a></li>
<li><a href="/mtproto/security_guidelines">Security guidelines for developers</a></li>
</ul>
<p></div></p>
<blockquote>
<p><em>This article is about Perfect Forward Secrecy in cloud chats, see also <a href="/api/end-to-end/pfs">PFS in Secret Chats</a>.</em></p>
</blockquote>
<hr>
<p>Telegram supports Perfect Forward Secrecy (PFS).</p>
<p>To make this possible, the client generates a permanent authorization key using <strong>p_q_inner_data</strong> and a temporary key using <strong>p_q_inner_data_temp</strong>. (See <a href="/mtproto/auth_key">Creating an Authorization Key</a> for more info.) These 2 operations may be done in parallel and even using the same connection. The client must save an <strong>expires_at</strong> unix timestamp <code>expires_at = time + expires_in</code>.</p>
<p><strong>Important</strong>: in order to achieve PFS, the client must <strong>never</strong> use the permanent auth_key_id directly. Every message that is sent to MTProto, must be encrypted by a <strong>temp_auth_key_id</strong>, that was bound to the <strong>perm_auth_key_id</strong>.</p>
<p>An unbound <strong>temp_auth_key_id</strong> may only be used with the following methods:</p>
<ul>
<li><a href="/method/auth.bindTempAuthKey">auth.bindTempAuthKey</a></li>
<li><a href="/method/help.getConfig">help.getConfig</a></li>
<li><a href="/method/help.getNearestDc">help.getNearestDc</a></li>
</ul>
<p>In order to bind a temporary authorization key to the permanent key the client creates a <a href="/method/auth.bindTempAuthKey#binding-message-contents">special binding message</a> and executes the <a href="/method/auth.bindTempAuthKey">auth.bindTempAuthKey</a> method using <strong>temp_auth_key</strong>. Once <strong>auth.bindTempAuthKey</strong> has been executed successfully, the client may signUp / signIn using other auth.* methods and continue using the API as usual; the client must also <a href="/api/invoking#saving-client-info">rewrite client info</a> using <a href="/method/initConnection">initConnection</a> after each binding. Each permanent key may only be bound to <strong>one</strong> temporary key at a time, binding a new temporary key overwrites the previous one.</p>
<p>Once the temporary key expires, the client needs to generate a new temporary key using <strong>p_q_inner_data_temp</strong>. Then it needs to re-bind that new temporary key to the initial permanent key. A new key can also be generated in advance, so that the client has a new key ready by the time the old one has expired.</p>
<p>For additional security, the client can store the temporary authorization key in RAM only and never save it in persistent storage.</p>
<p>A temporary authorization key may expire at any moment before <strong>expires_at</strong>, since such keys are also stored only in the RAM on the server-side. Be prepared to handle resulting MTProto errors correctly (non-existent auth_key_id results in a 404 error).</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,152 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Pinned messages</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows pinning multiple messages on top of a specific chat.">
<meta property="og:title" content="Pinned messages">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows pinning multiple messages on top of a specific chat.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/pin" >Pinned messages</a></li></ul></div>
<h1 id="dev_page_title">Pinned messages</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows pinning multiple messages on top of a specific chat. </p>
<pre><code><a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/updatePinnedMessages'>updatePinnedMessages</a>#ed85eab5 flags:<a href='/type/%23'>#</a> pinned:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/Peer'>Peer</a> messages:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/updatePinnedChannelMessages'>updatePinnedChannelMessages</a>#5bb98608 flags:<a href='/type/%23'>#</a> pinned:flags.0?<a href='/constructor/true'>true</a> channel_id:<a href='/type/long'>long</a> messages:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.updatePinnedMessage'>messages.updatePinnedMessage</a>#d2aaf7ec flags:<a href='/type/%23'>#</a> silent:flags.0?<a href='/constructor/true'>true</a> unpin:flags.1?<a href='/constructor/true'>true</a> pm_oneside:flags.2?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.unpinAllMessages'>messages.unpinAllMessages</a>#f025bc8b peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/messages.AffectedHistory'>messages.AffectedHistory</a>;
<a href='/method/messages.getMessages'>messages.getMessages</a>#63c66506 id:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputMessage'>InputMessage</a>&gt; = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/method/channels.getMessages'>channels.getMessages</a>#ad8c9a23 channel:<a href='/type/InputChannel'>InputChannel</a> id:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputMessage'>InputMessage</a>&gt; = <a href='/type/messages.Messages'>messages.Messages</a>;</code></pre>
<p>The <a href="/method/messages.updatePinnedMessage">messages.updatePinnedMessage</a> method can be used to pin or unpin a specific message in an arbitrary chat.<br>
The <code>unpin</code> flags specifies whether to unpin or pin the message, and <code>pm_oneside</code> specifies whether the message should only be pinned on the local side of a one-to-one chat. </p>
<p><a href="/method/messages.unpinAllMessages">messages.unpinAllMessages</a> can be used to unpin all messages in a chat. </p>
<p>When (un)pinning messages, a <a href="/constructor/updatePinnedMessages">updatePinnedMessages</a> or <a href="/constructor/updatePinnedChannelMessages">updatePinnedChannelMessages</a> update will be emitted, containing IDs of pinned or unpinned messages. </p>
<p>Pinned messages will also have the will also have the <code>pinned</code> flag of <a href="/constructor/message">message</a> set.</p>
<h3><a class="anchor" href="#getting-pinned-messages" id="getting-pinned-messages" name="getting-pinned-messages"><i class="anchor-icon"></i></a>Getting pinned messages</h3>
<pre><code><a href='/constructor/userFull'>userFull</a>#cf366521 flags:<a href='/type/%23'>#</a> blocked:flags.0?<a href='/constructor/true'>true</a> phone_calls_available:flags.4?<a href='/constructor/true'>true</a> phone_calls_private:flags.5?<a href='/constructor/true'>true</a> can_pin_message:flags.7?<a href='/constructor/true'>true</a> has_scheduled:flags.12?<a href='/constructor/true'>true</a> video_calls_available:flags.13?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:flags.1?<a href='/type/string'>string</a> settings:<a href='/type/PeerSettings'>PeerSettings</a> profile_photo:flags.2?<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> bot_info:flags.3?<a href='/type/BotInfo'>BotInfo</a> pinned_msg_id:flags.6?<a href='/type/int'>int</a> common_chats_count:<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> ttl_period:flags.14?<a href='/type/int'>int</a> theme_emoticon:flags.15?<a href='/type/string'>string</a> private_forward_name:flags.16?<a href='/type/string'>string</a> = <a href='/type/UserFull'>UserFull</a>;
<a href='/constructor/chatFull'>chatFull</a>#d18ee226 flags:<a href='/type/%23'>#</a> can_set_username:flags.7?<a href='/constructor/true'>true</a> has_scheduled:flags.8?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants:<a href='/type/ChatParticipants'>ChatParticipants</a> chat_photo:flags.2?<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.13?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; pinned_msg_id:flags.6?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> call:flags.12?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.14?<a href='/type/int'>int</a> groupcall_default_join_as:flags.15?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.16?<a href='/type/string'>string</a> requests_pending:flags.17?<a href='/type/int'>int</a> recent_requesters:flags.17?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; available_reactions:flags.18?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/ChatFull'>ChatFull</a>;
<a href='/constructor/channelFull'>channelFull</a>#e13c3d20 flags:<a href='/type/%23'>#</a> can_view_participants:flags.3?<a href='/constructor/true'>true</a> can_set_username:flags.6?<a href='/constructor/true'>true</a> can_set_stickers:flags.7?<a href='/constructor/true'>true</a> hidden_prehistory:flags.10?<a href='/constructor/true'>true</a> can_set_location:flags.16?<a href='/constructor/true'>true</a> has_scheduled:flags.19?<a href='/constructor/true'>true</a> can_view_stats:flags.20?<a href='/constructor/true'>true</a> blocked:flags.22?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants_count:flags.0?<a href='/type/int'>int</a> admins_count:flags.1?<a href='/type/int'>int</a> kicked_count:flags.2?<a href='/type/int'>int</a> banned_count:flags.2?<a href='/type/int'>int</a> online_count:flags.13?<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> chat_photo:<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.23?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href='/type/long'>long</a> migrated_from_max_id:flags.4?<a href='/type/int'>int</a> pinned_msg_id:flags.5?<a href='/type/int'>int</a> stickerset:flags.8?<a href='/type/StickerSet'>StickerSet</a> available_min_id:flags.9?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> linked_chat_id:flags.14?<a href='/type/long'>long</a> location:flags.15?<a href='/type/ChannelLocation'>ChannelLocation</a> slowmode_seconds:flags.17?<a href='/type/int'>int</a> slowmode_next_send_date:flags.18?<a href='/type/int'>int</a> stats_dc:flags.12?<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> call:flags.21?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.24?<a href='/type/int'>int</a> pending_suggestions:flags.25?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; groupcall_default_join_as:flags.26?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.27?<a href='/type/string'>string</a> requests_pending:flags.28?<a href='/type/int'>int</a> recent_requesters:flags.28?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; default_send_as:flags.29?<a href='/type/Peer'>Peer</a> available_reactions:flags.30?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/ChatFull'>ChatFull</a>;
<a href='/constructor/inputMessagesFilterPinned'>inputMessagesFilterPinned</a>#1bb00451 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
---functions---
<a href='/method/messages.search'>messages.search</a>#a0fda762 flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> q:<a href='/type/string'>string</a> from_id:flags.0?<a href='/type/InputPeer'>InputPeer</a> top_msg_id:flags.1?<a href='/type/int'>int</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> min_date:<a href='/type/int'>int</a> max_date:<a href='/type/int'>int</a> offset_id:<a href='/type/int'>int</a> add_offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> max_id:<a href='/type/int'>int</a> min_id:<a href='/type/int'>int</a> hash:<a href='/type/long'>long</a> = <a href='/type/messages.Messages'>messages.Messages</a>;</code></pre>
<p>The <code>pinned_msg_id</code> of <a href="/constructor/userFull">userFull</a>, <a href="/constructor/chatFull">chatFull</a>, <a href="/constructor/channelFull">channelFull</a> contains the ID of only the latest pinned message.<br>
To obtain a full list, use <a href="/method/messages.search">messages.search</a> with <a href="/constructor/inputMessagesFilterPinned">inputMessagesFilterPinned</a> filter. </p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,202 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Poll</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows sending polls and quizzes, that can be voted on by thousands, if not millions of users in chats and channels.">
<meta property="og:title" content="Poll">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows sending polls and quizzes, that can be voted on by thousands, if not millions of users in chats and channels.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/poll" >Poll</a></li></ul></div>
<h1 id="dev_page_title">Poll</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows sending polls and quizzes, that can be voted on by thousands, if not millions of users in chats and channels.</p>
<h3><a class="anchor" href="#sending-a-poll" id="sending-a-poll" name="sending-a-poll"><i class="anchor-icon"></i></a>Sending a poll</h3>
<pre><code><a href='/constructor/pollAnswer'>pollAnswer</a>#6ca9c2e9 text:<a href='/type/string'>string</a> option:<a href='/type/bytes'>bytes</a> = <a href='/type/PollAnswer'>PollAnswer</a>;
<a href='/constructor/poll'>poll</a>#86e18161 id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> closed:flags.0?<a href='/constructor/true'>true</a> public_voters:flags.1?<a href='/constructor/true'>true</a> multiple_choice:flags.2?<a href='/constructor/true'>true</a> quiz:flags.3?<a href='/constructor/true'>true</a> question:<a href='/type/string'>string</a> answers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PollAnswer'>PollAnswer</a>&gt; close_period:flags.4?<a href='/type/int'>int</a> close_date:flags.5?<a href='/type/int'>int</a> = <a href='/type/Poll'>Poll</a>;
<a href='/constructor/inputMediaPoll'>inputMediaPoll</a>#f94e5f1 flags:<a href='/type/%23'>#</a> poll:<a href='/type/Poll'>Poll</a> correct_answers:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/bytes'>bytes</a>&gt; solution:flags.1?<a href='/type/string'>string</a> solution_entities:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; = <a href='/type/InputMedia'>InputMedia</a>;
---functions---
<a href='/method/messages.sendMedia'>messages.sendMedia</a>#e25ff8e0 flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> media:<a href='/type/InputMedia'>InputMedia</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>To send a poll in a chat, call <a href="/method/messages.sendMedia">messages.sendMedia</a>, providing an <a href="/constructor/inputMediaPoll">inputMediaPoll</a>:</p>
<ul>
<li>
<p><code>poll</code> is the actual <a href="/constructor/poll">poll constructor</a>, containing:</p>
<ul>
<li><code>question</code> - The poll title, aka the poll's title</li>
<li><code>answers</code> - A vector of possible answers (2-10), each with a visible title <code>text</code> , and a unique <code>option</code> identifier (1-100 bytes)</li>
<li><code>closed</code> - Whether the poll is closed</li>
<li><code>public_voters</code> - Whether cast votes are publicly visible to all users (non-anonymous poll) </li>
<li><code>multiple_choice</code> - Whether multiple options can be chosen as answer</li>
<li><code>quiz</code> - Whether this is a quiz with correct answer IDs specified in <code>inputMediaPoll.correct_answers</code></li>
<li><code>close_period</code> - Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with <code>close_date</code> .</li>
<li><code>close_date</code> - Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future; can't be used together with <code>close_period</code> . <br>
These last two parameters are exactly the same, except that one uses absolute, the other relative unixtime.</li>
</ul>
</li>
<li>
<p><code>correct_answers</code> - For quizzes, option ID of the only correct answer</p>
</li>
<li>
<p><code>solution</code> - Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds</p>
</li>
<li>
<p><code>solution_entities</code> - <a href="/api/entities">Styled text message entities</a> for the <code>solution</code> explanation</p>
</li>
</ul>
<p>In order to prematurely close the poll, preventing further votes, use <a href="/method/messages.editMessage">messages.editMessage</a>, setting the <code>poll.closed</code> flag to true. </p>
<h3><a class="anchor" href="#voting-in-polls" id="voting-in-polls" name="voting-in-polls"><i class="anchor-icon"></i></a>Voting in polls</h3>
<pre><code><a href='/constructor/pollAnswerVoters'>pollAnswerVoters</a>#3b6ddad2 flags:<a href='/type/%23'>#</a> chosen:flags.0?<a href='/constructor/true'>true</a> correct:flags.1?<a href='/constructor/true'>true</a> option:<a href='/type/bytes'>bytes</a> voters:<a href='/type/int'>int</a> = <a href='/type/PollAnswerVoters'>PollAnswerVoters</a>;
<a href='/constructor/pollResults'>pollResults</a>#dcb82ea3 flags:<a href='/type/%23'>#</a> min:flags.0?<a href='/constructor/true'>true</a> results:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PollAnswerVoters'>PollAnswerVoters</a>&gt; total_voters:flags.2?<a href='/type/int'>int</a> recent_voters:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; solution:flags.4?<a href='/type/string'>string</a> solution_entities:flags.4?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; = <a href='/type/PollResults'>PollResults</a>;
<a href='/constructor/poll'>poll</a>#86e18161 id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> closed:flags.0?<a href='/constructor/true'>true</a> public_voters:flags.1?<a href='/constructor/true'>true</a> multiple_choice:flags.2?<a href='/constructor/true'>true</a> quiz:flags.3?<a href='/constructor/true'>true</a> question:<a href='/type/string'>string</a> answers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PollAnswer'>PollAnswer</a>&gt; close_period:flags.4?<a href='/type/int'>int</a> close_date:flags.5?<a href='/type/int'>int</a> = <a href='/type/Poll'>Poll</a>;
<a href='/constructor/messageMediaPoll'>messageMediaPoll</a>#4bd6e798 poll:<a href='/type/Poll'>Poll</a> results:<a href='/type/PollResults'>PollResults</a> = <a href='/type/MessageMedia'>MessageMedia</a>;
<a href='/constructor/updateMessagePoll'>updateMessagePoll</a>#aca1657b flags:<a href='/type/%23'>#</a> poll_id:<a href='/type/long'>long</a> poll:flags.0?<a href='/type/Poll'>Poll</a> results:<a href='/type/PollResults'>PollResults</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.sendVote'>messages.sendVote</a>#10ea6184 peer:<a href='/type/InputPeer'>InputPeer</a> msg_id:<a href='/type/int'>int</a> options:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/bytes'>bytes</a>&gt; = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>When receiving a <a href="/constructor/message">message</a> with a <a href="/constructor/messageMediaPoll">messageMediaPoll</a>, users can vote in it using <a href="/method/messages.sendVote">messages.sendVote</a>, specifying the chosen <code>option</code> identifiers. </p>
<p>The method will return an <a href="/constructor/updateMessagePoll">updateMessagePoll</a>, containing an updated <a href="/constructor/pollResults">pollResults</a> constructor, with the <code>chosen</code> flag set on the options we chose, and the <code>correct</code> flag set on the correct answers. </p>
<h3><a class="anchor" href="#getting-poll-votes" id="getting-poll-votes" name="getting-poll-votes"><i class="anchor-icon"></i></a>Getting poll votes</h3>
<pre><code><a href='/constructor/pollAnswerVoters'>pollAnswerVoters</a>#3b6ddad2 flags:<a href='/type/%23'>#</a> chosen:flags.0?<a href='/constructor/true'>true</a> correct:flags.1?<a href='/constructor/true'>true</a> option:<a href='/type/bytes'>bytes</a> voters:<a href='/type/int'>int</a> = <a href='/type/PollAnswerVoters'>PollAnswerVoters</a>;
<a href='/constructor/pollResults'>pollResults</a>#dcb82ea3 flags:<a href='/type/%23'>#</a> min:flags.0?<a href='/constructor/true'>true</a> results:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PollAnswerVoters'>PollAnswerVoters</a>&gt; total_voters:flags.2?<a href='/type/int'>int</a> recent_voters:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; solution:flags.4?<a href='/type/string'>string</a> solution_entities:flags.4?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; = <a href='/type/PollResults'>PollResults</a>;
<a href='/constructor/updateMessagePoll'>updateMessagePoll</a>#aca1657b flags:<a href='/type/%23'>#</a> poll_id:<a href='/type/long'>long</a> poll:flags.0?<a href='/type/Poll'>Poll</a> results:<a href='/type/PollResults'>PollResults</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.getPollResults'>messages.getPollResults</a>#73bb643b peer:<a href='/type/InputPeer'>InputPeer</a> msg_id:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>Regularly, if new users have voted in polls available to the user, they will receive an <a href="/constructor/updateMessagePoll">updateMessagePoll</a>, with updated <a href="/constructor/pollResults">pollResults</a>. </p>
<p>The same constructor can also be fetched manually using <a href="/method/messages.getPollResults">messages.getPollResults</a>.</p>
<h3><a class="anchor" href="#getting-poll-voters-in-non-anonymous-polls" id="getting-poll-voters-in-non-anonymous-polls" name="getting-poll-voters-in-non-anonymous-polls"><i class="anchor-icon"></i></a>Getting poll voters in non-anonymous polls</h3>
<pre><code><a href='/constructor/messageUserVote'>messageUserVote</a>#34d247b4 user_id:<a href='/type/long'>long</a> option:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> = <a href='/type/MessageUserVote'>MessageUserVote</a>;
<a href='/constructor/messageUserVoteInputOption'>messageUserVoteInputOption</a>#3ca5b0ec user_id:<a href='/type/long'>long</a> date:<a href='/type/int'>int</a> = <a href='/type/MessageUserVote'>MessageUserVote</a>;
<a href='/constructor/messageUserVoteMultiple'>messageUserVoteMultiple</a>#8a65e557 user_id:<a href='/type/long'>long</a> options:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/bytes'>bytes</a>&gt; date:<a href='/type/int'>int</a> = <a href='/type/MessageUserVote'>MessageUserVote</a>;
<a href='/constructor/messages.votesList'>messages.votesList</a>#823f649 flags:<a href='/type/%23'>#</a> count:<a href='/type/int'>int</a> votes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageUserVote'>MessageUserVote</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; next_offset:flags.0?<a href='/type/string'>string</a> = <a href='/type/messages.VotesList'>messages.VotesList</a>;
<a href='/constructor/updateMessagePollVote'>updateMessagePollVote</a>#106395c9 poll_id:<a href='/type/long'>long</a> user_id:<a href='/type/long'>long</a> options:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/bytes'>bytes</a>&gt; qts:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.getPollVotes'>messages.getPollVotes</a>#b86e380e flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/int'>int</a> option:flags.0?<a href='/type/bytes'>bytes</a> offset:flags.1?<a href='/type/string'>string</a> limit:<a href='/type/int'>int</a> = <a href='/type/messages.VotesList'>messages.VotesList</a>; </code></pre>
<p><a href="/method/messages.getPollVotes">messages.getPollVotes</a> can be used to get poll results for non-anonymous polls, to see how each user voted for a poll option.<br>
Bots will also receive an <a href="/constructor/updateMessagePollVote">updateMessagePollVote</a> every time a user their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,157 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Login via QR code</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="QR code login flow">
<meta property="og:title" content="Login via QR code">
<meta property="og:image" content="">
<meta property="og:description" content="QR code login flow">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/qr-login" >Login via QR code</a></li></ul></div>
<h1 id="dev_page_title">Login via QR code</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p><a href="https://en.wikipedia.org/wiki/QR_code">QR code</a> login flow.</p>
<p>Related TL schema:</p>
<pre><code><a href='/constructor/auth.loginToken'>auth.loginToken</a>#629f1980 expires:<a href='/type/int'>int</a> token:<a href='/type/bytes'>bytes</a> = <a href='/type/auth.LoginToken'>auth.LoginToken</a>;
<a href='/constructor/auth.loginTokenMigrateTo'>auth.loginTokenMigrateTo</a>#68e9916 dc_id:<a href='/type/int'>int</a> token:<a href='/type/bytes'>bytes</a> = <a href='/type/auth.LoginToken'>auth.LoginToken</a>;
<a href='/constructor/auth.loginTokenSuccess'>auth.loginTokenSuccess</a>#390d5c5e authorization:<a href='/type/auth.Authorization'>auth.Authorization</a> = <a href='/type/auth.LoginToken'>auth.LoginToken</a>;
<a href='/constructor/updateLoginToken'>updateLoginToken</a>#564fe691 = <a href='/type/Update'>Update</a>;
<a href='/constructor/authorization'>authorization</a>#ad01d61d flags:<a href='/type/%23'>#</a> current:flags.0?<a href='/constructor/true'>true</a> official_app:flags.1?<a href='/constructor/true'>true</a> password_pending:flags.2?<a href='/constructor/true'>true</a> encrypted_requests_disabled:flags.3?<a href='/constructor/true'>true</a> call_requests_disabled:flags.4?<a href='/constructor/true'>true</a> hash:<a href='/type/long'>long</a> device_model:<a href='/type/string'>string</a> platform:<a href='/type/string'>string</a> system_version:<a href='/type/string'>string</a> api_id:<a href='/type/int'>int</a> app_name:<a href='/type/string'>string</a> app_version:<a href='/type/string'>string</a> date_created:<a href='/type/int'>int</a> date_active:<a href='/type/int'>int</a> ip:<a href='/type/string'>string</a> country:<a href='/type/string'>string</a> region:<a href='/type/string'>string</a> = <a href='/type/Authorization'>Authorization</a>;
---functions---
<a href='/method/auth.exportLoginToken'>auth.exportLoginToken</a>#b7e085fe api_id:<a href='/type/int'>int</a> api_hash:<a href='/type/string'>string</a> except_ids:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; = <a href='/type/auth.LoginToken'>auth.LoginToken</a>;
<a href='/method/auth.acceptLoginToken'>auth.acceptLoginToken</a>#e894ad4d token:<a href='/type/bytes'>bytes</a> = <a href='/type/Authorization'>Authorization</a>;
<a href='/method/auth.importLoginToken'>auth.importLoginToken</a>#95ac5ce4 token:<a href='/type/bytes'>bytes</a> = <a href='/type/auth.LoginToken'>auth.LoginToken</a>;</code></pre>
<h3><a class="anchor" href="#exporting-a-login-token" id="exporting-a-login-token" name="exporting-a-login-token"><i class="anchor-icon"></i></a>Exporting a login token</h3>
<p>First of all, <a href="/method/auth.exportLoginToken">auth.exportLoginToken</a> must be called by the app that wants to log in to an existing Telegram account.<br>
The method will return an <a href="/constructor/auth.loginToken">auth.loginToken</a> constructor, containing a binary login <code>token</code> and an expiry date (usually 30 seconds). </p>
<p>The login <code>token</code> must be encoded using <a href="https://tools.ietf.org/html/rfc4648#section-5">base64url</a>, embedded in a <code>tg://login?token=base64encodedtoken</code> URL and shown in the form of a <a href="https://en.wikipedia.org/wiki/QR_code">QR code</a> to the user.<br>
After the expiration of the current QR code, the <a href="/method/auth.exportLoginToken">auth.exportLoginToken</a> method must be recalled and a new QR code must be generated automatically.</p>
<h3><a class="anchor" href="#accepting-a-login-token" id="accepting-a-login-token" name="accepting-a-login-token"><i class="anchor-icon"></i></a>Accepting a login token</h3>
<p>In order to log in, the QR code must be scanned and accepted by an already logged-in Telegram app using <a href="/method/auth.acceptLoginToken">auth.acceptLoginToken</a>.<br>
The token must be extracted from the <code>tg://login</code> URI and <a href="https://tools.ietf.org/html/rfc4648#section-5">base64url-decoded</a> before using it in the method.</p>
<p>Possible <a href="/api/errors">errors</a> returned by the method are: </p>
<ul>
<li>400 - <code>AUTH_TOKEN_INVALID</code>, an invalid authorization token was provided</li>
<li>400 - <code>AUTH_TOKEN_EXPIRED</code>, the provided authorization token has expired and the updated QR-code must be re-scanned</li>
<li>400 - <code>AUTH_TOKEN_ALREADY_ACCEPTED</code>, the authorization token was already used</li>
</ul>
<p>The method will return an <a href="/constructor/authorization">authorization</a> object, containing info about the app and session that we just authorized.</p>
<h3><a class="anchor" href="#confirming-importing-the-login-token" id="confirming-importing-the-login-token" name="confirming-importing-the-login-token"><i class="anchor-icon"></i></a>Confirming (importing) the login token</h3>
<p>After the logged-in app calls <a href="/method/auth.acceptLoginToken">auth.acceptLoginToken</a> and accepts the login token, the app that is trying to login will receive an <a href="/constructor/updateLoginToken">updateLoginToken</a> update, which should trigger a <strong>second</strong> call to the <a href="/method/auth.exportLoginToken">auth.exportLoginToken</a> method. </p>
<p>This second call should then return an <a href="/constructor/auth.loginTokenSuccess">auth.loginTokenSuccess</a> constructor, indicating <strong>successful login</strong>, essentially allowing further authorized interaction with the API.</p>
<p>If, however, there is a DC mismatch between the two apps, <a href="/constructor/auth.loginTokenMigrateTo">auth.loginTokenMigrateTo</a> is returned instead, to which the app that is trying to login should respond by calling <a href="/method/auth.importLoginToken">auth.importLoginToken</a> with the specified <code>token</code>, to the specified DC. </p>
<p>This call should then finally return a <a href="/constructor/auth.loginTokenSuccess">auth.loginTokenSuccess</a> constructor.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,182 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Message reactions</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows users to react on any message using specific emojis, triggering cute lottie animations.">
<meta property="og:title" content="Message reactions">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows users to react on any message using specific emojis, triggering cute lottie animations.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/reactions" >Message reactions</a></li></ul></div>
<h1 id="dev_page_title">Message reactions</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows users to react on any message using specific emojis, triggering cute lottie animations. </p>
<h2><a class="anchor" href="#react-to-a-message" id="react-to-a-message" name="react-to-a-message"><i class="anchor-icon"></i></a>React to a message</h2>
<pre><code><a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/updateMessageReactions'>updateMessageReactions</a>#154798c3 peer:<a href='/type/Peer'>Peer</a> msg_id:<a href='/type/int'>int</a> reactions:<a href='/type/MessageReactions'>MessageReactions</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/messageReactions'>messageReactions</a>#4f2b9479 flags:<a href='/type/%23'>#</a> min:flags.0?<a href='/constructor/true'>true</a> can_see_list:flags.2?<a href='/constructor/true'>true</a> results:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ReactionCount'>ReactionCount</a>&gt; recent_reactions:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessagePeerReaction'>MessagePeerReaction</a>&gt; = <a href='/type/MessageReactions'>MessageReactions</a>;
<a href='/constructor/reactionCount'>reactionCount</a>#6fb250d1 flags:<a href='/type/%23'>#</a> chosen:flags.0?<a href='/constructor/true'>true</a> reaction:<a href='/type/string'>string</a> count:<a href='/type/int'>int</a> = <a href='/type/ReactionCount'>ReactionCount</a>;
<a href='/constructor/messagePeerReaction'>messagePeerReaction</a>#51b67eff flags:<a href='/type/%23'>#</a> big:flags.0?<a href='/constructor/true'>true</a> unread:flags.1?<a href='/constructor/true'>true</a> peer_id:<a href='/type/Peer'>Peer</a> reaction:<a href='/type/string'>string</a> = <a href='/type/MessagePeerReaction'>MessagePeerReaction</a>;
<a href='/constructor/messages.messageReactionsList'>messages.messageReactionsList</a>#31bd492d flags:<a href='/type/%23'>#</a> count:<a href='/type/int'>int</a> reactions:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessagePeerReaction'>MessagePeerReaction</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; next_offset:flags.0?<a href='/type/string'>string</a> = <a href='/type/messages.MessageReactionsList'>messages.MessageReactionsList</a>;
---functions---
<a href='/method/messages.sendReaction'>messages.sendReaction</a>#25690ce4 flags:<a href='/type/%23'>#</a> big:flags.1?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> msg_id:<a href='/type/int'>int</a> reaction:flags.0?<a href='/type/string'>string</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.getMessagesReactions'>messages.getMessagesReactions</a>#8bba90e6 peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.getMessageReactionsList'>messages.getMessageReactionsList</a>#e0ee6b77 flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/int'>int</a> reaction:flags.0?<a href='/type/string'>string</a> offset:flags.1?<a href='/type/string'>string</a> limit:<a href='/type/int'>int</a> = <a href='/type/messages.MessageReactionsList'>messages.MessageReactionsList</a>;
<a href='/method/messages.getUnreadReactions'>messages.getUnreadReactions</a>#e85bae1a peer:<a href='/type/InputPeer'>InputPeer</a> offset_id:<a href='/type/int'>int</a> add_offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> max_id:<a href='/type/int'>int</a> min_id:<a href='/type/int'>int</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/method/messages.readReactions'>messages.readReactions</a>#82e251d7 peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/messages.AffectedHistory'>messages.AffectedHistory</a>;</code></pre>
<p>Users can react to a message using <a href="/method/messages.sendReaction">messages.sendReaction</a>: the <code>big</code> flag can be optionally set to elicit a bigger reaction.<br>
Message authors will receive an <a href="/constructor/updateMessageReactions">updateMessageReactions</a> update when a user reacts to their message. </p>
<p><a href="/method/messages.getMessagesReactions">messages.getMessagesReactions</a> can be used to fetch a full list of reactions for one or more messages.<br>
Apps should short-poll reactions for visible messages (that weren't sent by the user) once every 15-30 seconds, but only if <code>message.reactions</code> is set. </p>
<p>In groups, <a href="/method/messages.getMessageReactionsList">messages.getMessageReactionsList</a> can be used to fetch the reaction list, along with the sender of each reaction. </p>
<p><a href="/method/messages.getUnreadReactions">messages.getUnreadReactions</a> is used to fetch messages with unread reactions.<br>
Use <a href="/method/messages.readReactions">messages.readReactions</a> to mark all reactions as read in a certain chat.</p>
<h2><a class="anchor" href="#fetch-globally-available-reactions" id="fetch-globally-available-reactions" name="fetch-globally-available-reactions"><i class="anchor-icon"></i></a>Fetch globally available reactions</h2>
<pre><code><a href='/constructor/availableReaction'>availableReaction</a>#c077ec01 flags:<a href='/type/%23'>#</a> inactive:flags.0?<a href='/constructor/true'>true</a> reaction:<a href='/type/string'>string</a> title:<a href='/type/string'>string</a> static_icon:<a href='/type/Document'>Document</a> appear_animation:<a href='/type/Document'>Document</a> select_animation:<a href='/type/Document'>Document</a> activate_animation:<a href='/type/Document'>Document</a> effect_animation:<a href='/type/Document'>Document</a> around_animation:flags.1?<a href='/type/Document'>Document</a> center_icon:flags.1?<a href='/type/Document'>Document</a> = <a href='/type/AvailableReaction'>AvailableReaction</a>;
<a href='/constructor/messages.availableReactionsNotModified'>messages.availableReactionsNotModified</a>#9f071957 = <a href='/type/messages.AvailableReactions'>messages.AvailableReactions</a>;
<a href='/constructor/messages.availableReactions'>messages.availableReactions</a>#768e3aad hash:<a href='/type/int'>int</a> reactions:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/AvailableReaction'>AvailableReaction</a>&gt; = <a href='/type/messages.AvailableReactions'>messages.AvailableReactions</a>;
---functions---
<a href='/method/messages.getAvailableReactions'>messages.getAvailableReactions</a>#18dea0ac hash:<a href='/type/int'>int</a> = <a href='/type/messages.AvailableReactions'>messages.AvailableReactions</a>;</code></pre>
<p><a href="/method/messages.getAvailableReactions">messages.getAvailableReactions</a> can be used to fetch the full list of reactions that can be used on Telegram.<br>
The returned vector of <a href="/constructor/availableReaction">availableReaction</a> contains multiple fields with lottie animated stickers and simple images that should be positioned, displayed and played appropriately in the UI, as described in the <a href="/constructor/availableReaction">constructor page »</a>. </p>
<h2><a class="anchor" href="#set-default-reaction" id="set-default-reaction" name="set-default-reaction"><i class="anchor-icon"></i></a>Set default reaction</h2>
<pre><code><a href='/constructor/jsonString'>jsonString</a>#b71e767a value:<a href='/type/string'>string</a> = <a href='/type/JSONValue'>JSONValue</a>;
<a href='/constructor/jsonObjectValue'>jsonObjectValue</a>#c0de1bd9 key:<a href='/type/string'>string</a> value:<a href='/type/JSONValue'>JSONValue</a> = <a href='/type/JSONObjectValue'>JSONObjectValue</a>;
<a href='/constructor/jsonObject'>jsonObject</a>#99c1d49d value:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/JSONObjectValue'>JSONObjectValue</a>&gt; = <a href='/type/JSONValue'>JSONValue</a>;
---functions---
<a href='/method/messages.setDefaultReaction'>messages.setDefaultReaction</a>#d960c4d4 reaction:<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/help.getAppConfig'>help.getAppConfig</a>#98914110 = <a href='/type/JSONValue'>JSONValue</a>;</code></pre>
<p><a href="/method/messages.setDefaultReaction">messages.setDefaultReaction</a> can be used to change the default emoji reaction to use in the quick reaction menu.<br>
This value is synced across devices and can be fetched using <a href="/api/config#client-configuration">help.getAppConfig, <code>reactions_default</code> field</a>.</p>
<h2><a class="anchor" href="#change-available-reactions-in-group-or-channel" id="change-available-reactions-in-group-or-channel" name="change-available-reactions-in-group-or-channel"><i class="anchor-icon"></i></a>Change available reactions in group or channel</h2>
<pre><code><a href='/constructor/channelAdminLogEventActionChangeAvailableReactions'>channelAdminLogEventActionChangeAvailableReactions</a>#9cf7f76a prev_value:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; new_value:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
---functions---
<a href='/method/messages.setChatAvailableReactions'>messages.setChatAvailableReactions</a>#14050ea6 peer:<a href='/type/InputPeer'>InputPeer</a> available_reactions:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/Updates'>Updates</a>;</code></pre>
<p><a href="/method/messages.getUnreadReactions">messages.getUnreadReactions</a> can be used to </p>
<p>Chat and channel administrators can use <a href="/method/messages.setChatAvailableReactions">messages.setChatAvailableReactions</a> to restrict the set of reactions that can be used in the chat or channel. </p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,157 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Admin log</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Both supergroups and channels offer a so-called [admin log](https://telegram.org/blog/admin-revolution), a log of recent relevant supergroup and channel actions, like the modification of group/channel settings or information on behalf of an admin, user kicks and bans, and more.">
<meta property="og:title" content="Admin log">
<meta property="og:image" content="">
<meta property="og:description" content="Both supergroups and channels offer a so-called [admin log](https://telegram.org/blog/admin-revolution), a log of recent relevant supergroup and channel actions, like the modification of group/channel settings or information on behalf of an admin, user kicks and bans, and more.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/recent-actions" >Admin log</a></li></ul></div>
<h1 id="dev_page_title">Admin log</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Both supergroups and channels offer a so-called <a href="https://telegram.org/blog/admin-revolution">admin log</a>, a log of recent relevant supergroup and channel actions, like the modification of group/channel settings or information on behalf of an admin, user kicks and bans, and more. </p>
<pre><code><a href='/constructor/channelAdminLogEventActionChangeTitle'>channelAdminLogEventActionChangeTitle</a>#e6dfb825 prev_value:<a href='/type/string'>string</a> new_value:<a href='/type/string'>string</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionChangeAbout'>channelAdminLogEventActionChangeAbout</a>#55188a2e prev_value:<a href='/type/string'>string</a> new_value:<a href='/type/string'>string</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionChangeUsername'>channelAdminLogEventActionChangeUsername</a>#6a4afc38 prev_value:<a href='/type/string'>string</a> new_value:<a href='/type/string'>string</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionChangePhoto'>channelAdminLogEventActionChangePhoto</a>#434bd2af prev_photo:<a href='/type/Photo'>Photo</a> new_photo:<a href='/type/Photo'>Photo</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionToggleInvites'>channelAdminLogEventActionToggleInvites</a>#1b7907ae new_value:<a href='/type/Bool'>Bool</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionToggleSignatures'>channelAdminLogEventActionToggleSignatures</a>#26ae0971 new_value:<a href='/type/Bool'>Bool</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionUpdatePinned'>channelAdminLogEventActionUpdatePinned</a>#e9e82c18 message:<a href='/type/Message'>Message</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionEditMessage'>channelAdminLogEventActionEditMessage</a>#709b2405 prev_message:<a href='/type/Message'>Message</a> new_message:<a href='/type/Message'>Message</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionDeleteMessage'>channelAdminLogEventActionDeleteMessage</a>#42e047bb message:<a href='/type/Message'>Message</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionParticipantJoin'>channelAdminLogEventActionParticipantJoin</a>#183040d3 = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionParticipantLeave'>channelAdminLogEventActionParticipantLeave</a>#f89777f2 = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionParticipantInvite'>channelAdminLogEventActionParticipantInvite</a>#e31c34d8 participant:<a href='/type/ChannelParticipant'>ChannelParticipant</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionParticipantToggleBan'>channelAdminLogEventActionParticipantToggleBan</a>#e6d83d7e prev_participant:<a href='/type/ChannelParticipant'>ChannelParticipant</a> new_participant:<a href='/type/ChannelParticipant'>ChannelParticipant</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionParticipantToggleAdmin'>channelAdminLogEventActionParticipantToggleAdmin</a>#d5676710 prev_participant:<a href='/type/ChannelParticipant'>ChannelParticipant</a> new_participant:<a href='/type/ChannelParticipant'>ChannelParticipant</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionChangeStickerSet'>channelAdminLogEventActionChangeStickerSet</a>#b1c3caa7 prev_stickerset:<a href='/type/InputStickerSet'>InputStickerSet</a> new_stickerset:<a href='/type/InputStickerSet'>InputStickerSet</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionTogglePreHistoryHidden'>channelAdminLogEventActionTogglePreHistoryHidden</a>#5f5c95f1 new_value:<a href='/type/Bool'>Bool</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionDefaultBannedRights'>channelAdminLogEventActionDefaultBannedRights</a>#2df5fc0a prev_banned_rights:<a href='/type/ChatBannedRights'>ChatBannedRights</a> new_banned_rights:<a href='/type/ChatBannedRights'>ChatBannedRights</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionStopPoll'>channelAdminLogEventActionStopPoll</a>#8f079643 message:<a href='/type/Message'>Message</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionChangeLinkedChat'>channelAdminLogEventActionChangeLinkedChat</a>#50c7ac8 prev_value:<a href='/type/long'>long</a> new_value:<a href='/type/long'>long</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionChangeLocation'>channelAdminLogEventActionChangeLocation</a>#e6b76ae prev_value:<a href='/type/ChannelLocation'>ChannelLocation</a> new_value:<a href='/type/ChannelLocation'>ChannelLocation</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEventActionToggleSlowMode'>channelAdminLogEventActionToggleSlowMode</a>#53909779 prev_value:<a href='/type/int'>int</a> new_value:<a href='/type/int'>int</a> = <a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a>;
<a href='/constructor/channelAdminLogEvent'>channelAdminLogEvent</a>#1fad68cd id:<a href='/type/long'>long</a> date:<a href='/type/int'>int</a> user_id:<a href='/type/long'>long</a> action:<a href='/type/ChannelAdminLogEventAction'>ChannelAdminLogEventAction</a> = <a href='/type/ChannelAdminLogEvent'>ChannelAdminLogEvent</a>;
<a href='/constructor/channels.adminLogResults'>channels.adminLogResults</a>#ed8af74d events:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ChannelAdminLogEvent'>ChannelAdminLogEvent</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/channels.AdminLogResults'>channels.AdminLogResults</a>;
<a href='/constructor/channelAdminLogEventsFilter'>channelAdminLogEventsFilter</a>#ea107ae4 flags:<a href='/type/%23'>#</a> join:flags.0?<a href='/constructor/true'>true</a> leave:flags.1?<a href='/constructor/true'>true</a> invite:flags.2?<a href='/constructor/true'>true</a> ban:flags.3?<a href='/constructor/true'>true</a> unban:flags.4?<a href='/constructor/true'>true</a> kick:flags.5?<a href='/constructor/true'>true</a> unkick:flags.6?<a href='/constructor/true'>true</a> promote:flags.7?<a href='/constructor/true'>true</a> demote:flags.8?<a href='/constructor/true'>true</a> info:flags.9?<a href='/constructor/true'>true</a> settings:flags.10?<a href='/constructor/true'>true</a> pinned:flags.11?<a href='/constructor/true'>true</a> edit:flags.12?<a href='/constructor/true'>true</a> delete:flags.13?<a href='/constructor/true'>true</a> group_call:flags.14?<a href='/constructor/true'>true</a> invites:flags.15?<a href='/constructor/true'>true</a> send:flags.16?<a href='/constructor/true'>true</a> = <a href='/type/ChannelAdminLogEventsFilter'>ChannelAdminLogEventsFilter</a>;
---functions---
<a href='/method/channels.getAdminLog'>channels.getAdminLog</a>#33ddf480 flags:<a href='/type/%23'>#</a> channel:<a href='/type/InputChannel'>InputChannel</a> q:<a href='/type/string'>string</a> events_filter:flags.0?<a href='/type/ChannelAdminLogEventsFilter'>ChannelAdminLogEventsFilter</a> admins:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputUser'>InputUser</a>&gt; max_id:<a href='/type/long'>long</a> min_id:<a href='/type/long'>long</a> limit:<a href='/type/int'>int</a> = <a href='/type/channels.AdminLogResults'>channels.AdminLogResults</a>;</code></pre>
<p><a href="/method/channels.getAdminLog">channels.getAdminLog</a> can be used to list recent admin activity.<br>
A <a href="/constructor/channelAdminLogEventsFilter">channelAdminLogEventsFilter</a> can be used to filter out actions of a certain type, and the <code>admins</code> field can be used to show only actions by certain admins.<br>
<code>q</code> can also be used to filter only logs matching a query string. </p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,136 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Admin, banned, default rights</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to handle admin permissions, granular bans and global permissions in channels, groups and supergroups.">
<meta property="og:title" content="Admin, banned, default rights">
<meta property="og:image" content="d82fcde297bd0276c3">
<meta property="og:description" content="How to handle admin permissions, granular bans and global permissions in channels, groups and supergroups.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/rights" >Admin, banned, default rights</a></li></ul></div>
<h1 id="dev_page_title">Admin, banned, default rights</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p><a href="/api/channel">Channels and supergroups</a> allow setting <a href="https://telegram.org/blog/permissions-groups-undo">granular permissions</a> both for admins and specific users.
<a href="/api/channel">Channels, supergroups and basic groups</a> also allow setting global granular permissions for users.</p>
<p>They can be modified as follows:</p>
<h3><a class="anchor" href="#admin-rights" id="admin-rights" name="admin-rights"><i class="anchor-icon"></i></a>Admin rights</h3>
<p><a href="/method/channels.editAdmin">channels.editAdmin</a> can be used to modify the admin rights of a user in a channel or supergroup.
<a href="/api/channel#basic-groups">Basic groups</a> do not allow setting granular admin permissions, <a href="/method/messages.editChatAdmin">messages.editChatAdmin</a> has to be used, instead.</p>
<p>Permissions are defined by the <a href="/constructor/chatAdminRights">chatAdminRights</a> constructor, some admin rights can only be used for channels, others both for channels and supergroups (see the constructor page).</p>
<h3><a class="anchor" href="#banned-rights" id="banned-rights" name="banned-rights"><i class="anchor-icon"></i></a>Banned rights</h3>
<p><a href="/method/channels.editBanned">channels.editBanned</a> can be used to modify the rights of a user in a channel or supergroup, to ban/kick a user from the group, or restrict the user from doing certain things.
<a href="/api/channel#basic-groups">Basic groups</a> do not allow setting granular user permissions for single users, single users can only be removed from groups using <a href="/method/messages.deleteChatUser">messages.deleteChatUser</a>: however, setting <a href="#default-rights">global granular permissions with basic groups is supported</a>.</p>
<p>Permissions are defined by the <a href="/constructor/chatBannedRights">chatBannedRights</a> constructor, for more info see the constructor page.</p>
<h3><a class="anchor" href="#default-rights" id="default-rights" name="default-rights"><i class="anchor-icon"></i></a>Default rights</h3>
<p><a href="/method/messages.editChatDefaultBannedRights">messages.editChatDefaultBannedRights</a> can be used to modify the rights of <strong>all</strong> users in a <a href="/api/channel#channels">channel</a>, <a href="/api/channel#supergroups">supergroup</a> or <a href="/api/channel#basic-groups">basic group</a>, to restrict them from doing certain things.</p>
<p>Permissions are defined by the <a href="/constructor/chatBannedRights">chatBannedRights</a> constructor: all flags can be used except for <code>view_messages</code>, for more info see the constructor page.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,159 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Scheduled messages</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows scheduling messages">
<meta property="og:title" content="Scheduled messages">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows scheduling messages">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/scheduled-messages" >Scheduled messages</a></li></ul></div>
<h1 id="dev_page_title">Scheduled messages</h1>
<div id="dev_page_content"><p>Telegram allows scheduling messages.</p>
<pre><code><a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/updateNewScheduledMessage'>updateNewScheduledMessage</a>#39a51dfb message:<a href='/type/Message'>Message</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/updateDeleteScheduledMessages'>updateDeleteScheduledMessages</a>#90866cee peer:<a href='/type/Peer'>Peer</a> messages:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.sendMessage'>messages.sendMessage</a>#d9d75a4 flags:<a href='/type/%23'>#</a> no_webpage:flags.1?<a href='/constructor/true'>true</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.sendMedia'>messages.sendMedia</a>#e25ff8e0 flags:<a href='/type/%23'>#</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> media:<a href='/type/InputMedia'>InputMedia</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>To schedule a message, simply provide a future unixtime in the <code>schedule_date</code> flag of <a href="/method/messages.sendMessage">messages.sendMessage</a> or <a href="/method/messages.sendMedia">messages.sendMedia</a>. </p>
<p>The specified message or media will be added to a server-side schedule queue for the current chat, and will be automatically sent at the specified time.<br>
The method call generates the following updates:</p>
<ul>
<li>Immediately, an <a href="/constructor/updateNewScheduledMessage">updateNewScheduledMessage</a>, with ID equal to the ID of the message in the schedule queue for the current chat (each PM, chat, supergroup and channel has its own schedule queue and ID sequence).</li>
<li>At <code>schedule_date</code>, an <a href="/constructor/updateNewMessage">updateNewMessage</a> or <a href="/constructor/updateNewChannelMessage">updateNewChannelMessage</a> with the <code>from_scheduled</code> flag set, indicating to the sender that the specified scheduled message was sent. </li>
<li>At <code>schedule_date</code>, an <a href="/constructor/updateDeleteScheduledMessages">updateDeleteScheduledMessages</a>, indicating that the message was flushed from the schedule queue.</li>
</ul>
<p>If the <code>schedule_date</code> is less than 10 seconds in the future, the message will be sent immediately, generating a normal <a href="/constructor/updateNewMessage">updateNewMessage</a>/<a href="/constructor/updateNewChannelMessage">updateNewChannelMessage</a> . </p>
<h3><a class="anchor" href="#manipulating-the-schedule-queue" id="manipulating-the-schedule-queue" name="manipulating-the-schedule-queue"><i class="anchor-icon"></i></a>Manipulating the schedule queue</h3>
<pre><code><a href='/constructor/updateNewScheduledMessage'>updateNewScheduledMessage</a>#39a51dfb message:<a href='/type/Message'>Message</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/updateDeleteScheduledMessages'>updateDeleteScheduledMessages</a>#90866cee peer:<a href='/type/Peer'>Peer</a> messages:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.getScheduledHistory'>messages.getScheduledHistory</a>#f516760b peer:<a href='/type/InputPeer'>InputPeer</a> hash:<a href='/type/long'>long</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/method/messages.getScheduledMessages'>messages.getScheduledMessages</a>#bdbb0464 peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/method/messages.sendScheduledMessages'>messages.sendScheduledMessages</a>#bd38850a peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.deleteScheduledMessages'>messages.deleteScheduledMessages</a>#59ae2b16 peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/Updates'>Updates</a>;
<a href='/method/messages.editMessage'>messages.editMessage</a>#48f71778 flags:<a href='/type/%23'>#</a> no_webpage:flags.1?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> id:<a href='/type/int'>int</a> message:flags.11?<a href='/type/string'>string</a> media:flags.14?<a href='/type/InputMedia'>InputMedia</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.15?<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>Clients can manually edit the schedule queue of a certain chat, providing the scheduled message ID obtained from <a href="/constructor/updateNewScheduledMessage">updateNewScheduledMessage</a>. </p>
<ul>
<li><a href="/method/messages.getScheduledHistory">messages.getScheduledHistory</a> obtains all messages in the schedule queue for the specified chat</li>
<li><a href="/method/messages.getScheduledMessages">messages.getScheduledMessages</a> obtains information about specific messages in the schedule queue for the specified chat</li>
<li><a href="/method/messages.sendScheduledMessages">messages.sendScheduledMessages</a> flushes messages from the schedule queue, sending them immediately</li>
<li><a href="/method/messages.deleteScheduledMessages">messages.deleteScheduledMessages</a> deletes messages from the schedule queue, without sending them</li>
<li><a href="/method/messages.editMessage">messages.editMessage</a> can be used to modify the scheduled date of a specific message in a schedule queue. </li>
</ul>
<p>Modifying scheduled messages will generate an <a href="/constructor/updateNewScheduledMessage">updateNewScheduledMessage</a> with the same ID, and updated information.<br>
Deleting scheduled messages will generate an <a href="/constructor/updateDeleteScheduledMessages">updateDeleteScheduledMessages</a>. </p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,182 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Search</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows applying detailed message filters while looking for messages in chats.">
<meta property="og:title" content="Search">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows applying detailed message filters while looking for messages in chats.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/search" >Search</a></li></ul></div>
<h1 id="dev_page_title">Search</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows applying detailed message filters while looking for messages in chats.</p>
<h3><a class="anchor" href="#search-filters" id="search-filters" name="search-filters"><i class="anchor-icon"></i></a>Search filters</h3>
<pre><code><a href='/constructor/inputMessagesFilterEmpty'>inputMessagesFilterEmpty</a>#57e2f66c = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterPhotos'>inputMessagesFilterPhotos</a>#9609a51c = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterVideo'>inputMessagesFilterVideo</a>#9fc00e65 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterPhotoVideo'>inputMessagesFilterPhotoVideo</a>#56e9f0e4 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterDocument'>inputMessagesFilterDocument</a>#9eddf188 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterUrl'>inputMessagesFilterUrl</a>#7ef0dd87 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterGif'>inputMessagesFilterGif</a>#ffc86587 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterVoice'>inputMessagesFilterVoice</a>#50f5c392 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterMusic'>inputMessagesFilterMusic</a>#3751b49e = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterChatPhotos'>inputMessagesFilterChatPhotos</a>#3a20ecb8 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterPhoneCalls'>inputMessagesFilterPhoneCalls</a>#80c99768 flags:<a href='/type/%23'>#</a> missed:flags.0?<a href='/constructor/true'>true</a> = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterRoundVoice'>inputMessagesFilterRoundVoice</a>#7a7c17a4 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterRoundVideo'>inputMessagesFilterRoundVideo</a>#b549da53 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterMyMentions'>inputMessagesFilterMyMentions</a>#c1f8e69a = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterGeo'>inputMessagesFilterGeo</a>#e7026d0d = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterContacts'>inputMessagesFilterContacts</a>#e062db83 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterPinned'>inputMessagesFilterPinned</a>#1bb00451 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/messages.messages'>messages.messages</a>#8c718e87 messages:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Message'>Message</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/constructor/messages.messagesSlice'>messages.messagesSlice</a>#3a54685e flags:<a href='/type/%23'>#</a> inexact:flags.1?<a href='/constructor/true'>true</a> count:<a href='/type/int'>int</a> next_rate:flags.0?<a href='/type/int'>int</a> offset_id_offset:flags.2?<a href='/type/int'>int</a> messages:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Message'>Message</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/constructor/messages.channelMessages'>messages.channelMessages</a>#64479808 flags:<a href='/type/%23'>#</a> inexact:flags.1?<a href='/constructor/true'>true</a> pts:<a href='/type/int'>int</a> count:<a href='/type/int'>int</a> offset_id_offset:flags.2?<a href='/type/int'>int</a> messages:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Message'>Message</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/constructor/messages.messagesNotModified'>messages.messagesNotModified</a>#74535f21 count:<a href='/type/int'>int</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
---functions---
<a href='/method/messages.search'>messages.search</a>#a0fda762 flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> q:<a href='/type/string'>string</a> from_id:flags.0?<a href='/type/InputPeer'>InputPeer</a> top_msg_id:flags.1?<a href='/type/int'>int</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> min_date:<a href='/type/int'>int</a> max_date:<a href='/type/int'>int</a> offset_id:<a href='/type/int'>int</a> add_offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> max_id:<a href='/type/int'>int</a> min_id:<a href='/type/int'>int</a> hash:<a href='/type/long'>long</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/method/messages.searchGlobal'>messages.searchGlobal</a>#4bc6589a flags:<a href='/type/%23'>#</a> folder_id:flags.0?<a href='/type/int'>int</a> q:<a href='/type/string'>string</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> min_date:<a href='/type/int'>int</a> max_date:<a href='/type/int'>int</a> offset_rate:<a href='/type/int'>int</a> offset_peer:<a href='/type/InputPeer'>InputPeer</a> offset_id:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/messages.Messages'>messages.Messages</a>;</code></pre>
<p>When using <a href="/method/messages.search">messages.search</a> or <a href="/method/messages.searchGlobal">messages.searchGlobal</a>, a certain message filter may be applied.<br>
This allows the server to filter messages based on a text query, and even on their type, and this feature is often used by graphical clients to implement features like the chat gallery, chat profile pictures and more.
Available filters:</p>
<ul>
<li><a href="/constructor/inputMessagesFilterPhotos">inputMessagesFilterPhotos</a> - Returns only photos, used for implementing the chat photo gallery, and when scrolling left or right while viewing a photo</li>
<li><a href="/constructor/inputMessagesFilterVideo">inputMessagesFilterVideo</a> - Returns only videos, used for implementing the chat video gallery, and when scrolling left or right while viewing a video</li>
<li><a href="/constructor/inputMessagesFilterPhotoVideo">inputMessagesFilterPhotoVideo</a> - Return only videos and photos, used for implementing the chat media gallery</li>
<li><a href="/constructor/inputMessagesFilterDocument">inputMessagesFilterDocument</a> - Return only videos and photos, used for implementing the chat document gallery</li>
<li><a href="/constructor/inputMessagesFilterUrl">inputMessagesFilterUrl</a> - Return only messages with links, used for implementing the chat link gallery</li>
<li><a href="/constructor/inputMessagesFilterGif">inputMessagesFilterGif</a> - Return only GIFs, used for implementing the chat GIF gallery</li>
<li><a href="/constructor/inputMessagesFilterVoice">inputMessagesFilterVoice</a> - Return only voice messages, used for implementing the chat voice message gallery, and to consecutively play voice messages in a chat</li>
<li><a href="/constructor/inputMessagesFilterMusic">inputMessagesFilterMusic</a> - Return only music files, used for implementing the chat music gallery</li>
<li><a href="/constructor/inputMessagesFilterChatPhotos">inputMessagesFilterChatPhotos</a> - Return only chat photos, used to allow scrolling through the profile picture history of a group</li>
<li><a href="/constructor/inputMessagesFilterPhoneCalls">inputMessagesFilterPhoneCalls</a> - Return only phone calls, used with <a href="/method/messages.searchGlobal">messages.searchGlobal</a> to implement the call tab, with the phone call history</li>
<li><a href="/constructor/inputMessagesFilterRoundVoice">inputMessagesFilterRoundVoice</a> - Return only round videos and voice messages, used to consecutively play round videos and voice messages in a chat</li>
<li><a href="/constructor/inputMessagesFilterRoundVideo">inputMessagesFilterRoundVideo</a> - Return only round videos, used to consecutively play round videos in a chat</li>
<li><a href="/constructor/inputMessagesFilterMyMentions">inputMessagesFilterMyMentions</a> - Return only messages mentioning me, can be used to display the <a href="/api/mentions">mention history</a> or, combined with another filter or query, return only messages that satisfy a certain criteria, and contain a mention.</li>
<li><a href="/constructor/inputMessagesFilterGeo">inputMessagesFilterGeo</a> - Return only geolocations, is used to fetch all recent valid <a href="/api/live-location">geolocations or live locations</a> sent in a group, to display them all in a single map</li>
<li><a href="/constructor/inputMessagesFilterContacts">inputMessagesFilterContacts</a> - Return only contacts</li>
<li><a href="/constructor/inputMessagesFilterPinned">inputMessagesFilterPinned</a> - Returns only <a href="/api/pin">pinned messages</a>, used for implementing the pinned message list</li>
</ul>
<p>The returned <a href="/type/messages.Messages">messages.Messages</a> constructors contain parameters for <a href="/api/offsets">pagination</a>, the messages themselves and two <code>offset_id_offset</code>/<code>count</code> parameters that can be used to display a <code>progress/total</code> counter like <code>photo 134 of 200</code>.<br>
For example, when displaying the chat photo gallery, we could display a <code>photo ${offset_id_offset} of ${count}</code> indicator on top.</p>
<h4><a class="anchor" href="#search-counters" id="search-counters" name="search-counters"><i class="anchor-icon"></i></a>Search counters</h4>
<pre><code><a href='/constructor/messages.searchCounter'>messages.searchCounter</a>#e844ebff flags:<a href='/type/%23'>#</a> inexact:flags.1?<a href='/constructor/true'>true</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> count:<a href='/type/int'>int</a> = <a href='/type/messages.SearchCounter'>messages.SearchCounter</a>;
---functions---
<a href='/method/messages.getSearchCounters'>messages.getSearchCounters</a>#732eef00 peer:<a href='/type/InputPeer'>InputPeer</a> filters:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessagesFilter'>MessagesFilter</a>&gt; = <a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/messages.SearchCounter'>messages.SearchCounter</a>&gt;;</code></pre>
<p>Chat counters with filters can also be returned without fetching the actual messages, as seen in the schema above.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,310 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Two-factor authentication</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to login to a user&#39;s account if they have enabled 2FA, how to change password.">
<meta property="og:title" content="Two-factor authentication">
<meta property="og:image" content="566f538655672c95c6">
<meta property="og:description" content="How to login to a user&#39;s account if they have enabled 2FA, how to change password.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/srp" >Two-factor authentication</a></li></ul></div>
<h1 id="dev_page_title">Two-factor authentication</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram uses the <a href="https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol">Secure Remote Password protocol</a> version 6a to implement 2FA.</p>
<p>Example implementation: <a href="https://github.com/tdlib/td/blob/56163c2460a65afc4db2c57ece576b8c38ea194b/td/telegram/PasswordManager.cpp">tdlib</a>.</p>
<h3><a class="anchor" href="#checking-the-password-with-srp" id="checking-the-password-with-srp" name="checking-the-password-with-srp"><i class="anchor-icon"></i></a>Checking the password with SRP</h3>
<p>To login to an account protected by a 2FA password or to perform some other actions (like changing channel owner), you will need to verify the user's knowledge of the current 2FA account password.</p>
<p>To do this, first the client needs to obtain SRP parameters and the KDF algorithm to use to check the validity of the password via <a href="/method/account.getPassword">account.getPassword</a> method. For now, only the <a href="/constructor/passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow">passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow</a> algorithm is supported, so we'll only explain that.</p>
<p>Then, after the user provides a password, the client should generate an <a href="/type/InputCheckPasswordSRP">InputCheckPasswordSRP</a> object using SRP and a specific KDF algorithm as shown below and pass it to appropriate method (e.g. <a href="/method/auth.checkPassword">auth.checkPassword</a> in case of authorization).</p>
<p>This extension of the <a href="https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol">SRP protocol</a> uses the password-based <a href="https://en.wikipedia.org/wiki/PBKDF2">PBKDF2</a> with 100000 iterations using sha512 (<code>PBKDF2HMACSHA512iter100000</code>).
PBKDF2 is used to additionally rehash the <code>x</code> parameter, obtained using a method similar to the one described in <a href="https://tools.ietf.org/html/rfc2945#section-3">RFC 2945</a> (<code>H(s | H ( I | password | I) | s)</code> instead of <code>H(s | H ( I | ":" | password)</code>) (see below).</p>
<p>Here, <code>|</code> denotes concatenation and <code>+</code> denotes the arithmetical operator <code>+</code>.
In all cases where concatenation of numbers passed to hashing functions is done, the numbers must be used in big-endian form, padded to 2048 bits; all math is modulo <code>p</code>.
Instead of <code>I</code>, <code>salt1</code> will be used (see <a href="https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol">SRP protocol</a>).
Instead of <code>s</code>, <code>salt2</code> will be used (see <a href="https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol">SRP protocol</a>).</p>
<p>The main hashing function <code>H</code> is sha256:</p>
<ul>
<li><code>H(data) := sha256(data)</code></li>
</ul>
<p>The salting hashing function <code>SH</code> is defined as follows:</p>
<ul>
<li><code>SH(data, salt) := H(salt | data | salt)</code></li>
</ul>
<p>The primary password hashing function is defined as follows:</p>
<ul>
<li><code>PH1(password, salt1, salt2) := SH(SH(password, salt1), salt2)</code></li>
</ul>
<p>The secondary password hashing function is defined as follows:</p>
<ul>
<li><code>PH2(password, salt1, salt2) := SH(pbkdf2(sha512, PH1(password, salt1, salt2), salt1, 100000), salt2)</code></li>
</ul>
<p>Client-side, the following parameters are extracted from the <a href="/constructor/passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow">passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow</a> object, contained in the <a href="/constructor/account.password">account.password</a> object.</p>
<ul>
<li>
<p><code>g := algo.g</code></p>
</li>
<li>
<p><code>p := algo.p</code>
The client is expected to check whether <strong>p</strong> is a safe 2048-bit prime (meaning that both <strong>p</strong> and <strong>(p-1)/2</strong> are prime, and that <code>2^2047 &lt; p &lt; 2^2048</code>), 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 to avoid repeating lengthy computations in future. This cache might be shared with one used for <a href="/mtproto/auth_key">Authorization Key generation</a>.</p>
<p>If the client has an inadequate random number generator, it makes sense to use the <strong>secure_random</strong> of account.password as additional seed.</p>
</li>
<li>
<p><code>password := (user-provided password)</code></p>
</li>
<li>
<p><code>salt1 := algo.salt1</code></p>
</li>
<li>
<p><code>salt2 := algo.salt2</code></p>
</li>
<li>
<p><code>g_b := srp_B</code>
<code>srp_B</code> and <code>srp_id</code> are extracted from the <a href="/constructor/account.password">account.password</a> object.</p>
</li>
</ul>
<p>The <code>k</code> parameter is generated, both on client and server:</p>
<ul>
<li><code>k := H(p | g)</code></li>
</ul>
<p>The shared param <code>u</code> is generated: the client does this, and the server does the same with the <code>g_a</code> we will send him later (see below)</p>
<ul>
<li><code>u := H(g_a | g_b)</code></li>
</ul>
<p>The final parameters are generated client-side only:</p>
<ul>
<li><code>x := PH2(password, salt1, salt2)</code></li>
<li><code>v := pow(g, x) mod p</code></li>
</ul>
<p>The server already has <code>v</code>, from when we set the password.</p>
<p>A final shared param is generated, for commodity:</p>
<ul>
<li><code>k_v := (k * v) mod p</code></li>
</ul>
<p>Finally, the <a href="https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol#Protocol">key exchange process</a> starts on both parties.</p>
<p>The client computes a 2048-bit number <strong>a</strong> (using sufficient entropy or the server's <strong>random</strong>; see above) and generates:</p>
<ul>
<li><code>g_a := pow(g, a) mod p</code>.</li>
</ul>
<p>The server computes a 2048-bit number <strong>b</strong> using sufficient entropy and generates the <code>g_b</code> parameter that was sent to us (see above).</p>
<ul>
<li><code>g_b := (k_v + (pow(g, b) mod p)) mod p</code></li>
</ul>
<p>Finally, the <a href="https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol#Protocol">SRP session keys</a> are generated:</p>
<p>Client side: </p>
<ul>
<li><code>t := (g_b - k_v) mod p</code> (positive modulo, if the result is negative increment by <code>p</code>) </li>
<li><code>s_a := pow(t, a + u * x) mod p</code></li>
<li><code>k_a := H(s_a)</code></li>
</ul>
<p>Server side: </p>
<ul>
<li><code>s_b := pow(g_a * (pow(v, u) mod p), b) mod p</code></li>
<li><code>k_b := H(s_b)</code></li>
</ul>
<p>Since:</p>
<ul>
<li><code>g_b := (k_v + (pow(g, b) mod p)) mod p</code></li>
<li><code>t := (g_b - k_v) mod p</code></li>
<li><code>t := ((k_v + (pow(g, b) mod p)) - k_v) mod p</code></li>
<li><code>t := pow(g, b) mod p</code></li>
<li><code>s_a := pow(t, a + u * x) mod p</code></li>
<li><code>s_a := pow(pow(g, b) mod p, a + u * x) mod p</code></li>
</ul>
<p>And:</p>
<ul>
<li>
<p><code>g_a := pow(g, a) mod p</code></p>
</li>
<li>
<p><code>v := pow(g, x) mod p</code></p>
</li>
<li>
<p><code>s_b := pow(g_a * (pow(v, u) mod p), b) mod p</code></p>
</li>
<li>
<p><code>s_b := pow((pow(g, a) mod p) * (pow(pow(g, x) mod p, u) mod p), b) mod p</code></p>
</li>
<li>
<p><code>s_b := pow(pow(g, a + x * u) mod p, b) mod p</code></p>
</li>
<li>
<p><code>s_b := pow(pow(g, b) mod p, a + u * x) mod p</code></p>
</li>
<li>
<p><code>s_a := pow(pow(g, b) mod p, a + u * x) mod p</code></p>
</li>
</ul>
<p>This means:</p>
<ul>
<li><code>s_b === s_a</code></li>
<li><code>k_b === k_a</code></li>
</ul>
<p><strong>Finally, as per SRP</strong>:</p>
<ul>
<li><code>M1 := H(H(p) xor H(g) | H(salt1) | H(salt2) | g_a | g_b | k_a)</code></li>
</ul>
<p><code>M1</code> is passed to <a href="/constructor/inputCheckPasswordSRP">inputCheckPasswordSRP</a>, along with <code>g_a</code> (as <code>A</code> parameter) and the <code>srp_id</code>, extracted from the <a href="/constructor/account.password">account.password</a> object.</p>
<p>The server then computes:</p>
<ul>
<li><code>M2 := H(H(p) xor H(g) | H(salt1) | H(salt2) | g_a | g_b | k_b)</code></li>
</ul>
<p>Since we said that:</p>
<ul>
<li><code>s_b === s_a</code></li>
<li><code>k_b === k_a</code></li>
</ul>
<p>This means, if everything was done correctly,</p>
<ul>
<li><code>M1 === M2</code></li>
</ul>
<p>If the password isn't correct, <a href="/method/auth.checkPassword#possible-errors">400 PASSWORD_HASH_INVALID</a> will be returned.</p>
<h3><a class="anchor" href="#setting-a-new-2fa-password" id="setting-a-new-2fa-password" name="setting-a-new-2fa-password"><i class="anchor-icon"></i></a>Setting a new 2FA password</h3>
<p>To set a new 2FA password use the <a href="/method/account.updatePasswordSettings">account.updatePasswordSettings</a> method.<br>
If a password is already set, generate an InputCheckPasswordSRP object as per <a href="#checking-the-password-with-srp">checking passwords with SRP</a>, and insert it in the <code>password</code> field of the <a href="/method/account.updatePasswordSettings">account.updatePasswordSettings</a> method.<br>
To remove the current password, pass an empty <code>new_password_hash</code> in the <a href="/type/account.PasswordInputSettings">account.PasswordInputSettings</a> object.</p>
<p>To set a new password, use the SRP parameters and the KDF algorithm obtained using <a href="/method/account.getPassword">account.getPassword</a> when generating the <code>password</code> field.
Then generate a new <code>new_password_hash</code> using the KDF algorithm specified in the <code>new_settings</code>, just append 32 sufficiently random bytes to the <code>salt1</code>, first.
Proceed as for <a href="#checking-the-password-with-srp">checking passwords with SRP</a>, just stop at the generation of the <code>v</code> parameter, and use it as <code>new_password_hash</code>:</p>
<ul>
<li><code>v := pow(g, x) mod p</code></li>
</ul>
<p>As usual in big endian form, padded to 2048 bits.</p>
<h4><a class="anchor" href="#email-verification" id="email-verification" name="email-verification"><i class="anchor-icon"></i></a>Email verification</h4>
<p>When setting up two-factor authorization, it is recommended to set up a <strong>recovery email</strong>, to allow recovery of the password through the user's email address, in case they forget it.</p>
<p>To set up a recovery email, it must first be verified.
This can be done directly when setting the new password using <a href="/method/account.updatePasswordSettings">account.updatePasswordSettings</a> by setting the email parameter and flag in the <a href="/constructor/account.passwordInputSettings">account.passwordInputSettings</a> constructor.
If the email isn't verified, an <a href="/method/account.updatePasswordSettings#possible-errors">EMAIL_UNCONFIRMED_X 400 error</a> will be returned, where X is the length of the verification code that was just sent to the email.
Use <a href="/method/account.confirmPasswordEmail">account.confirmPasswordEmail</a> to enter the received verification code and enable the recovery email.
Use <a href="/method/account.resendPasswordEmail">account.resendPasswordEmail</a> to resend the verification code.
Use <a href="/method/account.cancelPasswordEmail">account.cancelPasswordEmail</a> to cancel the verification code.</p>
<p>To get the current recovery email, use <a href="/method/account.getPasswordSettings">account.getPasswordSettings</a>.</p>
<h4><a class="anchor" href="#email-recovery" id="email-recovery" name="email-recovery"><i class="anchor-icon"></i></a>Email recovery</h4>
<p>In order to recover a forgotten 2FA password, an email must be sent to the <a href="#email-verification">previously specified address</a> using the <a href="/method/auth.requestPasswordRecovery">auth.requestPasswordRecovery</a> method.<br>
Use <a href="/method/auth.checkRecoveryPassword">auth.checkRecoveryPassword</a> to make sure that the user provided a valid code.<br>
Then use <a href="/method/auth.recoverPassword">auth.recoverPassword</a> with the received code to delete the current 2FA password, to set a new one follow <a href="/api/srp">these instructions</a>.</p>
<h4><a class="anchor" href="#password-reset" id="password-reset" name="password-reset"><i class="anchor-icon"></i></a>Password reset</h4>
<pre><code><a href='/constructor/account.resetPasswordFailedWait'>account.resetPasswordFailedWait</a>#e3779861 retry_date:<a href='/type/int'>int</a> = <a href='/type/account.ResetPasswordResult'>account.ResetPasswordResult</a>;
<a href='/constructor/account.resetPasswordRequestedWait'>account.resetPasswordRequestedWait</a>#e9effc7d until_date:<a href='/type/int'>int</a> = <a href='/type/account.ResetPasswordResult'>account.ResetPasswordResult</a>;
<a href='/constructor/account.resetPasswordOk'>account.resetPasswordOk</a>#e926d63e = <a href='/type/account.ResetPasswordResult'>account.ResetPasswordResult</a>;
---functions---
<a href='/method/account.resetPassword'>account.resetPassword</a>#9308ce1b = <a href='/type/account.ResetPasswordResult'>account.ResetPasswordResult</a>;
<a href='/method/account.declinePasswordReset'>account.declinePasswordReset</a>#4c9409f6 = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>If the user is already logged in and has forgotten their 2FA password, <a href="/method/account.resetPassword">account.resetPassword</a> can be used to initiate a password reset.<br>
On success, the call will initially return a <a href="/constructor/account.resetPasswordRequestedWait">account.resetPasswordRequestedWait</a> constructor and start a 7-day server-side timer, during which the user can abort the reset process using a button sent by the Telegram service account or directly in-UI using <a href="/method/account.declinePasswordReset">account.declinePasswordReset</a>. </p>
<p>When the time comes, <a href="/method/account.resetPassword">account.resetPassword</a> is invoked once more, returning a <a href="/constructor/account.resetPasswordOk">account.resetPasswordOk</a> to indicate that the password was successfully reset. </p>
<p>If the user recently requested a password reset that was canceled, <a href="/constructor/account.resetPasswordFailedWait">account.resetPasswordFailedWait</a> will be returned by the initial <a href="/method/account.resetPassword">account.resetPassword</a> call, and they must wait until the specified date before requesting another reset. </p>
<p>Note that if the user already knows their 2FA password and simply wants to disable 2FA, <a href="#setting-a-new-2fa-password">the same process used to enable the password must also be used to disable it »</a>.</p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#srp-design" id="srp-design" name="srp-design"><i class="anchor-icon"></i></a><a href="http://srp.stanford.edu/design.html">SRP design</a></h4></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,318 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Channel statistics</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram offers detailed channel statistics for channels and supergroups.">
<meta property="og:title" content="Channel statistics">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram offers detailed channel statistics for channels and supergroups.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/stats" >Channel statistics</a></li></ul></div>
<h1 id="dev_page_title">Channel statistics</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram offers detailed channel statistics for channels and supergroups. </p>
<h3><a class="anchor" href="#channel-statistics" id="channel-statistics" name="channel-statistics"><i class="anchor-icon"></i></a>Channel statistics</h3>
<p>Schema:</p>
<pre><code><a href='/constructor/statsDateRangeDays'>statsDateRangeDays</a>#b637edaf min_date:<a href='/type/int'>int</a> max_date:<a href='/type/int'>int</a> = <a href='/type/StatsDateRangeDays'>StatsDateRangeDays</a>;
<a href='/constructor/statsAbsValueAndPrev'>statsAbsValueAndPrev</a>#cb43acde current:<a href='/type/double'>double</a> previous:<a href='/type/double'>double</a> = <a href='/type/StatsAbsValueAndPrev'>StatsAbsValueAndPrev</a>;
<a href='/constructor/statsPercentValue'>statsPercentValue</a>#cbce2fe0 part:<a href='/type/double'>double</a> total:<a href='/type/double'>double</a> = <a href='/type/StatsPercentValue'>StatsPercentValue</a>;
<a href='/constructor/statsGraphAsync'>statsGraphAsync</a>#4a27eb2d token:<a href='/type/string'>string</a> = <a href='/type/StatsGraph'>StatsGraph</a>;
<a href='/constructor/statsGraphError'>statsGraphError</a>#bedc9822 error:<a href='/type/string'>string</a> = <a href='/type/StatsGraph'>StatsGraph</a>;
<a href='/constructor/statsGraph'>statsGraph</a>#8ea464b6 flags:<a href='/type/%23'>#</a> json:<a href='/type/DataJSON'>DataJSON</a> zoom_token:flags.0?<a href='/type/string'>string</a> = <a href='/type/StatsGraph'>StatsGraph</a>;
<a href='/constructor/messageInteractionCounters'>messageInteractionCounters</a>#ad4fc9bd msg_id:<a href='/type/int'>int</a> views:<a href='/type/int'>int</a> forwards:<a href='/type/int'>int</a> = <a href='/type/MessageInteractionCounters'>MessageInteractionCounters</a>;
<a href='/constructor/stats.broadcastStats'>stats.broadcastStats</a>#bdf78394 period:<a href='/type/StatsDateRangeDays'>StatsDateRangeDays</a> followers:<a href='/type/StatsAbsValueAndPrev'>StatsAbsValueAndPrev</a> views_per_post:<a href='/type/StatsAbsValueAndPrev'>StatsAbsValueAndPrev</a> shares_per_post:<a href='/type/StatsAbsValueAndPrev'>StatsAbsValueAndPrev</a> enabled_notifications:<a href='/type/StatsPercentValue'>StatsPercentValue</a> growth_graph:<a href='/type/StatsGraph'>StatsGraph</a> followers_graph:<a href='/type/StatsGraph'>StatsGraph</a> mute_graph:<a href='/type/StatsGraph'>StatsGraph</a> top_hours_graph:<a href='/type/StatsGraph'>StatsGraph</a> interactions_graph:<a href='/type/StatsGraph'>StatsGraph</a> iv_interactions_graph:<a href='/type/StatsGraph'>StatsGraph</a> views_by_source_graph:<a href='/type/StatsGraph'>StatsGraph</a> new_followers_by_source_graph:<a href='/type/StatsGraph'>StatsGraph</a> languages_graph:<a href='/type/StatsGraph'>StatsGraph</a> recent_message_interactions:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageInteractionCounters'>MessageInteractionCounters</a>&gt; = <a href='/type/stats.BroadcastStats'>stats.BroadcastStats</a>;
<a href='/constructor/messages.chatFull'>messages.chatFull</a>#e5d7d19c full_chat:<a href='/type/ChatFull'>ChatFull</a> chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ChatFull'>messages.ChatFull</a>;
<a href='/constructor/channelFull'>channelFull</a>#e13c3d20 flags:<a href='/type/%23'>#</a> can_view_participants:flags.3?<a href='/constructor/true'>true</a> can_set_username:flags.6?<a href='/constructor/true'>true</a> can_set_stickers:flags.7?<a href='/constructor/true'>true</a> hidden_prehistory:flags.10?<a href='/constructor/true'>true</a> can_set_location:flags.16?<a href='/constructor/true'>true</a> has_scheduled:flags.19?<a href='/constructor/true'>true</a> can_view_stats:flags.20?<a href='/constructor/true'>true</a> blocked:flags.22?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants_count:flags.0?<a href='/type/int'>int</a> admins_count:flags.1?<a href='/type/int'>int</a> kicked_count:flags.2?<a href='/type/int'>int</a> banned_count:flags.2?<a href='/type/int'>int</a> online_count:flags.13?<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> chat_photo:<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.23?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href='/type/long'>long</a> migrated_from_max_id:flags.4?<a href='/type/int'>int</a> pinned_msg_id:flags.5?<a href='/type/int'>int</a> stickerset:flags.8?<a href='/type/StickerSet'>StickerSet</a> available_min_id:flags.9?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> linked_chat_id:flags.14?<a href='/type/long'>long</a> location:flags.15?<a href='/type/ChannelLocation'>ChannelLocation</a> slowmode_seconds:flags.17?<a href='/type/int'>int</a> slowmode_next_send_date:flags.18?<a href='/type/int'>int</a> stats_dc:flags.12?<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> call:flags.21?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.24?<a href='/type/int'>int</a> pending_suggestions:flags.25?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; groupcall_default_join_as:flags.26?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.27?<a href='/type/string'>string</a> requests_pending:flags.28?<a href='/type/int'>int</a> recent_requesters:flags.28?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; default_send_as:flags.29?<a href='/type/Peer'>Peer</a> available_reactions:flags.30?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/ChatFull'>ChatFull</a>;
---functions---
<a href='/method/stats.getBroadcastStats'>stats.getBroadcastStats</a>#ab42441a flags:<a href='/type/%23'>#</a> dark:flags.0?<a href='/constructor/true'>true</a> channel:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/stats.BroadcastStats'>stats.BroadcastStats</a>;
<a href='/method/stats.loadAsyncGraph'>stats.loadAsyncGraph</a>#621d5fa0 flags:<a href='/type/%23'>#</a> token:<a href='/type/string'>string</a> x:flags.0?<a href='/type/long'>long</a> = <a href='/type/StatsGraph'>StatsGraph</a>;
<a href='/method/channels.getFullChannel'>channels.getFullChannel</a>#8736a09 channel:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/messages.ChatFull'>messages.ChatFull</a>;</code></pre>
<p>Administrators of <a href="/api/channel">channels</a> of a certain size (the exact limit is a server-side config, returned in the <code>can_view_stats</code> flag of <a href="/constructor/channelFull">channelFull</a>) can invoke <a href="/method/stats.getBroadcastStats">stats.getBroadcastStats</a> to get detailed channel statistics.<br>
The query must be sent to the datacenter with ID <code>channelFull.stats_dc</code>, obtainable using <a href="/method/channels.getFullChannel">channels.getFullChannel</a>.<br>
The returned <a href="/constructor/stats.broadcastStats">stats.broadcastStats</a> contains multiple statistics: </p>
<ul>
<li>Period-related statistics: a pair of values, one at the beginning and one at the end of the period in consideration (<code>period</code>). <br> The <code>period</code> typically depends on channel activity.<ul>
<li>Absolute follower count (<code>followers</code>)</li>
<li><code>total_viewcount/postcount</code>, for posts posted during the period in consideration (<code>views_per_post</code>).<br>
Note that in this case, <code>current</code> refers to the <code>period</code> in consideration (<code>min_date</code> till <code>max_date</code>), and <code>prev</code> refers to the previous period (<code>(min_date - (max_date - min_date))</code> till <code>min_date</code>). </li>
<li><code>total_sharecount/postcount</code>, for posts posted during the period in consideration (<code>shares_per_post</code>).<br>
Note that in this case, <code>current</code> refers to the <code>period</code> in consideration (<code>min_date</code> till <code>max_date</code>), and <code>prev</code> refers to the previous period (<code>(min_date - (max_date - min_date))</code> till <code>min_date</code>).</li>
</ul>
</li>
<li>Percentage statistics<ul>
<li>Percentage of subscribers with enabled notifications (<code>enabled_notifications</code>)</li>
</ul>
</li>
<li>Graphs: <a href="#graph-visualization">graphs are described below »</a>. </li>
</ul>
<h3><a class="anchor" href="#supergroup-statistics" id="supergroup-statistics" name="supergroup-statistics"><i class="anchor-icon"></i></a>Supergroup statistics</h3>
<p>Schema:</p>
<pre><code><a href='/constructor/statsGroupTopPoster'>statsGroupTopPoster</a>#9d04af9b user_id:<a href='/type/long'>long</a> messages:<a href='/type/int'>int</a> avg_chars:<a href='/type/int'>int</a> = <a href='/type/StatsGroupTopPoster'>StatsGroupTopPoster</a>;
<a href='/constructor/statsGroupTopInviter'>statsGroupTopInviter</a>#535f779d user_id:<a href='/type/long'>long</a> invitations:<a href='/type/int'>int</a> = <a href='/type/StatsGroupTopInviter'>StatsGroupTopInviter</a>;
<a href='/constructor/statsGroupTopAdmin'>statsGroupTopAdmin</a>#d7584c87 user_id:<a href='/type/long'>long</a> deleted:<a href='/type/int'>int</a> kicked:<a href='/type/int'>int</a> banned:<a href='/type/int'>int</a> = <a href='/type/StatsGroupTopAdmin'>StatsGroupTopAdmin</a>;
<a href='/constructor/stats.megagroupStats'>stats.megagroupStats</a>#ef7ff916 period:<a href='/type/StatsDateRangeDays'>StatsDateRangeDays</a> members:<a href='/type/StatsAbsValueAndPrev'>StatsAbsValueAndPrev</a> messages:<a href='/type/StatsAbsValueAndPrev'>StatsAbsValueAndPrev</a> viewers:<a href='/type/StatsAbsValueAndPrev'>StatsAbsValueAndPrev</a> posters:<a href='/type/StatsAbsValueAndPrev'>StatsAbsValueAndPrev</a> growth_graph:<a href='/type/StatsGraph'>StatsGraph</a> members_graph:<a href='/type/StatsGraph'>StatsGraph</a> new_members_by_source_graph:<a href='/type/StatsGraph'>StatsGraph</a> languages_graph:<a href='/type/StatsGraph'>StatsGraph</a> messages_graph:<a href='/type/StatsGraph'>StatsGraph</a> actions_graph:<a href='/type/StatsGraph'>StatsGraph</a> top_hours_graph:<a href='/type/StatsGraph'>StatsGraph</a> weekdays_graph:<a href='/type/StatsGraph'>StatsGraph</a> top_posters:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/StatsGroupTopPoster'>StatsGroupTopPoster</a>&gt; top_admins:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/StatsGroupTopAdmin'>StatsGroupTopAdmin</a>&gt; top_inviters:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/StatsGroupTopInviter'>StatsGroupTopInviter</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/stats.MegagroupStats'>stats.MegagroupStats</a>;
<a href='/constructor/messages.chatFull'>messages.chatFull</a>#e5d7d19c full_chat:<a href='/type/ChatFull'>ChatFull</a> chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ChatFull'>messages.ChatFull</a>;
<a href='/constructor/channelFull'>channelFull</a>#e13c3d20 flags:<a href='/type/%23'>#</a> can_view_participants:flags.3?<a href='/constructor/true'>true</a> can_set_username:flags.6?<a href='/constructor/true'>true</a> can_set_stickers:flags.7?<a href='/constructor/true'>true</a> hidden_prehistory:flags.10?<a href='/constructor/true'>true</a> can_set_location:flags.16?<a href='/constructor/true'>true</a> has_scheduled:flags.19?<a href='/constructor/true'>true</a> can_view_stats:flags.20?<a href='/constructor/true'>true</a> blocked:flags.22?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants_count:flags.0?<a href='/type/int'>int</a> admins_count:flags.1?<a href='/type/int'>int</a> kicked_count:flags.2?<a href='/type/int'>int</a> banned_count:flags.2?<a href='/type/int'>int</a> online_count:flags.13?<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> chat_photo:<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.23?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href='/type/long'>long</a> migrated_from_max_id:flags.4?<a href='/type/int'>int</a> pinned_msg_id:flags.5?<a href='/type/int'>int</a> stickerset:flags.8?<a href='/type/StickerSet'>StickerSet</a> available_min_id:flags.9?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> linked_chat_id:flags.14?<a href='/type/long'>long</a> location:flags.15?<a href='/type/ChannelLocation'>ChannelLocation</a> slowmode_seconds:flags.17?<a href='/type/int'>int</a> slowmode_next_send_date:flags.18?<a href='/type/int'>int</a> stats_dc:flags.12?<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> call:flags.21?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.24?<a href='/type/int'>int</a> pending_suggestions:flags.25?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; groupcall_default_join_as:flags.26?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.27?<a href='/type/string'>string</a> requests_pending:flags.28?<a href='/type/int'>int</a> recent_requesters:flags.28?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; default_send_as:flags.29?<a href='/type/Peer'>Peer</a> available_reactions:flags.30?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/ChatFull'>ChatFull</a>;
---functions---
<a href='/method/stats.getMegagroupStats'>stats.getMegagroupStats</a>#dcdf8607 flags:<a href='/type/%23'>#</a> dark:flags.0?<a href='/constructor/true'>true</a> channel:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/stats.MegagroupStats'>stats.MegagroupStats</a>;
<a href='/method/channels.getFullChannel'>channels.getFullChannel</a>#8736a09 channel:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/messages.ChatFull'>messages.ChatFull</a>;</code></pre>
<p>Administrators of <a href="/api/channel">supergroups</a> of a certain size (the exact limit is a server-side config, returned in the <code>can_view_stats</code> flag of <a href="/constructor/channelFull">channelFull</a>) can call <a href="/method/stats.getMegagroupStats">stats.getMegagroupStats</a> to get detailed supergroup statistics.<br>
The query must be sent to the datacenter with ID <code>channelFull.stats_dc</code>, obtainable using <a href="/method/channels.getFullChannel">channels.getFullChannel</a>.<br>
The returned <a href="/constructor/stats.broadcastStats">stats.broadcastStats</a> contains multiple statistics, see the <a href="/constructor/stats.broadcastStats">constructor page for more info »</a>. </p>
<h3><a class="anchor" href="#message-statistics" id="message-statistics" name="message-statistics"><i class="anchor-icon"></i></a>Message statistics</h3>
<pre><code><a href='/constructor/stats.messageStats'>stats.messageStats</a>#8999f295 views_graph:<a href='/type/StatsGraph'>StatsGraph</a> = <a href='/type/stats.MessageStats'>stats.MessageStats</a>;
<a href='/constructor/messages.chatFull'>messages.chatFull</a>#e5d7d19c full_chat:<a href='/type/ChatFull'>ChatFull</a> chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/messages.ChatFull'>messages.ChatFull</a>;
<a href='/constructor/channelFull'>channelFull</a>#e13c3d20 flags:<a href='/type/%23'>#</a> can_view_participants:flags.3?<a href='/constructor/true'>true</a> can_set_username:flags.6?<a href='/constructor/true'>true</a> can_set_stickers:flags.7?<a href='/constructor/true'>true</a> hidden_prehistory:flags.10?<a href='/constructor/true'>true</a> can_set_location:flags.16?<a href='/constructor/true'>true</a> has_scheduled:flags.19?<a href='/constructor/true'>true</a> can_view_stats:flags.20?<a href='/constructor/true'>true</a> blocked:flags.22?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants_count:flags.0?<a href='/type/int'>int</a> admins_count:flags.1?<a href='/type/int'>int</a> kicked_count:flags.2?<a href='/type/int'>int</a> banned_count:flags.2?<a href='/type/int'>int</a> online_count:flags.13?<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> chat_photo:<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.23?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href='/type/long'>long</a> migrated_from_max_id:flags.4?<a href='/type/int'>int</a> pinned_msg_id:flags.5?<a href='/type/int'>int</a> stickerset:flags.8?<a href='/type/StickerSet'>StickerSet</a> available_min_id:flags.9?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> linked_chat_id:flags.14?<a href='/type/long'>long</a> location:flags.15?<a href='/type/ChannelLocation'>ChannelLocation</a> slowmode_seconds:flags.17?<a href='/type/int'>int</a> slowmode_next_send_date:flags.18?<a href='/type/int'>int</a> stats_dc:flags.12?<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> call:flags.21?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.24?<a href='/type/int'>int</a> pending_suggestions:flags.25?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; groupcall_default_join_as:flags.26?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.27?<a href='/type/string'>string</a> requests_pending:flags.28?<a href='/type/int'>int</a> recent_requesters:flags.28?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; default_send_as:flags.29?<a href='/type/Peer'>Peer</a> available_reactions:flags.30?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; = <a href='/type/ChatFull'>ChatFull</a>;
---functions---
<a href='/method/stats.getMessageStats'>stats.getMessageStats</a>#b6e0a3f5 flags:<a href='/type/%23'>#</a> dark:flags.0?<a href='/constructor/true'>true</a> channel:<a href='/type/InputChannel'>InputChannel</a> msg_id:<a href='/type/int'>int</a> = <a href='/type/stats.MessageStats'>stats.MessageStats</a>;
<a href='/method/channels.getFullChannel'>channels.getFullChannel</a>#8736a09 channel:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/messages.ChatFull'>messages.ChatFull</a>;</code></pre>
<p>Administrators of <a href="/api/channel">channels</a> of a certain size (the exact limit is a server-side config, returned in the <code>can_view_stats</code> flag of <a href="/constructor/channelFull">channelFull</a>) can invoke <a href="/method/stats.getMessageStats">stats.getMessageStats</a> to get statistics of a specific message.<br>
The query must be sent to the datacenter with ID <code>channelFull.stats_dc</code>, obtainable using <a href="/method/channels.getFullChannel">channels.getFullChannel</a>.<br>
The returned <a href="/constructor/stats.messageStats">stats.messageStats</a> contains the view graph of the message. </p>
<h2><a class="anchor" href="#graph-visualization" id="graph-visualization" name="graph-visualization"><i class="anchor-icon"></i></a>Graph visualization</h2>
<p>There are four available visualizations for graph types:</p>
<ul>
<li><a href="#line-graph">Line graph</a></li>
<li><a href="#step-graph">Step graph</a></li>
<li><a href="#bar-graph">Bar graph</a></li>
<li><a href="#area-graph">Area graph</a></li>
</ul>
<p>Graph modifiers (see <a href="#graph-examples">various graphs</a> for examples): </p>
<ul>
<li><code>y_scaled</code> - Indicates that each of the two (!) lines in a step graph must be visualized on its own scale, with two different tick axes on the left and right parts of the graph</li>
<li><code>percentage</code> - Indicates whether value percentages should be shown in labels</li>
<li><code>stacked</code> - Depending on the graph type, indicates stacking of multiple columns in the same graph</li>
</ul>
<h3><a class="anchor" href="#graph-syntax" id="graph-syntax" name="graph-syntax"><i class="anchor-icon"></i></a>Graph syntax</h3>
<pre><code><a href='/constructor/statsGraphAsync'>statsGraphAsync</a>#4a27eb2d token:<a href='/type/string'>string</a> = <a href='/type/StatsGraph'>StatsGraph</a>;
<a href='/constructor/statsGraphError'>statsGraphError</a>#bedc9822 error:<a href='/type/string'>string</a> = <a href='/type/StatsGraph'>StatsGraph</a>;
<a href='/constructor/statsGraph'>statsGraph</a>#8ea464b6 flags:<a href='/type/%23'>#</a> json:<a href='/type/DataJSON'>DataJSON</a> zoom_token:flags.0?<a href='/type/string'>string</a> = <a href='/type/StatsGraph'>StatsGraph</a>;
<a href='/constructor/dataJSON'>dataJSON</a>#7d748d04 data:<a href='/type/string'>string</a> = <a href='/type/DataJSON'>DataJSON</a>;
---functions---
<a href='/method/stats.loadAsyncGraph'>stats.loadAsyncGraph</a>#621d5fa0 flags:<a href='/type/%23'>#</a> token:<a href='/type/string'>string</a> x:flags.0?<a href='/type/long'>long</a> = <a href='/type/StatsGraph'>StatsGraph</a>;</code></pre>
<p>Certain graphs are not directly sent in the <a href="/constructor/stats.broadcastStats">stats.broadcastStats</a> constructor to reduce server load: instead, those graphs will be sent as a <a href="/constructor/statsGraphAsync">statsGraphAsync</a> constructor, and should be fetched separately using <a href="/method/stats.loadAsyncGraph">stats.loadAsyncGraph</a>. </p>
<p>After obtaining the full <a href="/constructor/statsGraph">statsGraph</a> constructor, clients should parse the JSON graph object in the <code>json</code> field.</p>
<p>Object structure: </p>
<table class="table">
<thead>
<tr>
<th>Key</th>
<th>Graph title</th>
</tr>
</thead>
<tbody>
<tr>
<td>columns</td>
<td>Array of all data column arrays in the chart. Each column array has its <strong>label</strong> at position 0, followed by values.</td>
</tr>
<tr>
<td>types</td>
<td><a href="#graphs">Graphs types</a> for each of the column arrays (object, <code>"label": "type"</code>): <br>- <code>line</code> - <a href="#line-graph">line graph</a> <br>- <code>area</code> - <a href="#area-graph">area graph</a> <br>- <code>step</code> - <a href="#step-graph">step graph</a> <br>- <code>bar</code> - <a href="#bar-graph">bar graph</a> <br>- <code>x</code> - x axis values for each of the charts at the corresponding positions, UNIX timestamps in milliseconds.</td>
</tr>
<tr>
<td>colors</td>
<td>Color for each type (object, <code>"label": "colorKey#AAAAAA"</code>; see <a href="#chart-colors">chart colors</a>).</td>
</tr>
<tr>
<td>names</td>
<td>Localized name for each variable (object, <code>"label": "Name"</code>)</td>
</tr>
<tr>
<td>subchart</td>
<td>Object indicating the default zoom range for the graph, this is object's structure: <br>- <code>show</code> - Whether to use the specified zoom range (boolean) <br>- <code>defaultZoom</code> - An array with two <code>x</code> values, indicating the two ends of the default zoom range</td>
</tr>
<tr>
<td>y_scaled</td>
<td>Indicates that each of the two (!) lines in a step graph must be visualized on its own scale, with two different tick axes on the left and right parts of the graph (boolean, see <a href="#graph-examples">various graphs</a> for examples)</td>
</tr>
<tr>
<td>percentage</td>
<td>Indicates whether value percentages should be shown in labels (boolean, see <a href="#graph-examples">various graphs</a> for examples)</td>
</tr>
<tr>
<td>stacked</td>
<td>Depending on the graph type, indicates stacking of multiple columns in the same graph (boolean, see <a href="#graph-examples">various graphs</a> for examples)</td>
</tr>
</tbody>
</table>
<!-- | hidden | Array of columns that should not be visualized in the final graph | -->
<p>The following chart restrictions apply:</p>
<ul>
<li>Up to 50 columns on one graph must be supported.</li>
<li>Chart types are always the same for every column in the graph.</li>
<li>The <code>bar</code> chart type and <code>stacked</code> option are always used together.</li>
<li><code>percentage</code> is always used with the <code>area</code> graph.<!-- * Graphs with every chart type _should_ be able to zoom into the same chart type with the same columns (names and types). -->
<!-- * `y_scaled` is only used with exactly 2 `line` columns -->
</li>
</ul>
<h3><a class="anchor" href="#chart-zooming" id="chart-zooming" name="chart-zooming"><i class="anchor-icon"></i></a>Chart zooming</h3>
<pre><code><a href='/constructor/statsGraphError'>statsGraphError</a>#bedc9822 error:<a href='/type/string'>string</a> = <a href='/type/StatsGraph'>StatsGraph</a>;
<a href='/constructor/statsGraph'>statsGraph</a>#8ea464b6 flags:<a href='/type/%23'>#</a> json:<a href='/type/DataJSON'>DataJSON</a> zoom_token:flags.0?<a href='/type/string'>string</a> = <a href='/type/StatsGraph'>StatsGraph</a>;
<a href='/constructor/dataJSON'>dataJSON</a>#7d748d04 data:<a href='/type/string'>string</a> = <a href='/type/DataJSON'>DataJSON</a>;
---functions---
<a href='/method/stats.loadAsyncGraph'>stats.loadAsyncGraph</a>#621d5fa0 flags:<a href='/type/%23'>#</a> token:<a href='/type/string'>string</a> x:flags.0?<a href='/type/long'>long</a> = <a href='/type/StatsGraph'>StatsGraph</a>;</code></pre>
<p>Graphs that support zooming will contain a <code>zoom_token</code> in the <a href="/constructor/statsGraph">statsGraph</a> constructor.<br>
Said token should be then used as <code>token</code> in a new <a href="/method/stats.loadAsyncGraph">stats.loadAsyncGraph</a> call triggered when the user clicks on the label, related to a certain x axis in the graph (see <a href="#graph-examples">graph examples</a>).<br>
The <code>x</code> coordinate of the label should be provided to the <code>x</code> parameter; the method will then return (if available) a more detailed subgraph.<br>
If not enough data is available, a localized <a href="/constructor/statsGraphError">statsGraphError</a> will be returned. </p>
<p>Typical zoom <em>visualization</em> rules: </p>
<ul>
<li>Any <code>percentage</code> graph (even if a <code>zoom_token</code> is not available) =&gt; <a href="#piechart">pie chart</a></li>
<li><a href="#line-graph">line graph</a> =&gt; <a href="#line-graph">line graph</a></li>
<li><a href="#step-graph">step graph</a> =&gt; <a href="#step-graph">step graph</a></li>
<li><a href="#bar-graph">bar graph</a> =&gt; <a href="#bar-graph">bar graph</a></li>
<li><a href="#area-graph">area graph</a> =&gt; <a href="#area-graph">area graph</a></li>
</ul>
<h3><a class="anchor" href="#chart-colors" id="chart-colors" name="chart-colors"><i class="anchor-icon"></i></a>Chart colors</h3>
<p>Chart colors can be provided as a color key, followed by the primary color value in hex format: </p>
<pre><code>red#e05356</code></pre>
<p>The color key can be one of <code>red</code>, <code>lightblue</code>, <code>lightgreen</code>, <code>golden</code>, <code>green</code>, <code>orange</code>, <code>blue</code>, <code>indigo</code>.<br>
Apps can choose to use a color value specified by the currently loaded theme: for example, the <a href="https://github.com/DrKLO/Telegram/blob/dceccae0b74576d092fb3b2accaffded2c0b5f63/TMessagesProj/src/main/java/org/telegram/ui/Charts/data/ChartData.java#L81">android app</a> uses <code>statisticChartLine_*</code> themekeys for each of the color keys, check out the <a href="https://github.com/DrKLO/Telegram/tree/master/TMessagesProj/src/main/assets">assets directory</a> for a bunch of default themes with various colors for channel statistics. </p>
<p>However, the server may also choose to return just a plain color value in hex format: </p>
<pre><code>#e05356</code></pre>
<p>In this case, the <code>dark</code> flag of the <a href="/method/stats.getBroadcastStats">stats.getBroadcastStats</a> method can be used to choose the palette of returned colors.</p>
<h2><a class="anchor" href="#graph-examples" id="graph-examples" name="graph-examples"><i class="anchor-icon"></i></a>Graph examples</h2>
<h3><a class="anchor" href="#line-graph" id="line-graph" name="line-graph"><i class="anchor-icon"></i></a>Line graph</h3>
<p>Simple single line graph</p>
<h3><a class="anchor" href="#step-graph" id="step-graph" name="step-graph"><i class="anchor-icon"></i></a>Step graph</h3>
<p>Step graph, always "stacked" (to indicate multiple lines)</p>
<h3><a class="anchor" href="#bar-graph" id="bar-graph" name="bar-graph"><i class="anchor-icon"></i></a>Bar graph</h3>
<p>Bar graph with multiple lines, always "stacked" (to indicate actual stacked bars, biggest bars first)</p>
<h3><a class="anchor" href="#area-graph" id="area-graph" name="area-graph"><i class="anchor-icon"></i></a>Area graph</h3>
<p>Mixed bar/line graph, always "stacked" (to indicate actual stacked bars, biggest bars first)</p>
<h3><a class="anchor" href="#piechart" id="piechart" name="piechart"><i class="anchor-icon"></i></a>Piechart</h3>
<p>Pie chart, typically obtained only when zooming into percentage graphs</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,144 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Telegram API Terms of Service</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="We welcome all developers to use our API and source code to create Telegram-like messaging applications on our platform…">
<meta property="og:title" content="Telegram API Terms of Service">
<meta property="og:image" content="">
<meta property="og:description" content="We welcome all developers to use our API and source code to create Telegram-like messaging applications on our platform…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/terms" >Telegram API Terms of Service</a></li></ul></div>
<h1 id="dev_page_title">Telegram API Terms of Service</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>We welcome all developers to use our API and source code to <a href="/api/obtaining_api_id">create Telegram-like messaging applications</a> on our platform free of charge. In order to ensure consistency and security across the Telegram ecosystem, all third-party client apps must comply with the following Terms of Service.</p>
<h4><a class="anchor" href="#1-privacy--security" id="1-privacy--security" name="1-privacy--security"><i class="anchor-icon"></i></a>1. Privacy &amp; Security</h4>
<p><strong>1.1.</strong> Telegram is a privacy-oriented platform. All client apps must, therefore, guard their users' privacy with utmost care and comply with our <a href="https://core.telegram.org/mtproto/security_guidelines">Security Guidelines</a>.<br>
<strong>1.2.</strong> Developers are welcome to add new features or improve and extend existing Telegram features provided that these modifications do not violate these Terms of Service.<br>
<strong>1.3.</strong> As a client developer, you must make sure that all the basic features of the main Telegram apps function correctly and in an expected way both in your app and when users of your app communicate with other Telegram users. It is forbidden to force users of other Telegram clients to download your app in order to view certain messages and content sent using your app.<br>
<strong>1.4.</strong> It is forbidden to interfere with the basic functionality of Telegram. This includes but is not limited to: making actions on behalf of the user without the user's knowledge and consent, preventing self-destructing content from disappearing, preventing last seen and online statuses from being displayed correctly, tampering with the 'read' statuses of messages (e.g. implementing a 'ghost mode'), preventing typing statuses from being sent/displayed, etc. </p>
<h4><a class="anchor" href="#2-transparency" id="2-transparency" name="2-transparency"><i class="anchor-icon"></i></a>2. Transparency</h4>
<p><strong>2.1.</strong> You must <a href="/api/obtaining_api_id#obtaining-api-id">obtain your own api_id</a> for your application.<br>
<strong>2.2.</strong> We offer our API free of charge, but your users must be aware of the fact that your app uses the Telegram API and is part of the Telegram ecosystem. This fact must be featured prominently in the app's description in the app stores and in the in-app intro if your app has it.<br>
<strong>2.3.</strong> To avoid confusion, the title of your app must not include the word “Telegram”. An exception can be made if the word “Telegram” is preceded with the word “Unofficial” in the title.<br>
<strong>2.4.</strong> You must not use the official Telegram logo for your app. Both the Telegram brand and its logo are registered trademarks protected by law in almost every country. </p>
<h4><a class="anchor" href="#3-advertising--monetization" id="3-advertising--monetization" name="3-advertising--monetization"><i class="anchor-icon"></i></a>3. Advertising &amp; Monetization</h4>
<p><strong>3.1.</strong> Developers are allowed to monetize their coding efforts through advertising or other legitimate means.<br>
<strong>3.2.</strong> If you decide to monetize your app, you must clearly mention all the methods of monetization that are used in your app in all its app store descriptions.
<strong>3.3.</strong> If your app allows accessing content from Telegram <a href="https://telegram.org/tour/channels">channels</a>, you must include support for <a href="https://core.telegram.org/api/sponsored-messages">official sponsored messages</a> in Telegram channels and may not interfere with this functionality.</p>
<h4><a class="anchor" href="#4-breach-of-terms" id="4-breach-of-terms" name="4-breach-of-terms"><i class="anchor-icon"></i></a>4. Breach of terms</h4>
<p><strong>4.1.</strong> If your app violates these terms, we will notify the Telegram account responsible for the app about the breach of terms.<br>
<strong>4.2.</strong> If you do not update the app to fix the highlighted issues within <strong>10</strong> days, we will have to discontinue your access to Telegram API and contact the app stores about the removal of your apps that are using the Telegram API in violation of these terms. </p>
<p>We reserve the right to expand these terms and guidelines as the need arises. We will inform client developers of such changes via an in-app notification to their accounts connected to the app in question. </p>
<blockquote>
<p><a href="https://core.telegram.org/api/obtaining_api_id">Back to Creating Your Telegram Application »</a></p>
</blockquote></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

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

View file

@ -0,0 +1,148 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Top peer rating</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="If enabled, the rating of top peers indicates the relevance of a frequently used peer in a certain category (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).">
<meta property="og:title" content="Top peer rating">
<meta property="og:image" content="34465abeb3bc2c4844">
<meta property="og:description" content="If enabled, the rating of top peers indicates the relevance of a frequently used peer in a certain category (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/top-rating" >Top peer rating</a></li></ul></div>
<h1 id="dev_page_title">Top peer rating</h1>
<div id="dev_page_content"><p>If <a href="/method/contacts.toggleTopPeers">enabled</a>, the rating of <a href="/constructor/topPeer">top peers</a> indicates the relevance of a frequently used peer in a certain <a href="/type/TopPeerCategory">category</a> (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).</p>
<p>Schema: </p>
<pre><code><a href='/constructor/topPeer'>topPeer</a>#edcdc05b peer:<a href='/type/Peer'>Peer</a> rating:<a href='/type/double'>double</a> = <a href='/type/TopPeer'>TopPeer</a>;
<a href='/constructor/topPeerCategoryBotsPM'>topPeerCategoryBotsPM</a>#ab661b5b = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
<a href='/constructor/topPeerCategoryBotsInline'>topPeerCategoryBotsInline</a>#148677e2 = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
<a href='/constructor/topPeerCategoryCorrespondents'>topPeerCategoryCorrespondents</a>#637b7ed = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
<a href='/constructor/topPeerCategoryGroups'>topPeerCategoryGroups</a>#bd17a14a = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
<a href='/constructor/topPeerCategoryChannels'>topPeerCategoryChannels</a>#161d9628 = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
<a href='/constructor/topPeerCategoryPhoneCalls'>topPeerCategoryPhoneCalls</a>#1e76a78c = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
<a href='/constructor/topPeerCategoryForwardUsers'>topPeerCategoryForwardUsers</a>#a8406ca9 = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
<a href='/constructor/topPeerCategoryForwardChats'>topPeerCategoryForwardChats</a>#fbeec0f0 = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
<a href='/constructor/topPeerCategoryPeers'>topPeerCategoryPeers</a>#fb834291 category:<a href='/type/TopPeerCategory'>TopPeerCategory</a> count:<a href='/type/int'>int</a> peers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/TopPeer'>TopPeer</a>&gt; = <a href='/type/TopPeerCategoryPeers'>TopPeerCategoryPeers</a>;
<a href='/constructor/contacts.topPeersNotModified'>contacts.topPeersNotModified</a>#de266ef5 = <a href='/type/contacts.TopPeers'>contacts.TopPeers</a>;
<a href='/constructor/contacts.topPeers'>contacts.topPeers</a>#70b772a8 categories:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/TopPeerCategoryPeers'>TopPeerCategoryPeers</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; = <a href='/type/contacts.TopPeers'>contacts.TopPeers</a>;
<a href='/constructor/contacts.topPeersDisabled'>contacts.topPeersDisabled</a>#b52c939d = <a href='/type/contacts.TopPeers'>contacts.TopPeers</a>;
---functions---
<a href='/method/contacts.getTopPeers'>contacts.getTopPeers</a>#973478b6 flags:<a href='/type/%23'>#</a> correspondents:flags.0?<a href='/constructor/true'>true</a> bots_pm:flags.1?<a href='/constructor/true'>true</a> bots_inline:flags.2?<a href='/constructor/true'>true</a> phone_calls:flags.3?<a href='/constructor/true'>true</a> forward_users:flags.4?<a href='/constructor/true'>true</a> forward_chats:flags.5?<a href='/constructor/true'>true</a> groups:flags.10?<a href='/constructor/true'>true</a> channels:flags.15?<a href='/constructor/true'>true</a> offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> hash:<a href='/type/long'>long</a> = <a href='/type/contacts.TopPeers'>contacts.TopPeers</a>;</code></pre>
<p>The rate delta is computed by taking the time delta between the last time the user used a certain peer and the last time the rating for that peer was received and dividing it by the <a href="/constructor/config">exponential decay from config</a>.</p>
<p>Example:
Client-side, every time a user opens chat <code>123456789</code> the following operation must be done on the cached top peer info.</p>
<ul>
<li><code>dateOpened</code> indicates when was the peer used</li>
<li><code>normalizeRate</code> is an arbitrary time in the recent past.
When ratings are received from the server using <a href="/method/contacts.getTopPeers">contacts.getTopPeers</a> and the schema described above, it is the time when they were received.</li>
</ul>
<pre><code>topPeer.rating += e^((dateOpened - normalizeRate) / config.rating_e_decay)</code></pre></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,229 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Working with Updates</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How to subscribe to updates and handle them properly.">
<meta property="og:title" content="Working with Updates">
<meta property="og:image" content="9c2ddd579d3d7cedba">
<meta property="og:description" content="How to subscribe to updates and handle them properly.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/updates" >Working with Updates</a></li></ul></div>
<h1 id="dev_page_title">Working with Updates</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>When a client is being actively used, events will occur that affect the current user and that they must learn about as soon as possible, e.g. when a new message is received. To eliminate the need for the client itself to periodically download these events, there is an update delivery mechanism in which the server sends the user notifications over one of its available connections with the client.</p>
<h3><a class="anchor" href="#subscribing-to-updates" id="subscribing-to-updates" name="subscribing-to-updates"><i class="anchor-icon"></i></a>Subscribing to Updates</h3>
<p>Update events are sent to an authorized user into the last active connection (except for connections needed for downloading / uploading files).</p>
<p>So to start receiving updates the client needs to init connection and call API method, e.g. to <a href="#fetching-state">fetch current state</a>.</p>
<h3><a class="anchor" href="#event-sequences" id="event-sequences" name="event-sequences"><i class="anchor-icon"></i></a>Event sequences</h3>
<p>All events are received from the socket as a sequence of TL-serialized <a href="/type/Updates">Updates</a> objects, which might be optionally gzip-compressed in the same way as <a href="/api/invoking#decompressing-data">responses to queries</a>.</p>
<p>Each <a href="/type/Updates">Updates</a> object may contain single or multiple <a href="/type/Update">Update</a> objects, representing different events happening.</p>
<p>In order to apply all updates in precise order and to guarantee that no update is missed or applied twice there is <code>seq</code> attribute in <a href="/type/Updates">Updates</a> constructors, and <code>pts</code> (with <code>pts_count</code>) or <code>qts</code> attributes in <a href="/type/Update">Update</a> constructors. The client must use those attributes values in combination with locally stored state to correctly apply incoming updates.</p>
<p>When a gap in updates sequence occurs, it must be filled via calling one of the API methods. <a href="#recovering-gaps">More below »</a></p>
<h3><a class="anchor" href="#updates-sequence" id="updates-sequence" name="updates-sequence"><i class="anchor-icon"></i></a><a href="/type/Updates">Updates</a> sequence</h3>
<p>As said earlier, each payload with updates has a TL-type <a href="/type/Updates">Updates</a>. It can be seen from the schema below that this type has several constructors.</p>
<pre><code><a href='/constructor/updatesTooLong'>updatesTooLong</a>#e317af7e = <a href='/type/Updates'>Updates</a>;
<a href='/constructor/updateShort'>updateShort</a>#78d4dec1 update:<a href='/type/Update'>Update</a> date:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/constructor/updateShortMessage'>updateShortMessage</a>#313bc7f8 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> user_id:<a href='/type/long'>long</a> message:<a href='/type/string'>string</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> date:<a href='/type/int'>int</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/constructor/updateShortChatMessage'>updateShortChatMessage</a>#4d6deea5 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:<a href='/type/long'>long</a> chat_id:<a href='/type/long'>long</a> message:<a href='/type/string'>string</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> date:<a href='/type/int'>int</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/constructor/updateShortSentMessage'>updateShortSentMessage</a>#9015e101 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> date:<a href='/type/int'>int</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/constructor/updatesCombined'>updatesCombined</a>#725b04c3 updates:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Update'>Update</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; date:<a href='/type/int'>int</a> seq_start:<a href='/type/int'>int</a> seq:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/constructor/updates'>updates</a>#74ae4240 updates:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Update'>Update</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; date:<a href='/type/int'>int</a> seq:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p><a href="/constructor/updatesTooLong">updatesTooLong</a> indicates that there are too many events pending to be pushed to the client, so one needs to <a href="#recovering-gaps">fetch them manually</a>.</p>
<p>Events inside <a href="/constructor/updateShort">updateShort</a> constructors, normally, have lower priority and are broadcast to a large number of users, i.e. one of the chat participants started entering text in a big conversation (<a href="/constructor/updateChatUserTyping">updateChatUserTyping</a>).</p>
<p>The <a href="/constructor/updateShortMessage">updateShortMessage</a>, <a href="/constructor/updateShortMessage">updateShortSentMessage</a> and <a href="/constructor/updateShortChatMessage">updateShortChatMessage</a> constructors are redundant but help significantly reduce the transmitted message size for 90% of the updates. They should be transformed to <a href="/constructor/updateShort">updateShort</a> upon receiving.</p>
<p>Two remaining constructors <a href="/constructor/updates">updates</a> and <a href="/constructor/updatesCombined">updatesCombined</a> are part of the Updates sequence. Both of them have <code>seq</code> attribute, which indicates the remote Updates state after the generation of the Updates, and <code>seq_start</code> indicates the remote Updates state after the <em>first</em> of the Updates in the packet is generated. For <a href="/constructor/updates">updates</a>, <code>seq_start</code> attribute is omitted, because it is assumed that it is always equal to <code>seq</code>.</p>
<h3><a class="anchor" href="#message-related-event-sequences" id="message-related-event-sequences" name="message-related-event-sequences"><i class="anchor-icon"></i></a>Message-related event sequences</h3>
<p>Each <em>event</em> related to a message box (message created, message edited, message deleted, etc) is identified by a unique autoincremented <em>pts</em>, or <em>qts</em> in case of secret chat updates, certain bot updates, etc.</p>
<p>Each message box can be considered as some server-side DB table that stores messages and events associated with them.
All boxes are completely independent, and each pts sequence is tied to just one box (see below).</p>
<p><a href="/type/Update">Update</a> object may contain info about <em>multiple events</em> (for example, <a href="/constructor/updateDeleteMessages">updateDeleteMessages</a>).
That's why all single updates might have <em>pts_count</em> parameter indicating the <em>number of events</em> contained in the received <em>update</em> (with some exceptions, in this case, the <em>pts_count</em> is considered to be <code>0</code>).</p>
<p>Each <a href="/api/channel#channels">channel</a> and <a href="/api/channel#supergroups">supergroup</a> has its message box and <em>its event sequence</em> as a result; private chats and <a href="/api/channel#basic-groups">basic groups</a> of one user have another <em>common event sequence</em>.
Secret chats, certain bot events and other kinds of updates have yet another <em>common secondary event sequence</em>.</p>
<p>To recap, the client has to take care of the integrity of the following sequences to properly handle updates:</p>
<ul>
<li>Updates sequence (seq)<ul>
<li>Common message box sequence (pts)</li>
<li>Secondary event sequence (qts)</li>
<li>Channel message box sequence 1 (pts)</li>
<li>Channel message box sequence 2 (pts)</li>
<li>Channel message box sequence 3 (pts)</li>
<li>and so on...</li>
</ul>
</li>
</ul>
<h3><a class="anchor" href="#fetching-state" id="fetching-state" name="fetching-state"><i class="anchor-icon"></i></a>Fetching state</h3>
<p>The <em>common</em> update state is represented by the <a href="/type/updates.State">updates.State</a> constructor.
When the user logs in for the first time, call to <a href="/method/updates.getState">updates.getState</a> has to be made to store the latest update state (which will not be the absolute initial state, just the latest state at the current time).
The common update state can also be fetched from <a href="/constructor/updates.differenceTooLong">updates.differenceTooLong</a>.</p>
<p>The <em>channel update state</em> is represented simply by the <em>pts</em> of the event sequence: when first logging in, the initial channel state can be obtained from the <a href="/constructor/dialog">dialog</a> constructor when fetching dialogs, from <a href="/constructor/channelFull">the full channel info</a>, or it can be received <a href="https://core.telegram.org/constructor/updateChannelTooLong">as an updateChannelTooLong update</a>.</p>
<p>The <em>secondary update state</em> is represented by the <em>qts</em> of the secret event sequence, it is contained in the <a href="/type/updates.State">updates.State</a> of the <em>common update state</em>.</p>
<p>The <em>Updates sequence state</em> is represented by the <em>date</em> and <em>seq</em> of the <em>Updates sequence</em>, it is contained in the <a href="/type/updates.State">updates.State</a> of the <em>common</em> update state.</p>
<h3><a class="anchor" href="#update-handling" id="update-handling" name="update-handling"><i class="anchor-icon"></i></a>Update handling</h3>
<p>Update handling in Telegram clients consists of receiving events, making sure there were no gaps and no events were missed based on the locally stored state of the correspondent event sequence, and then updating the locally stored state based on the parameters received.</p>
<p>When the client receives payload with serialized updates, first of all, it needs to walk through all of the nested <a href="/type/Update">Update</a> objects and check if they belong to any of message box sequences (have <code>pts</code> or <code>qts</code> parameters). Those updates need to be handled separately according to corresponding local state and new <code>pts</code>/<code>qts</code> values. <a href="#pts-checking-and-applying">Details below »</a></p>
<p>After message box updates are handled, if there are any other updates remaining the client needs to handle them with respect to <code>seq</code>. <a href="#seq-checking-and-applying">Details below »</a></p>
<h4><a class="anchor" href="#pts-checking-and-applying" id="pts-checking-and-applying" name="pts-checking-and-applying"><i class="anchor-icon"></i></a><code>pts</code>: checking and applying</h4>
<p>Here, <code>local_pts</code> will be the local state, <code>pts</code> will be the remote state, <code>pts_count</code> will be the number of events in the update.</p>
<p>If <code>local_pts + pts_count === pts</code>, the update can be applied.
If <code>local_pts + pts_count &gt; pts</code>, the update was already applied, and must be ignored.
If <code>local_pts + pts_count &lt; pts</code>, there's an update gap that must be <a href="#recovering-gaps">filled</a>.</p>
<p>For example, let's assume the client has the following local state for the channel <code>123456789</code>:</p>
<pre><code>local_pts = 131</code></pre>
<p>Now let's assume an <a href="/constructor/updateNewChannelMessage">updateNewChannelMessage</a> from channel <code>123456789</code> is received with <code>pts = 132</code> and <code>pts_count=1</code>.
Since <code>local_pts + pts_count === pts</code>, the total number of events since the last stored state is, in fact, equal to <code>pts_count</code>: this means the update can be safely accepted and the remote <code>pts</code> applied:</p>
<pre><code>local_pts = 132</code></pre>
<p>Since:</p>
<ul>
<li><code>pts</code> indicates the server state <strong>after</strong> the new channel message events are generated</li>
<li><code>pts_count</code> indicates the number of events in the new channel update</li>
<li>The server state <strong>before the new channel message event was generated</strong> has to be: <code>pts_before = pts - pts_count = 131</code>, which is, in fact, equal to our local state.</li>
</ul>
<p>Now let's assume an <a href="/constructor/updateNewChannelMessage">updateNewChannelMessage</a> from channel <code>123456789</code> is received with <code>pts = 132</code> and <code>pts_count=1</code>.
Since <code>local_pts + pts_count &gt; pts</code> (<code>133 &gt; 132</code>), the update is skipped because we've already handled this update (in fact, our current <code>local_pts</code> was set by this same update, and it was resent twice due to network issues or other issues).</p>
<p>Now let's assume an <a href="/constructor/updateDeleteChannelMessages">updateDeleteChannelMessages</a> from channel <code>123456789</code> is received with <code>pts = 140</code> and <code>pts_count=5</code>.
Since <code>local_pts + pts_count &lt; pts</code> (<code>137 &lt; 140</code>), this means that updates were missed, and the gap must be recovered.</p>
<h5><a class="anchor" href="#secret-chats--bots" id="secret-chats--bots" name="secret-chats--bots"><i class="anchor-icon"></i></a>Secret chats &amp; bots</h5>
<p>The whole process is very similar for secret chats and certain bot updates, but there is <code>qts</code> instead of <code>pts</code>, and events are never grouped, so it's assumed that <code>qts_count</code> is always equal to 1.</p>
<h4><a class="anchor" href="#seq-checking-and-applying" id="seq-checking-and-applying" name="seq-checking-and-applying"><i class="anchor-icon"></i></a><code>seq</code>: checking and applying</h4>
<p>On top level when handling received <a href="/constructor/updates">updates</a> and <a href="/constructor/updatesCombined">updatesCombined</a> there are three possible cases:
If <code>local_seq + 1 === seq_start</code>, the updates can be applied.
If <code>local_seq + 1 &gt; seq_start</code>, the updates were already applied, and must be ignored.
If <code>local_seq + 1 &lt; seq_start</code>, there's an updates gap that must be <a href="#recovering-gaps">filled</a> (updates.getDifference must be used as with common and secret event sequences).</p>
<p>If the updates were applied, local <em>Updates state</em> must be updated with <code>seq</code> and <code>date</code> from the constructor.</p>
<p>For all the other <a href="/type/Updates">Updates</a> type constructors there is no need to check <code>seq</code> or change a local state.</p>
<h3><a class="anchor" href="#recovering-gaps" id="recovering-gaps" name="recovering-gaps"><i class="anchor-icon"></i></a>Recovering gaps</h3>
<p>To do this, <a href="/method/updates.getDifference">updates.getDifference</a> (common/secret state) or <a href="/method/updates.getChannelDifference">updates.getChannelDifference</a> (channel state) with the respective local states must be called.
These methods should also be called on startup, to fetch new updates (preferably with some flags to reduce server load, see the method's docs).
Manually obtaining updates is also required in the following situations:</p>
<ul>
<li>Loss of sync: a gap was found in <strong>seq</strong> / <strong>pts</strong> / <strong>qts</strong> (as described above). It may be useful to wait up to 0.5 seconds in this situation and abort the sync in case a new update arrives, that fills the gap.</li>
<li>Session loss on the server: the client receives a <a href="https://core.telegram.org/mtproto/service_messages#new-session-creation-notification">new session created notification</a>. This can be caused by garbage collection on the MTProto server or a server reboot.</li>
<li>Incorrect update: the client cannot deserialize the received data.</li>
<li>Incomplete update: the client is missing data about a chat/user from one of the shortened constructors, such as <a href="/constructor/updateShortChatMessage">updateShortChatMessage</a>, etc.</li>
<li>Long period without updates: no updates for 15 minutes or longer.</li>
<li>The server requests the client to fetch the difference using <a href="/constructor/updateChannelTooLong">updateChannelTooLong</a> or <a href="/constructor/updatesTooLong">updatesTooLong</a>.</li>
</ul>
<p>When calling <a href="/method/updates.getDifference">updates.getDifference</a> if the <a href="/constructor/updates.differenceSlice">updates.differenceSlice</a> constructor is returned in response, the full difference was too large to be received in one request. The intermediate status, <strong>intermediate_state</strong>, must be saved on the client and the query must be repeated, using the intermediate status as the current status.</p>
<p>To fetch the updates difference of a channel, <a href="/method/updates.getChannelDifference">updates.getChannelDifference</a> is used.
If the difference is too large to be received in one request, the <code>final</code> flag of the result is <strong>not</strong> set (see <a href="/type/updates.ChannelDifference">docs</a>).
The intermediate status, represented by the <strong>pts</strong>, must be saved on the client and the query must be repeated, using the intermediate status as the current status.</p>
<p>For performance reasons and for better user experience, client can set maximum gap size to be filled: <code>pts_total_limit</code> parameter of <a href="/method/updates.getDifference">updates.getDifference</a> and <code>limit</code> parameter for <a href="/method/updates.getChannelDifference">updates.getChannelDifference</a> can be used.</p>
<p>If the gap is too large and there are too many updates to fetch, a <code>*TooLong</code> constructor will be returned. In this case, the client must <a href="#fetching-state">re-fetch the state</a>, re-start fetching updates from that state and follow the instructions that can be found <a href="/constructor/updates.channelDifferenceTooLong">here</a>.</p>
<p>It is recommended to use limit <code>10-100</code> for channels and <code>1000-10000</code> otherwise.</p>
<h3><a class="anchor" href="#example-implementations" id="example-implementations" name="example-implementations"><i class="anchor-icon"></i></a>Example implementations</h3>
<p>Implementations also have to take care to postpone updates received via the socket while filling gaps in the event and Update sequences, as well as avoid filling gaps in the same sequence.</p>
<p>Example implementations: <a href="https://github.com/tdlib/td">tdlib</a>, <a href="https://github.com/danog/MadelineProto">MadelineProto</a>. </p>
<p>An interesting and easy way this can be implemented, instead of using various locks, is by running background loops, like in <a href="https://docs.madelineproto.xyz/docs/UPDATES_INTERNAL.html">MadelineProto »</a>.</p>
<h3><a class="anchor" href="#push-notifications-about-updates" id="push-notifications-about-updates" name="push-notifications-about-updates"><i class="anchor-icon"></i></a><a href="/api/push-updates">PUSH Notifications about Updates</a></h3>
<p>If a client does not have an active connection at the time of an event, <a href="/api/push-updates">PUSH Notifications</a> will also be useful.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,163 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Seamless Telegram Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Handle Seamless Telegram Login URL authorization requests.">
<meta property="og:title" content="Seamless Telegram Login">
<meta property="og:image" content="faa06a44f2ab0cf059">
<meta property="og:description" content="Handle Seamless Telegram Login URL authorization requests.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/url-authorization" >Seamless Telegram Login</a></li></ul></div>
<h1 id="dev_page_title">Seamless Telegram Login</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Bots or Telegram websites may <a href="/bots/api#loginurl">ask users to login to a certain website via Telegram</a> when clicking on certain links or URL buttons in inline keyboards.</p>
<h3><a class="anchor" href="#bot-url-authorization" id="bot-url-authorization" name="bot-url-authorization"><i class="anchor-icon"></i></a>Bot URL authorization</h3>
<p>When the user clicks on <a href="/constructor/keyboardButtonUrlAuth">keyboardButtonUrlAuth</a>, <a href="/method/messages.requestUrlAuth">messages.requestUrlAuth</a> should be called, providing the <code>button_id</code> of the button and the ID and peer of the container message.
The returned <a href="/constructor/urlAuthResultRequest">urlAuthResultRequest</a> object will contain more details about the authorization request:</p>
<ul>
<li>The <code>domain</code> parameter will contain the domain name of the website on which the user will log in (example: <em>comments.app</em>).</li>
<li>The <code>bot</code> parameter will contain info about the bot which will be used for user authorization (example: <em>DiscussBot</em>).</li>
<li>The <code>request_write_access</code> will be set if the bot would like to send messages to the user.</li>
</ul>
<p>The info should be shown in a prompt:</p>
<div><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>
</div></div>
<p>If the user agrees to login to the URL, <a href="/method/messages.acceptUrlAuth">messages.acceptUrlAuth</a> should be called (eventually setting the <code>write_allowed</code> if the permission was requested and the user consented).
The result will be a <a href="/constructor/urlAuthResultAccepted">urlAuthResultAccepted</a> with the final URL to open, which will include a query string with the requested info and a hash that <a href="/widgets/login#receiving-authorization-data">must be verified upon receival by the service</a>.</p>
<p><a href="/constructor/urlAuthResultDefault">urlAuthResultDefault</a> could also be returned, instead, in which case the <code>url</code> of the <a href="/constructor/keyboardButtonUrlAuth">keyboardButtonUrlAuth</a> must be opened, instead.
The same must be done if the user opens the link while refusing the authorization request.</p>
<h3><a class="anchor" href="#link-url-authorization" id="link-url-authorization" name="link-url-authorization"><i class="anchor-icon"></i></a>Link URL authorization</h3>
<p>Telegram supports automatic authorization on certain websites upon opening an HTTP URL in-app, upon clicking a link in a message or clicking on a <a href="/constructor/keyboardButtonUrl">keyboardButtonUrl</a>.</p>
<h4><a class="anchor" href="#automatic-authorization" id="automatic-authorization" name="automatic-authorization"><i class="anchor-icon"></i></a>Automatic authorization</h4>
<p>Clients should automatically authenticate users when opening official Telegram websites, listed in the <code>url_auth_domains</code> key of the <a href="/api/config#client-configuration">client configuration object »</a>. </p>
<p>Upon clicking a link, the URL must be modified by appending the <code>autologin_token</code> from the <a href="/api/config#client-configuration">client configuration object »</a> to the <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">query string</a>, like so: </p>
<p>Original URL: <code>https://somedomain.telegram.org/path?query=string#fragment=value</code><br>
Modified URL: <code>https://somedomain.telegram.org/path?query=string&amp;autologin_token=$autologin_token#fragment=value</code> </p>
<p>Make sure that the used <code>autologin_token</code> is no more than <code>10000</code> seconds old, if it is older it must be refetched before use as described in the <a href="/api/config#client-configuration">client configuration section »</a>. </p>
<h4><a class="anchor" href="#manual-authorization" id="manual-authorization" name="manual-authorization"><i class="anchor-icon"></i></a>Manual authorization</h4>
<p>Clients should show a confirmation prompt similar to the one used <a href="#bot-url-authorization">for bots</a>, to authenticate users when opening certain Telegram websites, listed in the <code>url_auth_domains</code> key of the <a href="/api/config#client-configuration">client configuration object »</a>. </p>
<p><a href="/method/messages.requestUrlAuth">messages.requestUrlAuth</a> should be called, providing only the original <code>url</code>.
The returned <a href="/constructor/urlAuthResultRequest">urlAuthResultRequest</a> object will contain more details about the authorization request:</p>
<ul>
<li>The <code>domain</code> parameter will contain the domain name of the website on which the user will log in (example: <em>comments.app</em>).</li>
<li>The <code>request_write_access</code> will be set if the website would like to send messages to the user.</li>
</ul>
<p>The info should be shown in a prompt. </p>
<p>If the user agrees to login to the URL, <a href="/method/messages.acceptUrlAuth">messages.acceptUrlAuth</a> should be called (eventually setting the <code>write_allowed</code> if the permission was requested and the user consented).
The result will be a <a href="/constructor/urlAuthResultAccepted">urlAuthResultAccepted</a> with the final URL to open. </p>
<p><a href="/constructor/urlAuthResultDefault">urlAuthResultDefault</a> could also be returned, instead, in which case the original URL must be opened, instead.
The same must be done if the user opens the link while refusing the authorization request.</p>
<h3><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related articles</h3>
<h4><a class="anchor" href="#client-configuration" id="client-configuration" name="client-configuration"><i class="anchor-icon"></i></a><a href="/api/config">Client configuration</a></h4>
<p>The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,180 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Web events</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="How telegram apps interact with webpages">
<meta property="og:title" content="Web events">
<meta property="og:image" content="">
<meta property="og:description" content="How telegram apps interact with webpages">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/web-events" >Web events</a></li></ul></div>
<h1 id="dev_page_title">Web events</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>When interacting with HTML5 games and the websites of payment gateways, Telegram apps should expose APIs to allow receiving data and events from the websites.</p>
<h3><a class="anchor" href="#event-apis" id="event-apis" name="event-apis"><i class="anchor-icon"></i></a>Event APIs</h3>
<p>Games and payment gateways can generate events that are meant to be received by the Telegram apps.
Typically events are generated by using the <code>postEvent</code> method of the <a href="https://github.com/TelegramMessenger/GamingCommunication/blob/master/games.js">GamingCommunication library</a>.
The <code>postEvent</code> function will try sending the event to the Telegram app in a number of different ways.</p>
<h4><a class="anchor" href="#webviewproxy" id="webviewproxy" name="webviewproxy"><i class="anchor-icon"></i></a>WebviewProxy</h4>
<p>In mobile apps, the event receiver API should be typically exposed as a <code>window.TelegramWebviewProxy</code> object with a <code>postEvent</code> method.</p>
<pre><code>window.TelegramWebviewProxy.postEvent(eventType, eventData)</code></pre>
<h4><a class="anchor" href="#windowexternal" id="windowexternal" name="windowexternal"><i class="anchor-icon"></i></a>window.external</h4>
<p>Alternatively, a <code>window.external.notify</code> method can be exposed, accepting a string JSON payload with the event type and payload:</p>
<pre><code>window.external.notify(JSON.stringify({eventType: eventType, eventData: eventData}));</code></pre>
<h4><a class="anchor" href="#postmessage-api" id="postmessage-api" name="postmessage-api"><i class="anchor-icon"></i></a>postMessage API</h4>
<p>Finally, web MTProto clients that need to open a game or process a payment in an iframe can use the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage">postMessage API</a> to receive events from iframes.
The <a href="https://github.com/TelegramMessenger/GamingCommunication/blob/master/games.js">GamingCommunication library</a> by default will use <code>'*'</code> as <code>targetOrigin</code>, sending messages to parent pages regardless of the origin of the embedder.</p>
<pre><code>window.parent.postMessage(JSON.stringify({eventType: eventType, eventData: eventData}), targetOrigin);</code></pre>
<h4><a class="anchor" href="#event-types" id="event-types" name="event-types"><i class="anchor-icon"></i></a>Event types</h4>
<p><code>eventType</code> is a simple string indicating the event type, and <code>eventData</code> is a payload with an object that will be parsed by the Telegram app.</p>
<table class="table">
<thead>
<tr>
<th>eventType</th>
<th>eventData</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>payment_form_submit</code></td>
<td>JSON object with <code>data</code> and <code>title</code> fields</td>
<td><code>title</code> is the censored credit card title.<br><code>data</code> is a service-specific JSON payload with information about the payment credentials provided by the user to the payment system.<br><strong>Neither Telegram, nor bots will have access to your credit card information.</strong><br>Credit card details will be handled only by the payment system.</td>
</tr>
<tr>
<td><code>share_score</code></td>
<td>null</td>
<td>Will be called by games when the user explicitly clicks on the <strong>share score</strong> button to share the game, along with his score.<br>Typically done by using <a href="/method/messages.forwardMessages">messages.forwardMessages</a> on the game message with the <code>with_my_score</code> flag.</td>
</tr>
<tr>
<td><code>share_game</code></td>
<td>null</td>
<td>Will be called by games when the user explicitly clicks on the <strong>share game</strong> button to share the game, without sharing his score.<br>Typically done by using <a href="/method/messages.forwardMessages">messages.forwardMessages</a> on the game message without the <code>with_my_score</code> flag, or by sharing the game's short URL.</td>
</tr>
<tr>
<td><code>game_over</code></td>
<td>null</td>
<td>Can be called by games when the user loses a game</td>
</tr>
<tr>
<td><code>game_loaded</code></td>
<td>null</td>
<td>Can be called by games once the game fully loads</td>
</tr>
<tr>
<td><code>resize_frame</code></td>
<td>JSON object with <code>height</code> field</td>
<td>Called by supported pages inside of <a href="https://instantview.telegram.org">IV</a> iframe embeds, indicates the new size of the embed frame.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,440 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Bots: An introduction for developers</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands…">
<meta property="og:title" content="Bots: An introduction for developers">
<meta property="og:image" content="75f7c457f2561cbf84">
<meta property="og:description" content="Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Bots: An introduction for developers</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands and <a href="#inline-mode">inline requests</a>. You control your bots using HTTPS requests to Telegram&#39;s <a href="/bots/api">Bot API</a>.</p>
<blockquote>
<p>The <a href="/bots/api">full API reference</a> for <strong>developers</strong> is available <a href="/bots/api">here</a>.</p>
</blockquote>
<h3><a class="anchor" name="1-what-can-i-do-with-bots" href="#1-what-can-i-do-with-bots"><i class="anchor-icon"></i></a>1. What can I do with bots?</h3>
<div class="dev_side_image">
<a href="/file/811140081/1/VldnlW70g2I/a140b0216e7d156ebc" target="_blank"><img src="/file/811140663/1/uHVzwsRJz3Y/a499733c59840694ca" title="A chat with a bot also showing search results from the @gif inline-bot"/></a>
</div>
<p>To name just a few things, you could use bots to:</p>
<ul>
<li><p><strong>Get customized notifications and news</strong>. A bot can act as a smart newspaper, sending you relevant content as soon as it&#39;s published.</p>
</li>
<li><p><strong>Integrate with other services</strong>. A bot can enrich Telegram chats with content from external services.<br><a href="https://t.me/gmailbot"><strong>Gmail Bot</strong></a>, <a href="https://t.me/gif"><strong>GIF bot</strong></a>, <a href="https://t.me/imdb"><strong>IMDB bot</strong></a>, <a href="https://t.me/wiki"><strong>Wiki bot</strong></a>, <a href="https://t.me/music"><strong>Music bot</strong></a>, <a href="https://t.me/youtube"><strong>Youtube bot</strong></a>, <a href="https://t.me/githubbot"><strong>GitHubBot</strong></a></p>
</li>
<li><p><strong>Accept payments from Telegram users</strong>. A bot can offer paid services or work as a virtual storefront. <a href="/bots/payments">Read more »</a><br><a href="https://t.me/shopbot"><strong>Demo Shop Bot</strong></a>, <a href="https://t.me/teststore"><strong>Demo Store</strong></a></p>
</li>
<li><p><strong>Create custom tools</strong>. A bot may provide you with alerts, weather forecasts, translations, formatting or other services.<br><a href="https://t.me/Bold"><strong>Markdown bot</strong></a>, <a href="https://t.me/sticker"><strong>Sticker bot</strong></a>, <a href="https://t.me/vote"><strong>Vote bot</strong></a>, <a href="https://t.me/like"><strong>Like bot</strong></a></p>
</li>
<li><p><strong>Build single- and multiplayer games</strong>. A bot can offer rich <a href="/bots/games">HTML5 experiences</a>, from simple arcades and puzzles to 3D-shooters and real-time strategy games.<br><a href="https://t.me/gamebot"><strong>GameBot</strong></a>, <a href="https://t.me/gamee"><strong>Gamee</strong></a></p>
</li>
<li><p><strong>Build social services</strong>. A bot could connect people looking for conversation partners based on common interests or proximity.</p>
</li>
<li><p><strong>Do virtually anything else</strong>. Except for dishes — bots are terrible at doing the dishes.</p>
</li>
</ul>
<h3><a class="anchor" name="2-how-do-bots-work" href="#2-how-do-bots-work"><i class="anchor-icon"></i></a>2. How do bots work?</h3>
<p>At the core, Telegram Bots are special accounts that do not require an additional phone number to set up. Users can interact with bots in two ways:</p>
<ul>
<li>Send messages and <a href="#commands">commands</a> to bots by opening a chat with them or by adding them to groups.</li>
<li>Send requests directly from the input field by typing the bot&#39;s @username and a query. This allows sending content from <a href="/bots/inline">inline bots</a> directly into any chat, group or channel.</li>
</ul>
<p>Messages, commands and requests sent by users are passed to the software running on your servers. Our intermediary server handles all encryption and communication with the Telegram API for you. You communicate with this server via a simple HTTPS-interface that offers a simplified version of the Telegram API. We call that interface our <a href="/bots/api">Bot API</a>.</p>
<blockquote>
<p>A detailed description of the Bot API is available on <a href="/bots/api">this page »</a></p>
</blockquote>
<h3><a class="anchor" name="3-how-do-i-create-a-bot" href="#3-how-do-i-create-a-bot"><i class="anchor-icon"></i></a>3. How do I create a bot?</h3>
<div class="dev_side_image">
<a href="/file/811140327/1/zlN4goPTupk/9ff2f2f01c4bd1b013" target="_blank"><img src="/file/811140763/1/PihKNbjT8UE/03b57814e13713da37" title="The Botfather. Click for hi-res picture"/></a>
</div>
<p>There&#39;s a… bot for that. Just talk to <a href="https://t.me/botfather">BotFather</a> (described <a href="#6-botfather">below</a>) and follow a few simple steps. Once you&#39;ve created a bot and received your authentication token, head down to the <a href="/bots/api">Bot API manual</a> to see what you can teach your bot to do.</p>
<blockquote>
<p>You may also like to check out some <strong>code examples</strong> <a href="/bots/samples">here »</a></p>
</blockquote>
<h3><a class="anchor" name="4-how-are-bots-different-from-humans" href="#4-how-are-bots-different-from-humans"><i class="anchor-icon"></i></a>4. How are bots different from humans?</h3>
<ul>
<li>Bots have no online status and no last seen timestamps, the interface shows the label <strong>&#39;bot&#39;</strong> instead.</li>
<li>Bots have limited cloud storage — older messages may be removed by the server shortly after they have been processed.</li>
<li>Bots can&#39;t initiate conversations with users. A user <strong>must</strong> either add them to a group or send them a message first. People can use <code>t.me/&lt;bot_username&gt;</code> links or username search to find your bot.</li>
<li>Bot usernames always end in &#39;bot&#39; (e.g. <a href="https://t.me/triviabot">@TriviaBot</a>, <a href="https://t.me/githubbot">@GitHub_bot</a>).</li>
<li>When added to a group, bots do not receive all messages by default (see <a href="#privacy-mode">Privacy mode</a>).</li>
<li>Bots never eat, sleep or complain (unless expressly programmed otherwise).</li>
</ul>
<hr>
<h3><a class="anchor" name="5-bot-perks" href="#5-bot-perks"><i class="anchor-icon"></i></a>5. Bot perks</h3>
<p>Telegram bots are unique in many ways — we offer <a href="#keyboards">two</a> <a href="#inline-keyboards-and-on-the-fly-updating">kinds</a> of keyboards, additional interfaces for <a href="#global-commands">default commands</a> and <a href="#deep-linking">deep linking</a> as well as <a href="/bots/api#formatting-options">text formatting</a>, <a href="#payment-platform">integrated payments</a> and more.</p>
<h4><a class="anchor" name="inline-mode" href="#inline-mode"><i class="anchor-icon"></i></a>Inline mode</h4>
<!--<div class="dev_side_image">
<a href="/file/811140221/1/fW9vnLya4Fg/e2b5c530c7b0e019c4" target="_blank"><img src="/file/811140530/1/h-eMmPp2vp4/cd4a109f75e6561305" title="Inline bots. Click for hi-res picture">
</a></div>-->
<p>Users can interact with your bot via <a href="/bots/api#inline-mode"><strong>inline queries</strong></a> straight from the <strong>text input field</strong> in <strong>any</strong> chat. All they need to do is start a message with your bot&#39;s username and then type a query.</p>
<p>Having received the query, your bot can return some results. As soon as the user taps one of them, it is sent to the user&#39;s currently opened chat. This way, people can request content from your bot in any of their chats, groups or channels.</p>
<p>Check out this <a href="https://telegram.org/blog/inline-bots">blog</a> to see a sample inline bot in action. You can also try the <a href="https://t.me/sticker">@sticker</a> and <a href="https://t.me/music">@music</a> bots to see for yourself.</p>
<div><center>
<a href="/file/811140558/1/POjp00-nHqE/50d0312845a05e6da9" target="_blank"><img src="/file/811140558/1/POjp00-nHqE/50d0312845a05e6da9" title="New input field" style="width: 295px; padding: 10px 0px;" /></a></center>
</div>
<p>We&#39;ve also implemented an easy way for your bot to <a href="/bots/inline#switching-inline-pm-modes">switch between inline and PM modes</a>.</p>
<blockquote>
<p><a href="/bots/inline">Read more about the Inline Mode »</a></p>
</blockquote>
<h4><a class="anchor" name="payment-platform" href="#payment-platform"><i class="anchor-icon"></i></a>Payment platform</h4>
<!--<div class="dev_side_image">
<a href="/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207" target="_blank"><img src="/file/811140095/1/lfTvDVqVS8M.43169/1a191248e6cf027581" title="Payments API. Click for hi-res picture">
</a></div>-->
<p>You can use bots to <strong>accept payments</strong> from Telegram users around the world.</p>
<ul>
<li>Send invoices to <strong>any chat</strong>, including to groups and channels.</li>
<li>Create invoices that can be <strong>forwarded</strong> and used by <strong>multiple buyers</strong> to order things.</li>
<li>Use <a href="/bots/inline">inline mode</a> to help users show your goods and services to their friends and communities.</li>
<li>Allow <strong>tips</strong> from users with preset and custom amounts.</li>
<li>Accept payments from users on mobile or <strong>desktop apps</strong>.</li>
<li>Try <a href="https://t.me/shopbot">@ShopBot</a> to create a test invoice or start a message with <code>@ShopBot ...</code> in any chat for an <strong>inline invoice</strong>.</li>
<li>Check out <a href="https://telegram.org/teststore">Demo Shop</a> for an example of a <a href="https://telegram.org/tour/channels">Telegram Channel</a> used as <strong>virtual storefront</strong>.</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/464001377/1/0o3vSvY22g8.123356/deb4ed6951d780f7b7" style="max-width: 400px;" title="If your pizza place can't deliver a clone army, you're buying pizza from the wrong shop." alt="Video: Ordering a pizza through a Telegram channel">
<source src="/file/464001705/2/Hg-klQnZ_n4.4889245.mp4/d324511ffdab7b4668" type="video/mp4">
</video>
</div>
<blockquote>
<p><a href="/bots/payments">Read more about the Payments Platform »</a></p>
</blockquote>
<h4><a class="anchor" name="gaming-platform" href="#gaming-platform"><i class="anchor-icon"></i></a>Gaming platform</h4>
<p>Bots can offer their users <strong>HTML5 games</strong> to play solo or to compete against each other in groups and one-on-one chats. The platform allows your bot to keep track of <strong>high scores</strong> for every game played in every chat. Whenever theres a new leader in the game, other playing members in the chat are notified that they need to step it up. </p>
<div><center>
<a href="/file/811140306/1/dkciuEDbpxU.193188/8a0a21b6e9d111be4c" target="_blank"><img src="/file/811140306/1/dkciuEDbpxU.193188/8a0a21b6e9d111be4c" title="Game in a chat" style="width: 250px; padding: 10px 5px" /></a>
<a href="/file/811140426/1/ZCw3vu_v8s0.109692/04efd9e88644939a4f" target="_blank"><img src="/file/811140426/1/ZCw3vu_v8s0.109692/04efd9e88644939a4f" title="In-game scoreboard and sharing button" style="width: 250px; padding: 10px 5px" /></a>
</center>
</div>
<p>Since the underlying technology is HTML5, the games can be anything from simple arcades and puzzles to multiplayer 3D-shooters and real-time strategy games. Our team has created a couple of simple demos for you to try out:</p>
<ul>
<li><a href="https://t.me/gamebot?game=MathBattle">Math Battle</a></li>
<li><a href="https://t.me/gamebot?game=Lumberjack">Lumberjack</a></li>
<li><a href="https://t.me/gamebot?game=Corsairs">Corsairs</a></li>
</ul>
<p>You can also check out the <a href="https://t.me/gamee"><strong>@gamee</strong></a> bot that has more than 20 games.</p>
<blockquote>
<p><a href="https://telegram.org/blog/games">Read more about the Gaming Platform »</a></p>
</blockquote>
<h4><a class="anchor" name="keyboards" href="#keyboards"><i class="anchor-icon"></i></a>Keyboards</h4>
<p>Traditional chat bots can of course be taught to understand human language. But sometimes you want some more formal input from the user — and this is where <strong>custom keyboards</strong> can become extremely useful.</p>
<p>Whenever your bot sends a message, it can pass along a special keyboard 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. Tapping any of the buttons will immediately send the respective command. This way you can drastically simplify user interaction with your bot.</p>
<p>We currently support text and emoji for your buttons. Here are some custom keyboard examples:</p>
<center>
<div>
<a href="/file/811140184/1/5YJxx-rostA/ad3f74094485fb97bd" target="_blank"><img src="/file/811140184/1/5YJxx-rostA/ad3f74094485fb97bd" title="Keyboard for a poll bot" style="max-height: 300px; padding: 10px 5px" /></a>
<a href="/file/811140880/1/jS-YSVkDCNQ/b397dfcefc6da0dc70" target="_blank"><img src="/file/811140880/1/jS-YSVkDCNQ/b397dfcefc6da0dc70" title="Keyboard for a calculator bot. Because you can." style="max-height: 300px; padding: 10px 5px" /></a>
<a href="/file/811140733/2/KoysqJKQ_kI/a1ee46a377796c3961" target="_blank"><img src="/file/811140733/2/KoysqJKQ_kI/a1ee46a377796c3961" title="Keyboard for a trivia bot" style="max-height: 300px; padding: 10px 5px" /></a>
</div></center>
<blockquote>
<p>For more technical information on custom keyboards, please consult the <a href="/bots/api">Bot API manual</a> (see <a href="/bots/api#sendmessage">sendMessage</a>).</p>
</blockquote>
<h4><a class="anchor" name="inline-keyboards-and-on-the-fly-updating" href="#inline-keyboards-and-on-the-fly-updating"><i class="anchor-icon"></i></a>Inline keyboards and on-the-fly updating</h4>
<p>There are times when you&#39;d prefer to do things without sending any messages to the chat. For example, when your user is changing settings or flipping through search results. In such cases you can use Inline Keyboards that are integrated directly into the messages they belong to. </p>
<p>Unlike with custom reply keyboards, pressing buttons on inline keyboards doesn&#39;t result in messages sent to the chat. Instead, inline keyboards support buttons that work behind the scenes: <a href="/bots/2-0-intro#callback-buttons">callback buttons</a>, <a href="/bots/2-0-intro#url-buttons">URL buttons</a> and <a href="/bots/2-0-intro#switch-to-inline-buttons">switch to inline buttons</a>.</p>
<div><center>
<a href="/file/811140217/1/NkRCCLeQZVc/17a804837802700ea4" target="_blank"><img src="/file/811140217/1/NkRCCLeQZVc/17a804837802700ea4" title="Callback buttons in @music" style="width: 240px; padding: 10px 5px;" /></a>
<a href="/file/811140659/1/RRJyulbtLBY/ea6163411c7eb4f4dc" target="_blank"><img src="/file/811140659/1/RRJyulbtLBY/ea6163411c7eb4f4dc" title="More callback buttons in @music" style="width: 240px; padding: 10px 5px;" /></a>
<a href="/file/811140999/1/2JSoUVlWKa0/4fad2e2743dc8eda04" target="_blank"><img src="/file/811140999/1/2JSoUVlWKa0/4fad2e2743dc8eda04" title="A URL button" style="width:240px; padding:10px 5px"/></a>
</center>
</div>
<p>When callback buttons are used, your bot can update its existing messages (or just their keyboards) so that the chat remains tidy. Check out these sample bots to see inline keyboards in action: <a href="https://t.me/music">@music</a>, <a href="https://t.me/vote">@vote</a>, <a href="https://t.me/like">@like</a>.</p>
<blockquote>
<p><a href="/bots/2-0-intro#new-inline-keyboards">Read more about inline keyboards and on-the-fly editing »</a></p>
</blockquote>
<h4><a class="anchor" name="commands" href="#commands"><i class="anchor-icon"></i></a>Commands</h4>
<p>Commands present a more flexible way to communicate with your bot. The following syntax may be used:</p>
<pre><code>/command</code></pre>
<p>A command must always start with the &#39;/&#39; symbol and may not be longer than 32 characters. Commands can use latin letters, numbers and underscores. Here are a few examples:</p>
<pre><code>/get_messages_stats
/set_timer 10min Alarm!
/get_timezone London, UK</code></pre>
<p>Messages that start with a slash are always passed to the bot (along with replies to its messages and messages that @mention the bot by username). Telegram apps will:</p>
<ul>
<li>Suggest a list of supported commands with descriptions when the user enters a &#39;/&#39; (for this to work, you need to have provided a list of commands to the <a href="#6-botfather">BotFather</a>). Tapping on a command in the list immediately sends the command.</li>
<li>Show an additional <strong>(/)</strong> button in the input field in all chats with bots. Tapping it types a &#39;/&#39; and shows the list of commands.</li>
<li>Highlight <strong>/commands</strong> in messages. When the user taps a highlighted command, the command is sent at once.</li>
</ul>
<center><div>
<a href="/file/811140845/2/rNUxpcGDeQU/05eaaf20b0dbaf9cb3" target="_blank"><img src="/file/811140845/2/rNUxpcGDeQU/05eaaf20b0dbaf9cb3" title="Suggested commands" style="width: 230px; padding: 10px 5px" /></a>
<a href="/file/811140315/2/gf7_D2HbeyM/e3ca2de4de7918f826" target="_blank"><img src="/file/811140315/2/gf7_D2HbeyM/e3ca2de4de7918f826" title="Notice the new button in the input field, right next to the sticker button" style="width: 230px; padding: 10px 5px" /></a>
<a href="/file/811140029/1/s5zv4fbWdhw/a04aefa0ee0557f16a" target="_blank"><img src="/file/811140029/1/s5zv4fbWdhw/a04aefa0ee0557f16a" title="Suggested commands for multiple bots" style="width: 230px; padding: 10px 5px" /></a>
</div></center>
<p>If multiple bots are in a group, it is possible to add bot usernames to commands in order to avoid confusion:</p>
<pre><code>/start@TriviaBot
/start@ApocalypseBot</code></pre>
<p>This is done automatically when commands are selected via the list of suggestions. Please remember that your bot needs to be able to process commands that are followed by its username.</p>
<h5><a class="anchor" name="global-commands" href="#global-commands"><i class="anchor-icon"></i></a>Global commands</h5>
<p>In order to make it easier for users to navigate the bot multiverse, we ask all developers to support a few basic commands. Telegram apps will have <strong>interface shortcuts</strong> for these commands.</p>
<ul>
<li><strong>/start</strong> - begins interaction with the user, e.g., by sending a greeting message. This command can also be used to pass additional parameters to the bot (see <a href="#deep-linking">Deep linking</a>)</li>
<li><strong>/help</strong> - returns a help message. It can be a short text about what your bot can do and a list of commands.</li>
<li><strong>/settings</strong> - (if applicable) returns the bot&#39;s settings for this user and suggests commands to edit these settings.</li>
</ul>
<p>Users will see a <strong>Start</strong> button when they first open a conversation with your bot. <strong>Help</strong> and <strong>Settings</strong> links will be available in the menu on the bot&#39;s profile page.</p>
<center><div>
<a href="/file/811140979/2/yD8AphHbahk/7662d14f4e0442ae3a" target="_blank"><img src="/file/811140979/2/yD8AphHbahk/7662d14f4e0442ae3a" title="An empty conversation with a bot" style="width: 250px; padding: 10px 5px" /></a>
<a href="/file/811140479/2/1c2zUWhR7sA/98889b2a45f8e42a35" target="_blank"><img src="/file/811140479/2/1c2zUWhR7sA/98889b2a45f8e42a35" title="A bot's profile page, featuring 'Help' and 'Settings' buttons" style="width: 250px; padding: 10px 5px" /></a>
</div></center>
<h4><a class="anchor" name="formatting-bold-italic-fixed-width-text-and-inline-links" href="#formatting-bold-italic-fixed-width-text-and-inline-links"><i class="anchor-icon"></i></a>Formatting: bold, italic, fixed-width text and inline links</h4>
<p>You can use bold, italic or fixed-width text, as well as inline links in your bots&#39; messages. Telegram clients will render them accordingly. </p>
<blockquote>
<p><a href="bots/api#formatting-options">Read more in the Bot API manual »</a></p>
</blockquote>
<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 in order to augment communication between human users, e.g. by providing news, notifications from external services or additional search functionality. This is especially true for work-related groups. Now, when you share a group with a bot, you tend to ask yourself “How can I be sure that the little rascal isn&#39;t selling my chat history to my competitors?” The answer is — <strong>privacy mode</strong>.</p>
<p>A bot running in privacy mode will not receive all messages that people send to the group. Instead, it will only receive:</p>
<ul>
<li>Messages that start with a slash &#39;/&#39; (see <a href="#commands">Commands</a> above)</li>
<li>Replies to the bot&#39;s own messages</li>
<li>Service messages (people added or removed from the group, etc.)</li>
<li>Messages from channels where it&#39;s a member</li>
</ul>
<p>On one hand, this helps some of us sleep better at night (in our tinfoil nightcaps), on the other — it allows the bot developer to save a lot of resources, since they won&#39;t need to process tens of thousands irrelevant messages each day.</p>
<p>Privacy mode is enabled by default for all bots, except bots that were added to the group as <strong>admins</strong> (bot admins always receive all messages). It can be disabled, so that the bot receives all messages like an ordinary user (the bot will need to be <strong>re-added</strong> to the group for this change to take effect). We only recommend doing this in cases where it is absolutely necessary for your bot to work — users can always see a bot&#39;s current privacy setting in the group members list. In most cases, using the <a href="/bots/api#forcereply">force reply</a> option for the bot&#39;s messages should be more than enough. </p>
<p><a href="/bots/faq#what-messages-will-my-bot-get">So what messages exactly will my bot get? »</a></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 <a href="https://en.wikipedia.org/wiki/Deep_linking">deep linking</a> mechanism, that allows for passing additional parameters to the bot on startup. It could be a command that launches the bot — or an authentication token to connect the user&#39;s Telegram account to their account on some external service.</p>
<p>Each bot has a link that opens a conversation with it in Telegram — <code>https://t.me/&lt;bot username&gt;</code>. You can add the parameters <strong>start</strong> or <strong>startgroup</strong> to this link, with values up to 64 characters long. For example:</p>
<pre><code>https://t.me/triviabot?startgroup=test</code></pre>
<p><code>A-Z</code>, <code>a-z</code>, <code>0-9</code>, <code>_</code> and <code>-</code> are allowed. We recommend using <a href="https://en.wikipedia.org/wiki/Base64#The_URL_applications">base64url</a> to encode parameters with binary and other types of content.</p>
<p>Following a link with the <strong>start</strong> parameter will open a one-on-one conversation with the bot, showing a START button in the place of the input field. If the <strong>startgroup</strong> parameter is used, the user is prompted to select a group to add the bot to. As soon as a user confirms the action (presses the START button in their app or selects a group to add the bot to), your bot will receive a message from that user in this format:</p>
<pre><code>/start PAYLOAD</code></pre>
<p><code>PAYLOAD</code> stands for the value of the <strong>start</strong> or <strong>startgroup</strong> parameter that was passed in the link.</p>
<h5><a class="anchor" name="deep-linking-example" href="#deep-linking-example"><i class="anchor-icon"></i></a>Deep linking Example</h5>
<p>Suppose the website example.com would like to send notifications to its users via a Telegram bot. Here&#39;s what they could do to enable notifications for a user with the ID <code>123</code>.</p>
<ol>
<li><a href="#6-botfather">Create a bot</a> with a suitable username, e.g. @ExampleComBot</li>
<li>Set up a <a href="/bots/api#setwebhook">webhook</a> for incoming messages</li>
<li>Generate a random string of a sufficient length, e.g. <code>$memcache_key = &quot;vCH1vGWJxfSeofSAs0K5PA&quot;</code></li>
<li>Put the value <code>123</code> with the key <code>$memcache_key</code> into Memcache for 3600 seconds (one hour) </li>
<li>Show our user the button <code>https://t.me/ExampleComBot?start=vCH1vGWJxfSeofSAs0K5PA</code></li>
<li>Configure the webhook processor to query Memcached with the parameter that is passed in incoming messages beginning with <code>/start</code>. If the key exists, record the chat_id passed to the webhook as <strong>telegram_chat_id</strong> for the user <code>123</code>. Remove the key from Memcache.</li>
<li>Now when we want to send a notification to the user <code>123</code>, check if they have the field <strong>telegram_chat_id</strong>. If yes, use the <a href="/bots/api#sendmessage">sendMessage</a> method in the <a href="/bots/api">Bot API</a> to send them a message in Telegram.</li>
</ol>
<h4><a class="anchor" name="location-and-number" href="#location-and-number"><i class="anchor-icon"></i></a>Location and Number</h4>
<p>Some bots need extra data from the user to work properly. For example, knowing the user&#39;s location helps provide more relevant geo-specific results. The user&#39;s phone number can be very useful for integrations with other services, like banks, etc.</p>
<p>Bots can ask a user for their <strong>location</strong> and <strong>phone number</strong> using special buttons. Note that both phone number and location request buttons will only work in private chats.</p>
<div><center>
<a href="/file/811140587/2/jaowDLZg2l0/5ba3f7d7fd5c6c28dc" target="_blank"><img src="/file/811140587/2/jaowDLZg2l0/5ba3f7d7fd5c6c28dc" title="Phone number and location sharing buttons" style="width: 295px; padding: 10px 20px;" /></a></center>
</div>
<p>When these buttons are pressed, Telegram clients will display a confirmation alert that tells the user what&#39;s about to happen.</p>
<blockquote>
<p><a href="/bots/api#keyboardbutton">Manual: Number and location buttons »</a></p>
</blockquote>
<hr>
<h3><a class="anchor" name="6-botfather" href="#6-botfather"><i class="anchor-icon"></i></a>6. BotFather</h3>
<blockquote>
<p>Jump to top to learn everything about <a href="#">Telegram bots »</a></p>
</blockquote>
<p><a href="https://t.me/botfather">BotFather</a> is the one bot to rule them all. It will help you create new bots and change settings for existing ones.</p>
<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 <strong>/newbot</strong> command to create a new bot. The BotFather will ask you for a name and username, then generate an authentication token for your new bot. </p>
<p>The <strong>name</strong> of your bot is displayed in contact details and elsewhere.</p>
<p>The <strong>Username</strong> is a short name, to be used in mentions and t.me links. Usernames are 5-32 characters long and are case insensitive, but may only include Latin characters, numbers, and underscores. Your bot&#39;s username <strong>must</strong> end in &#39;bot&#39;, e.g. &#39;tetris_bot&#39; or &#39;TetrisBot&#39;.</p>
<p>The <strong>token</strong> is a string along the lines of <code>110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw</code> that is required to authorize the bot and send requests to the <a href="/bots/api">Bot API</a>. Keep your token secure and store it safely, it can be used by anyone to control your bot.</p>
<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 compromised or you lost it for some reason, use the <strong>/token</strong> command to generate a new one.</p>
<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><strong>/mybots</strong> — returns a list of your bots with handy controls to edit their settings</li>
<li><strong>/mygames</strong> — does the same for your games</li>
</ul>
<p><strong>Edit bots</strong></p>
<ul>
<li><strong>/setname</strong> change your bot&#39;s name.</li>
<li><strong>/setdescription</strong> — change the bot&#39;s <strong>description</strong>, a short text of up to 512 characters, describing your bot. Users will see this text at the beginning of the conversation with the bot, titled &#39;What can this bot do?&#39;.</li>
<li><strong>/setabouttext</strong> — change the bot&#39;s <strong>about info</strong>, an even shorter text of up to 120 characters. Users will see this text on the bot&#39;s profile page. When they share your bot with someone, this text is sent together with the link.</li>
<li><strong>/setuserpic</strong> — change the bot&#39;s profile pictures. It&#39;s always nice to put a face to a name.</li>
<li><strong>/setcommands</strong> — change the list of commands supported by your bot. Users will see these commands as suggestions when they type <code>/</code> in the chat with your bot. Each command has a name (must start with a slash /, alphanumeric plus underscores, no more than 32 characters, case-insensitive), parameters, and a text description. Users will see the list of commands whenever they type &#39;/&#39; in a conversation with your bot.</li>
<li><strong>/deletebot</strong> — delete your bot and free its username.</li>
</ul>
<p><strong>Edit settings</strong></p>
<ul>
<li><strong>/setinline</strong> — toggle <a href="/bots/inline">inline mode</a> for your bot.</li>
<li><strong>/setinlinegeo</strong> - request location data to provide <a href="/bots/inline#location-based-results">location-based inline results</a>.</li>
<li><strong>/setjoingroups</strong> — toggle whether your bot can be added to groups or not. Any bot must be able to process private messages, but if your bot was not designed to work in groups, you can disable this.</li>
<li><strong>/setprivacy</strong> — set which messages your bot will receive when added to a group. With privacy mode disabled, the bot will receive all messages. We recommend leaving <a href="#privacy-mode">privacy mode</a> enabled. You will need to re-add the bot to existing groups for this change to take effect.</li>
</ul>
<p><strong>Manage games</strong></p>
<ul>
<li><strong>/newgame</strong> — create a new <a href="/bots/games">game</a>.</li>
<li><strong>/listgames</strong> — get a list of your games.</li>
<li><strong>/editgame</strong> — edit a game.</li>
<li><strong>/deletegame</strong> — delete an existing game.</li>
</ul>
<blockquote>
<p>Please note, that it may take <strong>a few minutes</strong> for changes to take effect.</p>
</blockquote>
<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 stay competitive in this environment, your bot also needs to be responsive. In order to help developers keep their bots in shape, Botfather will send status alerts if it sees something is wrong.</p>
<p>We will be checking the number of replies and the request/response conversion rate for popular bots (~300 requests per minute: but don&#39;t write this down as the value may change in the future). If we get abnormally low readings, you will receive a notification from Botfather.</p>
<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, you will only get one alert per bot per hour. 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&#39;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&#39;t fix your bot at the moment. This will disable all alerts for the bot in question for the specified period of time. We do not recommend using this option since your users may migrate to a more stable bot. You can unmute alerts in your bot&#39;s settings via Botfather.</li>
</ul>
<h5><a class="anchor" name="monitored-issues" href="#monitored-issues"><i class="anchor-icon"></i></a>Monitored issues</h5>
<p>We will currently notify you about the following issues:</p>
<p><strong>1.</strong></p>
<pre><code>Too few **private messages** are sent compared to previous weeks: **{value}**</code></pre>
<p>Your bot is sending much fewer messages than it did in the previous weeks. This is useful for newsletter-style bots that send out messages without prompts from the users. The larger the value, the more significant the difference. </p>
<p><strong>2.</strong></p>
<pre><code>Too few replies to incoming **private messages**. Conversion rate: **{value}**</code></pre>
<p>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). To provide a good user experience, please respond to all messages that are sent to your bot. Respond to <em>message</em> <a href="https://core.telegram.org/bots/api#update">updates</a> by calling <em>send…</em> methods (e.g. <a href="https://core.telegram.org/bots/api#sendmessage">sendMessage</a>).</p>
<p><strong>3.</strong></p>
<pre><code>Too few answers to **inline queries**. Conversion rate: **{value}**</code></pre>
<p>Your bot is not replying to all inline queries that are being sent to it, calculated in the same way as above. Respond to <em>inline_query</em> <a href="https://core.telegram.org/bots/api#update">updates</a> by calling <a href="/bots/api#answerinlinequery">answerInlineQuery</a>.</p>
<p><strong>4.</strong></p>
<pre><code>Too few answers to **callback queries**. Conversion rate: **{value}**
Too few answers to **callback game queries**. Conversion rate: **{value}**</code></pre>
<p>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 <em>callback_query</em> <a href="https://core.telegram.org/bots/api#update">updates</a> by calling <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>.</p>
<blockquote>
<p>Please note that the status alerts feature is still being tested and will be improved in the future.</p>
</blockquote>
<hr>
<p>That&#39;s it for the introduction. You are now definitely ready to proceed to the <a href="/bots/api"><strong>BOT API MANUAL</strong></a>.</p>
<p>If you&#39;ve got any questions, please check out our <a href="/bots/faq"><strong>Bot FAQ »</strong></a></p>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,233 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Introducing Bot API 2.0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Howdy&#33; This text assumes that youre familiar with Telegrams bot platform.
If this is not the case, kindly check out our…">
<meta property="og:title" content="Introducing Bot API 2.0">
<meta property="og:image" content="4cffbe607dd6ff44bc">
<meta property="og:description" content="Howdy&#33; This text assumes that youre familiar with Telegrams bot platform.
If this is not the case, kindly check out our…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Introducing Bot API 2.0</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<blockquote>
<p>Howdy! This text assumes that youre familiar with Telegrams bot platform.<br>If this is not the case, kindly check out our <a href="/bots"><strong>Introduction to Bots</strong></a>.</p>
</blockquote>
<p>Today were introducing the biggest change to Telegrams Bot Platform since June 2015. These new tools will help you create fluid and intuitive interfaces for your bots. And bots are becoming a lot more capable. They can now send any type of content supported on Telegram, provide location-based services and integrate with other services deeply based on users&#39; phone numbers.</p>
<p>If you&#39;d like a more concise changelog, you can find one in the <a href="/bots/api#recent-changes"><strong>Bot API Manual</strong></a>.</p>
<h3><a class="anchor" name="new-inline-keyboards" href="#new-inline-keyboards"><i class="anchor-icon"></i></a>New Inline Keyboards</h3>
<p>To begin with, we&#39;re adding a new type of keyboard that is integrated directly into the message it belongs to. Inline keyboards are available for messages sent both in chat mode and inline mode.</p>
<div><center>
<a href="/file/811140217/1/NkRCCLeQZVc/17a804837802700ea4" target="_blank"><img src="/file/811140217/1/NkRCCLeQZVc/17a804837802700ea4" title="Callback buttons in @music" style="width: 295px; padding: 10px 20px;" /></a>
<a href="/file/811140659/1/RRJyulbtLBY/ea6163411c7eb4f4dc" target="_blank"><img src="/file/811140659/1/RRJyulbtLBY/ea6163411c7eb4f4dc" title="More callback buttons in @music" style="width: 295px; padding: 10px 20px;" /></a>
</center><br>
</div>
<p>Unlike with custom reply keyboards, pressing buttons on inline keyboards doesn&#39;t result in messages sent to the chat. Instead, inline keyboards support buttons that work behind the scenes: <a href="#callback-buttons">callback buttons</a>, <a href="#url-buttons">URL buttons</a> and <a href="#switch-to-inline-buttons">switch to inline buttons</a>.</p>
<blockquote>
<p><a href="/bots/api#inlinekeyboardmarkup">Manual: Inline keyboards »</a></p>
</blockquote>
<h4><a class="anchor" name="callback-buttons" href="#callback-buttons"><i class="anchor-icon"></i></a>Callback buttons</h4>
<p>When a user presses a <strong>callback button</strong>, no messages are sent to the chat. Instead, your bot simply receives the relevant query. Upon receiving the query, your bot can display some <a href="/bots/api#answercallbackquery">result in a notification</a> at the top of the chat screen or in an alert.</p>
<div><center>
<a href="/file/811140423/1/6BVlO7dWPeo/64d0d842ff73ff3dc8" target="_blank"><img src="/file/811140423/1/6BVlO7dWPeo/64d0d842ff73ff3dc8" title="Notification at the top" style="width:295px; padding:10px 20px"/></a></center><br>
</div>
<p><strong>Sample bot</strong><br><a href="https://telegram.me/music">@music</a> This sample music bot uses inline callback buttons to flip pages and reload random results.</p>
<p>Read on to <a href="#updating-messages">updating messages</a> to find out how callback buttons can get even cooler.</p>
<h4><a class="anchor" name="url-buttons" href="#url-buttons"><i class="anchor-icon"></i></a>URL buttons</h4>
<p>Buttons of this type have a small arrow icon to help the user understand that tapping on a <strong>URL button</strong> will open an external link. Naturally, we&#39;ll show them a confirmation alert before opening the link in the browser.</p>
<div><center>
<a href="/file/811140999/1/2JSoUVlWKa0/4fad2e2743dc8eda04" target="_blank"><img src="/file/811140999/1/2JSoUVlWKa0/4fad2e2743dc8eda04" title="URL button" style="width:295px; padding:10px 20px"/></a></center>
</div>
<h4><a class="anchor" name="switch-to-inline-buttons" href="#switch-to-inline-buttons"><i class="anchor-icon"></i></a>Switch to Inline buttons</h4>
<p>Pressing a switch to inline button prompts the user to select a chat, opens it and inserts the bot&#39;s username into the input field. You can also pass a query that will be inserted along with the username this way your users will immediately get some inline results they can share.</p>
<div><center>
<a href="/file/811140659/1/RRJyulbtLBY/ea6163411c7eb4f4dc" target="_blank"><img src="/file/811140659/1/RRJyulbtLBY/ea6163411c7eb4f4dc" title="More callback buttons in @music" style="width: 295px; padding: 10px 20px;" /></a></center><br>
</div>
<p><strong>Sample bot</strong><br><a href="https://telegram.me/sticker">@sticker</a> This sticker search bot offers a <a href="#switch-to-inline-buttons">switch to inline button</a> to teach users how to use it in inline mode. </p>
<h3><a class="anchor" name="updating-messages" href="#updating-messages"><i class="anchor-icon"></i></a>Updating Messages</h3>
<p>Since inline keyboards dont send additional messages to the chat, it made sense to give bots a way of manipulating their existing messages, so that they dont have to send a new message each time they need to update something. This helps reduce clutter and build more fluid interfaces.</p>
<div class="smartphone_video_player_wrap">
<div class="smartphone_video_player_iphone">
<video class="smartphone_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" poster="/resources/video/cover/Music.png" loop controls muted>
<source src="/resources/video/Music.mp4" type="video/mp4">
</video>
</div>
</div>
<p><strong>Sample bot</strong><br><a href="https://telegram.me/music">@music</a> Watch how the music bot updates its messages with search results when you press the navigation buttons.</p>
<blockquote>
<p><a href="/bots/api#updating-messages">Manual: Updating messages »</a></p>
</blockquote>
<h3><a class="anchor" name="locations-and-numbers" href="#locations-and-numbers"><i class="anchor-icon"></i></a>Locations and Numbers</h3>
<p>Some bots need extra data from the user to work properly. For example, knowing the users location helps provide more relevant geo-specific results. The users phone number can be very useful for integrations with other services, like banks, etc.</p>
<p>We&#39;ve added an easy way for bots to ask the user for their <strong>location</strong> and <strong>phone number</strong> using special buttons. Note that both phone number and location request buttons will only work in private chats.</p>
<div><center>
<a href="/file/811140587/2/jaowDLZg2l0/5ba3f7d7fd5c6c28dc" target="_blank"><img src="/file/811140587/2/jaowDLZg2l0/5ba3f7d7fd5c6c28dc" title="Phone number and location sharing buttons" style="width: 295px; padding: 10px 20px;" /></a></center><br>
</div>
<p>When these buttons are pressed, Telegram clients will display a confirmation alert that tells the user what&#39;s about to happen.</p>
<blockquote>
<p><a href="/bots/api#keyboardbutton">Manual: Number and location buttons »</a></p>
</blockquote>
<p>Inline bots can also request location data from their users. Use the <code>/setinlinegeo</code> command with <a href="https://telegram.me/botfather">@BotFather</a> to enable this. Your bot will ask the user for permission to access their location whenever they send an inline request.</p>
<p><strong>Sample bot</strong><br><a href="https://telegram.me/foursquare">@foursquare</a> This bot will ask for permission to access the user&#39;s location, then provide geo-targeted results.</p>
<h3><a class="anchor" name="inline-bots-2-0" href="#inline-bots-2-0"><i class="anchor-icon"></i></a>Inline Bots 2.0</h3>
<p>Speaking of inline bots, they are also getting a major upgrade today.</p>
<h4><a class="anchor" name="new-types-of-content" href="#new-types-of-content"><i class="anchor-icon"></i></a>New types of content</h4>
<p>Inline bots now support <strong>all types of content</strong> available in Telegram (19 in all), they are now capable of sending stickers, videos, music, locations, documents and more. </p>
<div><center>
<a href="/file/811140994/2/fvw-q_CRaBQ/c618325e119b0a8229" target="_blank"><img src="/file/811140994/2/fvw-q_CRaBQ/c618325e119b0a8229" title="All kinds of inline content" style="width: 295px; padding: 10px 20px;" /></a></center><br>
</div>
<p><strong>Sample bots</strong><br><a href="https://telegram.me/sticker">@sticker</a> This sticker bot will accept one or more emoji and search for relevant stickers.<br><a href="https://telegram.me/music">@music</a> The music bot allows users to send mp3 tracks from a database of public domain classical music.</p>
<blockquote>
<p><a href="/bots/api#inlinequeryresult">Manual: Types of inline content »</a></p>
</blockquote>
<h4><a class="anchor" name="switching-between-inline-mode-and-private-chat" href="#switching-between-inline-mode-and-private-chat"><i class="anchor-icon"></i></a>Switching between inline mode and private chat</h4>
<p>Some inline bots can benefit from an initial setup process, like connecting them to an account on an external service (e.g., YouTube). We&#39;ve added an easy way of switching between the private chat with a bot and whatever chat the user wants to share inline results in.</p>
<div><center>
<a href="/file/811140951/1/FD93gAgDVDI/8d8bdd16e6a7b40c12" target="_blank"><img src="/file/811140951/1/FD93gAgDVDI/8d8bdd16e6a7b40c12" title="Switch to PM button" style="width: 295px; padding: 10px 20px;" /></a></center><br>
</div>
<p>You can now display a special Switch to PM button above the inline results (or instead of them). This button will open a private chat with the bot and pass a parameter of your choosing, so that you can prompt the user for the relevant setup actions. Once done, you can use an inline keyboard with a <a href="/bots/api#inlinekeyboardmarkup"><em>switch_inline_query</em></a> button to send the user back to the original chat. </p>
<p><strong>Sample bots</strong><br><a href="https://telegram.me/youtube">@youtube</a> Shows a Sign in to YouTube button, then suggests personalized results.</p>
<blockquote>
<p><a href="/bots/api#answerinlinequery">Manual: Switch to PM</a></p>
</blockquote>
<h4><a class="anchor" name="better-inline-ui" href="#better-inline-ui"><i class="anchor-icon"></i></a>Better inline UI</h4>
<p>Since sending content via inline bots works differently from sending ordinary messages, weve changed the interface a little. Theres hardly a more effective way of explaining that theres no need to hit Send&#39;:</p>
<div><center>
<a href="/file/811140558/1/POjp00-nHqE/50d0312845a05e6da9" target="_blank"><img src="/file/811140558/1/POjp00-nHqE/50d0312845a05e6da9" title="New input field" style="width: 295px; padding: 10px 20px;" /></a></center><br>
</div>
<p>Tapping on the cross icon once will clear the query, tapping twice will give the Send button back to the user.</p>
<h3><a class="anchor" name="group-admins" href="#group-admins"><i class="anchor-icon"></i></a>Group Admins</h3>
<p>As a dessert, were beginning to roll out tools that will allow you to create bot solutions for group admins. As the first step, weve added methods to remove members from groups and supergroups.</p>
<blockquote>
<p><a href="/bots/api#kickchatmember">Manual: Group management »</a></p>
</blockquote>
<p>And that&#39;s about it for now. Stay tuned for more updates and subscribe to our official <a href="https://telegram.me/botnews">@Botnews</a> channel on Telegram.</p>
<blockquote>
<p><a href="/bots/api#recent-changes">Read the full changelog for this update »</a></p>
</blockquote>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,693 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Bot API changelog</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
To learn how to create…">
<meta property="og:title" content="Bot API changelog">
<meta property="og:image" content="bf055cf23fb6ab0d9b">
<meta property="og:description" content="The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
To learn how to create…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Bot API changelog</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<blockquote>
<p>The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.<br>To learn how to create and set up a bot, please consult our <a href="https://core.telegram.org/bots"><strong>Introduction to Bots »</strong></a></p>
</blockquote>
<p>You will find all changes to our <a href="/bots/api"><strong>Bot API</strong></a> on this page.</p>
<h3><a class="anchor" name="recent-changes" href="#recent-changes"><i class="anchor-icon"></i></a>Recent changes</h3>
<blockquote>
<p>Subscribe to <a href="https://t.me/botnews">@BotNews</a> to be the first to know about the latest updates and join the discussion in <a href="https://t.me/bottalk">@BotTalk</a></p>
</blockquote>
<h3><a class="anchor" name="april-16-2022" href="#april-16-2022"><i class="anchor-icon"></i></a>April 16, 2022</h3>
<p><strong>Bot API 6.0</strong></p>
<ul>
<li>Added support for <strong>Web Apps</strong>, see the <a href="/bots/webapps">detailed manual here</a>. (<a href="https://telegram.org/blog/notifications-bots">blog announcement</a>)</li>
<li>Added the class <a href="/bots/api#webappinfo">WebAppInfo</a> and the fields <em>web_app</em> to the classes <a href="/bots/api#keyboardbutton">KeyboardButton</a> and <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a>.</li>
<li>Added the class <a href="/bots/api#sentwebappmessage">SentWebAppMessage</a> and the method <a href="/bots/api#answerwebappquery">answerWebAppQuery</a> for sending an answer to a Web App query, which originated from an inline button of the &#39;web_app&#39; type.</li>
<li>Added the class <a href="/bots/api#webappdata">WebAppData</a> and the field <em>web_app_data</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Added the class <a href="/bots/api#menubutton">MenuButton</a> and the methods <a href="/bots/api#setchatmenubutton">setChatMenuButton</a> and <a href="/bots/api#getchatmenubutton">getChatMenuButton</a> for managing the behavior of the bot&#39;s menu button in private chats.</li>
<li>Added the class <a href="/bots/api#chatadministratorrights">ChatAdministratorRights</a> and the methods <a href="/bots/api#setmydefaultadministratorrights">setMyDefaultAdministratorRights</a> and <a href="/bots/api#getmydefaultadministratorrights">getMyDefaultAdministratorRights</a> for managing the bot&#39;s default administrator rights.</li>
<li>Added 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>
<li>Renamed the parameter <em>can_manage_voice_chats</em> to <em>can_manage_video_chats</em> in the method <a href="/bots/api#promotechatmember">promoteChatMember</a>. The old parameter will remain temporarily available.</li>
<li>Renamed the fields <em>voice_chat_scheduled</em>, <em>voice_chat_started</em>, <em>voice_chat_ended</em>, and <em>voice_chat_participants_invited</em> to <em>video_chat_scheduled</em>, <em>video_chat_started</em>, <em>video_chat_ended</em>, and <em>video_chat_participants_invited</em> in the class <a href="/bots/api#message">Message</a>. The old fields will remain temporarily available.</li>
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After the next update, only HTTPS links will be allowed in <em>login_url</em> inline keyboard buttons.</p>
</blockquote>
<hr>
<h3><a class="anchor" name="january-31-2022" href="#january-31-2022"><i class="anchor-icon"></i></a>January 31, 2022</h3>
<p><strong>Bot API 5.7</strong></p>
<ul>
<li>Added support for <a href="https://telegram.org/blog/video-stickers-better-reactions">Video Stickers</a>.</li>
<li>Added the field <em>is_video</em> to the classes <a href="/bots/api#sticker">Sticker</a> and <a href="/bots/api#stickerset">StickerSet</a>.</li>
<li>Added the parameter <em>webm_sticker</em> to the methods <a href="/bots/api#createnewstickerset">createNewStickerSet</a> and <a href="/bots/api#addstickertoset">addStickerToSet</a>.</li>
</ul>
<h3><a class="anchor" name="december-30-2021" href="#december-30-2021"><i class="anchor-icon"></i></a>December 30, 2021</h3>
<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 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>
<h3><a class="anchor" name="december-7-2021" href="#december-7-2021"><i class="anchor-icon"></i></a>December 7, 2021</h3>
<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>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>
<li>Added the field <em>has_protected_content</em> to the classes <a href="/bots/api#chat">Chat</a> and <a href="/bots/api#message">Message</a>.</li>
<li>Added the field <em>is_automatic_forward</em> to the class <a href="/bots/api#message">Message</a>.</li>
</ul>
<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>
<h3><a class="anchor" name="november-5-2021" href="#november-5-2021"><i class="anchor-icon"></i></a>November 5, 2021</h3>
<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>
<li>Added the fields <code>creates_join_request</code> and <code>pending_join_request_count</code> to the class <a href="/bots/api#chatinvitelink">ChatInviteLink</a>.</li>
<li>Added the field <code>name</code> to the class <a href="/bots/api#chatinvitelink">ChatInviteLink</a> and the parameters <code>name</code> to the methods <a href="/bots/api#createchatinvitelink">createChatInviteLink</a> and <a href="/bots/api#editchatinvitelink">editChatInviteLink</a> for managing <a href="https://telegram.org/blog/shared-media-scrolling-calendar-join-requests-and-more#unique-names-for-invite-links">invite link names</a>.</li>
<li>Added updates about new requests to join the chat, represented by the class <a href="/bots/api#chatjoinrequest">ChatJoinRequest</a> and the field <em>chat_join_request</em> in the <a href="/bots/api#update">Update</a> class. The bot must be an administrator in the chat with the <em>can_invite_users</em> administrator right to receive these updates.</li>
<li>Added the methods <a href="/bots/api#approvechatjoinrequest">approveChatJoinRequest</a> and <a href="/bots/api#declinechatjoinrequest">declineChatJoinRequest</a> for managing requests to join the chat.</li>
<li>Added support for the <em>choose_sticker</em> action in the method <a href="/bots/api#sendchataction">sendChatAction</a>.</li>
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>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>
<h3><a class="anchor" name="june-25-2021" href="#june-25-2021"><i class="anchor-icon"></i></a>June 25, 2021</h3>
<p><strong>Bot API 5.3</strong></p>
<p><strong>Personalized Commands</strong></p>
<ul>
<li>Bots can now show lists of commands tailored to specific situations - including localized commands for users with different languages, as well as different commands based on chat type or for specific chats, and special lists of commands for chat admins.</li>
<li>Added the class <a href="/bots/api#botcommandscope">BotCommandScope</a>, describing the scope to which bot commands apply.</li>
<li>Added the parameters <code>scope</code> and <code>language_code</code> to the method <a href="/bots/api#setmycommands">setMyCommands</a> to allow bots specify different commands for different chats and users.</li>
<li>Added the parameters <code>scope</code> and <code>language_code</code> to the method <a href="/bots/api#getmycommands">getMyCommands</a>.</li>
<li>Added the method <a href="/bots/api#deletemycommands">deleteMyCommands</a> to allow deletion of the bot&#39;s commands for the given scope and user language.</li>
<li>Improved visibility of bot commands in Telegram apps with the new &#39;Menu&#39; button in chats with bots, read more on the <a href="https://telegram.org/blog/animated-backgrounds#bot-menu">blog</a>.</li>
</ul>
<p><strong>Custom Placeholders</strong></p>
<ul>
<li>Added the ability to specify a custom input field placeholder in the classes <a href="/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a> and <a href="/bots/api#forcereply">ForceReply</a>.</li>
</ul>
<p><strong>And More</strong></p>
<ul>
<li>Improved documentation of the class <a href="/bots/api#chatmember">ChatMember</a> by splitting it into 6 subclasses.</li>
<li>Renamed the method <code>kickChatMember</code> to <a href="/bots/api#banchatmember">banChatMember</a>. The old method name can still be used.</li>
<li>Renamed the method <code>getChatMembersCount</code> to <a href="/bots/api#getchatmembercount">getChatMemberCount</a>. The old method name can still be used.</li>
<li>Values 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> were changed.</li>
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After 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>
<h3><a class="anchor" name="april-26-2021" href="#april-26-2021"><i class="anchor-icon"></i></a>April 26, 2021</h3>
<p><strong>Bot API 5.2</strong></p>
<ul>
<li>Support for <a href="https://telegram.org/blog/payments-2-0-scheduled-voice-chats">Payments 2.0</a>, see <a href="https://core.telegram.org/bots/payments">this manual</a> for more details about the <strong>Bot Payments API</strong>.</li>
<li>Added the type <a href="/bots/api#inputinvoicemessagecontent">InputInvoiceMessageContent</a> to support sending invoices as inline query results.</li>
<li>Allowed sending invoices to group, supergroup and channel chats.</li>
<li>Added the fields <em>max_tip_amount</em> and <em>suggested_tip_amounts</em> to the method <a href="/bots/api#sendinvoice">sendInvoice</a> to allow adding optional tips to the payment.</li>
<li>The parameter <em>start_parameter</em> of the method <a href="/bots/api#sendinvoice">sendInvoice</a> became optional. If the parameter isn&#39;t specified, the invoice can be paid directly from forwarded messages.</li>
<li>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>
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After the next Bot API update (Bot API 5.3) there will be a one-time change of the value of the field <code>file_unique_id</code> in objects of the type <a href="/bots/api#photosize">PhotoSize</a> and of the fields <code>small_file_unique_id</code> and <code>big_file_unique_id</code> in objects of the type <a href="/bots/api#chatphoto">ChatPhoto</a>.</p>
</blockquote>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>Service messages about non-bot users joining the chat will be soon removed from large groups. We recommend using the “chat_member” update as a replacement.</p>
</blockquote>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After one of the upcoming Bot API updates, user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
</blockquote>
<hr>
<h3><a class="anchor" name="march-9-2021" href="#march-9-2021"><i class="anchor-icon"></i></a>March 9, 2021</h3>
<p><strong>Bot API 5.1</strong></p>
<p><strong>Added two new update types</strong></p>
<ul>
<li>Added updates about member status changes in chats, represented by the class <a href="/bots/api#chatmemberupdated">ChatMemberUpdated</a> and the fields <em>my_chat_member</em> and <em>chat_member</em> in the <a href="/bots/api#update">Update</a> class. The bot must be an administrator in the chat to receive <em>chat_member</em> updates about other chat members. By default, only <em>my_chat_member</em> updates about the bot itself are received.</li>
</ul>
<p><strong>Improved Invite Links</strong></p>
<ul>
<li>Added the class <a href="/bots/api#chatinvitelink">ChatInviteLink</a>, representing an invite link to a chat.</li>
<li>Added the method <a href="/bots/api#createchatinvitelink">createChatInviteLink</a>, which can be used to create new invite links in addition to the primary invite link.</li>
<li>Added the method <a href="/bots/api#editchatinvitelink">editChatInviteLink</a>, which can be used to edit non-primary invite links created by the bot.</li>
<li>Added the method <a href="/bots/api#revokechatinvitelink">revokeChatInviteLink</a>, which can be used to revoke invite links created by the bot.</li>
</ul>
<p><strong>Voice Chat Info</strong></p>
<ul>
<li>Added the type <a href="/bots/api#voicechatstarted">VoiceChatStarted</a> and the field <em>voice_chat_started</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Added the type <a href="/bots/api#voicechatended">VoiceChatEnded</a> and the field <em>voice_chat_ended</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Added the type <a href="/bots/api#voicechatparticipantsinvited">VoiceChatParticipantsInvited</a> and the field <em>voice_chat_participants_invited</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Added the new administrator privilege <em>can_manage_voice_chats</em> to the class <a href="/bots/api#chatmember">ChatMember</a> and parameter <em>can_manage_voice_chats</em> to the method <a href="/bots/api#promotechatmember">promoteChatMember</a>. For now, bots can use this privilege only for passing to other administrators.</li>
</ul>
<p><strong>And More</strong></p>
<ul>
<li>Added the type <a href="/bots/api#messageautodeletetimerchanged">MessageAutoDeleteTimerChanged</a> and the field <em>message_auto_delete_timer_changed</em> to the class <a href="/bots/api#message">Message</a>.</li>
<li>Added the parameter <em>revoke_messages</em> to the method <a href="/bots/api#kickchatmember">kickChatMember</a>, allowing to delete all messages from a group for the user who is being removed.</li>
<li>Added the new administrator privilege <em>can_manage_chat</em> to the class <a href="/bots/api#chatmember">ChatMember</a> and parameter <em>can_manage_chat</em> to the method <a href="/bots/api#promotechatmember">promoteChatMember</a>. This administrator right is implied by any other administrator privilege.</li>
<li>Supported the new <em>bowling</em> animation for the random <a href="/bots/api#dice">dice</a>. Choose between different animations (dice, darts, basketball, football, bowling, slot machine) by specifying the <em>emoji</em> parameter in the method <a href="/bots/api#senddice">sendDice</a>.</li>
</ul>
<hr>
<blockquote>
<p><strong><img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /> WARNING! <img class="emoji" src="//telegram.org/img/emoji/40/E29AA0.png" width="20" height="20" alt="⚠️" /></strong><br>After one of the upcoming Bot API updates, some user identifiers will become bigger than <code>2^31 - 1</code> and it will be no longer possible to store them in a signed 32-bit integer type. User identifiers will have up to 52 significant bits, so a 64-bit integer or double-precision float type would still be safe for storing them. Please make sure that your code can correctly handle such user identifiers.</p>
</blockquote>
<hr>
<h3><a class="anchor" name="november-4-2020" href="#november-4-2020"><i class="anchor-icon"></i></a>November 4, 2020</h3>
<p>Introducing <strong>Bot API 5.0</strong></p>
<p><strong>Run Your Own Bot API Server</strong></p>
<ul>
<li>Bot API source code is now available at <a href="https://github.com/tdlib/telegram-bot-api">telegram-bot-api</a>. You can now run your <strong>own Bot API server</strong> locally, boosting your bots&#39; performance.</li>
<li>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>
<p><strong>Transfer Bot Ownership</strong></p>
<ul>
<li>You can now use <a href="https://t.me/botfather">@BotFather</a> to transfer your existing bots to another Telegram account. </li>
</ul>
<p><strong>Webhooks</strong></p>
<ul>
<li>Added the parameter <em>ip_address</em> to the method <a href="/bots/api#setwebhook">setWebhook</a>, allowing to bypass DNS resolving and use the specified fixed IP address to send webhook requests.</li>
<li>Added the field <em>ip_address</em> to the class <a href="/bots/api#webhookinfo">WebhookInfo</a>, containing the current IP address used for webhook connections creation.</li>
<li>Added the ability to drop all pending updates when changing webhook URL using the parameter <em>drop_pending_updates</em> in the methods <a href="/bots/api#setwebhook">setWebhook</a> and <a href="/bots/api#deletewebhook">deleteWebhook</a>.</li>
</ul>
<p><strong>Working with Groups</strong></p>
<ul>
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the user&#39;s bio for private chats if available.</li>
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the 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>
</ul>
<p><strong>Working with Files</strong></p>
<ul>
<li>Added the field <em>file_name</em> to the classes <a href="/bots/api#audio">Audio</a> and <a href="/bots/api#video">Video</a>, containing the name of the original file.</li>
<li>Added the ability to disable server-side file content type detection using the parameter <em>disable_content_type_detection</em> in the method <a href="/bots/api#senddocument">sendDocument</a> and the class <a href="/bots/api#inputmediadocument">inputMediaDocument</a>.</li>
</ul>
<p><strong>Multiple Pinned Messages</strong></p>
<ul>
<li>Added the ability to <strong>pin messages in private chats</strong>.</li>
<li>Added the parameter <em>message_id</em> to the method <a href="/bots/api#unpinchatmessage">unpinChatMessage</a> to allow unpinning of the specific pinned message.</li>
<li>Added the method <a href="/bots/api#unpinallchatmessages">unpinAllChatMessages</a>, which can be used to unpin all pinned messages in a chat.</li>
</ul>
<p><strong>File Albums</strong></p>
<ul>
<li>Added support for sending and receiving audio and document albums in the method <a href="/bots/api#sendmediagroup">sendMediaGroup</a>.</li>
</ul>
<p><strong>Live Locations</strong></p>
<ul>
<li>Added the field <em>live_period</em> to the class <a href="/bots/api#location">Location</a>, representing a maximum period for which the live location can be updated.</li>
<li>Added support for live location <a href="https://en.wikipedia.org/wiki/Heading_(navigation&#41;">heading</a>: added the field <em>heading</em> to the classes <a href="/bots/api#location">Location</a>, <a href="/bots/api#inlinequeryresultlocation">InlineQueryResultLocation</a>, <a href="/bots/api#inputlocationmessagecontent">InputLocationMessageContent</a> and the parameter <em>heading</em> to the methods <a href="/bots/api#sendlocation">sendLocation</a> and <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a>.</li>
<li>Added support for 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>
</ul>
<p><strong>Anonymous Admins</strong></p>
<ul>
<li>Added the field <em>sender_chat</em> to the class <a href="/bots/api#message">Message</a>, containing the sender of a message which is a chat (group or channel). For backward compatibility in non-channel chats, the field <em>from</em> in such messages will contain the user 777000 for messages automatically forwarded to the discussion group and the user 1087968824 (<a href="https://t.me/GroupAnonymousBot">@GroupAnonymousBot</a>) for messages from anonymous group administrators.</li>
<li>Added the field <em>is_anonymous</em> to the class <a href="/bots/api#chatmember">chatMember</a>, which can be used to distinguish anonymous chat administrators.</li>
<li>Added the parameter <em>is_anonymous</em> to the method <a href="/bots/api#promotechatmember">promoteChatMember</a>, which allows to promote anonymous chat administrators. The bot itself should have the <em>is_anonymous</em> right to do this. Despite the fact that bots can have the <em>is_anonymous</em> right, they will never appear as anonymous in the chat. Bots can use the right only for passing to other administrators.</li>
<li>Added the custom title of an anonymous message sender to the class <a href="/bots/api#message">Message</a> as <em>author_signature</em>.</li>
</ul>
<p><strong>And More</strong></p>
<ul>
<li>Added the method <a href="/bots/api#copymessage">copyMessage</a>, which sends a copy of any message.</li>
<li>Maximum poll question length increased to 300.</li>
<li>Added the ability to manually specify text entities instead of specifying the <em>parse_mode</em> in the classes <a href="/bots/api#inputmediaphoto">InputMediaPhoto</a>, <a href="/bots/api#inputmediavideo">InputMediaVideo</a>, <a href="/bots/api#inputmediaanimation">InputMediaAnimation</a>, <a href="/bots/api#inputmediaaudio">InputMediaAudio</a>, <a href="/bots/api#inputmediadocument">InputMediaDocument</a>, <a href="/bots/api#inlinequeryresultphoto">InlineQueryResultPhoto</a>, <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a>, <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a>, <a href="/bots/api#inlinequeryresultvideo">InlineQueryResultVideo</a>, <a href="/bots/api#inlinequeryresultaudio">InlineQueryResultAudio</a>, <a href="/bots/api#inlinequeryresultvoice">InlineQueryResultVoice</a>, <a href="/bots/api#inlinequeryresultdocument">InlineQueryResultDocument</a>, <a href="/bots/api#inlinequeryresultcachedphoto">InlineQueryResultCachedPhoto</a>, <a href="/bots/api#inlinequeryresultcachedgif">InlineQueryResultCachedGif</a>, <a href="/bots/api#inlinequeryresultcachedmpeg4gif">InlineQueryResultCachedMpeg4Gif</a>, <a href="/bots/api#inlinequeryresultcachedvideo">InlineQueryResultCachedVideo</a>, <a href="/bots/api#inlinequeryresultcachedaudio">InlineQueryResultCachedAudio</a>, <a href="/bots/api#inlinequeryresultcachedvoice">InlineQueryResultCachedVoice</a>, <a href="/bots/api#inlinequeryresultcacheddocument">InlineQueryResultCachedDocument</a>, <a href="/bots/api#inputtextmessagecontent">InputTextMessageContent</a> and 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#sendvoice">sendVoice</a>, <a href="/bots/api#sendpoll">sendPoll</a>, <a href="/bots/api#editmessagetext">editMessageText</a>, <a href="/bots/api#editmessagecaption">editMessageCaption</a>.</li>
<li>Added the fields <em>google_place_id</em> and <em>google_place_type</em> to the classes <a href="/bots/api#venue">Venue</a>, <a href="/bots/api#inlinequeryresultvenue">InlineQueryResultVenue</a>, <a href="/bots/api#inputvenuemessagecontent">InputVenueMessageContent</a> and the optional parameters <em>google_place_id</em> and <em>google_place_type</em> to the method <a href="/bots/api#sendvenue">sendVenue</a> to support Google Places as a venue API provider.</li>
<li>Added the field <em>allow_sending_without_reply</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> to allow sending messages not a as reply if the replied-to message has already been deleted.</li>
</ul>
<p><strong>And Last but not Least</strong></p>
<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>
<h3><a class="anchor" name="june-4-2020" href="#june-4-2020"><i class="anchor-icon"></i></a>June 4, 2020</h3>
<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>
<h3><a class="anchor" name="april-24-2020" href="#april-24-2020"><i class="anchor-icon"></i></a>April 24, 2020</h3>
<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>
<li>Added the fields <em>explanation</em> and <em>explanation_entities</em> to the <a href="/bots/api#poll">Poll</a> object.</li>
<li>Supported timed polls that automatically close at a certain date and time. Set up by specifying the parameter <em>open_period</em> or <em>close_date</em> in the method <a href="/bots/api#sendpoll">sendPoll</a>.</li>
<li>Added the fields <em>open_period</em> and <em>close_date</em> to the <a href="/bots/api#poll">Poll</a> object.</li>
<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>
<h3><a class="anchor" name="march-30-2020" href="#march-30-2020"><i class="anchor-icon"></i></a>March 30, 2020</h3>
<p><strong>Bot API 4.7</strong></p>
<ul>
<li>Added the method <a href="/bots/api#senddice">sendDice</a> for sending a dice message, which will have a random value from 1 to 6. (Yes, we&#39;re aware of the <em>“proper”</em> singular of <em>die</em>. But it&#39;s awkward, and we decided to help it change. One dice at a time!)</li>
<li>Added the field <a href="/bots/api#dice">dice</a> to the <a href="/bots/api#message">Message</a> object.</li>
<li>Added the method <a href="/bots/api#getmycommands">getMyCommands</a> for getting the current list of the bot&#39;s commands.</li>
<li>Added the method <a href="/bots/api#setmycommands">setMyCommands</a> for changing the list of the bot&#39;s commands through the Bot API instead of <a href="https://t.me/botfather">@BotFather</a>.</li>
<li>Added the 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>
<h3><a class="anchor" name="january-23-2020" href="#january-23-2020"><i class="anchor-icon"></i></a>January 23, 2020</h3>
<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>
<li>Added the ability to send non-anonymous, multiple answer, and quiz-style polls: added the parameters <em>is_anonymous</em>, <em>type</em>, <em>allows_multiple_answers</em>, <em>correct_option_id</em>, <em>is_closed</em> options to the method <a href="/bots/api#sendpoll">sendPoll</a>.</li>
<li>Added the object <a href="/bots/api#keyboardbuttonpolltype">KeyboardButtonPollType</a> and the field <em>request_poll</em> to the object <a href="/bots/api#keyboardbutton">KeyboardButton</a>.</li>
<li>Added updates about changes of user answers in non-anonymous polls, represented by the object <a href="/bots/api#pollanswer">PollAnswer</a> and the field <em>poll_answer</em> in the <a href="/bots/api#update">Update</a> object. </li>
<li>Added the fields <em>total_voter_count</em>, <em>is_anonymous</em>, <em>type</em>, <em>allows_multiple_answers</em>, <em>correct_option_id</em> to the <a href="/bots/api#poll">Poll</a> object.</li>
<li>Bots can now send polls to private chats.</li>
<li>Added more information about the bot in response to the <a href="/bots/api#getme">getMe</a> request: added the fields <em>can_join_groups</em>, <em>can_read_all_group_messages</em> and <em>supports_inline_queries</em> to the <a href="/bots/api#user">User</a> object.</li>
<li>Added the optional field <em>language</em> to the <a href="/bots/api#messageentity">MessageEntity</a> object.</li>
</ul>
<h3><a class="anchor" name="december-31-2019" href="#december-31-2019"><i class="anchor-icon"></i></a>December 31, 2019</h3>
<p><strong>Bot API 4.5</strong></p>
<ul>
<li>Added support for two new <a href="/bots/api#messageentity">MessageEntity</a> types, <em>underline</em> and <em>strikethrough</em>.</li>
<li>Added support for nested <a href="/bots/api#messageentity">MessageEntity</a> objects. Entities can now contain other entities. If two entities have common characters then one of them is fully contained inside the other.</li>
<li>Added support for nested entities and the new tags <code>&lt;u&gt;/&lt;ins&gt;</code> (for underlined text) and <code>&lt;s&gt;/&lt;strike&gt;/&lt;del&gt;</code> (for strikethrough text) in parse mode HTML.</li>
<li>Added a new parse mode, <a href="/bots/api#markdownv2-style">MarkdownV2</a>, which supports nested entities and two new entities <code>__</code> (for underlined text) and <code>~</code> (for strikethrough text). Parse mode <a href="/bots/api#markdown-style">Markdown</a> remains unchanged for backward compatibility.</li>
<li>Added the field <em>file_unique_id</em> to the objects <a href="/bots/api#animation">Animation</a>, <a href="/bots/api#audio">Audio</a>, <a href="/bots/api#document">Document</a>, <a href="/bots/api#passportfile">PassportFile</a>, <a href="/bots/api#photosize">PhotoSize</a>, <a href="/bots/api#sticker">Sticker</a>, <a href="/bots/api#video">Video</a>, <a href="/bots/api#videonote">VideoNote</a>, <a href="/bots/api#voice">Voice</a>, <a href="/bots/api#file">File</a> and the fields <em>small_file_unique_id</em> and <em>big_file_unique_id</em> to the object <a href="/bots/api#chatphoto">ChatPhoto</a>. The new fields contain a unique file identifier, which is supposed to be the same over time and for different bots, but can&#39;t be used to download or reuse the file.</li>
<li>Added the field <em>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>
<h3><a class="anchor" name="july-29-2019" href="#july-29-2019"><i class="anchor-icon"></i></a>July 29, 2019</h3>
<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>
<li>Added support for <a href="https://telegram.org/blog/permissions-groups-undo"><strong>default permissions</strong></a> in groups. New object <a href="/bots/api#chatpermissions">ChatPermissions</a>, containing actions which a member can take in a chat. New field <em>permissions</em> in the <a href="/bots/api#chat">Chat</a> object; new method <a href="/bots/api#setchatpermissions">setChatPermissions</a>.</li>
<li>The field <em>all_members_are_administrators</em> has been removed from the documentation for the <a href="/bots/api#chat">Chat</a> object. The field is still returned in the object for backward compatibility, but new bots should use the <em>permissions</em> field instead.</li>
<li>Added support for more permissions for group and supergroup members: added the new field <em>can_send_polls</em> to <a href="/bots/api#chatmember">ChatMember</a> object, added <em>can_change_info</em>, <em>can_invite_users</em>, <em>can_pin_messages</em> in <a href="/bots/api#chatmember">ChatMember</a> object for restricted users (previously available only for administrators).</li>
<li>The method <a href="/bots/api#restrictchatmember">restrictChatMember</a> now takes the new user permissions in a single argument of the type <a href="/bots/api#chatpermissions">ChatPermissions</a>. The old way of passing parameters will keep working for a while for backward compatibility.</li>
<li>Added <em>description</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group&#39;s chat_id to <a href="/bots/api#setchatdescription">setChatDescription</a> and receive the group&#39;s description in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
<li>Added <em>invite_link</em> support for basic groups (previously available in supergroups and channel chats). You can pass a group&#39;s chat_id to <a href="/bots/api#exportchatinvitelink">exportChatInviteLink</a> and receive the group&#39;s invite link in the <a href="/bots/api#chat">Chat</a> object in the response to <a href="/bots/api#getchat">getChat</a> method.</li>
<li>File identifiers from the <a href="/bots/api#chatphoto">ChatPhoto</a> object are now invalidated and can no longer be used whenever the photo is changed.</li>
<li>All <strong>webhook requests</strong> from the Bot API are now coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won&#39;t need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
<li>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>
<h3><a class="anchor" name="may-31-2019" href="#may-31-2019"><i class="anchor-icon"></i></a>May 31, 2019</h3>
<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>
</div>
<p><strong>Also in this update:</strong></p>
<ul>
<li>Added the field <code>reply_markup</code> to the <a href="/bots/api#message">Message</a> object, containing the inline keyboard attached to the message.</li>
<li>If a message with an inline keyboard is forwarded, the forwarded message will now have an inline keyboard if the keyboard contained only <em>url</em> and <em>login_url</em> buttons or if the message was sent via a bot and the keyboard contained only <em>url</em>, <em>login_url</em>, <em>switch_inline_query</em> or <em>switch_inline_query_current_chat</em> buttons. In the latter case, <em>switch_inline_query_current_chat</em> buttons are replaced with <em>switch_inline_query</em> buttons.</li>
<li>Bots now receive the <em>edited_message</em> <a href="/bots/api#update">Update</a> even if only <em>Message.reply_markup</em> has changed.</li>
<li>Bots that have the <em>can_edit_messages</em> right in a channel can now use the method <a href="/bots/api#editmessagereplymarkup">editMessageReplyMarkup</a> for messages written by other administrators forever without the 48 hours limit.</li>
<li>Don&#39;t forget that starting in <strong>July 2019</strong>, <strong>webhook requests</strong> from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won&#39;t need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
</ul>
<h3><a class="anchor" name="april-14-2019" href="#april-14-2019"><i class="anchor-icon"></i></a>April 14, 2019</h3>
<p><strong>Bot API 4.2</strong></p>
<ul>
<li>Added support for native polls: added the object <a href="/bots/api#poll">Poll</a>, the methods <a href="/bots/api#sendpoll">sendPoll</a> and <a href="/bots/api#stoppoll">stopPoll</a> and the field <em>poll</em> in the <a href="/bots/api#message">Message</a> and <a href="/bots/api#update">Update</a> objects.</li>
<li>The method <a href="/bots/api#deletemessage">deleteMessage</a> can now be used to delete messages sent by a user to the bot in private chats within 48 hours.</li>
<li>Added support for pinned messages in basic groups in addition to supergroups and channel chats: you can pass group&#39;s chat_id to <a href="/bots/api#pinchatmessage">pinChatMessage</a> and <a href="/bots/api#unpinchatmessage">unpinChatMessage</a>, and receive the pinned group message in <a href="/bots/api#chat">Chat</a> object.</li>
<li>Added the field <em>is_member</em> to the <a href="/bots/api#chatmember">ChatMember</a> object, which can be used to find whether a restricted user is a member of the chat.</li>
<li>Added the field <em>forward_sender_name</em> to the <a href="/bots/api#message">Message</a> object, containing name of the sender who has opted to hide their account.</li>
<li>Starting in July 2019, webhook requests from Bot API will be coming from the subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code>. Most users won&#39;t need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: <a href="/bots/webhooks"><a href="https://core.telegram.org/bots/webhooks">https://core.telegram.org/bots/webhooks</a></a>.</li>
<li>Document thumbnails now should be inscribed in a 320x320 square instead of 90x90.</li>
</ul>
<h3><a class="anchor" name="august-27-2018" href="#august-27-2018"><i class="anchor-icon"></i></a>August 27, 2018</h3>
<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>
<h3><a class="anchor" name="july-26-2018" href="#july-26-2018"><i class="anchor-icon"></i></a>July 26, 2018</h3>
<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>
<li>Added support for <strong>editing the media content of messages</strong>: added the method <a href="/bots/api#editmessagemedia">editMessageMedia</a> and new types <a href="/bots/api#inputmediaanimation">InputMediaAnimation</a>, <a href="/bots/api#inputmediaaudio">InputMediaAudio</a>, and <a href="/bots/api#inputmediadocument">InputMediaDocument</a>.</li>
<li>Added the field <em>thumb</em> to the <a href="/bots/api#audio">Audio</a> object to contain the thumbnail of the album cover to which the music file belongs.</li>
<li>Added support for attaching custom thumbnails to uploaded files. For animations, audios, videos and video notes, which are less than 10 MB in size, thumbnails are generated automatically.</li>
<li><code>tg://</code> URLs now can be used in inline keyboard url buttons and <code>text_link</code> message entities. </li>
<li>Added the method <a href="/bots/api#sendanimation">sendAnimation</a>, which can be used instead of <a href="/bots/api#senddocument">sendDocument</a> to send animations, specifying their duration, width and height.</li>
<li>Added the field <a href="/bots/api#animation">animation</a> to the <a href="/bots/api#message">Message</a> object. For backward compatibility, when this field is set, the <em>document</em> field will be also set.</li>
<li>Added two new <a href="/bots/api#messageentity">MessageEntity</a> types: <em>cashtag</em> and <em>phone_number</em>.</li>
<li>Added support for Foursquare venues: added the new field <em>foursquare_type</em> to the objects <a href="/bots/api#venue">Venue</a>, <a href="/bots/api#inlinequeryresultvenue">InlineQueryResultVenue</a> and <a href="/bots/api#inputvenuemessagecontent">InputVenueMessageContent</a>, and the parameter <em>foursquare_type</em> to the <a href="/bots/api#sendvenue">sendVenue</a> method.</li>
<li>You can now create inline mentions of users, who have pressed your bot&#39;s callback buttons.</li>
<li>You can now 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>
<h3><a class="anchor" name="february-13-2018" href="#february-13-2018"><i class="anchor-icon"></i></a>February 13, 2018</h3>
<p><strong>Bot API 3.6</strong>.</p>
<ul>
<li>Supported <a href="https://core.telegram.org/bots/api#formatting-options">text formatting</a> in media captions. Specify the desired <em>parse_mode</em> (<a href="https://core.telegram.org/bots/api#markdown-style">Markdown</a> or <a href="https://core.telegram.org/bots/api#html-style">HTML</a>) when you provide a caption.</li>
<li>In supergroups, if the bot receives a message that is a reply, it will also receive the message to which that message is replying even if the original message is inaccessible due to the bot&#39;s privacy settings. (In other words, replying to any message in a supergroup with a message that mentions the bot or features a command for it acts as forwarding the original message to the bot). </li>
<li>Added the new field <em>connected_website</em> to <a href="/bots/api#message">Message</a>. The bot will receive a message with this field in a private chat when a user logs in on the bot&#39;s connected website using the <a href="https://core.telegram.org/widgets/login">Login Widget</a> and allows sending messages from your bot.</li>
<li>Added the new parameter <em>supports_streaming</em> to the <a href="/bots/api#sendvideo">sendVideo</a> method and a field with the same name to the <a href="/bots/api#inputmediavideo">InputMediaVideo</a> object.</li>
</ul>
<h3><a class="anchor" name="november-17-2017" href="#november-17-2017"><i class="anchor-icon"></i></a>November 17, 2017</h3>
<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>
<h3><a class="anchor" name="october-11-2017" href="#october-11-2017"><i class="anchor-icon"></i></a>October 11, 2017</h3>
<p><strong>Bot API 3.4</strong>.</p>
<ul>
<li>Bots can now send and receive <a href="https://telegram.org/blog/live-locations">Live Locations</a>. Added new field <em>live_period</em> to the <a href="/bots/api#sendlocation">sendLocation</a> method and the <a href="/bots/api#editmessagelivelocation">editMessageLiveLocation</a> and <a href="/bots/api#stopmessagelivelocation">stopMessageLiveLocation</a> methods as well as the necessary objects for inline bots.</li>
<li>Bots can use the new <a href="/bots/api#setchatstickerset">setChatStickerSet</a> and <a href="/bots/api#deletechatstickerset">deleteChatStickerSet</a> methods to manage <a href="https://telegram.org/blog#stickers-of-the-group">group sticker sets</a>.</li>
<li>The <a href="/bots/api#getchat">getChat</a> request now returns the group&#39;s sticker set for supergroups if available.</li>
<li>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>
<h3><a class="anchor" name="august-23-2017" href="#august-23-2017"><i class="anchor-icon"></i></a>August 23, 2017</h3>
<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>
<li><a href="/bots/api#getchat">getChat</a> now also returns pinned messages in supergroups, if present. Added the new field <em>pinned_message</em> to the <a href="/bots/api#chat">Chat</a> object.</li>
<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>
<h3><a class="anchor" name="july-21-2017" href="#july-21-2017"><i class="anchor-icon"></i></a>July 21, 2017</h3>
<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>
<h3><a class="anchor" name="june-30-2017" href="#june-30-2017"><i class="anchor-icon"></i></a>June 30, 2017</h3>
<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>
<li>Added new methods <a href="/bots/api#exportchatinvitelink">exportChatInviteLink</a>, <a href="/bots/api#setchatphoto">setChatPhoto</a>, <a href="/bots/api#deletechatphoto">deleteChatPhoto</a>, <a href="/bots/api#setchattitle">setChatTitle</a>, <a href="/bots/api#setchatdescription">setChatDescription</a>, <a href="/bots/api#pinchatmessage">pinChatMessage</a> and <a href="/bots/api#unpinchatmessage">unpinChatMessage</a> to manage groups and channels.</li>
<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>
<h3><a class="anchor" name="may-18-2017" href="#may-18-2017"><i class="anchor-icon"></i></a>May 18, 2017</h3>
<p>Introducing <strong>Bot API 3.0</strong>.</p>
<p><strong>NEW Payment Platform</strong></p>
<p>See <a href="/bots/payments">Introduction to Bot Payments</a> for a brief overview. If you&#39;re not a developer, you may like <a href="https://telegram.org/blog/payments">this user-friendly blog post</a> better.</p>
<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>
<li>Added new methods for payments: <a href="/bots/api#sendinvoice">sendInvoice</a>, <a href="/bots/api#answershippingquery">answerShippingQuery</a>, and <a href="/bots/api#answerprecheckoutquery">answerPreCheckoutQuery</a>.</li>
<li>Added a new type of button, the <strong>pay</strong> button to <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a>.</li>
</ul>
<p><strong>NEW Video Messages</strong></p>
<ul>
<li>As of Telegram v.4.0, users can send short rounded <a href="https://telegram.org/blog/payments">video messages</a>, using an interface similar to that of voice notes.</li>
<li>Added the <a href="/bots/api#sendvideonote">sendVideoNote</a> method, the new field <em>video_note</em> to <a href="/bots/api#message">Message</a>, the fields <em>record_video_note</em> or <em>upload_video_note</em> to <a href="/bots/api#sendchataction">sendChatAction</a>.</li>
</ul>
<p><strong>NEW Multilingual Bots</strong></p>
<ul>
<li>The <a href="/bots/api#user">User</a> object now may have a <em>language_code</em> field that contains the <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a> of the user&#39;s language.</li>
<li>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>
<ul>
<li><a href="/bots/api#unbanchatmember">unbanChatMemeber</a> now also works in channels!</li>
<li>New method <a href="/bots/api#deletemessages">deleteMessage</a> that allows the bot to delete its own messages, as well as messages posted by other in groups and channels where the bot is an administrator.</li>
</ul>
<p><strong>Minor Changes</strong></p>
<ul>
<li>Replaced the field <em>new_chat_member</em> in <a href="/bots/api#message">Message</a> with <em>new_chat_members</em> (the old field will still be available for a while for compatibility purposes).</li>
<li><a href="https://core.telegram.org/bots/api#inlinekeyboardbutton">Inline keyboards</a> with <em>switch_inline_query</em> and <em>switch_inline_query_current_chat</em> can no longer be sent to channels because they are useless there.</li>
<li>New fields <em>gif_duration</em> in <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a> and <em>mpeg4_duration</em> in <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a>.</li>
</ul>
<h3><a class="anchor" name="december-4-2016" href="#december-4-2016"><i class="anchor-icon"></i></a>December 4, 2016</h3>
<p>Introducing <strong>Bot API 2.3.1</strong>, a nifty little update that will give you more control over how your bot gets its updates.</p>
<ul>
<li>Use the new field <em>max_connections</em> in <a href="/bots/api#setwebhook">setWebhook</a> to optimize your bot&#39;s server load</li>
<li>Use <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>
<h3><a class="anchor" name="november-21-2016" href="#november-21-2016"><i class="anchor-icon"></i></a>November 21, 2016</h3>
<p><strong>Bot API 2.3</strong></p>
<ul>
<li>Modified <a href="/bots/faq#what-messages-will-my-bot-get"><strong>bot privacy mode</strong></a> for the sake of consistency. </li>
<li><p>Your bot can now get <strong>updates about posts in channels</strong>. Added new fields <em>channel_post</em> and <em>edited_channel_post</em> to <a href="/bots/#update">Update</a>.</p>
</li>
<li><p>You can now update high scores to a lower value by using the new <em>force</em> parameter in <a href="/bots/#setgamescore">setGameScore</a>. Handy for punishing <strong>cheaters</strong> or fixing errors in your game&#39;s High Score table.</p>
</li>
<li>Starting today, messages with high scores will be updated with new high scores by default. Use <em>disable_edit_message</em> in <a href="/bots/#setgamescore">setGameScore</a> if you don&#39;t want this.</li>
<li>The <em>edit_message</em> parameter from <a href="/bots/#setgamescore">setGameScore</a> is no longer in use. For backward compatibility, it will be taken into account for a while, unless <em>disable_edit_message</em> is passed explicitly.</li>
<li>Added the new field <em>forward_from_message_id</em> to <a href="/bots/#message">Message</a>.</li>
<li>Added the new parameter <em>cache_time</em> to <a href="/bots/#answercallbackquery">answerCallbackQuery</a>. Will eventually work in Telegram apps — somewhere after version 3.14, maybe 3.15.</li>
<li>Renamed <em>hide_keyboard</em> to <em>remove_keyboard</em> in <a href="/bots/#replykeyboardremove">ReplyKeyboardRemove</a> for clarity. <em>hide_keyboard</em> will still work for a while for backward compatibility.</li>
</ul>
<h3><a class="anchor" name="october-3-2016" href="#october-3-2016"><i class="anchor-icon"></i></a>October 3, 2016</h3>
<p><strong>Bot API 2.2.</strong> <a href="/bots/games">Introducing a new Gaming Platform!</a> See <a href="/bots/games">this introduction</a> for a brief overview.<br>If you&#39;re not a developer, you may like <a href="https://telegram.org/blog/games"><strong>this user-friendly blog post</strong></a> better.</p>
<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>
<li>New parameter <em>url</em> in <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>. Create a game and accept the conditions using Botfather to send custom urls that open your games for the user.</li>
<li>New field <em>callback_game</em> in <a href="/bots/api#inlinekeyboardbutton">InlineKeyboardButton</a>, new fields <em>game_short_name</em> and <em>chat_instance</em> in <a href="/bots/api#callbackquery">CallbackQuery</a>, new object <a href="/bots/api#callbackgame">CallbackGame</a>. </li>
<li>New methods <a href="/bots/api#setgamescore">setGameScore</a> and <a href="/bots/api#getgamehighscores">getGameHighScores</a>.</li>
</ul>
<p><strong>Other changes</strong></p>
<ul>
<li>Making life easier for webhook users. Added a detailed <a href="https://core.telegram.org/bots/webhooks"><strong>Guide to All Things Webhook</strong></a> that describes every pothole you can run into on the webhook road.</li>
<li><p>New method <a href="/bots/api#getwebhookinfo">getWebhookInfo</a> to check current webhook status.</p>
</li>
<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>
<h3><a class="anchor" name="may-25-2016" href="#may-25-2016"><i class="anchor-icon"></i></a>May 25, 2016</h3>
<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>
<h3><a class="anchor" name="may-22-2016" href="#may-22-2016"><i class="anchor-icon"></i></a>May 22, 2016</h3>
<ul>
<li><strong>Bot API 2.1.</strong> Added more tools for group administrator bots. Your bot can now get a list of administrators and members count in a group, check a user&#39;s current status (administrator, creator, left the group, kicked from the group), and leave a group.</li>
<li>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>
<h3><a class="anchor" name="may-12-2016" href="#may-12-2016"><i class="anchor-icon"></i></a>May 12, 2016</h3>
<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>
<h3><a class="anchor" name="may-6-2016" href="#may-6-2016"><i class="anchor-icon"></i></a>May 6, 2016</h3>
<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>
<h3><a class="anchor" name="april-9-2016" href="#april-9-2016"><i class="anchor-icon"></i></a>April 9, 2016</h3>
<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>
<li>Bots can now <a href="/bots/api#updating-messages"><strong>edit</strong> their messages</a>. Added methods <a href="/bots/api#editmessagetext">editMessageText</a>, <a href="/bots/api#editmessagecaption">editMessageCaption</a>, <a href="/bots/api#editmessagereplymarkup">editMessageReplyMarkup</a>.</li>
<li>Bots can request <strong>location</strong> and <strong>phone number</strong> from the user. The <em>keyboard</em> field in the object <a href="/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a> now supports <a href="/bots/api#keyboardbutton">KeyboardButton</a>, a new object that can have the fields <em>request_location</em> and <em>request_contact</em>.</li>
</ul>
<p><strong>Inline bots</strong></p>
<ul>
<li>Added support for all content types available on Telegram. <strong>19 types</strong> of <a href="/bots/api#inlinequeryresult">InlineQueryResult</a> objects are now supported.</li>
<li>Inline bots can now <strong>substitute</strong> all kinds of content with text. Added 4 types of <a href="/bots/api#inputmessagecontent">InputMessageContent</a> objects.</li>
<li>Your inline bot can also ask users for permission to use their location. Added the new Botfather command <code>/setinlinegeo</code>, added field <em>location</em> to the <a href="/bots/api#inlinequery">InlineQuery</a> object, added fields <em>location</em> and <em>inline_message_id</em> to the <a href="/bots/api#choseninlineresult">ChosenInlineResult</a> object.</li>
<li>Added an easy way to <strong>switch</strong> between inline mode and a private chat with the bot useful for settings, establishing external connections and teaching users how to use your bot in inline mode. Added parameters <em>switch_pm_text</em> and <em>switch_pm_parameter</em> to the method <a href="/bots/api#answerinlinequery">answerInlineQuery</a>.</li>
</ul>
<p><strong>Miscellaneous</strong></p>
<ul>
<li>Added group <strong>administration</strong> tools. New methods <a href="/bots/api#kickchatmember">kickChatMember</a> and <a href="/bots/api#unbanchatmember">unbanChatMember</a>.</li>
<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>
<h3><a class="anchor" name="february-20-2016" href="#february-20-2016"><i class="anchor-icon"></i></a>February 20, 2016</h3>
<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>
<h3><a class="anchor" name="january-20-2016" href="#january-20-2016"><i class="anchor-icon"></i></a>January 20, 2016</h3>
<ul>
<li>By the way, you can use both HTML-style and markdown-style formatting in your bot&#39;s messages to send bold, italic or fixed-width text and inline links. All official Telegram clients support this. See <a href="/bots/api#formatting-options">Formatting options</a> for details.</li>
</ul>
<h3><a class="anchor" name="january-14-2016" href="#january-14-2016"><i class="anchor-icon"></i></a>January 14, 2016</h3>
<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>
<h3><a class="anchor" name="january-4-2016" href="#january-4-2016"><i class="anchor-icon"></i></a>January 4, 2016</h3>
<ul>
<li>Added support for <a href="/bots/inline">Inline Mode</a>, a new way for people to contact your bot by typing its username and a query in the text input field in any chat. Enable by sending <code>/setinline</code> to <a href="https://telegram.me/botfather">@BotFather</a>.</li>
<li>New optional field <em>inline_query</em> added to the <a href="/bots/api#update">Update</a> object.</li>
<li>Added new method <a href="/bots/api#answerinlinequery">answerInlineQuery</a> and new objects <a href="/bots/api#inlinequery">InlineQuery</a>, <a href="/bots/api#inlinequeryresultarticle">InlineQueryResultArticle</a>, <a href="/bots/api#inlinequeryresultphoto">InlineQueryResultPhoto</a>, <a href="/bots/api#inlinequeryresultgif">InlineQueryResultGif</a>, <a href="/bots/api#inlinequeryresultmpeg4gif">InlineQueryResultMpeg4Gif</a> and <a href="/bots/api#inlinequeryresultvideo">InlineQueryResultVideo</a>.</li>
</ul>
<h3><a class="anchor" name="november-2015" href="#november-2015"><i class="anchor-icon"></i></a>November, 2015</h3>
<ul>
<li>Added support for <a href="https://telegram.org/blog/supergroups">supergroups</a>. The <em>Type</em> field in the <a href="/bots/api#chat">Chat</a> object can now contain &#39;supergroup&#39;.</li>
<li>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>
<h3><a class="anchor" name="october-8-2015" href="#october-8-2015"><i class="anchor-icon"></i></a>October 8, 2015</h3>
<ul>
<li>Added initial channel support for bots (no Telegram clients support this at the moment, please wait for updates):</li>
<li>The <em>Chat</em> field in the <a href="/bots/api#message">Message</a> is now of the new type <a href="/bots/api#chat">Chat</a>.</li>
<li>You can now pass a channel username (in the format <code>@channelusername</code>) in the place of <em>chat_id</em> in all methods (and instead of <em>from_chat_id</em> in <a href="/bots/api#forwardmessage">forwardMessage</a>). For this to work, the bot must be an administrator in the channel (and that&#39;s exactly what Telegram clients don&#39;t support yet — adding bots as administrators coming soon).</li>
</ul>
<h3><a class="anchor" name="september-18-2015" href="#september-18-2015"><i class="anchor-icon"></i></a>September 18, 2015</h3>
<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>
<h3><a class="anchor" name="september-7-2015" href="#september-7-2015"><i class="anchor-icon"></i></a>September 7, 2015</h3>
<ul>
<li>You can now <a href="/bots/api#making-requests">pass parameters</a> using <em>application/json</em> (please note that this doesn&#39;t work for file uploads: use <em>multipart/form-data</em> to upload files).</li>
<li>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>
<h3><a class="anchor" name="august-29-2015" href="#august-29-2015"><i class="anchor-icon"></i></a>August 29, 2015</h3>
<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>
<h3><a class="anchor" name="august-15-2015" href="#august-15-2015"><i class="anchor-icon"></i></a>August 15, 2015</h3>
<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>
<h3><a class="anchor" name="july-2015" href="#july-2015"><i class="anchor-icon"></i></a>July 2015</h3>
<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>
<h3><a class="anchor" name="june-24-2015" href="#june-24-2015"><i class="anchor-icon"></i></a>June 24, 2015</h3>
<p>The bot platform was <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>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,246 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Bots FAQ</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="If you are new to Telegram bots, we recommend checking out our Introduction to Bots first.
You may also find the Bot API…">
<meta property="og:title" content="Bots FAQ">
<meta property="og:image" content="https://blogfork.telegram.org/file/811140979/3/5p52TWl9X2o/5c6d684ee0d6a4399d">
<meta property="og:description" content="If you are new to Telegram bots, we recommend checking out our Introduction to Bots first.
You may also find the Bot API…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/bots" >Telegram Bots</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/faq" >Bots FAQ</a></li></ul></div>
<h1 id="dev_page_title">Bots FAQ</h1>
<div id="dev_page_content"><blockquote>
<p>If you are new to Telegram bots, we recommend checking out our <a href="/bots"><strong>Introduction to Bots</strong></a> first.<br>You may also find the <strong><a href="/bots/api">Bot API Manual</a></strong> useful.</p>
</blockquote>
<p><div class="dev_page_nav_wrap"></p>
<p><a href="#general-questions"><strong>General</strong></a></p>
<ul>
<li><a href="#how-do-i-create-a-bot">How do I create a bot?</a></li>
<li><a href="#i-39m-a-developer-where-can-i-find-some-examples">Where can I get some code examples?</a></li>
<li><a href="#will-you-add-x-to-the-bot-api">I have a feature request!</a></li>
<li><a href="#what-messages-will-my-bot-get">What messages will my bot get?</a></li>
<li><a href="#why-doesn-39t-my-bot-see-messages-from-other-bots">Why doesn&#39;t my bot see messages from other bots?</a></li>
</ul>
<p><a href="#getting-updates"><strong>Getting Updates</strong></a></p>
<ul>
<li><a href="#how-do-i-get-updates">How do I get updates?</a></li>
<li><a href="#long-polling-gives-me-the-same-updates-again-and-again">Long polling problems</a></li>
<li><a href="#i-39m-having-problems-with-webhooks">Webhook problems</a></li>
<li><a href="#i-39m-having-trouble-with-my-self-signed-certificate">Using self-signed certificates</a></li>
<li><a href="#how-can-i-make-sure-that-webhook-requests-are-coming-from-telegr">How can I make sure webhook requests come from Telegram?</a></li>
</ul>
<p><a href="#handling-media"><strong>Handling Media</strong></a></p>
<ul>
<li><a href="#how-do-i-download-files">Downloading files</a></li>
<li><a href="#how-do-i-upload-a-large-file">Uploading large files</a></li>
<li><a href="#can-i-count-on-file-ids-to-be-persistent">Can I count of file_ids to be persistent?</a></li>
</ul>
<p><a href="#broadcasting-to-users"><strong>Broadcasting to Users</strong></a></p>
<ul>
<li><a href="#my-bot-is-hitting-limits-how-do-i-avoid-this">How do I avoid hitting limits?</a></li>
<li><a href="#how-can-i-message-all-of-my-bot-39s-subscribers-at-once">How do I message all my subscribers?</a><br></div></li>
</ul>
<hr>
<h3><a class="anchor" name="general-questions" href="#general-questions"><i class="anchor-icon"></i></a>General Questions</h3>
<h4><a class="anchor" name="how-do-i-create-a-bot" href="#how-do-i-create-a-bot"><i class="anchor-icon"></i></a>How do I create a bot?</h4>
<p>Creating Telegram bots is super-easy, but you will need at least some skills at computer programming. In order for a bot to work, set up a bot account with <a href="https://telegram.me/botfather">@BotFather</a>, then connect it to your backend server via our <a href="/bots/api">API</a>.</p>
<p>Unfortunately, there are no out-of-the-box ways to create a working bot if you are not a developer. But we&#39;re sure you&#39;ll soon find plenty of bots created by other people to play with.</p>
<h4><a class="anchor" name="i-39m-a-developer-where-can-i-find-some-examples" href="#i-39m-a-developer-where-can-i-find-some-examples"><i class="anchor-icon"></i></a>I&#39;m a developer. Where can I find some examples?</h4>
<p>Here are two sample bots, both written in PHP:</p>
<ul>
<li><a href="/bots/samples/hellobot">Hello Bot</a> demonstrates the basics of the Telegram bot API.</li>
<li><a href="https://github.com/kolar/telegram-poll-bot">Simple Poll bot</a> is a more complete example, it supports both long-polling and Webhooks for updates.</li>
</ul>
<blockquote>
<p>Many members of our community are building bots and publishing sources.<br>We&#39;re collecting them on <a href="/bots/samples"><strong>this page »</strong></a></p>
</blockquote>
<p>Ping us on <a href="https://telegram.me/botsupport">@BotSupport</a> if you&#39;ve built a bot and would like to share it with others.</p>
<h4><a class="anchor" name="will-you-add-x-to-the-bot-api" href="#will-you-add-x-to-the-bot-api"><i class="anchor-icon"></i></a>Will you add X to the Bot API?</h4>
<p>The bot API is still pretty young. There are many potential features to consider and implement. We&#39;ll be studying what people do with their bots for a while to see which directions will be most important for the platform.</p>
<p>All bot developers are welcome to share ideas for our Bot API with our <a href="https://telegram.me/botsupport"><strong>@BotSupport</strong></a> account.</p>
<h4><a class="anchor" name="what-messages-will-my-bot-get" href="#what-messages-will-my-bot-get"><i class="anchor-icon"></i></a>What messages will my bot get?</h4>
<p><strong>1.</strong> <strong>All bots</strong>, regardless of settings, will receive:</p>
<ul>
<li>All service messages.</li>
<li>All messages from private chats with users.</li>
<li>All messages from channels where they are a member.</li>
</ul>
<p><strong>2.</strong> <strong>Bot admins</strong> and bots with <a href="/bots#privacy-mode">privacy mode</a> <strong>disabled</strong> will receive all messages except messages sent by other bots.</p>
<p><strong>3.</strong> Bots with <a href="/bots#privacy-mode">privacy mode</a> <strong>enabled</strong> will receive:</p>
<ul>
<li>Commands explicitly meant for them (e.g., /command@this_bot).</li>
<li>General commands from users (e.g. /start) <strong>if</strong> the bot was the last bot to send a message to the group.</li>
<li>Messages sent <a href="/bots/api#inline-mode">via</a> this bot.</li>
<li>Replies to any messages implicitly or explicitly meant for this bot.</li>
</ul>
<p><strong>Note</strong> that each particular message can only be available to <strong>one</strong> privacy-enabled bot at a time, i.e., a reply to bot A containing an explicit command for bot B or sent via bot C will only be available to bot A. Replies have the highest priority.</p>
<h4><a class="anchor" name="why-doesn-39t-my-bot-see-messages-from-other-bots" href="#why-doesn-39t-my-bot-see-messages-from-other-bots"><i class="anchor-icon"></i></a>Why doesn&#39;t my bot see messages from other bots?</h4>
<p>Bots talking to each other could potentially get stuck in unwelcome loops. To avoid this, we decided that bots will not be able to see messages from other bots regardless of mode.</p>
<h3><a class="anchor" name="getting-updates" href="#getting-updates"><i class="anchor-icon"></i></a>Getting Updates</h3>
<h4><a class="anchor" name="how-do-i-get-updates" href="#how-do-i-get-updates"><i class="anchor-icon"></i></a>How do I get updates?</h4>
<p>There are currently two ways of getting updates. You can either use <a href="https://core.telegram.org/bots/api#getupdates">long polling</a> or <a href="https://core.telegram.org/bots/api#setwebhook">Webhooks</a>. Please note that it&#39;s <strong>not</strong> possible to get updates via long polling while an outgoing Webhook is set.</p>
<h4><a class="anchor" name="long-polling-gives-me-the-same-updates-again-and-again" href="#long-polling-gives-me-the-same-updates-again-and-again"><i class="anchor-icon"></i></a>Long polling gives me the same updates again and again!</h4>
<p>The <a href="/bots/api#getupdates">getUpdates</a> method returns the earliest 100 unconfirmed updates. To confirm an update, use the <em>offset</em> parameter when calling getUpdates like this:</p>
<pre><code>offset = update_id of last processed update + 1</code></pre>
<p>All updates with <em>update_id</em> less than or equal to <em>offset</em> will be marked as confirmed on the server and will no longer be returned.</p>
<h4><a class="anchor" name="i-39m-having-problems-with-webhooks" href="#i-39m-having-problems-with-webhooks"><i class="anchor-icon"></i></a>I&#39;m having problems with Webhooks.</h4>
<p>If you&#39;ve set up your webhook successfully, but are not getting any updates, please remember:</p>
<ul>
<li>You need a valid SSL certificate for webhooks to work.</li>
<li>To use a self-signed certificate, you need to upload your public key certificate using the <em>certificate</em> parameter in <a href="/bots/api#setwebhook">setWebhook</a>. Please upload as InputFile, sending a String will not work.</li>
<li>Ports currently supported for Webhooks: <strong>443</strong>, <strong>80</strong>, <strong>88</strong>, <strong>8443</strong>.</li>
<li>Wildcard certificates may not be supported.</li>
<li>Redirects are not supported.</li>
<li>CN must exactly match your domain.</li>
</ul>
<blockquote>
<p>Please check out this new <a href="/bots/webhooks"><strong>WEBHOOK GUIDE</strong></a> to learn all there is to know about webhooks!</p>
</blockquote>
<h4><a class="anchor" name="i-39m-having-trouble-with-my-self-signed-certificate" href="#i-39m-having-trouble-with-my-self-signed-certificate"><i class="anchor-icon"></i></a>I&#39;m having trouble with my self-signed certificate!</h4>
<p>Please take a look at this <a href="/bots/self-signed">self-signed certificate guide</a> we made just for you. If you&#39;ve read it and still have a question, ping us on botsupport.</p>
<h4><a class="anchor" name="how-can-i-make-sure-that-webhook-requests-are-coming-from-telegr" href="#how-can-i-make-sure-that-webhook-requests-are-coming-from-telegr"><i class="anchor-icon"></i></a>How can I make sure that Webhook requests are coming from Telegram?</h4>
<p>If you&#39;d like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL you give us, e.g. www.example.com/your_token. Since nobody else knows your bot&#39;s token, you can be pretty sure it&#39;s us.</p>
<h4><a class="anchor" name="how-can-i-make-requests-in-response-to-updates" href="#how-can-i-make-requests-in-response-to-updates"><i class="anchor-icon"></i></a>How can I make requests in response to updates?</h4>
<p>This is possible if you&#39;re using webhooks. The upside is that you need less requests, the downside — that in this case it&#39;s not possible to know that such a request was successful or get its result. </p>
<p>Whenever you receive a webhook update, you have two options:</p>
<p><strong>1. Issue POST to https://api.telegram.org/bot&lt;token&gt;/method</strong></p>
<div>
<a href="/file/811140979/3/5p52TWl9X2o/5c6d684ee0d6a4399d" target="_blank"><img src="/file/811140979/3/5p52TWl9X2o/5c6d684ee0d6a4399d" title="Confirm and request" class="dev_page_image" style="width:500px;" /></a>
</div>
<p><strong>2. Reply directly and give method as JSON payload in the reply</strong></p>
<div>
<a href="/file/811140266/2/vGxiVmENAos/6cffad00cbe72be7f2" target="_blank"><img src="/file/811140266/2/vGxiVmENAos/6cffad00cbe72be7f2" title="Reply with payload" class="dev_page_image" style="width:500px;" /></a></div>
<blockquote>
<p>You may also want to look at our sample <a href="/bots/samples/hellobot">HelloBot</a>, it offers a PHP implementation of this.</p>
</blockquote>
<h3><a class="anchor" name="handling-media" href="#handling-media"><i class="anchor-icon"></i></a>Handling Media</h3>
<h4><a class="anchor" name="how-do-i-download-files" href="#how-do-i-download-files"><i class="anchor-icon"></i></a>How do I download files?</h4>
<p>Use the <a href="/bots/api#getfile">getFile</a> method. Please note that this will only work with files of up to 20 MB in size.</p>
<h4><a class="anchor" name="how-do-i-upload-a-large-file" href="#how-do-i-upload-a-large-file"><i class="anchor-icon"></i></a>How do I upload a large file?</h4>
<p>Bots can currently send files of any type of up to 50 MB in size, so yes, very large files won&#39;t work for now. Sorry. This limit may be changed in the future.</p>
<h4><a class="anchor" name="can-i-count-on-file-ids-to-be-persistent" href="#can-i-count-on-file-ids-to-be-persistent"><i class="anchor-icon"></i></a>Can I count on file_ids to be persistent?</h4>
<p>Yes, file_ids can be treated as persistent.</p>
<h3><a class="anchor" name="broadcasting-to-users" href="#broadcasting-to-users"><i class="anchor-icon"></i></a>Broadcasting to Users</h3>
<h4><a class="anchor" name="my-bot-is-hitting-limits-how-do-i-avoid-this" href="#my-bot-is-hitting-limits-how-do-i-avoid-this"><i class="anchor-icon"></i></a>My bot is hitting limits, how do I avoid this?</h4>
<p>When sending messages inside a particular chat, avoid sending more than one message per second. We may allow short bursts that go over this limit, but eventually you&#39;ll begin receiving 429 errors.</p>
<p>If you&#39;re sending bulk notifications to multiple users, the API will not allow more than 30 messages per second or so. Consider spreading out notifications over large intervals of 8—12 hours for best results.</p>
<p>Also note that your bot will not be able to send more than 20 messages per minute to the same group.</p>
<h4><a class="anchor" name="how-can-i-message-all-of-my-bot-39s-subscribers-at-once" href="#how-can-i-message-all-of-my-bot-39s-subscribers-at-once"><i class="anchor-icon"></i></a>How can I message all of my bot&#39;s subscribers at once?</h4>
<p>Unfortunately, at this moment we don&#39;t have methods for sending bulk messages, e.g. notifications. We may add something along these lines in the future.</p>
<p>In order to avoid hitting our limits when sending out mass notifications, consider spreading them over longer intervals, e.g. 8-12 hours. The API will not allow bulk notifications to more than ~30 users per second, if you go over that, you&#39;ll start getting 429 errors.</p>
<p>See also: <a href="#my-bot-is-hitting-limits-how-do-i-avoid-this">How to avoid hitting limits?</a></p>
<hr>
<blockquote>
<p>If you&#39;ve got questions that are not answered on this page, ping us at <a href="https://telegram.me/botsupport">@BotSupport</a> in Telegram.<br>We welcome any suggestions for the Bot Platform and API.</p>
</blockquote>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,188 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Gaming Platform</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Bots can offer their users HTML5 games to play solo or to compete against each other in groups and one-on-one chats. Games…">
<meta property="og:title" content="Gaming Platform">
<meta property="og:image" content="https://blogfork.telegram.org/file/811140063/2/hlfJUWy75wU.82563/ea57853b3d4d9ab22f">
<meta property="og:description" content="Bots can offer their users HTML5 games to play solo or to compete against each other in groups and one-on-one chats. Games…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/bots" >Telegram Bots</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/games" >Gaming Platform</a></li></ul></div>
<h1 id="dev_page_title">Gaming Platform</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<div class="dev_side_image">
<a href="/file/811140373/1/0_42vz9chLs.975647/383dca94f028b1872c" target="_blank"><img src="/file/811140063/2/hlfJUWy75wU.82563/ea57853b3d4d9ab22f" title="Gaming Platform Poster">
</a></div>
<p>Bots can offer their users <strong>HTML5 games</strong> to play solo or to compete against each other in groups and one-on-one chats. Games are a new type of content on Telegram that your bot can send to users.</p>
<div><center>
<a href="/file/811140035/2/cIULSr61vi4.78261/127282e0bbd66ce3a9" target="_blank"><img src="/file/811140035/2/cIULSr61vi4.78261/127282e0bbd66ce3a9" title="Game in a chat" style="width: 295px; padding: 10px 10px;" /></a></center><br>
</div>
<blockquote>
<p>This introduction is meant for <strong>bot developers</strong>. <a href="https://telegram.org/blog/games"><strong>Click here</strong></a>, in case you&#39;d like something more user-friendly.<br>Check out the <a href="https://telegram.me/gamebot"><strong>@gamebot</strong></a> and <a href="https://telegram.me/gamee"><strong>@gamee</strong></a> bots for examples of what you can do using the new Gaming Platform.</p>
</blockquote>
<h3><a class="anchor" name="creating-a-game" href="#creating-a-game"><i class="anchor-icon"></i></a>Creating a Game</h3>
<p>To get started, send the <code>/newgame</code> command to <a href="https://telegram.me/botfather">@BotFather</a>.You will be prompted for a description text and a photo. You can also upload an optional GIF animation that demostrates your game to the users to make messages with the game more attractive (check out <a href="https://telegram.me/gamebot?game=Lumberjack">Lumberjack</a> or <a href="https://telegram.me/gamebot?game=Corsairs">Corsairs</a> for examples).</p>
<h3><a class="anchor" name="launching-the-game" href="#launching-the-game"><i class="anchor-icon"></i></a>Launching the Game</h3>
<p>Once the game is created, your bot can send it to chats as regular messages, or offer them via <a href="/bots/inline">inline mode</a>. The game message will always have an <a href="/bots/api#inlinekeyboardmarkup">inline</a> <strong>Play button</strong>.</p>
<p>When this button is pressed, your bot gets a callback query that indicates the requested game. You provide the correct URL for this particular user and the app automatically opens the game in the in-app browser.</p>
<h3><a class="anchor" name="adding-buttons" href="#adding-buttons"><i class="anchor-icon"></i></a>Adding Buttons</h3>
<p>If you send the game message without any buttons, it will automatically have a &#39;Play <em>GameName</em>&#39; button. You can manually add multiple buttons to your game message. Please note that the first button in the first row <strong>must always</strong> be the one that launches the game. You can add more buttons: e.g., for a description of the rules, or a button that links to the game&#39;s official community.</p>
<h3><a class="anchor" name="tracking-high-scores" href="#tracking-high-scores"><i class="anchor-icon"></i></a>Tracking High Scores</h3>
<p>The message with your game will also display high scores for the current chat. When a new high score is set, a service message will be sent to the chat and the message with the current scoreboard will be updated. You can also request the necessary data for building in-game high score tables.</p>
<div><center>
<br>
<a href="/file/811140022/1/m7-46hgmwbI.91190/ad7033bcb879270a69" target="_blank"><img src="/file/811140022/1/m7-46hgmwbI.91190/ad7033bcb879270a69" title="In-game high scores for Lumberjack" style="width: 295px; padding: 0px 20px;" /></a>
<a href="/file/811140594/2/WS2fB3n2UGA.149087/270057ff677339717e" target="_blank"><img src="/file/811140594/2/WS2fB3n2UGA.149087/270057ff677339717e" title="Message with the score in the chat" style="width: 295px; padding: 0px 20px;" /></a><br><br>
<br><br></center></div>
<h3><a class="anchor" name="sharing-your-game-to-telegram-chats" href="#sharing-your-game-to-telegram-chats"><i class="anchor-icon"></i></a>Sharing Your Game to Telegram Chats</h3>
<p>There are many way for users to spread your game virally if they like it. The interface will always have the standard system button for sharing the game in the top right corner:</p>
<div><center>
<a href="/file/811140766/2/_wJtf-Zib5I.25531/774eb9b59898526d26" target="_blank"><img src="/file/811140766/2/_wJtf-Zib5I.25531/774eb9b59898526d26" title="Standard share button: iOS" style="width: 295px; padding: 15px 20px;" /></a>
<a href="/file/811140557/3/ddi8K6x0obQ.34056/a1ca60069b70a81646" target="_blank"><img src="/file/811140557/3/ddi8K6x0obQ.34056/a1ca60069b70a81646" title="Standard share button: Android" style="width: 295px; padding: 15px 20px;" /></a><br><br>
</center></div>
<p>You can also create an additional <strong>Share</strong> button inside your HTML page. Pressing this button will send the game to a desired chat along with the user&#39;s best score in the game.</p>
<div><center>
<a href="/file/811140189/2/SLwHmToemfg.91233/a242854be2b500b4cb" target="_blank"><img src="/file/811140189/2/SLwHmToemfg.91233/a242854be2b500b4cb" title="Gamee: share button" style="width: 295px; padding: 15px 20px;" /></a>
<a href="/file/811140978/1/JoBvEad8JaM.148942/dcd741b65b446781b4" target="_blank"><img src="/file/811140978/1/JoBvEad8JaM.148942/dcd741b65b446781b4" title="Shared game with 'just scored'" style="width: 295px; padding: 15px 20px;" /></a>
<br><br></center></div>
<p>To add the sharing button, include <a href="https://telegram.org/js/games.js">this script</a> at the end of the <code>&lt;body&gt;</code> tag on your page:</p>
<pre><code>&lt;script src=&quot;https://telegram.org/js/games.js&quot;&gt;&lt;/script&gt;</code></pre>
<p>Then use the method <code>TelegramGameProxy.shareScore()</code> to call the sharing option.</p>
<blockquote>
<p>Warning: Do not call this method without consent and <strong>direct action</strong> from the user.</p>
</blockquote>
<p><strong>Example:</strong></p>
<pre><code>&lt;button onclick=&quot;TelegramGameProxy.shareScore()&quot;&gt;Share score&lt;/button&gt;</code></pre>
<p>This library will only work when launched from inside Telegram, so please don&#39;t use it on ordinary web pages. </p>
<h3><a class="anchor" name="using-url-parameters" href="#using-url-parameters"><i class="anchor-icon"></i></a>Using URL Parameters</h3>
<p>If your URL is using a fragment identifier, please note that Telegram Apps could add certain service parameters to the fragment id. The names for such parameters will start in <code>tg</code> (you can check the code that adds them <a href="https://github.com/TelegramMessenger/GamingCommunication/blob/master/games.js#L54">here</a>). Use the <code>TelegramGameProxy.initParams</code> object if you need to read your own parameters from the fragment id.</p>
<h3><a class="anchor" name="creating-a-great-html5-experience" href="#creating-a-great-html5-experience"><i class="anchor-icon"></i></a>Creating a Great HTML5 Experience</h3>
<p>Please make sure that your HTML5 page is responsive and works well on all Telegram apps and supported platforms. If you find it impossible to support certain conditions or platforms, don&#39;t leave your users hanging and at least provide a notification.</p>
<blockquote>
<p>See the <a href="/bots/api#games">Bot API Manual</a> for the relevant methods and objects.</p>
</blockquote>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,191 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Inline Bots</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Inline bots: A new way to interact with bots and send bot-generated content to any chat, group or channel.">
<meta property="og:title" content="Inline Bots">
<meta property="og:image" content="https://blogfork.telegram.org/file/811140530/1/h-eMmPp2vp4/cd4a109f75e6561305">
<meta property="og:description" content="Inline bots: A new way to interact with bots and send bot-generated content to any chat, group or channel.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/bots" >Telegram Bots</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/inline" >Inline Bots</a></li></ul></div>
<h1 id="dev_page_title">Inline Bots</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<div class="dev_side_image">
<a href="/file/811140221/1/fW9vnLya4Fg/e2b5c530c7b0e019c4" target="_blank"><img src="/file/811140530/1/h-eMmPp2vp4/cd4a109f75e6561305" title="Inline bots. Click for hi-res picture">
</a></div>
<p>Beyond sending commands in private messages or groups, users can interact with your bot via <a href="/bots/api#inline-mode"><strong>inline queries</strong></a>. If inline queries are enabled, users can call your bot by typing its username and a query in the <strong>text input field</strong> in <strong>any</strong> chat. The query is sent to your bot in an update. This way, people can request content from your bot in <strong>any</strong> of their chats, groups, or channels without sending any messages at all.</p>
<div><center>
<a href="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" target="_blank"><img src="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" title="Users can type the bots username in any chat, then type a query without sending any messages" style="width:300px; padding:10px 0px 10px"/></a></center>
<br/>
</div>
<p>To enable this option, send the <code>/setinline</code> command to <a href="https://telegram.me/botfather">@BotFather</a> and provide the placeholder text that the user will see in the input field after typing your bots name.</p>
<blockquote>
<p>See the <a href="/bots/api#inline-mode">Bot API Manual</a> for the relevant methods and objects.</p>
</blockquote>
<h3><a class="anchor" name="inline-results" href="#inline-results"><i class="anchor-icon"></i></a>Inline results</h3>
<p>Inline bots support <strong>all types of content</strong> available in Telegram (20 in all). They are capable of sending stickers, videos, music, locations, documents and more. </p>
<div><center>
<a href="/file/811140994/2/fvw-q_CRaBQ/c618325e119b0a8229" target="_blank"><img src="/file/811140994/2/fvw-q_CRaBQ/c618325e119b0a8229" title="All kinds of inline content" style="width: 295px; padding: 10px 20px;" /></a></center>
<br/>
</div>
<p>Clients can display the results with vertical or horizontal scrolling, depending on the type of content:</p>
<div><center>
<a href="/file/811140049/2/M2mzqjZoiUw/2d872f0df2aed182d6" target="_blank"><img src="/file/811140049/2/M2mzqjZoiUw/2d872f0df2aed182d6" title="Vertical scrolling" style="width: 295px; padding: 0px 20px;" /></a>
<a href="/file/811140592/2/P4-tFhmBsCg/57418af08f1a252d45" target="_blank"><img src="/file/811140592/2/P4-tFhmBsCg/57418af08f1a252d45" title="Horizontal scrolling" style="width: 295px; padding: 0px 20px;" /></a>
</center>
<br/>
</div>
<p>As soon as the user taps on an item, it&#39;s immediately sent to the recipient, and the input field is cleared.</p>
<h3><a class="anchor" name="switching-inline-pm-modes" href="#switching-inline-pm-modes"><i class="anchor-icon"></i></a>Switching inline/PM modes</h3>
<p>Some inline bots can benefit from an initial setup process, like connecting them to an account on an external service (e.g., YouTube). We&#39;ve added an easy way of switching between the private chat with a bot and whatever chat the user wants to share inline results in.</p>
<div><center>
<a href="/file/811140951/1/FD93gAgDVDI/8d8bdd16e6a7b40c12" target="_blank"><img src="/file/811140951/1/FD93gAgDVDI/8d8bdd16e6a7b40c12" title="Switch to PM button" style="width: 295px; padding: 10px 20px;" /></a></center><br/>
</div>
<p>You can display a special &#39;Switch to PM&#39; button above the inline results (or instead of them). This button will open a private chat with the bot and pass a parameter of your choosing, so that you can prompt the user for the relevant setup actions. Once done, you can use an inline keyboard with a <a href="/bots/api#inlinekeyboardmarkup"><em>switch_inline_query</em></a> button to send the user back to the original chat. </p>
<p><strong>Sample bots</strong><br><a href="https://telegram.me/youtube">@youtube</a> Shows a &#39;Sign in to YouTube&#39; button, then suggests personalized results.</p>
<blockquote>
<p><a href="/bots/api#answerinlinequery">Manual: Switch to PM</a></p>
</blockquote>
<h3><a class="anchor" name="location-based-results" href="#location-based-results"><i class="anchor-icon"></i></a>Location-based results</h3>
<p>Inline bots can request location data from their users. Use the <code>/setinlinegeo</code> command with <a href="https://telegram.me/botfather">@BotFather</a> to enable this. Your bot will ask the user for permission to access their location whenever they send an inline request.</p>
<p><strong>Sample bot</strong><br><a href="https://telegram.me/foursquare">@foursquare</a> This bot will ask for permission to access the user&#39;s location, then provide geo-targeted results.</p>
<h3><a class="anchor" name="spreading-virally" href="#spreading-virally"><i class="anchor-icon"></i></a>Spreading virally</h3>
<p>Messages sent with the help of your bot will show its username next to the sender&#39;s name.</p>
<div><center>
<a href="/file/811140680/2/P3E5RVFzGZ8/5ae6f9c9610b0cbace" target="_blank"><img src="/file/811140680/2/P3E5RVFzGZ8/5ae6f9c9610b0cbace" title="Gif shared via a bot" style="width: 295px; padding: 0px 20px;" /></a>
<a href="/file/811140016/2/2b_B7nq9OQA/161b06d38843930fe5" target="_blank"><img src="/file/811140016/2/2b_B7nq9OQA/161b06d38843930fe5" title="Inline bot suggestions" style="width: 295px; padding: 0px 20px;" /></a>
<br/><br/>
</center></div>
<p>When a user taps on the bot username in the message header, the mention is automatically inserted into the input field. Entering the <code>@</code> symbol in the input field brings up a list of suggestions, featuring recently used inline bots.</p>
<h4><a class="anchor" name="collecting-feedback" href="#collecting-feedback"><i class="anchor-icon"></i></a>Collecting feedback</h4>
<p>To know which of the provided results your users are sending to their chat partners, send <a href="https://telegram.me/botfather">@Botfather</a> the <code>/setinlinefeedback</code> command. With this enabled, you will receive updates on the results chosen by your users.</p>
<p>Please note that this can create load issues for popular bots you may receive more results than actual requests due to caching (see the <em>cache_time</em> parameter in <a href="/bots/api#answerinlinequery">answerInlineQuery</a>). For these cases, we recommend adjusting the probability setting to receive 1/10, 1/100 or 1/1000 of the results.</p>
<h3><a class="anchor" name="inline-bot-samples" href="#inline-bot-samples"><i class="anchor-icon"></i></a>Inline bot samples</h3>
<p>Here are some sample inline bots, in case youre curious to see one in action. Try any of these:<br><a href="https://telegram.me/gif">@gif</a> GIF search<br><a href="https://telegram.me/vid">@vid</a> Video search<br><a href="https://telegram.me/pic">@pic</a> Yandex image search<br><a href="https://telegram.me/bing">@bing</a> Bing image search<br><a href="https://telegram.me/wiki">@wiki</a> Wikipedia search<br><a href="https://telegram.me/imdb">@imdb</a> IMDB search<br><a href="https://telegram.me/bold">@bold</a> Make bold, italic or fixed sys text</p>
<p><strong>NEW</strong><br><a href="https://telegram.me/youtube">@youtube</a> - Connect your account for personalized results<br><a href="https://telegram.me/music">@music</a> - Search and send classical music<br><a href="https://telegram.me/foursquare">@foursquare</a> Find and send venue addresses<br><a href="https://telegram.me/sticker">@sticker</a> Find and send stickers based on emoji</p>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,743 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Bot Payments API</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram Bot Payments are a free and open platform that allows sellers to accept payments for goods and services from Telegram…">
<meta property="og:title" content="Bot Payments API">
<meta property="og:image" content="b92643c0c9a2612b36">
<meta property="og:description" content="Telegram Bot Payments are a free and open platform that allows sellers to accept payments for goods and services from Telegram…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Bot Payments API</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<div class="dev_side_image">
<a href="/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207" target="_blank"><img src="/file/811140095/1/lfTvDVqVS8M.43169/1a191248e6cf027581" title="Payments API. Click for hi-res picture">
</a></div>
<p><strong>Telegram Bot Payments</strong> are a free and open platform that allows sellers to accept payments for goods and services from Telegram users. Telegram doesn&#39;t collect payment information and takes <strong>no commission</strong>.</p>
<blockquote>
<p><strong>Note:</strong> This article is intended for bot developers and store owners. If you&#39;re looking for a general overview of Telegram Payments, check out the <a href="https://telegram.org/blog/payments-2-0-scheduled-voice-chats#payments-2-0">Telegram blog</a>.</p>
</blockquote>
<p>If you are new to Telegram bots and would like 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> and <a href="/bots/faq"><strong>Bot FAQ</strong></a>.</p>
<h3><a class="anchor" name="introducing-payments-2-0" href="#introducing-payments-2-0"><i class="anchor-icon"></i></a>Introducing Payments 2.0</h3>
<p><a href="https://telegram.org/blog/payments-2-0-scheduled-voice-chats">Payments 2.0</a> were added in April 2021 with <a href="/bots/api">Bot API v.5.2</a>. New features:</p>
<ul>
<li>Send invoices to <strong>any chat</strong>, including to groups and channels.</li>
<li>Create invoices that can be <strong>forwarded</strong> and used by <strong>multiple buyers</strong> to order things.</li>
<li>Use <a href="/bots/inline">inline mode</a> to help users show your goods and services to their friends and communities.</li>
<li>Allow <strong>tips</strong> from users with preset and custom amounts.</li>
<li>Accept payments from users on mobile or <strong>desktop apps</strong>.</li>
<li>Try <a href="https://t.me/shopbot">@ShopBot</a> to create a test invoice or start a message with <code>@ShopBot ...</code> in any chat for an <strong>inline invoice</strong>.</li>
<li>Check out <a href="https://t.me/teststore">Demo Shop</a> for an example of a <a href="https://telegram.org/tour/channels">Telegram Channel</a> used as <strong>virtual storefront</strong>.</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/464001377/1/0o3vSvY22g8.123356/deb4ed6951d780f7b7" style="max-width: 400px;" title="If your pizza place can't deliver a clone army, you're buying pizza from the wrong shop." alt="Video: Ordering a pizza through a Telegram channel">
<source src="/file/464001705/2/Hg-klQnZ_n4.4889245.mp4/d324511ffdab7b4668" type="video/mp4">
</video>
</div>
<blockquote>
<p>Users need to update to <strong>Telegram 7.7</strong> or higher to use <strong>Payments 2.0</strong> (for <a href="https://desktop.telegram.org">Telegram Desktop</a>, <strong>2.7.2</strong> or higher). Older <em>mobile</em> apps released after <a href="https://telegram.org/blog/payments">May 2017</a> support basic payments in chats with bots.</p>
</blockquote>
<h4><a class="anchor" name="how-does-this-work" href="#how-does-this-work"><i class="anchor-icon"></i></a>How does this work?</h4>
<p>You create a <strong>bot</strong> that offers goods and services to Telegram users. Merchant bots can send specially formatted <strong>invoice messages</strong> to users, groups or channels. If your bot supports <a href="/bots/inline">inline mode</a>, users can also send invoices to other chats <em>via the bot</em>, including to one-on-one chats with other users.</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/464001361/2/0tUACjLHgog.102443/ba08e6374676fd1918" style="max-width: 400px;" alt="Video: Paying for goods via an inline invoice">
<source src="/file/464001302/1/H6KwJFdtIRk.4794843.mp4/e8b988bdd940e7a952" type="video/mp4">
</video>
</div>
<p>Invoice messages feature a <strong>photo</strong> and <strong>description</strong> of the product along with a prominent <strong>Pay</strong> button. Tapping this button opens a special payment interface in the Telegram app. In this interface, users can choose a <strong>tip amount</strong> (if allowed by the merchant) and enter additional details like shipping info, phone number, or email address.</p>
<p>The bot can offer several shipping options for physical goods based on the delivery address. When ready, users enter their credit card info or choose a saved card — and pay for the product. Telegram also supports <em>Apple Pay</em> and <em>Google Pay</em>. Once the transaction is done, the merchant bot can send a <strong>receipt message</strong> with payment details, shipping and delivery information.</p>
<blockquote>
<p><a href="#the-payments-api">Detailed information</a> and <a href="#step-by-step-process">step-by-step instructions</a> are available below.</p>
</blockquote>
<h4><a class="anchor" name="supported-payment-providers" href="#supported-payment-providers"><i class="anchor-icon"></i></a>Supported Payment Providers</h4>
<p>Telegram does <strong>not</strong> process payments from users and instead relies on different <strong>payment providers</strong> around the world. It is the payment providers that handle and store all sensitive information, like credit card details. Neither Telegram nor the bot developers have access to it.</p>
<p>For the moment we support payments from more than <strong>200 countries</strong> via the following payment providers:</p>
<ul>
<li><a href="https://stripe.com">Stripe</a></li>
<li><a href="https://smart-glocal.com">Smart Glocal</a></li>
<li><a href="https://tranzzo.com">Tranzzo</a></li>
<li><a href="https://yoomoney.ru/">YooMoney</a></li>
<li><a href="https://www.sberbank.ru">Sberbank</a></li>
<li><a href="https://www.psbank.ru/Business/Acquiring/Internet">PSB</a></li>
<li><a href="https://developer.131.ru/ru/">Bank 131</a></li>
<li><a href="https://payme.uz/">Payme</a></li>
<li><a href="http://click.uz/">CLICK</a></li>
<li><a href="https://www.liqpay.ua/uk/">LiqPay</a></li>
<li><a href="https://leogaming.net/ua/telegram">LeoGaming</a></li>
<li><a href="https://cascad.com/">Cascad</a></li>
<li><a href="https://www.portmone.com.ua/">Portmone</a></li>
<li><a href="https://paymega.io/">Paymega</a></li>
<li><a href="https://ecommpay.com/">ECOMMPAY</a></li>
<li><a href="https://info.paymaster.ru">PayMaster</a></li>
<li><a href="https://gate.global.uz/">Global Pay UZ</a></li>
</ul>
<p>We continue expanding this list, follow <a href="https://t.me/botnews">@BotNews</a> for updates.</p>
<blockquote>
<p>If you work for a company that provides services similar to standalone accounts in <a href="https://stripe.com/connect">Stripe Connect</a>, please let us know via <a href="https://t.me/botsupport">@BotSupport</a> (include the hashtag <code>#paymentsprovider</code> in your message).</p>
</blockquote>
<hr>
<h3><a class="anchor" name="the-payments-api" href="#the-payments-api"><i class="anchor-icon"></i></a>The Payments API</h3>
<p>This section explores payments via Telegram&#39;s Bot API in more detail.</p>
<h4><a class="anchor" name="connecting-payments" href="#connecting-payments"><i class="anchor-icon"></i></a>Connecting Payments</h4>
<p>To start accepting payments, you need a <strong>Telegram bot</strong>. Use <a href="https://t.me/botfather">BotFather</a> to create a bot if you don&#39;t have one already.</p>
<p>Now you have a merchant bot that can offer goods or services to Telegram users. Let&#39;s call it <code>@merchantbot</code> in this document. The first stop is to choose and <strong>connect a payment provider</strong>, you can find the <a href="#supported-payment-providers">list of supported providers</a> above.</p>
<h4><a class="anchor" name="getting-a-token" href="#getting-a-token"><i class="anchor-icon"></i></a>Getting a Token</h4>
<ul>
<li>Use the <code>/mybots</code> command in the chat with <a href="https://t.me/botfather">BotFather</a> and choose the <code>@merchantbot</code> that will be offering goods or services.</li>
<li>Go to <em>Bot Settings &gt; Payments</em>.</li>
<li>Choose a provider, and you will be redirected to the relevant bot.</li>
<li>Enter the required details so that the payments provider is connected successfully, go back to the chat with Botfather.</li>
<li>The message will now show available providers. Each will have a name, a <strong>token</strong>, and the date the provider was connected.</li>
<li>You will use the <strong>token</strong> when working with the Bot API.</li>
</ul>
<h4><a class="anchor" name="implementing-payments" href="#implementing-payments"><i class="anchor-icon"></i></a>Implementing Payments</h4>
<p>You will find the necessary methods for building your payment implementation in the <a href="https://core.telegram.org/bots/api#payments">Payments Section of the Bot API Manual</a>.</p>
<h4><a class="anchor" name="testing-payments-the-39stripe-test-mode-39-provider" href="#testing-payments-the-39stripe-test-mode-39-provider"><i class="anchor-icon"></i></a>Testing Payments: the &#39;Stripe TEST MODE&#39; Provider</h4>
<p>While you&#39;re still developing and testing payments for your bot, use the “Stripe TEST MODE” provider. When in this mode, you can make payments without actually billing any accounts. Real cards can&#39;t be used in test mode, but you can use test cards like <code>4242 4242 4242 4242</code> (<a href="https://stripe.com/docs/testing#cards">full list here</a>). You can switch between test mode and live mode as many times as you want, but please see the <a href="#going-live">live checklist</a> <strong>before</strong> you go live.</p>
<h3><a class="anchor" name="step-by-step-process" href="#step-by-step-process"><i class="anchor-icon"></i></a>Step-by-Step Process</h3>
<blockquote>
<p>See <a href="https://core.telegram.org/bots/api#payments">Bot API: Payments</a> for the complete list of available methods and objects.</p>
</blockquote>
<h4><a class="anchor" name="1-create-invoice" href="#1-create-invoice"><i class="anchor-icon"></i></a>1. Create Invoice</h4>
<p>The user contacts <code>@merchantbot</code> and requests to purchase something. The bot forms an invoice message with a description of the goods or service, amount to be paid, and requested shipping info. There are two ways of creating an invoice:</p>
<h5><a class="anchor" name="a-bot-invoice" href="#a-bot-invoice"><i class="anchor-icon"></i></a>A. Bot Invoice</h5>
<p>Use the <a href="/bots/api#sendinvoice">sendInvoice</a> method to generate an invoice and send it to a chat. The <em>provider_token</em> parameter is where you put the <em>token</em> value that you&#39;ve <a href="#getting-a-token">obtained earlier via Botfather</a>. It is possible for one merchant bot to use several different tokens for different users or different goods and services.</p>
<p>As of <a href="#introducing-payments-2-0">Payments 2.0</a>, invoice messages with a pay button can be sent to <strong>chats of any type</strong>: private chats with the user, groups, or channels. The resulting invoice message will look like this:</p>
<div class="blog_image_wrap">
<a href="/file/464001285/4/UBRF1ViiEOU.106159/0bbcdcb7f5af77a782" target="_blank"><img src="/file/464001285/4/UBRF1ViiEOU.106159/0bbcdcb7f5af77a782" title="Join button"/></a>
<p>Bot Invoice</p> </div>
<h5><a class="anchor" name="b-inline-invoice" href="#b-inline-invoice"><i class="anchor-icon"></i></a>B. Inline Invoice</h5>
<p>If <code>@merchantbot</code> supports <a href="/bots/inline">inline mode</a>, you can use <a href="/bots/api#inputinvoicemessagecontent">inputInvoiceMessageContent</a> to allow users to share invoices for your goods and services to their one-on-one chats with friends, or to their groups and channels. These invoices will have a <strong>Pay button</strong> that can be used multiple times.</p>
<div class="blog_image_wrap">
<a href="/file/464001162/3/C2wdLOXaMA0.97425/32091afe52ef0e59f2" target="_blank"><img src="/file/464001162/3/C2wdLOXaMA0.97425/32091afe52ef0e59f2" title="Join button"/></a>
<p>Inline Invoice</p> </div>
<h4><a class="anchor" name="2-choose-forwarding-behavior" href="#2-choose-forwarding-behavior"><i class="anchor-icon"></i></a>2. Choose Forwarding Behavior</h4>
<p>As of <a href="#introducing-payments-2-0">Payments 2.0</a> there are two ways for handling <strong>forwarded copies</strong> of your invoices, controlled by the parameter <em>start_parameter</em> in the <a href="/bots/api#sendinvoice">sendInvoice</a> method.</p>
<ul>
<li><strong>A. Multi-chat invoice.</strong> Forwarded copies show a <strong>Pay button</strong>, which multiple users can press and attempt to pay for the goods or services. <a href="#b-inline-invoice">Inline invoices</a> are always multi-chat invoices.</li>
<li><strong>B. Single-chat invoice.</strong> Invoice can only be paid from the chat to which it was sent, <em>forwarded copies</em> show a <strong>URL button</strong> with a deep link to the bot. The deep link can be used to generate a similar invoice in the chat with the bot, to show an error message, or for other purposes. <a href="/bots#deep-linking">More info on Deep Linking »</a></li>
</ul>
<p>If a <em>single-chat invoice</em> is sent to the chat with <code>@merchantbot</code>, it can only be paid <strong>once</strong>. If a <em>single-chat invoice</em> is sent to any other chat, it can be paid <strong>many times</strong> by many users.</p>
<blockquote>
<p>To get a better understanding of how this works, try toggling the <em>“Pay from Forwards”</em> parameter when creating invoices with our demo <a href="https://t.me/shopbot">@ShopBot</a>.</p>
</blockquote>
<p>Regardless of whether or not the <strong>Pay</strong> button is available in an invoice, the merchant bot always has the power to decide whether or not to accept new payments for a particular invoice.</p>
<h4><a class="anchor" name="3-tips-optional-step" href="#3-tips-optional-step"><i class="anchor-icon"></i></a>3. Tips (optional step)</h4>
<p>If the <em>max_tip_amount</em> parameter is set to above <code>0</code>, users can add a tip to their payment. You can use the parameter <em>suggested_tip_amounts</em> to suggest particular amounts that you feel will be relevant for the invoice.</p>
<div class="blog_image_wrap">
<a href="/file/464001701/6/-BJZJqe9VeA.70226/75a192d58d76dc96c1" target="_blank"><img src="/file/464001701/6/-BJZJqe9VeA.70226/75a192d58d76dc96c1" title="Join button"/></a>
<p>Adding Tips</p> </div>
<h4><a class="anchor" name="4-shipping-info-and-other-details-optional-step" href="#4-shipping-info-and-other-details-optional-step"><i class="anchor-icon"></i></a>4. Shipping info and other details (optional step)</h4>
<p> The user specifies shipping information or other info requested by the bot. This could be the user&#39;s full name, an email address, a phone number in international format, or a full postal address for delivery.</p>
<div class="blog_image_wrap">
<a href="/file/464001896/2/9gTF8_aGQkE.45826/d5b11a999a40a1a6d9" target="_blank"><img src="/file/464001896/2/9gTF8_aGQkE.45826/d5b11a999a40a1a6d9" title="Shipping Info"/></a>
<p>Shipping Info</p> </div>
<h4><a class="anchor" name="5-offer-delivery-options-based-on-shipping-address-optional-step" href="#5-offer-delivery-options-based-on-shipping-address-optional-step"><i class="anchor-icon"></i></a>5. Offer delivery options based on shipping address (optional step)</h4>
<p>If a shipping address was requested and you included the parameter <em>is_flexible</em>, the Bot API will send an <a href="/bots/api#update">Update</a> with a <em>shipping_query</em> field to the bot. The bot must respond using <a href="/bots/api#answershippingquery">answerShippingQuery</a> either with a list of possible delivery options and the relevant delivery prices, or with an error (for example, if delivery to the specified address is not possible).</p>
<blockquote>
<p><strong>Tip:</strong> It is recommended that the merchant bot confirms availability of the goods/services at this step to let the user know in case they are no longer available. This is especially important if you are using <a href="#2-choose-forwarding-behavior">multi-chat</a>, <a href="#2-choose-forwarding-behavior">inline</a> or <a href="#2-choose-forwarding-behavior">single-chat, multi-use</a> invoices.</p>
</blockquote>
<h4><a class="anchor" name="6-select-delivery-option-optional-step" href="#6-select-delivery-option-optional-step"><i class="anchor-icon"></i></a>6. Select delivery option (optional step)</h4>
<p>The user selects a delivery option from the list (the overall amount to be paid may change at this point) and proceeds to checkout.</p>
<div class="blog_image_wrap">
<a href="/file/464001836/2/rwUQeqMOsnI.31142/b0cc9d885ccb78ab39" target="_blank"><img src="/file/464001836/2/rwUQeqMOsnI.31142/b0cc9d885ccb78ab39" title="Choose Delivery Option"/></a>
<p>Choose Delivery Option</p> </div>
<h4><a class="anchor" name="7-pre-checkout" href="#7-pre-checkout"><i class="anchor-icon"></i></a>7. Pre-Checkout</h4>
<p>The user enters their payment information and presses the final pay button. At this moment the Bot API sends an <a href="/bots/api#update">Update</a> with the field <em>pre_checkout_query</em> to the bot that contains all the available information about the order. Your bot must reply using <a href="/bots/api#answerprecheckoutquery">answerPrecheckoutQuery</a> within <strong>10 seconds</strong> after receiving this update or the transaction is canceled.</p>
<p>The bot may return an error if it can&#39;t process the order for any reason. We highly recommend specifying a reason for failure to complete the order in human readable form (e.g. <em>&quot;Sorry, we&#39;re all out of rubber ducks! Would you be interested in a cast iron bear instead?&quot;</em>). Telegram will display this reason to the user.</p>
<blockquote>
<p><strong>Warning:</strong> As of <a href="#introducing-payments-2-0">Payments 2.0</a>, it is critical to make sure your bot <strong>only</strong> accepts multiple payments when the order can be processed correctly. This is especially important if you are using <a href="#2-choose-forwarding-behavior">multi-chat</a>, <a href="#2-choose-forwarding-behavior">inline</a> or <a href="#2-choose-forwarding-behavior">single-chat, multi-use</a> invoices.</p>
</blockquote>
<h4><a class="anchor" name="8-checkout" href="#8-checkout"><i class="anchor-icon"></i></a>8. Checkout</h4>
<p>In case the bot confirms the order, Telegram requests the payment provider to complete the transaction. If the payment information was entered correctly and the payment goes through, the API will send a receipt message of the type <a href="/bots/api#message"><em>successful_payment</em></a> from the user. Once your bot receives this message, it should proceed with delivering the goods or services purchased by the user.</p>
<p>If the invoice message was sent in the chat with <code>@merchantbot</code>, it becomes a Receipt in the UI for the user — they can open this receipt at any time and see all the details of the transaction:</p>
<div class="blog_image_wrap">
<a href="/file/464001648/1/1-P1Pb7TusA.105628/b9cb2cf4c7427302c0" target="_blank"><img src="/file/464001648/1/1-P1Pb7TusA.105628/b9cb2cf4c7427302c0" title="Receipt"/></a>
<p>Receipt</p> </div>
<p>If the message was sent to any other chat, the <strong>Pay button</strong> remains and can be used again. It is up to the merchant bot whether to actually accept multiple payments.</p>
<h3><a class="anchor" name="going-live" href="#going-live"><i class="anchor-icon"></i></a>Going Live</h3>
<p>Once you&#39;ve tested everything and confirmed that your payments implementation works, you&#39;re ready to switch to LIVE MODE. To do this, go to BotFather &gt; /mybots &gt; select <code>@merchantbot</code> &gt; Bot Settings / Payments and enable Stripe LIVE MODE. You will get a token that has the string <code>:LIVE:</code> in the middle, e.g. <code>123:LIVE:XXXX</code>. Do not give this token to any third parties!</p>
<p>Before your merchant bot goes into live mode, please ensure the following:</p>
<h4><a class="anchor" name="live-checklist" href="#live-checklist"><i class="anchor-icon"></i></a>Live Checklist</h4>
<ul>
<li>We highly recommend turning on <a href="https://telegram.org/faq#q-how-does-2-step-verification-work">2-step verification</a> for the Telegram account that controls your bot. </li>
<li>You as the bot owner have <strong>full responsibility</strong> in case any conflicts or disputes arise. You must be prepared to correctly process disputes and chargebacks (in the case of Stripe, see <a href="https://stripe.com/docs/disputes">here</a>).</li>
<li>To prevent any misunderstandings and possible legal issues, make sure your bot can respond to a /terms command (or offers a similarly easy way of accessing your Terms and Conditions). Your Terms and Conditions should be written in a clear way and easy to understand for your users. The users must confirm that they have read and agree to your terms before they make the purchase.</li>
<li>Your bot must provide support for its customers, either by responding to a /support command or by some other clearly communicated means. Users must have a clear way of contacting you about their purchases and you must process their support requests in a timely fashion. You must notify your users that Telegram support or <a href="https://t.me/botsupport">bot support</a> will not able to help them with purchases made via your bot.</li>
<li>Make sure that your server hardware and software is stable. Use backups to make sure that you don&#39;t lose data about your users&#39; payments.</li>
<li>Make sure that you have completed the live checklist for your selected <strong>payments provider</strong> as well as this one. </li>
</ul>
<hr>
<h3><a class="anchor" name="faq" href="#faq"><i class="anchor-icon"></i></a>FAQ</h3>
<h4><a class="anchor" name="how-do-i-join-as-a-payment-provider" href="#how-do-i-join-as-a-payment-provider"><i class="anchor-icon"></i></a>How do I join as a payment provider?</h4>
<p>If you work for a company that provides services similar to standalone accounts in <a href="https://stripe.com/connect">Stripe Connect</a>, please let us know via <a href="https://t.me/botsupport">@BotSupport</a> (kindly include the hashtag <code>#paymentsprovider</code> in your message).</p>
<h4><a class="anchor" name="how-much-do-you-charge" href="#how-much-do-you-charge"><i class="anchor-icon"></i></a>How much do you charge?</h4>
<p>Telegram does <strong>not</strong> charge any commission for using the Payments API. Note though, that most payment providers will have their own commissions. For example, Stripe in the US charges 2.9% + 30¢ per successful card charge (see the <a href="https://stripe.com/pricing">Stripe website</a> for more details on pricing).</p>
<h4><a class="anchor" name="do-i-need-a-bot-to-accept-payments" href="#do-i-need-a-bot-to-accept-payments"><i class="anchor-icon"></i></a>Do I need a bot to accept payments?</h4>
<p>Yes. If you are not a developer, you will need to either hire someone to make a bot for you (recommended), or use a bot created by a third-party company. We advise extreme caution when using services of bots that process payments for you Telegram doesn&#39;t maintain any such bots and doesn&#39;t endorse any of the third-party bots offering these services.</p>
<h4><a class="anchor" name="what-can-my-bot-sell" href="#what-can-my-bot-sell"><i class="anchor-icon"></i></a>What can my bot sell?</h4>
<p>Telegram does not impose any limits on what products or services your bot can offer. But please note that you <strong>must</strong> comply with the rules of the payments provider you choose in our system. E.g., Stripe has a special page for <a href="https://stripe.com/us/prohibited-businesses">prohibited businesses</a> you may want to consult that one before you start selling harvested organs.</p>
<p><strong>Special Note:</strong> Due to Apple&#39;s limitations, bot developers are currently not allowed to accept payments for digital goods and virtual services from <strong>iOS users</strong>.</p>
<h4><a class="anchor" name="how-are-disputes-handled" href="#how-are-disputes-handled"><i class="anchor-icon"></i></a>How are disputes handled?</h4>
<p>Telegram acts as a messenger between the paying user, the bot developer, and their chosen payment system. The user sends their credit card details directly to the payment system. Then the payment system&#39;s response and the shipping details entered by the user are passed to the bot developer so that they can process the order.</p>
<p>Since Telegram doesnt process the payments, we dont store and cant access any sensitive data. Due to this structure, it is impossible for Telegram to handle complaints or cashbacks any disputed payments are the responsibility of the bot developers, payment providers, and banks that participated in the exchange.</p>
<blockquote>
<p>See also: <a href="https://telegram.org/privacy#7-third-party-payment-services">Telegram Privacy Policy</a></p>
</blockquote>
<h4><a class="anchor" name="how-do-i-support-payments-in-my-third-party-app-that-uses-the-te" href="#how-do-i-support-payments-in-my-third-party-app-that-uses-the-te"><i class="anchor-icon"></i></a>How do I support payments in my third-party app that uses the Telegram API?</h4>
<p>You are welcome to study the <a href="/api/payments">MTProto payment documentation</a>.</p>
<h4><a class="anchor" name="supported-currencies" href="#supported-currencies"><i class="anchor-icon"></i></a>Supported Currencies</h4>
<p>Telegram payments currently support the currencies listed below (here&#39;s a <a href="https://core.telegram.org/bots/payments/currencies.json">JSON version</a> in case you need it).</p>
<p>If you&#39;re using Stripe as the payments provider, supported currencies may vary depending on the country you have specified in your Stripe account (<a href="https://support.stripe.com/questions/which-currencies-does-stripe-support">more info</a>).</p>
<p>The minimum and maximum amounts for each of the currencies roughly correspond to the limit of <code>US$ 1-10000</code>. The amount must be expressed in 12 digits or less, so the maximum value will be correspondingly lower for some lower-value currencies. Note that for each currency except USD these limits depend on exchange rates and may change over time (plan ahead for this when you implement limits in your code).</p>
<p><table class="table table-hover table-bordered">
<thead>
<tr>
<th>Code</th>
<th>Title</th>
<th>Min amount</th>
<th>Max amount</th>
</tr>
</thead>
<tbody><tr>
<td>AED</td>
<td>United Arab Emirates Dirham</td>
<td>AED 3.67</td>
<td>AED 36,730.15</td>
</tr><tr>
<td>AFN</td>
<td>Afghan Afghani</td>
<td>AFN88.35</td>
<td>AFN883,589.85</td>
</tr><tr>
<td>ALL</td>
<td>Albanian Lek</td>
<td>116,15ALL</td>
<td>1.161.583,07ALL</td>
</tr><tr>
<td>AMD</td>
<td>Armenian Dram</td>
<td>464.91 AMD</td>
<td>4,649,159.99 AMD</td>
</tr><tr>
<td>ARS</td>
<td>Argentine Peso</td>
<td>ARS 117,25</td>
<td>ARS 1.172.572,36</td>
</tr><tr>
<td>AUD</td>
<td>Australian Dollar</td>
<td>AU$1.44</td>
<td>AU$14,496.12</td>
</tr><tr>
<td>AZN</td>
<td>Azerbaijani Manat</td>
<td>1,69 AZN</td>
<td>16 950,79 AZN</td>
</tr><tr>
<td>BAM</td>
<td>Bosnia & Herzegovina Convertible Mark</td>
<td>1,88 BAM</td>
<td>18.842,47 BAM</td>
</tr><tr>
<td>BDT</td>
<td>Bangladeshi Taka</td>
<td>BDT 87.20</td>
<td>BDT 872,042.12</td>
</tr><tr>
<td>BGN</td>
<td>Bulgarian Lev</td>
<td>1,87 BGN</td>
<td>18 786,43 BGN</td>
</tr><tr>
<td>BND</td>
<td>Brunei Dollar</td>
<td>BND1,40</td>
<td>BND14.023,17</td>
</tr><tr>
<td>BOB</td>
<td>Bolivian Boliviano</td>
<td>BOB 6,91</td>
<td>BOB 69.129,76</td>
</tr><tr>
<td>BRL</td>
<td>Brazilian Real</td>
<td>R$ 5,13</td>
<td>R$ 51.347,52</td>
</tr><tr>
<td>CAD</td>
<td>Canadian Dollar</td>
<td>CA$1.30</td>
<td>CA$13,006.30</td>
</tr><tr>
<td>CHF</td>
<td>Swiss Franc</td>
<td>1.00 CHF</td>
<td>10'006.02 CHF</td>
</tr><tr>
<td>CLP</td>
<td>Chilean Peso</td>
<td>CLP 865</td>
<td>CLP 8.656.598</td>
</tr><tr>
<td>CNY</td>
<td>Chinese Renminbi Yuan</td>
<td>CN¥6.77</td>
<td>CN¥67,799.03</td>
</tr><tr>
<td>COP</td>
<td>Colombian Peso</td>
<td>COP 4.110,49</td>
<td>COP 41.104.900,00</td>
</tr><tr>
<td>CRC</td>
<td>Costa Rican Colón</td>
<td>CRC673,32</td>
<td>CRC6.733.271,35</td>
</tr><tr>
<td>CZK</td>
<td>Czech Koruna</td>
<td>23,94 CZK</td>
<td>239 490,10 CZK</td>
</tr><tr>
<td>DKK</td>
<td>Danish Krone</td>
<td>7,14 DKK</td>
<td>71482,29 DKK</td>
</tr><tr>
<td>DOP</td>
<td>Dominican Peso</td>
<td>DOP55.36</td>
<td>DOP553,681.62</td>
</tr><tr>
<td>DZD</td>
<td>Algerian Dinar</td>
<td>DZD 146.28</td>
<td>DZD 1,462,829.90</td>
</tr><tr>
<td>EGP</td>
<td>Egyptian Pound</td>
<td>EGP 18.31</td>
<td>EGP 183,167.98</td>
</tr><tr>
<td>EUR</td>
<td>Euro</td>
<td>0,96 </td>
<td>9 606,30 </td>
</tr><tr>
<td>GBP</td>
<td>British Pound</td>
<td>£0.81</td>
<td>£8,184.70</td>
</tr><tr>
<td>GEL</td>
<td>Georgian Lari</td>
<td>3,03 GEL</td>
<td>30 349,69 GEL</td>
</tr><tr>
<td>GTQ</td>
<td>Guatemalan Quetzal</td>
<td>GTQ7.71</td>
<td>GTQ77,117.37</td>
</tr><tr>
<td>HKD</td>
<td>Hong Kong Dollar</td>
<td>HK$7.84</td>
<td>HK$78,499.50</td>
</tr><tr>
<td>HNL</td>
<td>Honduran Lempira</td>
<td>HNL 24.69</td>
<td>HNL 246,905.02</td>
</tr><tr>
<td>HRK</td>
<td>Croatian Kuna</td>
<td>7,22 HRK</td>
<td>72.266,02 HRK</td>
</tr><tr>
<td>HUF</td>
<td>Hungarian Forint</td>
<td>369,24 HUF</td>
<td>3 692 459,93 HUF</td>
</tr><tr>
<td>IDR</td>
<td>Indonesian Rupiah</td>
<td>IDR14.627,55</td>
<td>IDR146.275.500,00</td>
</tr><tr>
<td>ILS</td>
<td>Israeli New Sheqel</td>
<td> 3.40</td>
<td> 34,077.15</td>
</tr><tr>
<td>INR</td>
<td>Indian Rupee</td>
<td>₹77.30</td>
<td>₹773,028.50</td>
</tr><tr>
<td>ISK</td>
<td>Icelandic Króna</td>
<td>134 ISK</td>
<td>1.341.900 ISK</td>
</tr><tr>
<td>JMD</td>
<td>Jamaican Dollar</td>
<td>JMD156.22</td>
<td>JMD1,562,260.95</td>
</tr><tr>
<td>JPY</td>
<td>Japanese Yen</td>
<td>¥128</td>
<td>¥1,288,124</td>
</tr><tr>
<td>KES</td>
<td>Kenyan Shilling</td>
<td>KES116.15</td>
<td>KES1,161,500.66</td>
</tr><tr>
<td>KGS</td>
<td>Kyrgyzstani Som</td>
<td>82-67 KGS</td>
<td>826 741-00 KGS</td>
</tr><tr>
<td>KRW</td>
<td>South Korean Won</td>
<td>₩1,280</td>
<td>₩12,809,399</td>
</tr><tr>
<td>KZT</td>
<td>Kazakhstani Tenge</td>
<td>KZT436-24</td>
<td>KZT4 362 469-77</td>
</tr><tr>
<td>LBP</td>
<td>Lebanese Pound</td>
<td>LBP 1,520.53</td>
<td>LBP 15,205,348.80</td>
</tr><tr>
<td>LKR</td>
<td>Sri Lankan Rupee</td>
<td>LKR 372.04</td>
<td>LKR 3,720,444.32</td>
</tr><tr>
<td>MAD</td>
<td>Moroccan Dirham</td>
<td>MAD 10.15</td>
<td>MAD 101,544.33</td>
</tr><tr>
<td>MDL</td>
<td>Moldovan Leu</td>
<td>19.05 MDL</td>
<td>190,547.12 MDL</td>
</tr><tr>
<td>MNT</td>
<td>Mongolian Tögrög</td>
<td>MNT3 048,80</td>
<td>MNT30 488 015,99</td>
</tr><tr>
<td>MUR</td>
<td>Mauritian Rupee</td>
<td>MUR42.99</td>
<td>MUR429,952.60</td>
</tr><tr>
<td>MVR</td>
<td>Maldivian Rufiyaa</td>
<td>15.45 MVR</td>
<td>154,501.97 MVR</td>
</tr><tr>
<td>MXN</td>
<td>Mexican Peso</td>
<td>MX$20.17</td>
<td>MX$201,746.60</td>
</tr><tr>
<td>MYR</td>
<td>Malaysian Ringgit</td>
<td>MYR4.39</td>
<td>MYR43,925.02</td>
</tr><tr>
<td>MZN</td>
<td>Mozambican Metical</td>
<td>MZN63.82</td>
<td>MZN638,298.64</td>
</tr><tr>
<td>NGN</td>
<td>Nigerian Naira</td>
<td>NGN415.32</td>
<td>NGN4,153,299.95</td>
</tr><tr>
<td>NIO</td>
<td>Nicaraguan Córdoba</td>
<td>NIO 36.01</td>
<td>NIO 360,151.26</td>
</tr><tr>
<td>NOK</td>
<td>Norwegian Krone</td>
<td>NOK 9,84</td>
<td>NOK 98 411,98</td>
</tr><tr>
<td>NPR</td>
<td>Nepalese Rupee</td>
<td>NPR124.63</td>
<td>NPR1,246,332.83</td>
</tr><tr>
<td>NZD</td>
<td>New Zealand Dollar</td>
<td>NZ$1.59</td>
<td>NZ$15,994.00</td>
</tr><tr>
<td>PAB</td>
<td>Panamanian Balboa</td>
<td>PAB 1.00</td>
<td>PAB 10,055.01</td>
</tr><tr>
<td>PEN</td>
<td>Peruvian Nuevo Sol</td>
<td>PEN 3.80</td>
<td>PEN 38,084.18</td>
</tr><tr>
<td>PHP</td>
<td>Philippine Peso</td>
<td>PHP52.40</td>
<td>PHP524,060.26</td>
</tr><tr>
<td>PKR</td>
<td>Pakistani Rupee</td>
<td>PKR192.81</td>
<td>PKR1,928,113.26</td>
</tr><tr>
<td>PLN</td>
<td>Polish Złoty</td>
<td>4,48 PLN</td>
<td>44 881,20 PLN</td>
</tr><tr>
<td>PYG</td>
<td>Paraguayan Guaraní</td>
<td>PYG 6.914</td>
<td>PYG 69.149.028</td>
</tr><tr>
<td>QAR</td>
<td>Qatari Riyal</td>
<td>QAR 3.64</td>
<td>QAR 36,407.50</td>
</tr><tr>
<td>RON</td>
<td>Romanian Leu</td>
<td>4,75 RON</td>
<td>47.515,99 RON</td>
</tr><tr>
<td>RSD</td>
<td>Serbian Dinar</td>
<td>112,94 RSD</td>
<td>1.129.409,05 RSD</td>
</tr><tr>
<td>RUB</td>
<td>Russian Ruble</td>
<td>62,91 RUB</td>
<td>629 149,79 RUB</td>
</tr><tr>
<td>SAR</td>
<td>Saudi Riyal</td>
<td>SAR 3.75</td>
<td>SAR 37,509.37</td>
</tr><tr>
<td>SEK</td>
<td>Swedish Krona</td>
<td>10,09 SEK</td>
<td>100.994,11 SEK</td>
</tr><tr>
<td>SGD</td>
<td>Singapore Dollar</td>
<td>SGD1.39</td>
<td>SGD13,943.95</td>
</tr><tr>
<td>THB</td>
<td>Thai Baht</td>
<td>฿34.74</td>
<td>฿347,460.62</td>
</tr><tr>
<td>TJS</td>
<td>Tajikistani Somoni</td>
<td>12;54 TJS</td>
<td>125 440;76 TJS</td>
</tr><tr>
<td>TRY</td>
<td>Turkish Lira</td>
<td>15,46 TRY</td>
<td>154.615,25 TRY</td>
</tr><tr>
<td>TTD</td>
<td>Trinidad and Tobago Dollar</td>
<td>TTD6.83</td>
<td>TTD68,331.10</td>
</tr><tr>
<td>TWD</td>
<td>New Taiwan Dollar</td>
<td>NT$29.79</td>
<td>NT$297,952.99</td>
</tr><tr>
<td>TZS</td>
<td>Tanzanian Shilling</td>
<td>TZS2,324.99</td>
<td>TZS23,249,998.70</td>
</tr><tr>
<td>UAH</td>
<td>Ukrainian Hryvnia</td>
<td>29,71UAH</td>
<td>297 124,66UAH</td>
</tr><tr>
<td>UGX</td>
<td>Ugandan Shilling</td>
<td>UGX3,622</td>
<td>UGX36,228,323</td>
</tr><tr>
<td>USD</td>
<td>United States Dollar</td>
<td>$1.00</td>
<td>$10,000.00</td>
</tr><tr>
<td>UYU</td>
<td>Uruguayan Peso</td>
<td>UYU 41,90</td>
<td>UYU 419.006,15</td>
</tr><tr>
<td>UZS</td>
<td>Uzbekistani Som</td>
<td>11 227,61 UZS</td>
<td>112 276 129,83 UZS</td>
</tr><tr>
<td>VND</td>
<td>Vietnamese Đồng</td>
<td>23.091 ₫</td>
<td>230.915.000 ₫</td>
</tr><tr>
<td>YER</td>
<td>Yemeni Rial</td>
<td>YER 250.24</td>
<td>YER 2,502,498.91</td>
</tr><tr>
<td>ZAR</td>
<td>South African Rand</td>
<td>ZAR 16.03</td>
<td>ZAR 160,303.39</td>
</tr></tbody>
</table></p>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,252 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Bot Code Examples</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="If you want to learn more about Telegram bots, start with our Introduction to Bots »
Check out the FAQ, if you have questions.…">
<meta property="og:title" content="Bot Code Examples">
<meta property="og:image" content="">
<meta property="og:description" content="If you want to learn more about Telegram bots, start with our Introduction to Bots »
Check out the FAQ, if you have questions.…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/bots" >Telegram Bots</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/samples" >Bot Code Examples</a></li></ul></div>
<h1 id="dev_page_title">Bot Code Examples</h1>
<div id="dev_page_content"><blockquote>
<p>If you want to learn more about Telegram bots, start with our <a href="/bots"><strong>Introduction to Bots »</strong></a><br>Check out the <a href="/bots/faq"><strong>FAQ</strong></a>, if you have questions.</p>
</blockquote>
<p>Many members of our community are building bots and libraries and publishing their source code. We collect these examples here. Ping us on <a href="https://telegram.me/botsupport">BotSupport</a> if you&#39;ve built a bot and would like to share its code with others.</p>
<h4><a class="anchor" name="php" href="#php"><i class="anchor-icon"></i></a>PHP</h4>
<ul>
<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>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>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>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>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>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>
<li><p><strong>PHP Telegram Bot</strong>. Telegram bot as it should be.<br><a href="https://github.com/formapro/telegram-bot-php">https://github.com/formapro/telegram-bot-php</a></p>
</li>
<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>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>TelegramBotApiBundle</strong>. A symfony wrapper bundle for Telegram Bot API.<br><a href="https://github.com/borsaco/TelegramBotApiBundle">https://github.com/borsaco/TelegramBotApiBundle</a></p>
</li>
</ul>
<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.<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.<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.<br><a href="https://github.com/mullwar/telebot">https://github.com/mullwar/telebot</a></p>
</li>
<li><p><strong>telegram-bot-api</strong>. Node.js library for Telegram Bot API.<br><a href="https://github.com/mast/telegram-bot-api">https://github.com/mast/telegram-bot-api</a></p>
</li>
<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>
<li><p><strong>tgapi</strong>. Reactive and with full Flow coverage Telegram Bot API JS implementation.<br><a href="https://github.com/bigslycat/tgapi">https://github.com/bigslycat/tgapi</a></p>
</li>
<li><p><strong>Botgram</strong>. Practical Telegram Bot microframework.<br><a href="https://github.com/botgram/botgram">https://github.com/botgram/botgram</a></p>
</li>
</ul>
<h4><a class="anchor" name="rust" href="#rust"><i class="anchor-icon"></i></a>Rust</h4>
<ul>
<li><p><strong>teloxide</strong>. An elegant Telegram bots framework for Rust.<br><a href="https://github.com/teloxide/teloxide">https://github.com/teloxide/teloxide</a></p>
</li>
<li><p><strong>Telebot</strong>. Write Telegram bots in Rust with Tokio and Futures.<br><a href="https://github.com/bytesnake/telebot">https://github.com/bytesnake/telebot</a></p>
</li>
<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>telegram-bot</strong>. Rust 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>
</ul>
<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&#39;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>. Python 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.<br><a href="https://github.com/aiogram/aiogram">https://github.com/aiogram/aiogram</a></p>
</li>
</ul>
<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.<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&#39;s Bot API.<br><a href="https://github.com/atipugin/telegram-bot-ruby">https://github.com/atipugin/telegram-bot-ruby</a></p>
</li>
<li><p><strong>TelegramBot</strong>. A charismatic Ruby client for Telegram&#39;s Bot API.<br><a href="https://github.com/eljojo/telegram_bot">https://github.com/eljojo/telegram_bot</a></p>
</li>
</ul>
<h4><a class="anchor" name="swift" href="#swift"><i class="anchor-icon"></i></a>Swift</h4>
<ul>
<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.<br><a href="https://github.com/givip/Telegrammer">https://github.com/givip/Telegrammer</a></p>
</li>
<li><p><strong>SwiftyBot</strong>. Swift + Vapor + Telegram.<br><a href="https://github.com/FabrizioBrancati/SwiftyBot">https://github.com/FabrizioBrancati/SwiftyBot</a></p>
</li>
</ul>
<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.<br><a href="https://github.com/InsanusMokrassar/TelegramBotAPI">https://github.com/InsanusMokrassar/TelegramBotAPI</a></p>
</li>
<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>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>Telegraff</strong>. Kotlin DSL for Telegram Bots.<br><a href="https://github.com/ruslanys/telegraff">https://github.com/ruslanys/telegraff</a></p>
</li>
</ul>
<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.<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.<br><a href="https://github.com/pengrad/java-telegram-bot-api">https://github.com/pengrad/java-telegram-bot-api</a></p>
</li>
</ul>
<h4><a class="anchor" name="go" href="#go"><i class="anchor-icon"></i></a>Go</h4>
<ul>
<li><p><strong>go-telegram-bot-api</strong>. Golang 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>telebot</strong>. A Telegram bot framework in Go.<br><a href="https://github.com/tucnak/telebot">https://github.com/tucnak/telebot</a></p>
</li>
</ul>
<h4><a class="anchor" name="other-languages" href="#other-languages"><i class="anchor-icon"></i></a>Other Languages</h4>
<ul>
<li><p>TypeScript. <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>C#. <strong>Telegram.bot</strong>. Library.<br><a href="https://github.com/TelegramBots/Telegram.Bot">https://github.com/TelegramBots/Telegram.Bot</a></p>
</li>
<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>. C++ 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>Dart. <strong>TeleDart</strong>. A Dart 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>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>. An OCaml 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.<br><a href="https://github.com/klappvisor/haskell-telegram-api">https://github.com/klappvisor/haskell-telegram-api</a></p>
</li>
<li><p>Scala. <strong>canoe</strong>. Functional Telegram Bot API for Scala.<br><a href="https://github.com/augustjune/canoe">https://github.com/augustjune/canoe</a></p>
</li>
<li><p>Scala. <strong>bot4s.telegram</strong>. 100% idiomatic Scala wrapper for the Telegram Bot API.<br><a href="https://github.com/bot4s/telegram">https://github.com/bot4s/telegram</a></p>
</li>
<li><p>Perl. <strong>Telegram Bot</strong>. A genuine Perl 6 client for the Telegram&#39;s Bot API.<br><a href="https://github.com/GildedHonour/TelegramBot">https://github.com/GildedHonour/TelegramBot</a></p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,290 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Hellobot</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="This sample PHP bot demonstrates the basics of the Telegram Bot API.
If you have questions, try our FAQ or check out this…">
<meta property="og:title" content="Hellobot">
<meta property="og:image" content="">
<meta property="og:description" content="This sample PHP bot demonstrates the basics of the Telegram Bot API.
If you have questions, try our FAQ or check out this…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/bots" >Telegram Bots</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/samples" >Code Examples</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/samples%2Fhellobot" >Hellobot</a></li></ul></div>
<h1 id="dev_page_title">Hellobot</h1>
<div id="dev_page_content"><blockquote>
<p>This sample PHP bot demonstrates the basics of the <a href="/bots/api">Telegram Bot API</a>.<br>If you have questions, try our <a href="/bots/faq">FAQ</a> or check out <a href="/bots/samples">this page</a> for more examples.</p>
</blockquote>
<div><br></div>
<pre><code>&lt;?php
define(&#39;BOT_TOKEN&#39;, &#39;12345678:replace-me-with-real-token&#39;);
define(&#39;API_URL&#39;, &#39;https://api.telegram.org/bot&#39;.BOT_TOKEN.&#39;/&#39;);
function apiRequestWebhook($method, $parameters) {
if (!is_string($method)) {
error_log(&quot;Method name must be a string\n&quot;);
return false;
}
if (!$parameters) {
$parameters = array();
} else if (!is_array($parameters)) {
error_log(&quot;Parameters must be an array\n&quot;);
return false;
}
$parameters[&quot;method&quot;] = $method;
$payload = json_encode($parameters);
header(&#39;Content-Type: application/json&#39;);
header(&#39;Content-Length: &#39;.strlen($payload));
echo $payload;
return true;
}
function exec_curl_request($handle) {
$response = curl_exec($handle);
if ($response === false) {
$errno = curl_errno($handle);
$error = curl_error($handle);
error_log(&quot;Curl returned error $errno: $error\n&quot;);
curl_close($handle);
return false;
}
$http_code = intval(curl_getinfo($handle, CURLINFO_HTTP_CODE));
curl_close($handle);
if ($http_code &gt;= 500) {
// do not wat to DDOS server if something goes wrong
sleep(10);
return false;
} else if ($http_code != 200) {
$response = json_decode($response, true);
error_log(&quot;Request has failed with error {$response[&#39;error_code&#39;]}: {$response[&#39;description&#39;]}\n&quot;);
if ($http_code == 401) {
throw new Exception(&#39;Invalid access token provided&#39;);
}
return false;
} else {
$response = json_decode($response, true);
if (isset($response[&#39;description&#39;])) {
error_log(&quot;Request was successful: {$response[&#39;description&#39;]}\n&quot;);
}
$response = $response[&#39;result&#39;];
}
return $response;
}
function apiRequest($method, $parameters) {
if (!is_string($method)) {
error_log(&quot;Method name must be a string\n&quot;);
return false;
}
if (!$parameters) {
$parameters = array();
} else if (!is_array($parameters)) {
error_log(&quot;Parameters must be an array\n&quot;);
return false;
}
foreach ($parameters as $key =&gt; &amp;$val) {
// encoding to JSON array parameters, for example reply_markup
if (!is_numeric($val) &amp;&amp; !is_string($val)) {
$val = json_encode($val);
}
}
$url = API_URL.$method.&#39;?&#39;.http_build_query($parameters);
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($handle, CURLOPT_TIMEOUT, 60);
return exec_curl_request($handle);
}
function apiRequestJson($method, $parameters) {
if (!is_string($method)) {
error_log(&quot;Method name must be a string\n&quot;);
return false;
}
if (!$parameters) {
$parameters = array();
} else if (!is_array($parameters)) {
error_log(&quot;Parameters must be an array\n&quot;);
return false;
}
$parameters[&quot;method&quot;] = $method;
$handle = curl_init(API_URL);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($handle, CURLOPT_TIMEOUT, 60);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, json_encode($parameters));
curl_setopt($handle, CURLOPT_HTTPHEADER, array(&quot;Content-Type: application/json&quot;));
return exec_curl_request($handle);
}
function processMessage($message) {
// process incoming message
$message_id = $message[&#39;message_id&#39;];
$chat_id = $message[&#39;chat&#39;][&#39;id&#39;];
if (isset($message[&#39;text&#39;])) {
// incoming text message
$text = $message[&#39;text&#39;];
if (strpos($text, &quot;/start&quot;) === 0) {
apiRequestJson(&quot;sendMessage&quot;, array(&#39;chat_id&#39; =&gt; $chat_id, &quot;text&quot; =&gt; &#39;Hello&#39;, &#39;reply_markup&#39; =&gt; array(
&#39;keyboard&#39; =&gt; array(array(&#39;Hello&#39;, &#39;Hi&#39;)),
&#39;one_time_keyboard&#39; =&gt; true,
&#39;resize_keyboard&#39; =&gt; true)));
} else if ($text === &quot;Hello&quot; || $text === &quot;Hi&quot;) {
apiRequest(&quot;sendMessage&quot;, array(&#39;chat_id&#39; =&gt; $chat_id, &quot;text&quot; =&gt; &#39;Nice to meet you&#39;));
} else if (strpos($text, &quot;/stop&quot;) === 0) {
// stop now
} else {
apiRequestWebhook(&quot;sendMessage&quot;, array(&#39;chat_id&#39; =&gt; $chat_id, &quot;reply_to_message_id&quot; =&gt; $message_id, &quot;text&quot; =&gt; &#39;Cool&#39;));
}
} else {
apiRequest(&quot;sendMessage&quot;, array(&#39;chat_id&#39; =&gt; $chat_id, &quot;text&quot; =&gt; &#39;I understand only text messages&#39;));
}
}
define(&#39;WEBHOOK_URL&#39;, &#39;https://my-site.example.com/secret-path-for-webhooks/&#39;);
if (php_sapi_name() == &#39;cli&#39;) {
// if run from console, set or delete webhook
apiRequest(&#39;setWebhook&#39;, array(&#39;url&#39; =&gt; isset($argv[1]) &amp;&amp; $argv[1] == &#39;delete&#39; ? &#39;&#39; : WEBHOOK_URL));
exit;
}
$content = file_get_contents(&quot;php://input&quot;);
$update = json_decode($content, true);
if (!$update) {
// receive wrong update, must not happen
exit;
}
if (isset($update[&quot;message&quot;])) {
processMessage($update[&quot;message&quot;]);
}</code></pre>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,164 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Using self-signed certificates</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Upload your certificate using the certificate parameter in the setWebhook method. The certificate supplied should be PEM…">
<meta property="og:title" content="Using self-signed certificates">
<meta property="og:image" content="">
<meta property="og:description" content="Upload your certificate using the certificate parameter in the setWebhook method. The certificate supplied should be PEM…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/bots" >Telegram Bots</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/faq" >FAQ</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/self-signed" >Using self-signed certificates</a></li></ul></div>
<h1 id="dev_page_title">Using self-signed certificates</h1>
<div id="dev_page_content"><p>Upload your certificate using the <em>certificate</em> parameter in the <a href="/bots/api#setwebhook">setWebhook</a> method. The certificate supplied should be <strong>PEM encoded</strong> (ASCII BASE64), the pem file should only contain the <strong>public key</strong> (including BEGIN and END portions). When converting from a bundle format, please split the file to only include the public key.</p>
<h3><a class="anchor" name="generating-a-self-signed-certificate-pair-pem" href="#generating-a-self-signed-certificate-pair-pem"><i class="anchor-icon"></i></a>Generating a self-signed certificate pair (PEM):</h3>
<h4><a class="anchor" name="openssl" href="#openssl"><i class="anchor-icon"></i></a>Openssl</h4>
<blockquote>
<p>Windows binaries for Openssl are available online</p>
</blockquote>
<p><code>openssl req -newkey rsa:2048 -sha256 -nodes -keyout YOURPRIVATE.key -x509 -days 365 -out YOURPUBLIC.pem -subj &quot;/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=YOURDOMAIN.EXAMPLE&quot;</code></p>
<p>YOURPUBLIC.pem has to be used as input for setting the self-signed webhook.</p>
<p>You can inspect the generated certificate with:<br><code>openssl x509 -text -noout -in YOURPUBLIC.pem</code></p>
<p>Converting from a previously generated DER:<br><code>openssl x509 -inform der -in YOURDER.der -out YOURPEM.pem</code></p>
<p>Converting from a previously generated PKCS12:<br><code>openssl pkcs12 -in YOURPKCS.p12 -out YOURPEM.pem</code></p>
<blockquote>
<p>More information: https://www.openssl.org/</p>
</blockquote>
<h4><a class="anchor" name="java-keystore" href="#java-keystore"><i class="anchor-icon"></i></a>Java keystore</h4>
<p>Generate self-signed JKS:<br><code>keytool -genkey -keyalg RSA -alias YOURDOMAIN.EXAMPLE -keystore YOURJKS.jks -storepass YOURPASSWORD -validity 360 -keysize 2048</code></p>
<p>Converting JKS to pkcs12 (intermediate step for conversion to PEM):<br><code>keytool -importkeystore -srckeystore YOURJKS.jks -destkeystore YOURPKCS.p12 -srcstoretype jks -deststoretype pkcs12</code></p>
<p>Convert PKCS12 to PEM (requires openssl):<br><code>openssl pkcs12 -in YOURPKCS.p12 -out YOURPEM.pem</code></p>
<blockquote>
<p>More information: https://docs.oracle.com</p>
</blockquote>
<h4><a class="anchor" name="windows" href="#windows"><i class="anchor-icon"></i></a>Windows</h4>
<p>Creating a self-signed certificate using Windows native utilities is also possible, although OpenSSL binaries for Windows are available online.</p>
<p>On the commandline:<br><code>certreq -new TEMPLATE.txt RequestFileOut</code></p>
<p>TEMPLATE.txt example file:</p>
<pre><code>[NewRequest]
; At least one value must be set in this section
Subject = &quot;CN=DOMAIN.EXAMPLE&quot;
KeyLength = 2048
KeyAlgorithm = RSA
HashAlgorithm = sha256
;MachineKeySet = true
RequestType = Cert
UseExistingKeySet=false ;generates a new private key (for export)
Exportable = true ;makes the private key exportable with the PFX</code></pre>
<p>A self-signed certificate will be generated and installed, to view the certificate:<br><code>certutil -store -user my</code></p>
<p>To export in DER format (intermediate step for conversion to PEM)<br><code>certutil -user -store -split my SERIALNUMBER YOURDER.crt</code></p>
<p>Converting to PEM (used for setting the webhook)<br><code>certutil -encode YOURDER.crt YOURPEM.cer</code></p>
<p>To delete a certificate from your store:<br><code>certutil -delstore -user my SERIALNUMBER</code> (from view)</p>
<p>To export in PFX(PKCS12) format<br><code>certutil -exportpfx -user YOURDOMAIN.EXAMPLE YOURPKCS.pfx NoChain</code></p>
<blockquote>
<p>More information: https://technet.microsoft.com</p>
</blockquote>
<p>Converting YOURPKCS.pfx to PEM including the private key is best done with OpenSSL:<br><code>openssl pkcs12 -in YOURPKCS.pfx -out YOURPEM.cer</code></p>
<p>Remember that only the public key is needed as input for the self-signed webhook certificate parameter. certmgr.msc can also be used as a GUI to export the public part of self-signed certificates to PEM.</p>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,594 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Web Apps for Bots</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram bots can completely replace any website. They support seamless authorization, integrated payments via 15 payment…">
<meta property="og:title" content="Web Apps for Bots">
<meta property="og:image" content="https://blogfork.telegram.org/file/464001702/1194c/mBQhTbIWqw8.451557/08727d5d763e24d750">
<meta property="og:description" content="Telegram bots can completely replace any website. They support seamless authorization, integrated payments via 15 payment…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Web Apps for Bots</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram bots can completely replace <strong>any website</strong>. They support <a href="https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots">seamless authorization</a>, <a href="https://core.telegram.org/bots/payments">integrated payments</a> via <strong>15</strong> payment providers (with <em>Google Pay</em> and <em>Apple Pay</em> out of the box), delivering tailored push notifications to users, and <a href="https://core.telegram.org/bots">much more</a>.</p>
<p>With <strong>Web Apps</strong>, bots get a whole new dimension. Bot developers can create <strong>infinitely flexible interfaces</strong> with <em>JavaScript</em>, the most widely used programming language in the world.</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/464001434/100bf/eWprjdgzEbE.100386/644bbea83084f44c8f" style="max-width: 600px;" title="console.log('Vive la révolution')" alt="Bot Revolution">
<source src="/file/464001679/11aa9/KQx_BlPVXRo.4922145.mp4/c65433c8ac11a347a8" type="video/mp4">
</video>
</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" 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&#39;s current <strong>color theme</strong> in real time, so you can adjust the appearance of your interfaces to match it. For example, when users switch between <strong>Day and Night</strong> modes or use various <a href="https://telegram.org/blog/protected-content-delete-by-date-and-more#global-chat-themes-on-android">custom themes</a>.</p>
<div class="blog_video_player_wrap" style="max-width: 600px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay loop controls muted poster="/file/464001576/10249/wikoQUNnrH4.112118/7b6c8d3366ada2615b" style="max-width: 600px;" title="" alt="Switching Colors">
<source src="/file/464001257/12087/QNQUbIi864k.909800.mp4/8ea7adad7db407388e" type="video/mp4">
</video>
</div>
<blockquote>
<p><a href="#themeparams">Jump to technical information</a></p>
</blockquote>
<h4><a class="anchor" name="design-guidelines" href="#design-guidelines"><i class="anchor-icon"></i></a>Design Guidelines</h4>
<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>
<li>Interactive elements should mimic the style, behavior and intent of UI components that already exist.</li>
<li>All included animations should be smooth, ideally 60fps.</li>
<li>All inputs and images should contain labels for accessibility purposes.</li>
<li>The app should deliver a seamless experience by monitoring the <a href="#color-schemes">dynamic theme-based colors</a> provided by the API and using them accordingly.</li>
</ul>
<hr>
<h3><a class="anchor" name="implementing-web-apps" href="#implementing-web-apps"><i class="anchor-icon"></i></a>Implementing Web Apps</h3>
<p>Telegram currently supports four 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> and even from the <a href="#launching-web-apps-from-the-attachment-menu">attachment menu</a>.</p>
<div class="blog_image_wrap blog_medium_image_wrap">
<a href="/file/464001702/1194c/mBQhTbIWqw8.451557/08727d5d763e24d750" target="_blank"><img src="/file/464001702/1194c/mBQhTbIWqw8.451557/08727d5d763e24d750" title="" alt="Types of buttons" srcset="/file/464001702/1194c/mBQhTbIWqw8.451557/08727d5d763e24d750 , 2x" /></a>
</div>
<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>
<p>Users can interact with bots using <a href="https://core.telegram.org/bots#keyboards">custom keyboards</a>, <a href="https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating">buttons under bot messages</a>, as well as by sending freeform <strong>text messages</strong> or any of the <strong>attachment types</strong> supported by Telegram: photos and videos, files, locations, contacts and polls. For even more flexibility, bots can utilize the full power of <strong>HTML5</strong> to create user-friendly input interfaces.</p>
<p>You can send a <strong>web_app</strong> type <a href="/bots/api#keyboardbutton">KeyboardButton</a> that opens a Web App from the specified URL.</p>
<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>Reusable components</strong> that do not depend on a particular bot.</li>
</ul>
<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&#39;s <a href="#color-schemes">theme settings</a>, it will receive basic user information (<code>ID</code>, <code>name</code>, <code>username</code>, <code>language_code</code>) and a unique identifier for the session, <strong>query_id</strong>, which allows messages on behalf of the user to be sent back to the bot.</p>
<p>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" 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
" style="max-width: 600px;" title="" alt="Menu Button">
<source src="/file/464001838/10fa2/WrJmkuIMan0.1217917.mp4/e25a5f31bc4e6493f7" type="video/mp4">
</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 &gt; Menu Button</em>).</li>
<li>To customize the button for both <strong>all users</strong> and <strong>specific users</strong>, use the <a href="/bots/api#setchatmenubutton">setChatMenuButton</a> method in the Bot API. For example, change the button text according to the user&#39;s language, or show links to different Web Apps based on a user&#39;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" 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&#39;s attachment menu, allowing them to be quickly launched from any private 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 any <strong>private chat</strong>.</p>
</blockquote>
<p>Web App Bots can request to be added directly to a user&#39;s attachment menu, allowing them to be quickly launched from <strong>any private chat</strong> (with either a <em>user</em> or <em>another bot</em>).</p>
<p>Attachment menu integration is currently only available for major advertisers on the <a href="https://promote.telegram.org/basics">Telegram Ad Platform</a>. However, <strong>all bots</strong> can use it in the <a href="#using-bots-in-the-test-environment">test server environment</a>.</p>
<p>To enable this feature for your bot, open <a href="https://t.me/botfather">@BotFather</a> <a href="#using-bots-in-the-test-environment">from an account on the test server</a> and send the <code>/setattach</code> command or go to <em>Bot Settings &gt; Configure Attachment Menu</em>. Then specify the URL that will be opened to launch the bot&#39;s Web App via its icon in the attachment menu.</p>
<p>In addition to the user&#39;s <a href="#color-schemes">theme settings</a>, the bot will receive basic user information (<code>ID</code>, <code>name</code>, <code>username</code>, <code>language_code</code>, <code>photo</code>), as well as public info about the chat partner (<code>ID</code>, <code>name</code>, <code>username</code>, <code>photo</code>) 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 private 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" 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>&lt;head&gt;</code> tag before any other scripts, using this code:</p>
<pre><code>&lt;script src=&quot;https://telegram.org/js/telegram-web-app.js&quot;&gt;&lt;/script&gt;</code></pre>
<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>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<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&#39;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&#39;s server and only after it has been <a href="#validating-data-received-via-the-web-app">validated</a>.</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>
</tr>
<tr>
<td>themeParams</td>
<td><a href="#themeparams">ThemeParams</a></td>
<td>An object containing the current theme settings used in the Telegram app.</td>
</tr>
<tr>
<td>isExpanded</td>
<td>Boolean</td>
<td><em>True</em> if the Web App is expanded to the maximum available height. False, if the Web App occupies part of the screen and can be expanded to the full height using the <strong>expand()</strong> method.</td>
</tr>
<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&#39;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>
</tr>
<tr>
<td>MainButton</td>
<td><a href="#mainbutton">MainButton</a></td>
<td>An object for controlling the main button, which is displayed at the bottom of the Web App in the Telegram interface.</td>
</tr>
<tr>
<td>onEvent(eventType, eventHandler)</td>
<td>Function</td>
<td>A method that sets the app event handler. Check <a href="#events-available-for-web-apps">the list of available events</a>.</td>
</tr>
<tr>
<td>offEvent(eventType, eventHandler)</td>
<td>Function</td>
<td>A method that deletes a previously set event handler.</td>
</tr>
<tr>
<td>sendData(data)</td>
<td>Function</td>
<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>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>
</tr>
<tr>
<td>expand()</td>
<td>Function</td>
<td>A method that expands the Web App to the maximum available height. To find out if the Web App is expanded to the maximum height, refer to the value of the <em>Telegram.WebApp.isExpanded</em> parameter</td>
</tr>
<tr>
<td>close()</td>
<td>Function</td>
<td>A method that closes the Web App.</td>
</tr>
</tbody>
</table>
<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&#39;s app in real time. This object contains the user&#39;s current theme settings:</p>
<table class="table">
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<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>
</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>
</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>
</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>
</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>
</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>
</tr>
</tbody>
</table>
<div class="blog_image_wrap blog_medium_image_wrap">
<a href="/file/464001058/109a6/XLMi7E5_IvY.218203/90b01ba97b6bc3ab8e" target="_blank"><img src="/file/464001058/109a6/XLMi7E5_IvY.218203/90b01ba97b6bc3ab8e" title="" alt="Color parameters guide" srcset="/file/464001058/109a6/XLMi7E5_IvY.218203/90b01ba97b6bc3ab8e , 2x" /></a>
</div>
<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>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>text</td>
<td>String</td>
<td>Current button text. Set to <em>CONTINUE</em> by default.</td>
</tr>
<tr>
<td>color</td>
<td>String</td>
<td>Current button color. Set to <code>themeParams.button_color</code> by default.</td>
</tr>
<tr>
<td>textColor</td>
<td>String</td>
<td>Current button text color. Set to <code>themeParams.button_text_color</code> by default.</td>
</tr>
<tr>
<td>isVisible</td>
<td>Boolean</td>
<td>Shows whether the button is visible. Set to <em>false</em> by default.</td>
</tr>
<tr>
<td>isActive</td>
<td>Boolean</td>
<td>Shows whether the button is active. Set to <em>true</em> by default.</td>
</tr>
<tr>
<td>isProgressVisible</td>
<td>Boolean</td>
<td><em>Readonly.</em> Shows whether the button is displaying a loading indicator.</td>
</tr>
<tr>
<td>setText(text)</td>
<td>Function</td>
<td>A method to set the button text.</td>
</tr>
<tr>
<td>onClick(callback)</td>
<td>Function</td>
<td>A method that sets the button press event handler. An alias for <code>Telegram.WebApp.onEvent(&#39;mainButtonClicked&#39;, callback)</code></td>
</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>
</tr>
<tr>
<td>hide()</td>
<td>Function</td>
<td>A method to hide the button.</td>
</tr>
<tr>
<td>enable()</td>
<td>Function</td>
<td>A method to enable the button.</td>
</tr>
<tr>
<td>disable()</td>
<td>Function</td>
<td>A method to disable the button.</td>
</tr>
<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>
</tr>
<tr>
<td>hideProgress()</td>
<td>Function</td>
<td>A method to hide the loading indicator.</td>
</tr>
<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>
</tr>
</tbody>
</table>
<p>All these methods return the MainButton object so they can be chained.</p>
<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>.</p>
<table class="table">
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>query_id</td>
<td>String</td>
<td><em>Optional.</em> A unique identifier for the Web App session, required for sending messages via the <a href="/bots/api#answerwebappquery">answerWebAppQuery</a> method.</td>
</tr>
<tr>
<td>user</td>
<td><a href="#webappuser">WebAppUser</a></td>
<td><em>Optional.</em> An object containing data about the current user.</td>
</tr>
<tr>
<td>receiver</td>
<td><a href="#webappuser">WebAppUser</a></td>
<td><em>Optional.</em> An object containing data about the chat partner of the current user in the chat where the bot was launched via the attachment menu. Returned only for Web Apps launched via the attachment menu.</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>
</tr>
<tr>
<td>auth_date</td>
<td>Integer</td>
<td>Unix time when the form was opened.</td>
</tr>
<tr>
<td>hash</td>
<td>String</td>
<td>A hash of all passed parameters, which the bot server can use to <a href="#validating-data-received-via-the-web-app">check their validity</a>.</td>
</tr>
</tbody>
</table>
<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>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>Integer</td>
<td>A unique identifier for the user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. It has at most 52 significant bits, so a 64-bit integer or a double-precision float type is safe for storing this identifier.</td>
</tr>
<tr>
<td>is_bot</td>
<td>Boolean</td>
<td><em>Optional</em>. <em>True</em>, if this user is a bot. Returns in the <a href="#webappinitdata">receiver</a> field only.</td>
</tr>
<tr>
<td>first_name</td>
<td>String</td>
<td>First name of the user or bot.</td>
</tr>
<tr>
<td>last_name</td>
<td>String</td>
<td><em>Optional</em>. Last name of the user or bot.</td>
</tr>
<tr>
<td>username</td>
<td>String</td>
<td><em>Optional</em>. Username of the user or bot.</td>
</tr>
<tr>
<td>language_code</td>
<td>String</td>
<td><em>Optional</em>. <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a> of the user&#39;s language. Returns in <em>user</em> field only.</td>
</tr>
<tr>
<td>photo_url</td>
<td>String</td>
<td><em>Optional</em>. URL of the users profile photo. The photo can be in .jpeg or .svg formats. Only returned for Web Apps launched from the attachment menu.</td>
</tr>
</tbody>
</table>
<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&#39;s backend. The data is a query string, which is composed of a series of field-value pairs.</p>
<p>You can verify the integrity of the data received by comparing the received <em>hash</em> parameter with the hexadecimal representation of the <a href="https://en.wikipedia.org/wiki/Hash-based_message_authentication_code">HMAC-SHA-256</a> signature of the <strong>data-check-string</strong> with the secret key, which is the <a href="https://en.wikipedia.org/wiki/Hash-based_message_authentication_code">HMAC-SHA-256</a> signature of the <a href="/bots#creating-a-new-bot">bot&#39;s token</a> with the constant string <code>WebAppData</code> used as a key.</p>
<p><strong>Data-check-string</strong> is a chain of all received fields, sorted alphabetically, in the format <code>key=&lt;value&gt;</code> with a <a href="https://en.wikipedia.org/wiki/Newline">line feed</a> character (&#39;\n&#39;, 0x0A) used as separator e.g., <code>&#39;auth_date=&lt;auth_date&gt;\nquery_id=&lt;query_id&gt;\nuser=&lt;user&gt;&#39;</code>.</p>
<p>The full check might look like:</p>
<pre><code>data_check_string = ...
secret_key = HMAC_SHA256(&lt;bot_token&gt;, &quot;WebAppData&quot;)
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" 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>
<tr>
<th>eventType</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>themeChanged</code></td>
<td>Occurs whenever theme settings are changed in the user&#39;s Telegram app (including switching to night mode).<br><em>eventHandler</em> receives no parameters, new theme settings and color scheme can be received via <em>this.themeParams</em> and <em>this.colorScheme</em> respectively.</td>
</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 <code>isStateStable</code> = 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 sections height is available in <em>this.viewportHeight</em>.</td>
</tr>
<tr>
<td><code>mainButtonClicked</code></td>
<td>Occurs when the <a href="#mainbutton">main button</a> is pressed.<br><em>eventHandler</em> receives no parameters.</td>
</tr>
</tbody>
</table>
<h4><a class="anchor" name="adding-bots-to-the-attachment-menu" href="#adding-bots-to-the-attachment-menu"><i class="anchor-icon"></i></a>Adding Bots to the Attachment Menu</h4>
<p>Attachment menu integration is currently only available for major advertisers on the <a href="https://promote.telegram.org/basics">Telegram Ad Platform</a>. However, <strong>all bots</strong> can use it in the <a href="#using-bots-in-the-test-environment">test server environment</a>. Talk to Botfather on the test server to <a href="#using-bots-in-the-test-environment">set up the integration</a>.</p>
<p>A special link is used to add bots to the attachment menu:</p>
<p><code>https://t.me/botusername?startattach</code><br>or<br><code>https://t.me/botusername?startattach=command</code></p>
<blockquote>
<p>For example, open this <a href="https://t.me/durgerkingbot?startattach">attachment menu link</a> for <em>@DurgerKingBot</em>, then use the <img class="icon" src="/file/464001085/2/E4hNXSNQimQ.2503/bf6ffcab3cb3afd43d" alt="Attach"> menu in any <strong>private chat</strong>.</p>
</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><br><code>https://t.me/username?attach=botusername&amp;startattach=command</code><br><code>https://t.me/+1234567890?attach=botusername</code><br><code>https://t.me/+1234567890?attach=botusername&amp;startattach=command</code></p>
<p>These links open the Web App in the attachment menu in the chat with a specific user. If the bot wasn&#39;t already added to the attachment menu, the user will be prompted to do so. If a non-empty <em>startattach</em> parameter was included in the link, it will be passed to the 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 &gt; Accounts &gt; Login to another account &gt; Test.</li>
<li><strong>Telegram Desktop:</strong> open ☰ Settings &gt; 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>The test environment is completely separate from the main environment, so you will need to create a <strong>new user account</strong> and a <strong>new bot</strong> with @BotFather.</p>
<p>After receiving your bot token, you can send requests to the Bot API in this format: </p>
<p><code>https://api.telegram.org/bot&lt;token&gt;/test/METHOD_NAME</code></p>
<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>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,830 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Marvin&#39;s Marvellous Guide to All Things Webhook</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="We currently support two ways of processing bot updates, getUpdates and setWebhook. getUpdates is a pull mechanism, setwebhook…">
<meta property="og:title" content="Marvin&#39;s Marvellous Guide to All Things Webhook">
<meta property="og:image" content="https://blogfork.telegram.org/file/811140281/1/5le8eVE7mPk.261973/25ba8c07609aef2310">
<meta property="og:description" content="We currently support two ways of processing bot updates, getUpdates and setWebhook. getUpdates is a pull mechanism, setwebhook…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/bots" >Telegram Bots</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/webhooks" >Marvin&#39;s Marvellous Guide to All Things…</a></li></ul></div>
<h1 id="dev_page_title">Marvin&#39;s Marvellous Guide to All Things Webhook</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>We currently support two ways of processing bot updates, <a href="https://core.telegram.org/bots/api#getting-updates"><strong>getUpdates</strong></a> and <a href="/bots/api#setwebhook"><strong>setWebhook</strong></a>. <strong>getUpdates</strong> is a pull mechanism, <strong>setwebhook</strong> is push. Although the concept of a webhook is fairly simple, the setup of the individual components has proven to be tricky for many. This guide provides some extra information for those of you brave enough to venture into the art of the webhook.</p>
<p>There are some advantages of using a webhook over getUpdates. As soon as an update arrives, well kindly deliver it to your bot for processing.</p>
<p><strong>This:</strong></p>
<pre><code>1. Avoids your bot having to ask for updates frequently.
2. Avoids the need for some kind of polling mechanism in your code.</code></pre>
<p>Other advantages may include saving some potential CPU cycles and an increase in response time, these things however depend heavily on the usage pattern of your bot.</p>
<p>Setting a webhook means you supplying Telegram with a location in the form of a URL, on which your bot listens for updates. We need to be able to connect and post updates to that URL. </p>
<p>To ensure that we can do that, there are some basic requirements:</p>
<h3><a class="anchor" name="the-short-version" href="#the-short-version"><i class="anchor-icon"></i></a>The short version</h3>
<p>You&#39;ll need a server that:</p>
<ul>
<li>Supports IPv4, IPv6 is currently not supported for webhooks.</li>
<li>Accepts incoming POSTs from subnets <code>149.154.160.0/20</code> and <code>91.108.4.0/22</code> on port 443, 80, 88, or 8443. </li>
<li>Is able to handle TLS1.2(+) HTTPS-traffic. </li>
<li>Provides a supported, verified or self-signed certificate.</li>
<li>Uses a CN or SAN that matches the domain youve supplied on setup.</li>
<li>Supplies all intermediate certificates to complete a verification chain.</li>
</ul>
<p>Thats almost all theres to it.<br>If you decide to limit traffic to our specific range of addresses, keep an eye on this document whenever you seem to run into trouble. Our IP-range might change in the future. </p>
<h3><a class="anchor" name="the-longer-version" href="#the-longer-version"><i class="anchor-icon"></i></a>The longer version</h3>
<ul>
<li><h4><a class="anchor" name="a-domain-name" href="#a-domain-name"><i class="anchor-icon"></i></a>A domain name</h4>
<p>Setting a webhook needs a URL for us to post to. For that you&#39;ll need a server with a domain name. If you don&#39;t have one, you&#39;ll need to obtain one first. Telegram currently doesn&#39;t offer hosting or domain name services. There are quite a few VPS/Web hosting providers around the internet, feel free to pick one to your liking.<br>If you&#39;re using a self-signed certificate, you may use the IP as a CN, instead of the domain name.<br><a href="https://core.telegram.org/bots/webhooks#how-do-i-get-a-server-with-a-domain-name">How do I get a server with a domain name?</a></p>
</li>
<li><h4><a class="anchor" name="an-open-port" href="#an-open-port"><i class="anchor-icon"></i></a>An open port</h4>
<p>A webhook needs an open port on your server. We currently support the following ports: <strong>443, 80, 88</strong> and <strong>8443</strong>. Other ports are not supported and will not work. Make sure your bot is running on one of those supported ports, and that the bot is reachable via its public address.</p>
<pre><code>If you want to limit access to Telegram only, please allow traffic from 149.154.167.197-233 (starting July 2019 please use: 149.154.160.0/20 and 91.108.4.0/22).
Whenever something stops working in the future, please check this document again as
the range might expand or change.</code></pre>
<p><a href="https://core.telegram.org/bots/webhooks#how-do-i-check-for-open-ports-or-limit-access-to-my-bot">How do I check for open ports or limit access to my bot?</a></p>
</li>
<li><h4><a class="anchor" name="always-ssl-tls" href="#always-ssl-tls"><i class="anchor-icon"></i></a>Always SSL/TLS</h4>
<p>A webhook requires SSL/TLS encryption, no matter which port is used. It&#39;s not possible to use a plain-text HTTP webhook. You shouldn&#39;t want to either, for the sake of your bot and users.<br><a href="https://core.telegram.org/bots/webhooks#ssl-tls-what-is-it-and-why-do-i-have-to-handle-this-for-a-webhoo">SSL/TLS, why do I have to handle this for a webhook?</a></p>
</li>
<li><h4><a class="anchor" name="not-all-ssl-tls-is-equal" href="#not-all-ssl-tls-is-equal"><i class="anchor-icon"></i></a>Not all SSL/TLS is equal</h4>
<p>We support any SSL/TLS version TLS1.2 and up for your webhook. This means that <strong>SSLV2/3/TLS1.0/TSL1.1 are NOT supported</strong>, due to security issues associated with those older versions.<br><a href="https://core.telegram.org/bots/webhooks#how-do-i-check-that-im-handling-the-right-version">How do I check that Im handling the right version?</a></p>
</li>
<li><h4><a class="anchor" name="ssl-needs-a-certificate" href="#ssl-needs-a-certificate"><i class="anchor-icon"></i></a>SSL needs a certificate</h4>
<p>The common name (CN) of your certificate (self-signed or verified) has to match the domain name where your bot is hosted. You may also use a subject alternative name (SAN), that matches the domain for your webhook. Server Name Indication (SNI)-routing is supported. If you&#39;re using a self-signed certificate, you may use the IP as a CN, instead of the domain name.<br><a href="https://core.telegram.org/bots/webhooks#a-certificate-where-do-i-get-one-and-how">A certificate, where do I get one, and how?</a></p>
</li>
<li><h4><a class="anchor" name="verified-or-self-signed" href="#verified-or-self-signed"><i class="anchor-icon"></i></a>Verified or self-signed</h4>
<p>A certificate can either be verified or self-signed. Setting a webhook with a self-signed certificate differs a little from setting a webhook with a verified certificate. Ensure you&#39;re using the correct setup for the type of certificate you&#39;ve chosen for your webhook.<br><a href="https://core.telegram.org/bots/webhooks#how-do-i-set-a-webhook-for-either-type">How do I set a webhook for either type?</a></p>
</li>
<li><h4><a class="anchor" name="supported-certificates" href="#supported-certificates"><i class="anchor-icon"></i></a>Supported certificates</h4>
<p>Not all verified certificates are supported. Certificates are based on a network of trust and come in a chain. Trusting your verified certificate means we have to trust the provider of that certificate, the Certificate Authority (and hence its root certificate). Before you pick a certificate provider, Check <a href="https://packages.debian.org/jessie/all/ca-certificates/filelist">this list</a> to make sure that we actually trust their root certificate.<br><a href="https://core.telegram.org/bots/webhooks#an-untrusted-root">What if my root certificate isnt on that list?</a></p>
</li>
<li><h4><a class="anchor" name="an-untrusted-root" href="#an-untrusted-root"><i class="anchor-icon"></i></a>An Untrusted root</h4>
<p>Ok, so you already had a certificate installed and just discovered its not on our list.<br>Start by ignoring it, and just try to set it. We occasionally add extra root certificates to keep up with popular demand, so the list isn&#39;t always exhaustive. Unlucky after all? We&#39;ll allow you to supply an unsupported root certificate when setting the webhook. This method is nearly identical to setting a self-signed certificate webhook. Instead of your self-signed certificate you&#39;ll be sending us the root certificate as inputFile.<br><a href="https://core.telegram.org/bots/webhooks#setting-a-verified-webhook-with-an-untrusted-root">Setting a verified webhook with an untrusted root</a></p>
</li>
<li><h4><a class="anchor" name="intermediate-certificates" href="#intermediate-certificates"><i class="anchor-icon"></i></a>Intermediate certificates</h4>
<p>Some verified certificates require an intermediate certificate. In this construction the provider of your verified certificate has used their root certificate to sign an intermediate certificate. This intermediate certificate is then used to sign your verified certificate. You&#39;ll need to provide the intermediate certificate for us to be able to verify the chain of trust. CA&#39;s that use this type of chain supply an intermediate certificate.<br><a href="https://core.telegram.org/bots/webhooks#supplying-an-intermediate-certificate">Supplying an intermediate certificate</a></p>
</li>
<li><h4><a class="anchor" name="more-information" href="#more-information"><i class="anchor-icon"></i></a>More information</h4>
<p>Since we know webhooks can be a tad overwhelming, were working on a little digital assistant thatll try and help you with the most common problems, it&#39;s not nearly perfect, but you may try using @CanOfWormsBot to check if your chain of certificates is installed correctly before contacting support.</p>
</li>
<li><h4><a class="anchor" name="testing-your-bot" href="#testing-your-bot"><i class="anchor-icon"></i></a>Testing your bot</h4>
<p>We took the liberty of adding a <a href="https://core.telegram.org/bots/webhooks#testing-your-bot-with-updates">set of example updates</a>. They come in handy when testing your bot, no matter which method of getting updates you might be using.</p>
</li>
<li><h4><a class="anchor" name="don-39t-panic" href="#don-39t-panic"><i class="anchor-icon"></i></a>Don&#39;t panic.</h4>
<p>If by now you&#39;re looking for your fishing gear because we&#39;ve mentioned ports and hooks or you&#39;re about to Google what kind of bait URL and TLS exactly are, this guide might not be completely for you. Youre quite likely still a brilliant bot programmer, dont worry. Perhaps this whole webhook thing is just new to you, not all is lost. If you currently have a working getUpdates situation, it&#39;s a good idea to pick up this guide again on a rainy Sunday afternoon and take your time to read up on some subjects around the internet. This <a href="http://www.douglasadams.com/creations/hhgg.html">guide</a> can only contain a finite amount of information after all.</p>
</li>
</ul>
<h3><a class="anchor" name="the-verbose-version" href="#the-verbose-version"><i class="anchor-icon"></i></a>The verbose version</h3>
<h5><a class="anchor" name="how-do-i-get-a-server-with-a-domain-name" href="#how-do-i-get-a-server-with-a-domain-name"><i class="anchor-icon"></i></a>How do I get a server with a domain name?</h5>
<p>If you use a webhook, we have to deliver requests to your bot to a server we can reach. So yes, you need a server we can connect to. It can be anywhere in the galaxy, if you ensure we can reach the server by domain name (or at least via IP for a self-signed certificate), it will work just fine.</p>
<p>There are quite a few ways to get this done, as a novice however it&#39;s likely that you&#39;re not directly jumping at the chance of crafting this from scratch. Actually, as a novice, we recommend you don&#39;t. It&#39;s likely to be a complex and long ride.</p>
<p><strong>If you got stuck here, make a choice:</strong></p>
<ul>
<li><p>You use getUpdates at the moment and it works, keep it that way. Especially if you&#39;re running your bot from a nice machine that does well. There is nothing wrong with using getUpdates.</p>
</li>
<li><p>Go with a hosted service and let a bunch of professionals worry about things like registering a domain, setting up DNS, a web server, securing it and so on.</p>
</li>
</ul>
<pre><code>If you&#39;re going with a hosted service, make sure to look for a hosting provider that
not only supports your codes needs, for example: support for your PHP version,
but one that also handles SSL and allows you to create/deploy certificates.</code></pre>
<ul>
<li>Go crazy, dive on the internet and start reading. Once youre confident that youve got all the basic theories down, find yourself a nice hosted VPS or roll your own machine at home and get back to us here.</li>
</ul>
<h5><a class="anchor" name="how-do-i-check-for-open-ports-or-limit-access-to-my-bot" href="#how-do-i-check-for-open-ports-or-limit-access-to-my-bot"><i class="anchor-icon"></i></a>How do I check for open ports or limit access to my bot?</h5>
<p>So you have the hosting thing down and all is good so far, however, when you enter the address of your bot in your browser it seems unreachable.</p>
<p>Explaining every firewall or web server solution in detail isn&#39;t possible for us, which we hope you understand. If youre running a hosted solution, youre more likely to have a nice UI where you configure these settings. Head to your configuration panel and check all of them. If youre on a Linux based VPS with shell access, we have some tips for you:</p>
<ul>
<li>Make sure your bot process is indeed configured to listen on the port you&#39;re using.<br><code>netstat ln | grep portnumber</code><br>Shows you if your bot is actually listening for incoming requests on the port you expect.<br><code>sudo lsof -i | grep process name</code><br>Is a simple way to check if thats actually being listened on by the process your bot is using.</li>
</ul>
<ul>
<li>Make sure its listening correctly.<br>Your bot has to listen on the address youve exposed to the outside <code>(your public IP)</code>, it can also listen on all addresses <code>(*: or 0.0.0.0)</code>.<br>The <code>netstat</code> and <code>lsof</code>-commands mentioned above assist in checking this. If nothing shows up, it is time to check your configuration and fix it. Set the correct IP, make sure its listening on a supported port and fire away! Just use a Web Browser to check if youre reachable. The problem can be in the configuration of your bot, your web server virtual host configuration, or the servers binding configuration.</li>
</ul>
<ul>
<li><p>If you still cant reach your address, check your firewall.<br><code>sudo iptables L</code><br><strong>OR</strong><br><code>sudo ufw status verbose</code> (Ubuntu)<br>Gives you some insight in the current firewall settings.</p>
</li>
<li><p>If it looks like youre blocking incoming traffic, lets fix that.<br><code>sudo iptables A INPUT p tcp m tcp dport portnumber -j ACCEPT</code><br><strong>OR</strong><br><code>sudo ufw allow portnumber/tcp</code><br>Allows incoming traffic on all interfaces to the specified tcp port.<br><code>sudo iptables A INPUT i interfacename p tcp m tcp dport portnumber -j ACCEPT</code><br><strong>OR</strong><br><code>sudo ufw allow in on interfacename to any port portnumber proto tcp</code><br>Allows incoming traffic to a specific interface and a specific port from everywhere.<br><code>sudo ifconfig</code><br>Helps you find the interface with the public address youre going to use.</p>
</li>
</ul>
<pre><code>If you use iptables, make sure to actually SAVE after changing the configuration.
On a Debian based system the iptables-persistent package is be a good option.
RHEL/CentOS offers a service iptables save -command.
A quick online search for &quot;YOUROPERATINGSYSTEM save iptables&quot; also helps.</code></pre>
<ul>
<li>If youre just looking for some hints on how to limit incoming traffic:<br><code>sudo iptables A INPUT i interfacename p tcp m iprange src-range 149.154.167.197-149.154.167.233 dport portnumber -j ACCEPT</code><br><strong>OR</strong><br><code>sudo ufw allow in on interfacename to any port portnumber proto tcp from 149.154.167.192/26</code><br>Allows incoming traffic to a specific interface and a specific port from a specific range of addresses. (ufw is using a subnet mask in the example, ranging from 192-255)</li>
</ul>
<p>Thats all for our examples. More information on best practices for setting up your firewall, on whichever operating system you prefer for your bot, is best found on the internet.</p>
<h5><a class="anchor" name="ssl-tls-what-is-it-and-why-do-i-have-to-handle-this-for-a-webhoo" href="#ssl-tls-what-is-it-and-why-do-i-have-to-handle-this-for-a-webhoo"><i class="anchor-icon"></i></a>SSL/TLS, what is it and why do I have to handle this for a webhook?</h5>
<p>Youre already familiar with it in some form or another. Whenever you see that (nicely green) lock in your browser bar, you know its reasonably safe to assume that youve landed on the site you actually wanted to visit. If you see the green lock, that&#39;s SSL/TLS in action. If you want to learn more about how SSL/TLS works in general, it&#39;s best to search the internet.</p>
<p>The main difference between getUpdates and a webhook is the way the connection takes place. getUpdates means you&#39;ll connect to our server, a webhook means we&#39;ll be connecting to your server instead. Connecting to your server has to be done secure, we have to know for sure it&#39;s you we&#39;re talking to after all. This means you&#39;ll have to handle all that server side encryption stuff, virtually presenting us with a green lock. If you use a web server for us to post to, you need to support SSL/TLS handling on the port/virtual host of your choice. An online search for “YOURWEBSERVER enable HTTPS” will help you.</p>
<p>Not using a regular web server? Have a look at our <a href="https://core.telegram.org/bots/samples">example page</a>, most examples there include code for handling SSL/TLS in a webhook setup.</p>
<h5><a class="anchor" name="how-do-i-check-that-im-handling-the-right-version" href="#how-do-i-check-that-im-handling-the-right-version"><i class="anchor-icon"></i></a>How do I check that Im handling the right version?</h5>
<p>You just read up on the whole SSL/TLS stuff, figured out that its not all that bad to setup and we add some more requirements. Here are some tips to check if youre indeed supporting at least TLS1.2.</p>
<ul>
<li><p>Several online services exist that allow you to check your certificate installation,<br>They give you an overview of your supported TLS versions/Cipher suites and other details. Search online for <strong>Symantec crypto report</strong> or <strong>Qualys ssl</strong>. Both supply tools to verify your setup.</p>
</li>
<li><p>Checking locally can also be done, in several ways, here are three options,</p>
<ul>
<li><p>Go simple:<br>Using Chrome as a browser? Open up the URL to your bot and inspect the certificate details. If youre supporting TLS Chrome tells you so in the security overview tab. Other browsers are likely able to give you similar basic information.</p>
</li>
<li><p>Using curl:<br><code>curl --tlsv1.2 -v -k https://yourbotdomain:yourbotport/</code><br>You can add <code>--tlsv1.2</code> to force curl into using TLS1.2 when trying to connect. <code>-k</code> is optional and used to check against a self-signed certificate. <code>yourbotdomain</code> is the public hostname your webhook is running on. For local testing purposes you can also use the IP. <code>yourbotport</code> is the port youre using.</p>
</li>
<li><p>Using OpenSSL<br><code>openssl s_client -tls1_2 -connect yourbotdomain:yourbotport -servername yourbotdomain</code><br>You can add <code>-tls1_2</code> to force OpenSSL into using TLS1.2 when trying to connect. <code>yourbotdomain</code> is the public hostname your webhook is running on. For local testing purposes you can also use the IP. <code>yourbotport</code> is the port youre using. Note that https:// isnt used for OpenSSL. <code>-servername</code> is optional, and included here for some shared hosters, which use SNI to route traffic to the correct domain. When SNI is used youll notice that your server appears to be returning a certificate for a different domain than your own. Adding <code>-servername yourbotdomain</code> ensures that SNI negotiation is done, and the correct certificate is returned.</p>
</li>
</ul>
</li>
<li><p>Some additional configuration pointers</p>
<ul>
<li>Forcing TLS in your virtual host on Apache:<br><code>SSLProtocol -all +TLSv1.2</code></li>
<li>Forcing TLS in your virtual host on Nginx:<br><code>ssl_protocols TLSv1.2;</code></li>
<li>Force TLS for your Java virtual machine through system properties:<br><code>-Dhttps.protocols=TLSv1.2 -Djdk.tls.client.protocols=TLSv1.2</code></li>
<li>Enabling ssl debug for your JVM:<br><code>-Djavax.net.debug=ssl,handshake,record</code></li>
</ul>
</li>
<li><p>Other tools that may help in debugging issues:</p>
<ul>
<li><strong>Wireshark</strong>: excellent packet capturing</li>
<li><strong>Tcpdump</strong>: equally excellent and doesnt need a GUI</li>
<li><strong>Charles</strong>: web debugging proxy</li>
<li><strong>Fiddler</strong>: web debugging proxy</li>
</ul>
</li>
</ul>
<h5><a class="anchor" name="a-certificate-where-do-i-get-one-and-how" href="#a-certificate-where-do-i-get-one-and-how"><i class="anchor-icon"></i></a>A certificate, where do I get one and how?</h5>
<p>You need a certificate, pick on of these types;</p>
<ul>
<li><a href="https://core.telegram.org/bots/webhooks#a-verified-supported-certificate">A verified, supported certificate</a></li>
<li><p><a href="https://core.telegram.org/bots/webhooks#a-self-signed-certificate">A self-signed certificate</a></p>
</li>
<li><h5><a class="anchor" name="a-verified-supported-certificate" href="#a-verified-supported-certificate"><i class="anchor-icon"></i></a>A verified, supported certificate</h5>
<p>Using a verified certificate means you already have, or will obtain, a certificate backed by a trusted certificate authority (CA). There are many ways to acquire a verified certificate, paid or free. Two popular examples of free suppliers are <strong>StartSSL</strong> and <strong>Lets Encrypt</strong>. Youre welcome to pick another. Just make sure first the supplier is likely to be supported.<br>Check <a href="https://packages.debian.org/jessie/all/ca-certificates/filelist">this list</a> before selecting a CA.<br>Once youve picked a CA and validated your identity with them, you can craft your certificate. This frequently starts by generating a CSR (Certificate Signing Request). Generating a CSR is done either through your host machine, or online via the tools provided by the CA.</p>
</li>
<li><p>Here is an example (PEM format output).</p>
<ul>
<li>Using OpenSSL:<br><code>openssl req -newkey rsa:2048 -keyout yourprivatekey.key -out yoursigningrequest.csr</code></li>
</ul>
</li>
</ul>
<pre><code>----
Generating a 2048 bit RSA private keywriting new private key to yourprivatekey.key
Enter PEM pass phrase: enter a password for your key here
Verifying - Enter PEM pass phrase: confirm the entered password
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,If you enter &#39;.&#39;,
the field will be left blank.-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []: yourbotdomainname
Email Address []:
Please enter the following &#39;extra&#39; attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
---</code></pre>
<ul>
<li><p>Another example:</p>
<ul>
<li>Using Java keytool:<br><code>keytool -genkey -alias yourbotdomainname -keyalg RSA -keystore yourkeystore.jks -keysize 2048</code></li>
</ul>
</li>
</ul>
<pre><code>---
Enter keystore password:
Re-enter new password:
What is your first and last name? [Unknown]: yourbotdomainname
What is the name of your organizational unit? [Unknown]:
What is the name of your organization? [Unknown]:
What is the name of your City or Locality? [Unknown]:
What is the name of your State or Province? [Unknown]:
What is the two-letter country code for this unit? [Unknown]:
Is CN=test.telegram.org, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
[no]: yes
Enter key password for yourbotdomainname
(RETURN if same as keystore password):
---</code></pre>
<p>This generates the initial keystore, from which you can then create a CSR like this:</p>
<p><code>keytool -certreq -alias yourbotdomainname -keystore yourkeystore.jks -file yourbotdomainname.csr</code></p>
<pre><code>---
Enter keystore password:
---</code></pre>
<p>To validate your certificate the Common Name (CN) has to match your webhook domain. Example, if youre using <a href="https://www.example.com/example.php"><a href="https://www.example.com/example.php">https://www.example.com/example.php</a></a> as a webhook address, the certificate CN has to be <a href="http://www.example.com">www.example.com</a>.<br>So you need an <strong>exact match</strong> of the FQDN youre setting for the webhook</p>
<p>There is an exception, if youre using a SAN (Subject Alternative Name) the webhook address can either match the CN of your certificate, <strong>OR</strong> one of the SANs provided in the certificate. In most cases youll be using the CN.</p>
<p>Create your CSR and supply the contents of the file to your CA. Most CAs are kind enough to give you an example command of the input format they expect.</p>
<p><code>cat yoursigningrequest.csr</code> <strong>or</strong> <code>cat yourbotdomainname.csr</code><br>Lets you have a look at the CSR we just generated:</p>
<div>
<a href="/file/811140281/1/5le8eVE7mPk.261973/25ba8c07609aef2310" target="_blank"><img src="/file/811140281/1/5le8eVE7mPk.261973/25ba8c07609aef2310" title="csrexample.jpg, 255.83Kb" height="60%" width="60%" class="dev_page_image" /></a>
</div>
<p>That doesnt seem to informative, but we can deduce that the file is in PEM format (ASCII base64 encoded) and contains a certificate signing request. Luckily it is possible to look at the human readable contents of the CSR. Use the following commands to double check if all fields are set correctly.</p>
<ul>
<li><p>Using OpenSSL<br><code>openssl req -text -noout -verify -in yoursigningrequest.csr</code></p>
</li>
<li><p>Using Java keytool<br><code>keytool -printcertreq -v -file yourbotdomainname.csr</code></p>
</li>
</ul>
<p>Verify your CSR and supply it to your CA to get a certificate. Well use StartSSL as an example here. StartSSL allows you to set up to 5 names (SAN), Their intermediate certificate is also needed for a webhook to work, which makes for a nice complete example. </p>
<p>Go to the certificates wizard, enter the required hostname(s) for your SSL certificate (this is the CN youve also set in the CSR and an optional SAN).</p>
<div>
<a href="/file/811140045/1/wtVcG_IghfI.78937/51e72042b1df5f28b5" target="_blank"><img src="/file/811140045/1/wtVcG_IghfI.78937/51e72042b1df5f28b5" title="sslcertwiz.jpg, 77.09Kb" height="75%" width="75%" class="dev_page_image" /></a>
</div>
<p>In the example above weve chosen to set a CN <code>(test.telegram.org)</code>, but also a SAN <code>(sanexample.telegram.org)</code> The CN given has to match the CN used for generating the CSR.<br>Set your CN (and optional SAN) and copy the contents of the yoursigningrequest.csr file.</p>
<div>
<a href="/file/811140068/1/5qVIwLYnqd8.116971/87a6da7b70e377f899" target="_blank"><img src="/file/811140068/1/5qVIwLYnqd8.116971/87a6da7b70e377f899" title="sslcertwiz1.jpg, 114.23Kb" height="75%" width="75%" class="dev_page_image" /></a>
</div>
<p>Paste the contents, submit and youre done.</p>
<div>
<a href="/file/811140069/2/MVKz66N9t4o.53664/7130b06124c18c9e94" target="_blank"><img src="/file/811140069/2/MVKz66N9t4o.53664/7130b06124c18c9e94" title="sslcertwiz2.jpg, 52.41Kb" height="75%" width="75%" class="dev_page_image" /></a>
</div>
<p>Now you can download the created certificate directly. In the example used above youll receive a zip file with several PEM certificates. The root, intermediate and yourdomain certificate.<br>You need the <code>intermediate</code> and <code>yourdomain</code> to set a webhook with a StartSSL certificate.</p>
<p>You can inspect the set of certificates youve just downloaded.</p>
<ul>
<li><p>Here are some example commands:</p>
<ul>
<li><p>Using OpenSSL:<br><code>openssl x509 -in yourdomain.crt -text -noout</code></p>
</li>
<li><p>Using Java keytool:<br><code>keytool -printcert -v -yourdomain.crt</code></p>
</li>
<li><p>Using Windows:<br>StartSSL supplies certificates in PEM format with a .crt extension, on Windows you can view the contents of them with a quick double click. Extract the files or open the “Otherserver.zip” and double click each of the certificates for inspection. The details tab supplies you with extra information.<br>Make sure you have a correct CN in the <code>Subject</code>-field of the <code>yourdomain</code>-certificate. If you&#39;re using a SAN, make sure that it is listed in the Subject <code>Alternative Name</code>-field.</p>
</li>
</ul>
</li>
</ul>
<div>
<a href="/file/811140010/2/omTlwQW_Wpk.133258/5db0b29d43f5558413" target="_blank"><img src="/file/811140010/2/omTlwQW_Wpk.133258/5db0b29d43f5558413" title="wincert.jpg, 130.13Kb" height="50%" width="50%" class="dev_page_image" /></a>
</div>
<p>With your fresh certificates at hand, you can now continue setting your webhook.</p>
<ul>
<li><h5><a class="anchor" name="a-self-signed-certificate" href="#a-self-signed-certificate"><i class="anchor-icon"></i></a>A self-signed certificate</h5>
<p>Using a self-signed certificate means youll forfeit on the chain of trust backed by a CA. Instead you are the CA. For this to work, a slight difference in setup is required. Because Telegram will have no chain of trust to verify your certificate, you have to use the generated public certificate as an input file when setting the webhook. Keep in mind that the certificate file has to be uploaded as <strong>multipart/form</strong> data in <strong>PEM encoded (ASCII BASE64)</strong> format.</p>
</li>
<li><p>First lets generate some certificates:</p>
<ul>
<li><p>Using OpenSSL:<br><code>openssl req -newkey rsa:2048 -sha256 -nodes -keyout YOURPRIVATE.key -x509 -days 365 -out YOURPUBLIC.pem -subj &quot;/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=YOURDOMAIN.EXAMPLE&quot;</code><br>Youll end up with 2 files, a private key and the public certificate file. Use <strong>YOURPUBLIC.PEM</strong> as input file for setting the webhook.</p>
</li>
<li><p>Using Java keytool:<br><code>keytool -genkey -keyalg RSA -alias YOURDOMAIN.EXAMPLE -keystore YOURJKS.jks -storepass YOURPASSWORD -validity 360 -keysize 2048</code></p>
<pre><code>What is your first and last name?
[test.telegram.org]:
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]:
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]:
Is CN=test.telegram.org, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
[no]: yes</code></pre>
<p>Once done youll need 2 more commands to export the public certificate file from the generated store (youll be using the store for your JVM and the PEM for setting the webhook)</p>
</li>
<li><p>Convert the JKS to pkcs12 (intermediate step for conversion to PEM):<br><code>keytool -importkeystore -srckeystore YOURJKS.jks -destkeystore YOURPKCS.p12 -srcstoretype jks -deststoretype pkcs12</code></p>
</li>
<li><p>Convert PKCS12 to PEM (requires OpenSSL)<br><code>openssl pkcs12 -in YOURPKCS.p12 -out YOURPEM.pem -nokeys</code></p>
</li>
<li><p>Using Windows:<br>Creating a self-signed certificate using Windows native utilities is also possible, although OpenSSL binaries for Windows are available online.<br><code>certreq -new TEMPLATE.txt RequestFileOut generates a CSR.</code></p>
</li>
<li><p>TEMPLATE.txt example file:</p>
<pre><code>[NewRequest]
; At least one value must be set in this section
Subject = &quot;CN=DOMAIN.EXAMPLE&quot;
KeyLength = 2048
KeyAlgorithm = RSA
HashAlgorithm = sha256
;MachineKeySet = true
RequestType = Cert
UseExistingKeySet=false ;generates a new private key (for export)
Exportable = true ;makes the private key exportable with the PFX</code></pre>
</li>
</ul>
</li>
</ul>
<p>A self-signed certificate is generated and installed, to use the certificate for a self-signed webhook you&#39;ll have to export it in PEM format.</p>
<ul>
<li><p>Windows continued:</p>
<ul>
<li><p>You can have a look at the certificates in your store with:<br><code>certutil -store -user my</code></p>
</li>
<li><p>To export the installed certificate in DER format (intermediate step for conversion to PEM):<br><code>certutil -user -store -split my SERIALNUMBER YOURDER.der</code></p>
</li>
<li><p>Now you can convert the certificate to PEM:<br><code>certutil -encode YOURDER.der YOURPEM.pem</code><br>Remember that only the public certificate is needed as input for the self-signed webhook certificate parameter.<br><code>certmgr.msc</code> can also be used as a GUI to export the public part of self-signed certificate to PEM.</p>
</li>
</ul>
</li>
</ul>
<p>After following the above you&#39;ll end up with a nice self-signed certificate. Youll still have to set the webhook, and handle SSL correctly.</p>
<h5><a class="anchor" name="how-do-i-set-a-webhook-for-either-type" href="#how-do-i-set-a-webhook-for-either-type"><i class="anchor-icon"></i></a>How do I set a webhook for either type?</h5>
<p>The setWebhook method is needed for both types. For a verified certificate with a trusted root CA, its enough to use the setWebhook method with just the URL parameter.</p>
<ul>
<li>A curl example for a verified certificate:<br><code>curl -F &quot;url=https://&lt;YOURDOMAIN.EXAMPLE&gt;/&lt;WEBHOOKLOCATION&gt;&quot; https://api.telegram.org/bot&lt;YOURTOKEN&gt;/setWebhook</code></li>
</ul>
<p>For a self-signed certificate an extra parameter is needed, <code>certificate</code>, with the public certificate in PEM format as data.</p>
<ul>
<li>A curl example for a self-signed certificate:<br><code>curl -F &quot;url=https://&lt;YOURDOMAIN.EXAMPLE&gt;/&lt;WEBHOOKLOCATION&gt;&quot; -F &quot;certificate=@&lt;YOURCERTIFICATE&gt;.pem&quot; https://api.telegram.org/bot&lt;YOURTOKEN&gt;/setWebhook</code></li>
</ul>
<p>The <code>-F</code> means were using the <code>multipart/form-data</code>-type to supply the certificate, the type of the certificate parameter is <a href="https://core.telegram.org/bots/api#inputfile">inputFile</a>. Make sure that youre supplying the correct type.</p>
<p>Both parameters for the setWebhook method are classed as optional. Calling the method with an empty URL parameter can be used to clear a previously set webhook.</p>
<ul>
<li>A curl example to clear a previous webhook :<br><code>curl -F &quot;url=&quot; https://api.telegram.org/bot&lt;YOURTOKEN&gt;/setWebhook</code></li>
</ul>
<p>Keep in mind that the URL parameter starts with <code>https://</code> when setting a webhook. By default that means were knocking at your door on port 443. If you want to use another port (80,88 or 8443), youll have to specify the port in the URL parameter.</p>
<ul>
<li>Example:<br><code>url=https://&lt;YOURDOMAIN.EXAMPLE&gt;:88/&lt;WEBHOOKLOCATION&gt;</code></li>
</ul>
<h5><a class="anchor" name="setting-a-verified-webhook-with-an-untrusted-root" href="#setting-a-verified-webhook-with-an-untrusted-root"><i class="anchor-icon"></i></a>Setting a verified webhook with an untrusted root</h5>
<p>If you already have a verified certificate and our servers dont trust your root CA, we have an alternative way for you to set a webhook. Instead of using the setWebhook method <strong>without</strong> the <code>certificate</code> parameter, you can use the self-signed method. Your CA&#39;s root certificate has to be used as an inputFile for the <code>certificate</code> parameter.</p>
<ul>
<li>A curl example to supply an untrusted root certificate:<br><code>curl -F &quot;url=https://&lt;YOURDOMAIN.EXAMPLE&gt;&quot; -F &quot;certificate=@&lt;YOURCAROOTCERTIFICATE&gt;.pem&quot; https://api.telegram.org/bot&lt;YOURTOKEN&gt;/setWebhook</code><br>Before you can do this, you need the root certificate of your certificates CA. Most CAs supply their root certificates in several different formats (PEM/DER/etc.). Visit your CAs website, and download the Root certificate indicated for your verified certificate.</li>
</ul>
<p>You can use these commands to quickly convert a DER formatted root certificate to PEM:</p>
<ul>
<li><p>Using OpenSSL:<br><code>openssl x509 -inform der -in root.cer -out root.pem</code></p>
</li>
<li><p>Using Java keytool:<br><code>keytool -import -alias Root -keystore YOURKEYSTORE.JKS -trustcacerts -file ROOTCERT.CER</code><br>The root certificate needs to be imported in your keystore first:<br><code>keytool -exportcert -alias Root -file &lt;YOURROOTPEMFILE.PEM&gt; -rfc -keystore YOURKEYSTORE.JKS</code></p>
</li>
</ul>
<p>Once done, set your webhook with the root-pem-file and youll be good to go. If you need more pointers, have a look at the <a href="https://core.telegram.org/bots/webhooks#a-self-signed-certificate">self-signed</a> part of this guide.</p>
<h5><a class="anchor" name="supplying-an-intermediate-certificate" href="#supplying-an-intermediate-certificate"><i class="anchor-icon"></i></a>Supplying an intermediate certificate</h5>
<p>Once youve crafted your certificate, your CA might present you with a nice bundle. Most bundles contain a root certificate, your public certificate and sometimes an <strong>intermediate</strong> certificate. StartSSL is one of many CAs thatll supply such an intermediate beast. This certificate has to be supplied in the chain of certificates youre presenting to us when we connect to your server. If an intermediate was used to sign your certificate but isnt supplied to our servers, we wont be able to verify the chain of trust and your webhook will not work.</p>
<p>If your webhook isnt working and youre wondering if the chain is complete:</p>
<ul>
<li>Check with your certificate provider if you need an intermediate certificate.</li>
<li>Verify your certificate chain.<pre><code>Search online for Symantec crypto report or Qualys ssl.
Both supply tools to verify your setup.</code></pre>
</li>
</ul>
<p>Heres an example of a complete chain, note that in this case 2 intermediate certificates have been supplied.</p>
<div>
<a href="/file/811140157/1/FsbXbc0yPJA.49297/5812f355ecfcda764a" target="_blank"><img src="/file/811140157/1/FsbXbc0yPJA.49297/5812f355ecfcda764a" title="startsslexample.jpg, 48.14Kb" height="75%" width="75%" class="dev_page_image" /></a>
</div>
<p>Even though your browser might not complain when visiting your page, an incomplete chain will not work for your webhook. If your chain is incomplete we have some tips to add them to your current setup:</p>
<ul>
<li><p>Apache:<br>Add the intermediate certificate to the end of the file configured in the <code>SSLCertificateFile</code> directive of your virtual host configuration. If youre using an older version than Apache 2.4.8, you may use the <code>SSLCertificateChainFile</code> directive instead.</p>
</li>
<li><p>Nginx:<br>Add the intermediate certificate to the end of the file configured in the <code>ssl_certificate_key</code> directive of your virtual host configuration.</p>
</li>
<li><p>A quick command for doing this correctly:<br><code>cat your_domain_name.pem intermediate.pem &gt;&gt; bundle.pem</code><br>Make sure the order is correct, expect failure otherwise.</p>
</li>
<li><p>Java keytool:<br><code>keytool -import -trustcacerts -alias intermediate -file intermediate.pem -keystore YOURKEYSTORE.jks</code></p>
</li>
</ul>
<p>The end result of all this is a complete certificate chain, backed by either a root certificate we trust or, in the case of an untrusted root, a root certificate you&#39;re supplying to us. Make sure to verify your setup again after adding the intermediate, once done, you&#39;re good to go!</p>
<h5><a class="anchor" name="testing-your-bot-with-updates" href="#testing-your-bot-with-updates"><i class="anchor-icon"></i></a>Testing your bot with updates</h5>
<ul>
<li><p>Update examples<br>A set of example updates, which comes in handy for testing your bot.</p>
<ul>
<li><p>Message with text using curl:</p>
<pre><code>curl --tlsv1.2 -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test&quot;,
&quot;username&quot;:&quot;Test&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test&quot;,
&quot;username&quot;:&quot;Test&quot;
},
&quot;text&quot;:&quot;/start&quot;
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
<p><code>--tlsv1.2</code> will force using TLS1.2.</p>
</li>
<li><p>Message with text using Postman:</p>
<div>
<a href="/file/811140789/2/DmiZPh1t6z0.269328/98525b6835f0a91432" target="_blank"><img src="/file/811140789/2/DmiZPh1t6z0.269328/98525b6835f0a91432" title="postmanfakeupdate.jpg, 263.02Kb" class="dev_page_image" /></a>
</div>
</li>
</ul>
</li>
<li><p>More examples in curl:</p>
<ul>
<li>Message with text:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;type&quot;: &quot;private&quot;,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;text&quot;:&quot;/start&quot;
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Forwarded message:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;type&quot;: &quot;private&quot;,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;forward_from&quot;: {
&quot;last_name&quot;:&quot;Forward Lastname&quot;,
&quot;id&quot;: 222222,
&quot;first_name&quot;:&quot;Forward Firstname&quot;
},
&quot;forward_date&quot;:1441645550,
&quot;text&quot;:&quot;/start&quot;
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Forwarded channel message:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;forward_from&quot;: {
&quot;id&quot;: -10000000000,
&quot;type&quot;: &quot;channel&quot;,
&quot;title&quot;: &quot;Test channel&quot;
},
&quot;forward_date&quot;:1441645550,
&quot;text&quot;:&quot;/start&quot;
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Message with a reply:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;text&quot;:&quot;/start&quot;,
&quot;reply_to_message&quot;:{
&quot;date&quot;:1441645000,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Reply Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111112,
&quot;first_name&quot;:&quot;Reply Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1334,
&quot;text&quot;:&quot;Original&quot;
}
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Edited message:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;edited_message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;text&quot;:&quot;Edited text&quot;,
&quot;edit_date&quot;: 1441646600
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Message with entities:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;text&quot;:&quot;Bold and italics&quot;,
&quot;entities&quot;: [
{
&quot;type&quot;: &quot;italic&quot;,
&quot;offset&quot;: 9,
&quot;length&quot;: 7
},
{
&quot;type&quot;: &quot;bold&quot;,
&quot;offset&quot;: 0,
&quot;length&quot;: 4
}
]
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Message with audio:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;audio&quot;: {
&quot;file_id&quot;: &quot;AwADBAADbXXXXXXXXXXXGBdhD2l6_XX&quot;,
&quot;duration&quot;: 243,
&quot;mime_type&quot;: &quot;audio/mpeg&quot;,
&quot;file_size&quot;: 3897500,
&quot;title&quot;: &quot;Test music file&quot;
}
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Voice message:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;voice&quot;: {
&quot;file_id&quot;: &quot;AwADBAADbXXXXXXXXXXXGBdhD2l6_XX&quot;,
&quot;duration&quot;: 5,
&quot;mime_type&quot;: &quot;audio/ogg&quot;,
&quot;file_size&quot;: 23000
}
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Message with a document:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;message&quot;:{
&quot;date&quot;:1441645532,
&quot;chat&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;message_id&quot;:1365,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;document&quot;: {
&quot;file_id&quot;: &quot;AwADBAADbXXXXXXXXXXXGBdhD2l6_XX&quot;,
&quot;file_name&quot;: &quot;Testfile.pdf&quot;,
&quot;mime_type&quot;: &quot;application/pdf&quot;,
&quot;file_size&quot;: 536392
}
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Inline query:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;inline_query&quot;:{
&quot;id&quot;: 134567890097,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;query&quot;: &quot;inline query&quot;,
&quot;offset&quot;: &quot;&quot;
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Chosen inline query:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;chosen_inline_result&quot;:{
&quot;result_id&quot;: &quot;12&quot;,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;query&quot;: &quot;inline query&quot;,
&quot;inline_message_id&quot;: &quot;1234csdbsk4839&quot;
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
</li>
<li>Callback query:<pre><code>curl -v -k -X POST -H &quot;Content-Type: application/json&quot; -H &quot;Cache-Control: no-cache&quot; -d &#39;{
&quot;update_id&quot;:10000,
&quot;callback_query&quot;:{
&quot;id&quot;: &quot;4382bfdwdsb323b2d9&quot;,
&quot;from&quot;:{
&quot;last_name&quot;:&quot;Test Lastname&quot;,
&quot;type&quot;: &quot;private&quot;,
&quot;id&quot;:1111111,
&quot;first_name&quot;:&quot;Test Firstname&quot;,
&quot;username&quot;:&quot;Testusername&quot;
},
&quot;data&quot;: &quot;Data from button callback&quot;,
&quot;inline_message_id&quot;: &quot;1234csdbsk4839&quot;
}
}&#39; &quot;https://YOUR.BOT.URL:YOURPORT/&quot;</code></pre>
That&#39;s all we have for now!</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,212 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Encrypted CDNs for Speed and Security</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Following the launch of version 4.2 of the official apps, Telegram client apps may be required to download popular files…">
<meta property="og:title" content="Encrypted CDNs for Speed and Security">
<meta property="og:image" content="9ba979e9b9f66d5bdc">
<meta property="og:description" content="Following the launch of version 4.2 of the official apps, Telegram client apps may be required to download popular files…">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Encrypted CDNs for Speed and Security</h1>
<div id="dev_page_content"><p>Following the launch of version 4.2 of the official apps, Telegram client apps may be required to download popular files that were published in public channels with more than <strong>100,000</strong> members from secondary <a href="https://en.wikipedia.org/wiki/Content_delivery_network">Content Delivery Network</a> data centers. These CDN DCs are located in regions with significant Telegram traffic where we wouldn't want to place Telegram servers for various reasons.</p>
<p>The CDN DCs are not a part of the Telegram cloud and should be considered enemy territory. For this reason, each file that is to be sent to these CDN DCs is encrypted with a unique key using AES-256-CTR encryption. The CDN <strong>can't access the data</strong> it stores because these keys are only accessible to the main MTProto server and to the authorized client.</p>
<blockquote>
<p><strong>See also:</strong> <a href="/techfaq#encrypted-cdns">More about CDNs and governments in the Advanced FAQ</a></p>
</blockquote>
<h3><a class="anchor" href="#how-this-works" id="how-this-works" name="how-this-works"><i class="anchor-icon"></i></a>How this works</h3>
<p>When a file from a public channel with <strong>~100,000</strong> members becomes popular in a particular region, the Telegram server may encrypt this file with a unique AES-256-CTR key and send it to a relevant CDN DC for storage.</p>
<p>When a file is stored in a CDN DC close to the end user, the download speed will be much higher because the data needs to travel smaller distances and will likely avoid many bottlenecks that exist between regions.</p>
<p>This is secure because CDN DCs are treated the same way as internet providers / random third parties:</p>
<ul>
<li>CDN DCs don't have the keys to decrypt files that are stored there, so they can't access the data even if a DC becomes compromised.</li>
<li>Encrypted files fragments are protected from tampering by their SHA-256 hash which is checked on the client upon receipt.</li>
<li>No private data is stored in or passed to the CDN DCs.</li>
<li>The server only allows media from public channels with more than <strong>100,000</strong> subscribers to be cached in CDN DCs (this includes media forwarded from those channels and viral media that originated from other large public channels).</li>
</ul>
<div>
<a href="/file/811140934/1815/aSQ-nSUHJzc.45662/40c2955965574cef80" target="_blank"><img src="/file/811140934/1815/aSQ-nSUHJzc.45662/40c2955965574cef80" title="CDNs explained" class="dev_page_image"></a>
</div>
<p>CDNs are very limited when it comes to communication: the master data center only uploads encrypted files for storage and will accept no data from the CDN. The client apps only download encrypted files and accept no other updates. The client apps obtain the keys necessary to decrypt the file from the main Telegram server and verify the integrity of the file by its hash, which means that the CDN may only supply the correct file  anything different will be immediately discarded by the client.</p>
<p>CDN DCs do not store files on hard disks only in memory. When a CDN server runs out of memory, a simple LRU algorithm is used to replace the least popular files with new ones.</p>
<h3><a class="anchor" href="#how-cdn-dcs-are-different-from-the-master-dcs" id="how-cdn-dcs-are-different-from-the-master-dcs" name="how-cdn-dcs-are-different-from-the-master-dcs"><i class="anchor-icon"></i></a>How CDN DCs are different from the master DCs</h3>
<ul>
<li><strong>CDNs may not be trusted.</strong></li>
<li>Client developers can use <a href="/method/help.getCdnConfig">help.getCdnConfig</a> to obtain a list of public RSA keys for CDN DCs, which are different from public RSA keys of the master DCs.</li>
<li>CDNs support only the following methods: <a href="/method/upload.getCdnFile">upload.getCdnFile</a>, <a href="/method/initConnection">initConnection</a>, <a href="/method/invokeWithLayer">invokeWithLayer</a>.</li>
<li>When working with CDNs, client developers must remember that auth_key may be deleted at any given moment (resulting in a -404 error, in which case a new key must be generated).</li>
<li>Client apps must not accept updates from CDN DCs (apps should only accept updates from their main connection to the master DC).</li>
<li>Clients must not allow the CDN DCs to substitute replies to queries sent to other DCs.</li>
<li>Clients must not send private user info that is passed in <a href="/method/initConnection">initConnection</a> to the CDNs.</li>
</ul>
<h3><a class="anchor" href="#getting-files-from-a-cdn" id="getting-files-from-a-cdn" name="getting-files-from-a-cdn"><i class="anchor-icon"></i></a>Getting files from a CDN</h3>
<p>The API may return the <a href="/constructor/upload.fileCdnRedirect">upload.fileCdnRedirect</a> constructor after an <a href="/method/upload.getFile">upload.getFile</a> query. In this case, the client must request the required file from a CDN DC. The <em>dc_id</em> in the response is the id of the new CDN. The IP address for the connection will be available in <a href="/method/help.getConfig">help.getConfig</a>, same as with the master DCs. The corresponding <a href="/constructor/dcOption">dcOption</a> will have the flag <em>cdn:flags.3?true</em>.</p>
<p>Once a successful connection to the CDN-dc_id is established, the client must generate an auth_key (after confirming that the public RSA MTProto key of the CDN DC matches one from the list returned in <a href="/method/help.getCdnConfig">help.getCdnConfig</a>). Then the client must perform an <a href="/method/upload.getCdnFile">upload.getCdnFile</a> for each <em>offset</em>. For files of an unknown size it is necessary to repeat the query until an empty reply is returned.</p>
<p><a href="/method/upload.getCdnFile">upload.getCdnFile</a> may return the <a href="/constructor/upload.cdnFileReuploadNeeded">upload.cdnFileReuploadNeeded</a> constructor. In this case, the client needs to send an <a href="/method/upload.reuploadCdnFile">upload.reuploadCdnFile</a> request to the DC that got the original <a href="/method/upload.getFile">upload.getFile</a> request. Once <a href="/method/upload.reuploadCdnFile">upload.reuploadCdnFile</a> is successful, the app needs to request the file from the CDN DC again.</p>
<p>The main DC for a file is the DC where its main copy is stored (not to be confused with the main DC of the user) either <em>userProfilePhoto.dc_id</em>, <em>chatPhoto.dc_id</em>, <em>photo.dc_id</em>, or <em>document.dc_id</em>.</p>
<h3><a class="anchor" href="#decrypting-files" id="decrypting-files" name="decrypting-files"><i class="anchor-icon"></i></a>Decrypting files</h3>
<p>In <a href="/constructor/upload.fileCdnRedirect">upload.fileCdnRedirect</a>, the server sends a decryption key and IV for the file (the fields <code>encryption_key:bytes</code> and <code>encryption_iv:bytes</code> respectively).</p>
<p>Having received a portion of encrypted data from the CDN DC inside <a href="/constructor/upload.cdnFile">upload.cdnFile</a>, the client must decrypt this data using <code>AES-256-CTR</code>. For IV, it should use the value of <code>encryption_iv</code>, modified in the following manner: for each <code>offset</code> replace the last 4 bytes of the <code>encryption_iv</code> with <code>offset / 16</code> in big-endian. This allows to effectively decrypt a file and to use random access to a file's content (e.g., for streaming).</p>
<h3><a class="anchor" href="#verifying-files" id="verifying-files" name="verifying-files"><i class="anchor-icon"></i></a>Verifying files</h3>
<p>In order to confirm that the CDN DC passed an untampered file, clients must verify hashes for each downloaded part. <a href="/constructor/upload.fileCdnRedirect">upload.fileCdnRedirect</a>, <a href="/method/upload.reuploadCdnFile">upload.reuploadCdnFile</a> and <a href="/method/upload.getCdnFileHashes">upload.getCdnFileHashes</a> contain <a href="/type/FileHash">FileHash</a> constructors. Each of these constructors contains the SHA-256 hash of a part of the file that starts with <code>offset</code> and takes <code>limit</code> bytes.</p>
<p>Before saving each portion of the data received from the CDN DC into the file, the client must confirm that its hash matches the hash that was received from the master DC. If missing a hash for any file part, client developers must use the <a href="/method/upload.getCdnFileHashes">upload.getCdnFileHashes</a> method to obtain the missing hash.</p>
<h3><a class="anchor" href="#schema" id="schema" name="schema"><i class="anchor-icon"></i></a>Schema</h3>
<pre><code><a href='/constructor/fileHash'>fileHash</a>#6242c773 offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> hash:<a href='/type/bytes'>bytes</a> = <a href='/type/FileHash'>FileHash</a>;
<a href='/constructor/upload.fileCdnRedirect'>upload.fileCdnRedirect</a>#f18cda44 dc_id:<a href='/type/int'>int</a> file_token:<a href='/type/bytes'>bytes</a> encryption_key:<a href='/type/bytes'>bytes</a> encryption_iv:<a href='/type/bytes'>bytes</a> file_hashes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/FileHash'>FileHash</a>&gt; = <a href='/type/upload.File'>upload.File</a>;
<a href='/constructor/upload.cdnFileReuploadNeeded'>upload.cdnFileReuploadNeeded</a>#eea8e46e request_token:<a href='/type/bytes'>bytes</a> = <a href='/type/upload.CdnFile'>upload.CdnFile</a>;
<a href='/constructor/upload.cdnFile'>upload.cdnFile</a>#a99fca4f bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/upload.CdnFile'>upload.CdnFile</a>;
<a href='/constructor/dcOption'>dcOption</a>#18b7a10d flags:<a href='/type/%23'>#</a> ipv6:flags.0?<a href='/constructor/true'>true</a> media_only:flags.1?<a href='/constructor/true'>true</a> tcpo_only:flags.2?<a href='/constructor/true'>true</a> cdn:flags.3?<a href='/constructor/true'>true</a> static:flags.4?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> ip_address:<a href='/type/string'>string</a> port:<a href='/type/int'>int</a> secret:flags.10?<a href='/type/bytes'>bytes</a> = <a href='/type/DcOption'>DcOption</a>;
<a href='/constructor/cdnPublicKey'>cdnPublicKey</a>#c982eaba dc_id:<a href='/type/int'>int</a> public_key:<a href='/type/string'>string</a> = <a href='/type/CdnPublicKey'>CdnPublicKey</a>;
<a href='/constructor/cdnConfig'>cdnConfig</a>#5725e40a public_keys:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/CdnPublicKey'>CdnPublicKey</a>&gt; = <a href='/type/CdnConfig'>CdnConfig</a>;
---functions---
// CDN DC
<a href='/method/upload.getCdnFile'>upload.getCdnFile</a>#2000bcc3 file_token:<a href='/type/bytes'>bytes</a> offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/upload.CdnFile'>upload.CdnFile</a>;
// Master DC
<a href='/method/upload.reuploadCdnFile'>upload.reuploadCdnFile</a>#9b2754a8 file_token:<a href='/type/bytes'>bytes</a> request_token:<a href='/type/bytes'>bytes</a> = <a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/FileHash'>FileHash</a>&gt;;
<a href='/method/upload.getCdnFileHashes'>upload.getCdnFileHashes</a>#4da54231 file_token:<a href='/type/bytes'>bytes</a> offset:<a href='/type/int'>int</a> = <a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/FileHash'>FileHash</a>&gt;;
<a href='/method/help.getCdnConfig'>help.getCdnConfig</a>#52029342 = <a href='/type/CdnConfig'>CdnConfig</a>;</code></pre>
<h3><a class="anchor" href="#restrictions-on-uploadgetfile-and-uploadgetcdnfile-parameters" id="restrictions-on-uploadgetfile-and-uploadgetcdnfile-parameters" name="restrictions-on-uploadgetfile-and-uploadgetcdnfile-parameters"><i class="anchor-icon"></i></a>Restrictions on upload.getFile and upload.getCdnFile parameters</h3>
<ul>
<li><code>offset</code> must be divisible by 4096 bytes</li>
<li><code>limit</code> must be divisible by 4096 bytes</li>
<li>1048576 (1MB) must be divisible by <code>limit</code></li>
<li><code>offset / (1024 * 1024) == (offset + limit - 1) / (1024 * 1024)</code>
(file parts that are being downloaded must always be inside the same megabyte-sized fragment)</li>
</ul>
<h3><a class="anchor" href="#possible-errors-and-their-meanings" id="possible-errors-and-their-meanings" name="possible-errors-and-their-meanings"><i class="anchor-icon"></i></a>Possible errors and their meanings</h3>
<table class="table">
<tbody>
<tr>
<td>upload.getCdnFile</td>
<td>FILE_TOKEN_INVALID</td>
<td>The CDN DC did not accept the <code>file_token</code> (e.g., the token has expired). Continue downloading the file from the master DC using upload.getFile.</td>
</tr>
<tr>
<td>upload.reuploadCdnFile</td>
<td>FILE_TOKEN_INVALID</td>
<td>The master DC did not accept the <code>file_token</code> (e.g., the token has expired). Continue downloading the file from the master DC using upload.getFile.</td>
</tr>
<tr>
<td>upload.reuploadCdnFile</td>
<td>REQUEST_TOKEN_INVALID</td>
<td>The master DC did not accept the <code>request_token</code> from the CDN DC. Continue downloading the file from the master DC using upload.getFile.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,177 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.authorizationForm</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram Passport authorization form">
<meta property="og:title" content="account.authorizationForm">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram Passport authorization form">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.authorizationForm" >account.authorizationForm</a></li></ul></div>
<h1 id="dev_page_title">account.authorizationForm</h1>
<div id="dev_page_content"><p><a href="/passport">Telegram Passport</a> authorization form</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.authorizationForm" class="current_page_link" >account.authorizationForm</a>#ad2e1cd8 flags:<a href="/type/%23" >#</a> required_types:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/SecureRequiredType" >SecureRequiredType</a>&gt; values:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/SecureValue" >SecureValue</a>&gt; errors:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/SecureValueError" >SecureValueError</a>&gt; users:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/User" >User</a>&gt; privacy_policy_url:flags.0?<a href="/type/string" >string</a> = <a href="/type/account.AuthorizationForm" >account.AuthorizationForm</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>flags</strong></td>
<td style="text-align: center;"><a href="/type/%23">#</a></td>
<td>Flags, see <a href="/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></td>
</tr>
<tr>
<td><strong>required_types</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/SecureRequiredType">SecureRequiredType</a>&gt;</td>
<td>Required <a href="/passport">Telegram Passport</a> documents</td>
</tr>
<tr>
<td><strong>values</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/SecureValue">SecureValue</a>&gt;</td>
<td>Already submitted <a href="/passport">Telegram Passport</a> documents</td>
</tr>
<tr>
<td><strong>errors</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/SecureValueError">SecureValueError</a>&gt;</td>
<td><a href="/passport">Telegram Passport</a> errors</td>
</tr>
<tr>
<td><strong>users</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt;</td>
<td>Info about the bot to which the form will be submitted</td>
</tr>
<tr>
<td><strong>privacy_policy_url</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/type/string">string</a></td>
<td>URL of the service's privacy policy</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.AuthorizationForm">account.AuthorizationForm</a></p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#telegram-passport-manual" id="telegram-passport-manual" name="telegram-passport-manual"><i class="anchor-icon"></i></a><a href="/passport">Telegram Passport Manual</a></h4></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.authorizations</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Logged-in sessions">
<meta property="og:title" content="account.authorizations">
<meta property="og:image" content="">
<meta property="og:description" content="Logged-in sessions">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.authorizations" >account.authorizations</a></li></ul></div>
<h1 id="dev_page_title">account.authorizations</h1>
<div id="dev_page_content"><p>Logged-in sessions</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.authorizations" class="current_page_link" >account.authorizations</a>#4bff8ea0 authorization_ttl_days:<a href="/type/int" >int</a> authorizations:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/Authorization" >Authorization</a>&gt; = <a href="/type/account.Authorizations" >account.Authorizations</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>authorization_ttl_days</strong></td>
<td style="text-align: center;"><a href="/type/int">int</a></td>
<td>Time-to-live of session</td>
</tr>
<tr>
<td><strong>authorizations</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Authorization">Authorization</a>&gt;</td>
<td>Logged-in sessions</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.Authorizations">account.Authorizations</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,160 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.autoDownloadSettings</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Media autodownload settings">
<meta property="og:title" content="account.autoDownloadSettings">
<meta property="og:image" content="">
<meta property="og:description" content="Media autodownload settings">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.autoDownloadSettings" >account.autoDownloadSettings</a></li></ul></div>
<h1 id="dev_page_title">account.autoDownloadSettings</h1>
<div id="dev_page_content"><p>Media autodownload settings</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.autoDownloadSettings" class="current_page_link" >account.autoDownloadSettings</a>#63cacf26 low:<a href="/type/AutoDownloadSettings" >AutoDownloadSettings</a> medium:<a href="/type/AutoDownloadSettings" >AutoDownloadSettings</a> high:<a href="/type/AutoDownloadSettings" >AutoDownloadSettings</a> = <a href="/type/account.AutoDownloadSettings" >account.AutoDownloadSettings</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>low</strong></td>
<td style="text-align: center;"><a href="/type/AutoDownloadSettings">AutoDownloadSettings</a></td>
<td>Low data usage preset</td>
</tr>
<tr>
<td><strong>medium</strong></td>
<td style="text-align: center;"><a href="/type/AutoDownloadSettings">AutoDownloadSettings</a></td>
<td>Medium data usage preset</td>
</tr>
<tr>
<td><strong>high</strong></td>
<td style="text-align: center;"><a href="/type/AutoDownloadSettings">AutoDownloadSettings</a></td>
<td>High data usage preset</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.AutoDownloadSettings">account.AutoDownloadSettings</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,160 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.contentSettings</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Sensitive content settings">
<meta property="og:title" content="account.contentSettings">
<meta property="og:image" content="">
<meta property="og:description" content="Sensitive content settings">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.contentSettings" >account.contentSettings</a></li></ul></div>
<h1 id="dev_page_title">account.contentSettings</h1>
<div id="dev_page_content"><p>Sensitive content settings</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.contentSettings" class="current_page_link" >account.contentSettings</a>#57e28221 flags:<a href="/type/%23" >#</a> sensitive_enabled:flags.0?true sensitive_can_change:flags.1?true = <a href="/type/account.ContentSettings" >account.ContentSettings</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>flags</strong></td>
<td style="text-align: center;"><a href="/type/%23">#</a></td>
<td>Flags, see <a href="/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></td>
</tr>
<tr>
<td><strong>sensitive_enabled</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/constructor/true">true</a></td>
<td>Whether viewing of sensitive (NSFW) content is enabled</td>
</tr>
<tr>
<td><strong>sensitive_can_change</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.1?<a href="/constructor/true">true</a></td>
<td>Whether the current client can change the sensitive content settings to view NSFW content</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.ContentSettings">account.ContentSettings</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,216 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.password</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Configuration for two-factor authorization">
<meta property="og:title" content="account.password">
<meta property="og:image" content="">
<meta property="og:description" content="Configuration for two-factor authorization">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.password" >account.password</a></li></ul></div>
<h1 id="dev_page_title">account.password</h1>
<div id="dev_page_content"><p>Configuration for two-factor authorization</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.password" class="current_page_link" >account.password</a>#185b184f flags:<a href="/type/%23" >#</a> has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?<a href="/type/PasswordKdfAlgo" >PasswordKdfAlgo</a> srp_B:flags.2?<a href="/type/bytes" >bytes</a> srp_id:flags.2?<a href="/type/long" >long</a> hint:flags.3?<a href="/type/string" >string</a> email_unconfirmed_pattern:flags.4?<a href="/type/string" >string</a> new_algo:<a href="/type/PasswordKdfAlgo" >PasswordKdfAlgo</a> new_secure_algo:<a href="/type/SecurePasswordKdfAlgo" >SecurePasswordKdfAlgo</a> secure_random:<a href="/type/bytes" >bytes</a> pending_reset_date:flags.5?<a href="/type/int" >int</a> = <a href="/type/account.Password" >account.Password</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>flags</strong></td>
<td style="text-align: center;"><a href="/type/%23">#</a></td>
<td>Flags, see <a href="/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></td>
</tr>
<tr>
<td><strong>has_recovery</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/constructor/true">true</a></td>
<td>Whether the user has a recovery method configured</td>
</tr>
<tr>
<td><strong>has_secure_values</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.1?<a href="/constructor/true">true</a></td>
<td>Whether telegram <a href="/passport">passport</a> is enabled</td>
</tr>
<tr>
<td><strong>has_password</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.2?<a href="/constructor/true">true</a></td>
<td>Whether the user has a password</td>
</tr>
<tr>
<td><strong>current_algo</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.2?<a href="/type/PasswordKdfAlgo">PasswordKdfAlgo</a></td>
<td>The <a href="/api/srp">KDF algorithm for SRP two-factor authentication</a> of the current password</td>
</tr>
<tr>
<td><strong>srp_B</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.2?<a href="/type/bytes">bytes</a></td>
<td>Srp B param for <a href="/api/srp">SRP authorization</a></td>
</tr>
<tr>
<td><strong>srp_id</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.2?<a href="/type/long">long</a></td>
<td>Srp ID param for <a href="/api/srp">SRP authorization</a></td>
</tr>
<tr>
<td><strong>hint</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.3?<a href="/type/string">string</a></td>
<td>Text hint for the password</td>
</tr>
<tr>
<td><strong>email_unconfirmed_pattern</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.4?<a href="/type/string">string</a></td>
<td>A <a href="/api/srp#email-verification">password recovery email</a> with the specified <a href="/api/pattern">pattern</a> is still awaiting verification</td>
</tr>
<tr>
<td><strong>new_algo</strong></td>
<td style="text-align: center;"><a href="/type/PasswordKdfAlgo">PasswordKdfAlgo</a></td>
<td>The <a href="/api/srp">KDF algorithm for SRP two-factor authentication</a> to use when creating new passwords</td>
</tr>
<tr>
<td><strong>new_secure_algo</strong></td>
<td style="text-align: center;"><a href="/type/SecurePasswordKdfAlgo">SecurePasswordKdfAlgo</a></td>
<td>The KDF algorithm for telegram <a href="/passport">passport</a></td>
</tr>
<tr>
<td><strong>secure_random</strong></td>
<td style="text-align: center;"><a href="/type/bytes">bytes</a></td>
<td>Secure random string</td>
</tr>
<tr>
<td><strong>pending_reset_date</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.5?<a href="/type/int">int</a></td>
<td>The 2FA password will be automatically removed at this date, unless the user cancels the operation</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.Password">account.Password</a></p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#telegram-passport-manual" id="telegram-passport-manual" name="telegram-passport-manual"><i class="anchor-icon"></i></a><a href="/passport">Telegram Passport Manual</a></h4>
<h4><a class="anchor" href="#two-factor-authentication" id="two-factor-authentication" name="two-factor-authentication"><i class="anchor-icon"></i></a><a href="/api/srp">Two-factor authentication</a></h4>
<p>How to login to a user's account if they have enabled 2FA, how to change password.</p>
<h4><a class="anchor" href="#pattern-matching" id="pattern-matching" name="pattern-matching"><i class="anchor-icon"></i></a><a href="/api/pattern">Pattern matching</a></h4>
<p>Some methods require the client to verify if the data obtained from an external source matches a certain pattern.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,179 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.passwordInputSettings</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Settings for setting up a new password">
<meta property="og:title" content="account.passwordInputSettings">
<meta property="og:image" content="">
<meta property="og:description" content="Settings for setting up a new password">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.passwordInputSettings" >account.passwordInputSettings</a></li></ul></div>
<h1 id="dev_page_title">account.passwordInputSettings</h1>
<div id="dev_page_content"><p>Settings for setting up a new password</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.passwordInputSettings" class="current_page_link" >account.passwordInputSettings</a>#c23727c9 flags:<a href="/type/%23" >#</a> new_algo:flags.0?<a href="/type/PasswordKdfAlgo" >PasswordKdfAlgo</a> new_password_hash:flags.0?<a href="/type/bytes" >bytes</a> hint:flags.0?<a href="/type/string" >string</a> email:flags.1?<a href="/type/string" >string</a> new_secure_settings:flags.2?<a href="/type/SecureSecretSettings" >SecureSecretSettings</a> = <a href="/type/account.PasswordInputSettings" >account.PasswordInputSettings</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>flags</strong></td>
<td style="text-align: center;"><a href="/type/%23">#</a></td>
<td>Flags, see <a href="/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></td>
</tr>
<tr>
<td><strong>new_algo</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/type/PasswordKdfAlgo">PasswordKdfAlgo</a></td>
<td>The <a href="/api/srp">SRP algorithm</a> to use</td>
</tr>
<tr>
<td><strong>new_password_hash</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/type/bytes">bytes</a></td>
<td>The <a href="/api/srp">computed password hash</a></td>
</tr>
<tr>
<td><strong>hint</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/type/string">string</a></td>
<td>Text hint for the password</td>
</tr>
<tr>
<td><strong>email</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.1?<a href="/type/string">string</a></td>
<td>Password recovery email</td>
</tr>
<tr>
<td><strong>new_secure_settings</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.2?<a href="/type/SecureSecretSettings">SecureSecretSettings</a></td>
<td>Telegram <a href="/passport">passport</a> settings</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.PasswordInputSettings">account.PasswordInputSettings</a></p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#two-factor-authentication" id="two-factor-authentication" name="two-factor-authentication"><i class="anchor-icon"></i></a><a href="/api/srp">Two-factor authentication</a></h4>
<p>How to login to a user's account if they have enabled 2FA, how to change password.</p>
<h4><a class="anchor" href="#telegram-passport-manual" id="telegram-passport-manual" name="telegram-passport-manual"><i class="anchor-icon"></i></a><a href="/passport">Telegram Passport Manual</a></h4></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,164 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.passwordSettings</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Private info associated to the password info (recovery email, telegram passport info &amp; so on)">
<meta property="og:title" content="account.passwordSettings">
<meta property="og:image" content="">
<meta property="og:description" content="Private info associated to the password info (recovery email, telegram passport info &amp; so on)">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.passwordSettings" >account.passwordSettings</a></li></ul></div>
<h1 id="dev_page_title">account.passwordSettings</h1>
<div id="dev_page_content"><p>Private info associated to the password info (recovery email, telegram <a href="/passport">passport</a> info &amp; so on)</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.passwordSettings" class="current_page_link" >account.passwordSettings</a>#9a5c33e5 flags:<a href="/type/%23" >#</a> email:flags.0?<a href="/type/string" >string</a> secure_settings:flags.1?<a href="/type/SecureSecretSettings" >SecureSecretSettings</a> = <a href="/type/account.PasswordSettings" >account.PasswordSettings</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>flags</strong></td>
<td style="text-align: center;"><a href="/type/%23">#</a></td>
<td>Flags, see <a href="/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></td>
</tr>
<tr>
<td><strong>email</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/type/string">string</a></td>
<td><a href="/api/srp#email-verification">2FA Recovery email</a></td>
</tr>
<tr>
<td><strong>secure_settings</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.1?<a href="/type/SecureSecretSettings">SecureSecretSettings</a></td>
<td>Telegram <a href="/passport">passport</a> settings</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.PasswordSettings">account.PasswordSettings</a></p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#two-factor-authentication" id="two-factor-authentication" name="two-factor-authentication"><i class="anchor-icon"></i></a><a href="/api/srp">Two-factor authentication</a></h4>
<p>How to login to a user's account if they have enabled 2FA, how to change password.</p>
<h4><a class="anchor" href="#telegram-passport-manual" id="telegram-passport-manual" name="telegram-passport-manual"><i class="anchor-icon"></i></a><a href="/passport">Telegram Passport Manual</a></h4></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,160 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.privacyRules</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Privacy rules">
<meta property="og:title" content="account.privacyRules">
<meta property="og:image" content="">
<meta property="og:description" content="Privacy rules">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.privacyRules" >account.privacyRules</a></li></ul></div>
<h1 id="dev_page_title">account.privacyRules</h1>
<div id="dev_page_content"><p>Privacy rules</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.privacyRules" class="current_page_link" >account.privacyRules</a>#50a04e45 rules:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/PrivacyRule" >PrivacyRule</a>&gt; chats:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/Chat" >Chat</a>&gt; users:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/User" >User</a>&gt; = <a href="/type/account.PrivacyRules" >account.PrivacyRules</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>rules</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/PrivacyRule">PrivacyRule</a>&gt;</td>
<td>Privacy rules</td>
</tr>
<tr>
<td><strong>chats</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Chat">Chat</a>&gt;</td>
<td>Chats to which the rules apply</td>
</tr>
<tr>
<td><strong>users</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt;</td>
<td>Users to which the rules apply</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.PrivacyRules">account.PrivacyRules</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.resetPasswordFailedWait</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="You recently requested a password reset that was canceled, please wait until the specified date before requesting another reset.">
<meta property="og:title" content="account.resetPasswordFailedWait">
<meta property="og:image" content="">
<meta property="og:description" content="You recently requested a password reset that was canceled, please wait until the specified date before requesting another reset.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.resetPasswordFailedWait" >account.resetPasswordFailedWait</a></li></ul></div>
<h1 id="dev_page_title">account.resetPasswordFailedWait</h1>
<div id="dev_page_content"><p>You recently requested a password reset that was canceled, please wait until the specified date before requesting another reset.</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.resetPasswordFailedWait" class="current_page_link" >account.resetPasswordFailedWait</a>#e3779861 retry_date:<a href="/type/int" >int</a> = <a href="/type/account.ResetPasswordResult" >account.ResetPasswordResult</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>retry_date</strong></td>
<td style="text-align: center;"><a href="/type/int">int</a></td>
<td>Wait until this date before requesting another reset.</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.ResetPasswordResult">account.ResetPasswordResult</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.resetPasswordOk</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="The 2FA password was reset successfully.">
<meta property="og:title" content="account.resetPasswordOk">
<meta property="og:image" content="">
<meta property="og:description" content="The 2FA password was reset successfully.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.resetPasswordOk" >account.resetPasswordOk</a></li></ul></div>
<h1 id="dev_page_title">account.resetPasswordOk</h1>
<div id="dev_page_content"><p>The 2FA password was reset successfully.</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.resetPasswordOk" class="current_page_link" >account.resetPasswordOk</a>#e926d63e = <a href="/type/account.ResetPasswordResult" >account.ResetPasswordResult</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<p>This constructor does not require any parameters.</p>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.ResetPasswordResult">account.ResetPasswordResult</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.resetPasswordRequestedWait</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="You successfully requested a password reset, please wait until the specified date before finalizing the reset.">
<meta property="og:title" content="account.resetPasswordRequestedWait">
<meta property="og:image" content="">
<meta property="og:description" content="You successfully requested a password reset, please wait until the specified date before finalizing the reset.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.resetPasswordRequestedWait" >account.resetPasswordRequestedWait</a></li></ul></div>
<h1 id="dev_page_title">account.resetPasswordRequestedWait</h1>
<div id="dev_page_content"><p>You successfully requested a password reset, please wait until the specified date before finalizing the reset.</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.resetPasswordRequestedWait" class="current_page_link" >account.resetPasswordRequestedWait</a>#e9effc7d until_date:<a href="/type/int" >int</a> = <a href="/type/account.ResetPasswordResult" >account.ResetPasswordResult</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>until_date</strong></td>
<td style="text-align: center;"><a href="/type/int">int</a></td>
<td>Wait until this date before finalizing the reset.</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.ResetPasswordResult">account.ResetPasswordResult</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.sentEmailCode</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="The sent email code">
<meta property="og:title" content="account.sentEmailCode">
<meta property="og:image" content="">
<meta property="og:description" content="The sent email code">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.sentEmailCode" >account.sentEmailCode</a></li></ul></div>
<h1 id="dev_page_title">account.sentEmailCode</h1>
<div id="dev_page_content"><p>The sent email code</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.sentEmailCode" class="current_page_link" >account.sentEmailCode</a>#811f854f email_pattern:<a href="/type/string" >string</a> length:<a href="/type/int" >int</a> = <a href="/type/account.SentEmailCode" >account.SentEmailCode</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>email_pattern</strong></td>
<td style="text-align: center;"><a href="/type/string">string</a></td>
<td>The email (to which the code was sent) must match this <a href="/api/pattern">pattern</a></td>
</tr>
<tr>
<td><strong>length</strong></td>
<td style="text-align: center;"><a href="/type/int">int</a></td>
<td>The length of the verification code</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.SentEmailCode">account.SentEmailCode</a></p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#pattern-matching" id="pattern-matching" name="pattern-matching"><i class="anchor-icon"></i></a><a href="/api/pattern">Pattern matching</a></h4>
<p>Some methods require the client to verify if the data obtained from an external source matches a certain pattern.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.takeout</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Takeout info">
<meta property="og:title" content="account.takeout">
<meta property="og:image" content="">
<meta property="og:description" content="Takeout info">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.takeout" >account.takeout</a></li></ul></div>
<h1 id="dev_page_title">account.takeout</h1>
<div id="dev_page_content"><p>Takeout info</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.takeout" class="current_page_link" >account.takeout</a>#4dba4501 id:<a href="/type/long" >long</a> = <a href="/type/account.Takeout" >account.Takeout</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>id</strong></td>
<td style="text-align: center;"><a href="/type/long">long</a></td>
<td>Takeout ID</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.Takeout">account.Takeout</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.themes</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Installed themes">
<meta property="og:title" content="account.themes">
<meta property="og:image" content="">
<meta property="og:description" content="Installed themes">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.themes" >account.themes</a></li></ul></div>
<h1 id="dev_page_title">account.themes</h1>
<div id="dev_page_content"><p>Installed themes</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.themes" class="current_page_link" >account.themes</a>#9a3d8c6d hash:<a href="/type/long" >long</a> themes:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/Theme" >Theme</a>&gt; = <a href="/type/account.Themes" >account.Themes</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>hash</strong></td>
<td style="text-align: center;"><a href="/type/long">long</a></td>
<td><a href="/api/offsets#hash-generation">Hash for pagination, for more info click here</a></td>
</tr>
<tr>
<td><strong>themes</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Theme">Theme</a>&gt;</td>
<td>Themes</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.Themes">account.Themes</a></p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#pagination-in-the-api" id="pagination-in-the-api" name="pagination-in-the-api"><i class="anchor-icon"></i></a><a href="/api/offsets">Pagination in the API</a></h4>
<p>How to fetch results from large lists of objects.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.themesNotModified</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="No new themes were installed">
<meta property="og:title" content="account.themesNotModified">
<meta property="og:image" content="">
<meta property="og:description" content="No new themes were installed">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.themesNotModified" >account.themesNotModified</a></li></ul></div>
<h1 id="dev_page_title">account.themesNotModified</h1>
<div id="dev_page_content"><p>No new themes were installed</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.themesNotModified" class="current_page_link" >account.themesNotModified</a>#f41eb622 = <a href="/type/account.Themes" >account.Themes</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<p>This constructor does not require any parameters.</p>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.Themes">account.Themes</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.tmpPassword</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Temporary payment password">
<meta property="og:title" content="account.tmpPassword">
<meta property="og:image" content="">
<meta property="og:description" content="Temporary payment password">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.tmpPassword" >account.tmpPassword</a></li></ul></div>
<h1 id="dev_page_title">account.tmpPassword</h1>
<div id="dev_page_content"><p>Temporary payment password</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.tmpPassword" class="current_page_link" >account.tmpPassword</a>#db64fd34 tmp_password:<a href="/type/bytes" >bytes</a> valid_until:<a href="/type/int" >int</a> = <a href="/type/account.TmpPassword" >account.TmpPassword</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>tmp_password</strong></td>
<td style="text-align: center;"><a href="/type/bytes">bytes</a></td>
<td>Temporary password</td>
</tr>
<tr>
<td><strong>valid_until</strong></td>
<td style="text-align: center;"><a href="/type/int">int</a></td>
<td>Validity period</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.TmpPassword">account.TmpPassword</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.wallPapers</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Installed wallpapers">
<meta property="og:title" content="account.wallPapers">
<meta property="og:image" content="">
<meta property="og:description" content="Installed wallpapers">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.wallPapers" >account.wallPapers</a></li></ul></div>
<h1 id="dev_page_title">account.wallPapers</h1>
<div id="dev_page_content"><p>Installed wallpapers</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.wallPapers" class="current_page_link" >account.wallPapers</a>#cdc3858c hash:<a href="/type/long" >long</a> wallpapers:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/WallPaper" >WallPaper</a>&gt; = <a href="/type/account.WallPapers" >account.WallPapers</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>hash</strong></td>
<td style="text-align: center;"><a href="/type/long">long</a></td>
<td><a href="/api/offsets#hash-generation">Hash for pagination, for more info click here</a></td>
</tr>
<tr>
<td><strong>wallpapers</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/WallPaper">WallPaper</a>&gt;</td>
<td>Wallpapers</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.WallPapers">account.WallPapers</a></p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#pagination-in-the-api" id="pagination-in-the-api" name="pagination-in-the-api"><i class="anchor-icon"></i></a><a href="/api/offsets">Pagination in the API</a></h4>
<p>How to fetch results from large lists of objects.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.wallPapersNotModified</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="No new wallpapers were found">
<meta property="og:title" content="account.wallPapersNotModified">
<meta property="og:image" content="">
<meta property="og:description" content="No new wallpapers were found">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.wallPapersNotModified" >account.wallPapersNotModified</a></li></ul></div>
<h1 id="dev_page_title">account.wallPapersNotModified</h1>
<div id="dev_page_content"><p>No new wallpapers were found</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.wallPapersNotModified" class="current_page_link" >account.wallPapersNotModified</a>#1c199183 = <a href="/type/account.WallPapers" >account.WallPapers</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<p>This constructor does not require any parameters.</p>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.WallPapers">account.WallPapers</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>account.webAuthorizations</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Web authorizations">
<meta property="og:title" content="account.webAuthorizations">
<meta property="og:image" content="">
<meta property="og:description" content="Web authorizations">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/account.webAuthorizations" >account.webAuthorizations</a></li></ul></div>
<h1 id="dev_page_title">account.webAuthorizations</h1>
<div id="dev_page_content"><p>Web authorizations</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/account.webAuthorizations" class="current_page_link" >account.webAuthorizations</a>#ed56c9fc authorizations:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/WebAuthorization" >WebAuthorization</a>&gt; users:<a href="/type/Vector%20t" >Vector</a>&lt;<a href="/type/User" >User</a>&gt; = <a href="/type/account.WebAuthorizations" >account.WebAuthorizations</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>authorizations</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/WebAuthorization">WebAuthorization</a>&gt;</td>
<td>Web authorization list</td>
</tr>
<tr>
<td><strong>users</strong></td>
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/User">User</a>&gt;</td>
<td>Users</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/account.WebAuthorizations">account.WebAuthorizations</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>accountDaysTTL</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Time to live in days of the current account">
<meta property="og:title" content="accountDaysTTL">
<meta property="og:image" content="">
<meta property="og:description" content="Time to live in days of the current account">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/accountDaysTTL" >accountDaysTTL</a></li></ul></div>
<h1 id="dev_page_title">accountDaysTTL</h1>
<div id="dev_page_content"><p>Time to live in days of the current account</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/accountDaysTTL" class="current_page_link" >accountDaysTTL</a>#b8d0afdf days:<a href="/type/int" >int</a> = <a href="/type/AccountDaysTTL" >AccountDaysTTL</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>days</strong></td>
<td style="text-align: center;"><a href="/type/int">int</a></td>
<td>This account will self-destruct in the specified number of days</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/AccountDaysTTL">AccountDaysTTL</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,172 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>auth.authorization</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Contains user authorization info.">
<meta property="og:title" content="auth.authorization">
<meta property="og:image" content="">
<meta property="og:description" content="Contains user authorization info.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/auth.authorization" >auth.authorization</a></li></ul></div>
<h1 id="dev_page_title">auth.authorization</h1>
<div id="dev_page_content"><p>Contains user authorization info.</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/auth.authorization" class="current_page_link" >auth.authorization</a>#33fb7bb8 flags:<a href="/type/%23" >#</a> setup_password_required:flags.1?true otherwise_relogin_days:flags.1?<a href="/type/int" >int</a> tmp_sessions:flags.0?<a href="/type/int" >int</a> user:<a href="/type/User" >User</a> = <a href="/type/auth.Authorization" >auth.Authorization</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>flags</strong></td>
<td style="text-align: center;"><a href="/type/%23">#</a></td>
<td>Flags, see <a href="/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></td>
</tr>
<tr>
<td><strong>setup_password_required</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.1?<a href="/constructor/true">true</a></td>
<td>Suggests the user to set up a 2-step verification password to be able to log in again</td>
</tr>
<tr>
<td><strong>otherwise_relogin_days</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.1?<a href="/type/int">int</a></td>
<td>Iff setup_password_required is set and the user declines to set a 2-step verification password, they will be able to log into their account via SMS again only after this many days pass.</td>
</tr>
<tr>
<td><strong>tmp_sessions</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/type/int">int</a></td>
<td>Temporary <a href="/passport">passport</a> sessions</td>
</tr>
<tr>
<td><strong>user</strong></td>
<td style="text-align: center;"><a href="/type/User">User</a></td>
<td>Info on authorized user</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/auth.Authorization">auth.Authorization</a></p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#telegram-passport-manual" id="telegram-passport-manual" name="telegram-passport-manual"><i class="anchor-icon"></i></a><a href="/passport">Telegram Passport Manual</a></h4></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>auth.authorizationSignUpRequired</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="An account with this phone number doesn&#39;t exist on telegram: the user has to enter basic information and sign up">
<meta property="og:title" content="auth.authorizationSignUpRequired">
<meta property="og:image" content="">
<meta property="og:description" content="An account with this phone number doesn&#39;t exist on telegram: the user has to enter basic information and sign up">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/auth.authorizationSignUpRequired" >auth.authorizationSignUpRequired</a></li></ul></div>
<h1 id="dev_page_title">auth.authorizationSignUpRequired</h1>
<div id="dev_page_content"><p>An account with this phone number doesn't exist on telegram: the user has to <a href="/api/auth">enter basic information and sign up</a></p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/auth.authorizationSignUpRequired" class="current_page_link" >auth.authorizationSignUpRequired</a>#44747e9a flags:<a href="/type/%23" >#</a> terms_of_service:flags.0?<a href="/type/help.TermsOfService" >help.TermsOfService</a> = <a href="/type/auth.Authorization" >auth.Authorization</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>flags</strong></td>
<td style="text-align: center;"><a href="/type/%23">#</a></td>
<td>Flags, see <a href="/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></td>
</tr>
<tr>
<td><strong>terms_of_service</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/type/help.TermsOfService">help.TermsOfService</a></td>
<td>Telegram's terms of service: the user must read and accept the terms of service before signing up to telegram</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/auth.Authorization">auth.Authorization</a></p>
<h3><a class="anchor" href="#related-pages" id="related-pages" name="related-pages"><i class="anchor-icon"></i></a>Related pages</h3>
<h4><a class="anchor" href="#user-authorization" id="user-authorization" name="user-authorization"><i class="anchor-icon"></i></a><a href="/api/auth">User Authorization</a></h4>
<p>How to register a user's phone to start using the API.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>auth.codeTypeCall</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="The next time, the authentication code is to be delivered via an outgoing phone call.">
<meta property="og:title" content="auth.codeTypeCall">
<meta property="og:image" content="">
<meta property="og:description" content="The next time, the authentication code is to be delivered via an outgoing phone call.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/auth.codeTypeCall" >auth.codeTypeCall</a></li></ul></div>
<h1 id="dev_page_title">auth.codeTypeCall</h1>
<div id="dev_page_content"><p>The next time, the authentication code is to be delivered via an outgoing phone call.</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/auth.codeTypeCall" class="current_page_link" >auth.codeTypeCall</a>#741cd3e3 = <a href="/type/auth.CodeType" >auth.CodeType</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<p>This constructor does not require any parameters.</p>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/auth.CodeType">auth.CodeType</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>auth.codeTypeFlashCall</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="The next time, the authentication code will be delivered via an immediately canceled incoming call.">
<meta property="og:title" content="auth.codeTypeFlashCall">
<meta property="og:image" content="">
<meta property="og:description" content="The next time, the authentication code will be delivered via an immediately canceled incoming call.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/auth.codeTypeFlashCall" >auth.codeTypeFlashCall</a></li></ul></div>
<h1 id="dev_page_title">auth.codeTypeFlashCall</h1>
<div id="dev_page_content"><p>The next time, the authentication code will be delivered via an immediately canceled incoming call.</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/auth.codeTypeFlashCall" class="current_page_link" >auth.codeTypeFlashCall</a>#226ccefb = <a href="/type/auth.CodeType" >auth.CodeType</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<p>This constructor does not require any parameters.</p>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/auth.CodeType">auth.CodeType</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>auth.codeTypeMissedCall</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user.">
<meta property="og:title" content="auth.codeTypeMissedCall">
<meta property="og:image" content="">
<meta property="og:description" content="The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/auth.codeTypeMissedCall" >auth.codeTypeMissedCall</a></li></ul></div>
<h1 id="dev_page_title">auth.codeTypeMissedCall</h1>
<div id="dev_page_content"><p>The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user.</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/auth.codeTypeMissedCall" class="current_page_link" >auth.codeTypeMissedCall</a>#d61ad6ee = <a href="/type/auth.CodeType" >auth.CodeType</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<p>This constructor does not require any parameters.</p>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/auth.CodeType">auth.CodeType</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>auth.codeTypeSms</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="The next time, the authentication code will be delivered via an immediately canceled incoming call.">
<meta property="og:title" content="auth.codeTypeSms">
<meta property="og:image" content="">
<meta property="og:description" content="The next time, the authentication code will be delivered via an immediately canceled incoming call.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/auth.codeTypeSms" >auth.codeTypeSms</a></li></ul></div>
<h1 id="dev_page_title">auth.codeTypeSms</h1>
<div id="dev_page_content"><p>The next time, the authentication code will be delivered via an immediately canceled incoming call.</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/auth.codeTypeSms" class="current_page_link" >auth.codeTypeSms</a>#72a3158c = <a href="/type/auth.CodeType" >auth.CodeType</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<p>This constructor does not require any parameters.</p>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/auth.CodeType">auth.CodeType</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

View file

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>auth.exportedAuthorization</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Data for copying of authorization between data centers.">
<meta property="og:title" content="auth.exportedAuthorization">
<meta property="og:image" content="">
<meta property="og:description" content="Data for copying of authorization between data centers.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class=""><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class="active"><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/auth.exportedAuthorization" >auth.exportedAuthorization</a></li></ul></div>
<h1 id="dev_page_title">auth.exportedAuthorization</h1>
<div id="dev_page_content"><p>Data for copying of authorization between data centers.</p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 139 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?layer=1">1 &ndash; Base layer</a></li><li><a href="?layer=2">2 &ndash; New userpic notifications</a></li><li><a href="?layer=3">3 &ndash; Send message can trigger link change</a></li><li><a href="?layer=4">4 &ndash; Check-in chats</a></li><li><a href="?layer=5">5 &ndash; Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 &ndash; Foursquare integration</a></li><li><a href="?layer=7">7 &ndash; Added wallPaperSolid</a></li><li><a href="?layer=8">8 &ndash; Added end-to-end encryption</a></li><li><a href="?layer=9">9 &ndash; Improved big files upload perfomance</a></li><li><a href="?layer=10">10 &ndash; Improved chat participants updates</a></li><li><a href="?layer=11">11 &ndash; Improved secret chats</a></li><li><a href="?layer=12">12 &ndash; New dynamic support</a></li><li><a href="?layer=13">13 &ndash; Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 &ndash; Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 &ndash; Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 &ndash; Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 &ndash; Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 &ndash; Added usernames</a></li><li><a href="?layer=23">23 &ndash; Stickers for secret chats</a></li><li><a href="?layer=105">105 &ndash; Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 &ndash; Login with QR code</a></li><li><a href="?layer=109">109 &ndash; Polls v2</a></li><li><a href="?layer=110">110 &ndash; People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 &ndash; Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 &ndash; Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 &ndash; PSA</a></li><li><a href="?layer=114">114 &ndash; Video thumbs for GIFs</a></li><li><a href="?layer=115">115 &ndash; Peek Channel Invite</a></li><li><a href="?layer=116">116 &ndash; Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 &ndash; WebRTC Phone Calls</a></li><li><a href="?layer=118">118 &ndash; Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 &ndash; Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 &ndash; Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 &ndash; SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 &ndash; Voice Chats</a></li><li><a href="?layer=123">123 &ndash; Voice Chat improvements</a></li><li><a href="?layer=124">124 &ndash; Expiring Invite links</a></li><li><a href="?layer=125">125 &ndash; Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 &ndash; Ban channels in channels</a></li><li><a href="?layer=127">127 &ndash; Payments in channels</a></li><li><a href="?layer=128">128 &ndash; Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 &ndash; Video Chats</a></li><li><a href="?layer=130">130 &ndash; Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 &ndash; Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 &ndash; Chat themes</a></li><li><a href="?layer=133">133 &ndash; 64-bit IDs for User/Chat</a></li><li><a href="?layer=134">134 &ndash; Chat Requests, Shared Media Calendar</a></li><li><a href="?layer=135">135 &ndash; Send Message As a Channel</a></li><li><a href="?layer=136">136 &ndash; Reactions</a></li><li><a href="?layer=137">137 &ndash; Translations</a></li><li><a href="?layer=138">138 &ndash; GIF Sticker Packs</a></li><li><a href="?layer=139"><strong>139 &ndash; RTMP streaming</strong></a></li>
<li class="divider"></li>
<li><a href="/api/layers">More...</a></li>
</ul>
</li>
</ul>
</div>
<pre class="page_scheme"><code><a href="/constructor/auth.exportedAuthorization" class="current_page_link" >auth.exportedAuthorization</a>#b434e2b8 id:<a href="/type/long" >long</a> bytes:<a href="/type/bytes" >bytes</a> = <a href="/type/auth.ExportedAuthorization" >auth.ExportedAuthorization</a>;</code></pre></p>
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>id</strong></td>
<td style="text-align: center;"><a href="/type/long">long</a></td>
<td>current user identifier</td>
</tr>
<tr>
<td><strong>bytes</strong></td>
<td style="text-align: center;"><a href="/type/bytes">bytes</a></td>
<td>authorizes key</td>
</tr>
</tbody>
</table>
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
<p><a href="/type/auth.ExportedAuthorization">auth.ExportedAuthorization</a></p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more