diff --git a/data/core.telegram.org/api/end-to-end.html b/data/core.telegram.org/api/end-to-end.html new file mode 100644 index 0000000000..4fa159929c --- /dev/null +++ b/data/core.telegram.org/api/end-to-end.html @@ -0,0 +1,244 @@ + + +
+ +++This article on MTProto's End-to-End encryption is meant for advanced users. +If you want to learn more about Secret Chats from a less intimidating source, kindly see our general FAQ.
+
++Note that as of version 4.6, major Telegram clients are using MTProto 2.0. +MTProto v.1.0 is deprecated and is currently being phased out.
+
Secret Chats are one-on-one chats wherein messages are encrypted with a key held only by the chat’s participants. Note that the schema for these end-to-end encrypted Secret Chats is different from what is used for cloud chats:
+ +This article describes the end-to-end encryption layer in the MTProto protocol version 2.0. +The principal differences from version 1.0 (described here for reference) are as follows:
+See also: MTProto 2.0: Cloud Chats, server-client encryption
+Keys are generated using the Diffie-Hellman protocol.
+Let us consider the following scenario: User A would like to initiate end-to-end encrypted communication with User B.
+User A executes messages.getDhConfig to obtain the Diffie-Hellman parameters: a prime p, and a high order element g.
+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 messages.dhConfigNotModified.
+Client is expected to check whether p is a safe 2048-bit prime (meaning that both p and (p-1)/2 are prime, and that 2^2047 < p < 2^2048), and that g generates a cyclic subgroup of prime order (p-1)/2, i.e. is a quadratic residue mod p. Since g is always equal to 2, 3, 4, 5, 6 or 7, this is easily done using quadratic reciprocity law, yielding a simple condition on p mod 4g -- namely, p mod 8 = 7 for g = 2; p mod 3 = 2 for g = 3; no extra condition for g = 4; p mod 5 = 1 or 4 for g = 5; p mod 24 = 19 or 23 for g = 6; and p mod 7 = 3, 5 or 6 for g = 7. After g and p 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 Authorization Key generation.
+If the client needs additional entropy for the random number generator, it can pass the random_length parameter (random_length> 0) so the server generates its own random sequence random of the appropriate length. +Important: using the server’s random sequence in its raw form may be unsafe, it must be combined with a client sequence.
+Client A computes a 2048-bit number a (using sufficient entropy or the server’s random; see above) and executes messages.requestEncryption after passing in g_a := pow(g, a) mod dh_prime
.
User B receives the update updateEncryption for all associated authorization keys (all authorized devices) with the chat constructor encryptedChatRequested. The user must be shown basic information about User A and must be prompted to accept or reject the request.
+Both clients are to check that g, g_a and g_b are greater than one and smaller than p-1. We recommend checking that g_a and g_b are between 2^{2048-64} and p - 2^{2048-64} as well.
+After User B confirms the creation of a secret chat with A in the client interface, Client B also receives up-to-date configuration parameters for the Diffie-Hellman method. Thereafter, it generates a random 2048-bit number, b, using rules similar to those for a.
+Having received g_a from the update with encryptedChatRequested, it can immediately generate the final shared key: key = (pow(g_a, b) mod dh_prime)
. If key length < 256 bytes, add several leading zero bytes as padding — so that the key is exactly 256 bytes long. Its fingerprint, key_fingerprint, is equal to the 64 last bits of SHA1 (key).
Note 1: in this particular case SHA1 is used here even for MTProto 2.0 secret chats.
+Note 2: 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. Key visualizations 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).
+Client B executes messages.acceptEncryption after passing it g_b := pow(g, b) mod dh_prime
and key_fingerprint.
For all of Client B’s authorized devices, except the current one, updateEncryption updates are sent with the constructor encryptedChatDiscarded. Thereafter, the only device that will be able to access the secret chat is Device B, which made the call to messages.acceptEncryption.
+User A will be sent an updateEncryption update with the constructor encryptedChat, for the authorization key that initiated the chat.
+With g_b from the update, Client A can also compute the shared key key = (pow(g_b, a) mod dh_prime)
. If key length < 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 encryptedChat, incoming messages can be sent and processed. Otherwise, messages.discardEncryption must be executed and the user notified.
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.
+++The re-keying protocol is further described in this article: Perfect Forward Secrecy in Secret Chats.
+
Please note that your client must support Forward Secrecy in Secret Chats to be compatible with official Telegram clients.
+A TL object of type DecryptedMessage is created and contains the message in plain text. For backward compatibility, the object must be wrapped in the constructor decryptedMessageLayer with an indication of the supported layer (starting with 46).
+++The TL-Schema for the contents of end-to-end encrypted messages is available here »
+
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.
+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.)
+Message key, msg_key, 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 key. (For the older MTProto 1.0 encryption, msg_key was computed differently, as the 128 lower bits of SHA1 of the data obtained in the previous steps, excluding the padding bytes.)
+For MTProto 2.0, the AES key aes_key and initialization vector aes_iv are computed ( key is the shared key obtained during Key Generation ) as follows:
+For MTProto 2.0, x=0 for messages from the originator of the secret chat, x=8 for the messages in the opposite direction.
+For the obsolete MTProto 1.0, msg_key, aes_key, and aes_iv were computed differently (see this document for reference).
+Data is encrypted with a 256-bit key, aes_key, and a 256-bit initialization vector, aes-iv, using AES-256 encryption with infinite garble extension (IGE). Encryption key fingerprint key_fingerprint and the message key msg_key are added at the top of the resulting byte array.
+Encrypted data is embedded into a messages.sendEncrypted API call and passed to Telegram server for delivery to the other party of the Secret Chat.
+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 sequence numbers must be encrypted with MTProto 2.0 as well.
+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 successfull (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).
+The steps above are performed in reverse order. +When an encrypted message is received, you must check that msg_key is in fact equal to the 128 middle bits of the SHA256 hash of the decrypted message, prepended by 32 bytes taken from the shared key. +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.
+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.
+++Proper handling of these counters is further described in this article: Sequence numbers in Secret Chats.
+
Please note that your client must support sequence numbers in Secret Chats to be compatible with official Telegram clients.
+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 file parameter of the messages.sendEncryptedFile method and that the key for direct decryption will be sent in the body of the message (the key parameter in the constructors decryptedMessageMediaPhoto, decryptedMessageMediaVideo and decryptedMessageMediaFile.
+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.
+The key fingerprint is computed as follows:
+The encrypted contents of a file are stored on the server in much the same way as those of a file in cloud chats: piece by piece using calls to upload.saveFilePart. +A subsequent call to messages.sendEncryptedFile will assign an identifier to the stored file and send the address together with the message. The recipient will receive an update with encryptedMessage, and the file parameter will contain file information.
+Incoming and outgoing encrypted files can be forwarded to other secret chats using the constructor inputEncryptedFile to avoid saving the same content on the server twice.
+Secret chats are associated with specific devices (or rather with authorization keys), not users. A conventional message box, which uses pts to describe the client’s status, is not suitable, because it is designed for long-term message storage and message access from different devices.
+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 qts 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.
+As the number of events increases, the value of qts increases by 1 with each new event. The initial value may not (and will not) be equal to 0.
+The fact that events from the temporary queue have been received and stored by the client is acknowledged explicitly by a call to the messages.receivedQueue method or implicitly by a call to updates.getDifference (the value of qts 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.
+Upon de-authorization, the event queue of the corresponding device will be forcibly cleared, and the value of qts will become irrelevant.
+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 any packet containing information of an upper layer, i.e.:
+decryptedMessageLayer
with layer>=46, ordecryptedMessageService#aa48327d
).In order to notify the remote client of your local layer, your client must send a message of the decryptedMessageActionNotifyLayer
type. This notification must be wrapped in a constructor of an appropriate layer.
There are two cases when your client must notify the remote client about its local layer:
+This article describes the end-to-end encryption used for Telegram voice and video calls.
+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 reflectors), and generate a one-time encryption key for this voice call with the aid of Diffie--Hellman key exchange. 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.
+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 Secret Chats. We recommend studying the linked article before proceeding.
+However, we have introduced some important changes to facilitate the key verification process. Below is the entire exchange between the two communicating parties, the Caller (A) and the Callee (B), through the Telegram servers (S).
+g_a_hash:bytes
, among others. For this call, this field is to be filled with g_a_hash, not g_a itself.g_a:bytes
and key_fingerprint:long
.key_fingerprint:long
received from the other side, as an implementation sanity check.At this point, the Diffie--Hellman key exchange is complete, and both parties have a 256-byte shared secret key key which is used to encrypt all further exchanges between A and B.
+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).
+++This document describes encryption in voice and video calls as implemented in Telegram apps with versions 7.0 and above. See this document for details on encryption used in voice calls in app versions released before August 14, 2020.
+
The Telegram Voice and Video Call Library uses an optimized version of MTProto 2.0 to send and receive packets, consisting of one or more end-to-end encrypted messages of various types (ice candidates list, video formats, remote video status, audio stream data, video stream data, message ack or empty).
+This document describes only the encryption process, leaving out encoding and network-dependent parts.
+The library starts working with:
+key
shared between the parties, as generated above.Both data transfer channels are unreliable (messages may get lost), but signaling is slower and more reliable.
+The body of a packet (decrypted_body
) consists of several messages and their respective seq
numbers concatenated together.
Each decrypted_body
is unique because no two seq
numbers of the first message can be the same. If only old messages need to be re-sent, an empty message with new unique seq
is added to the packet first.
The encryption key key
is used to compute a 128-bit msg_key
and then a 256-bit aes_key
and a 128-bit aes_iv
:
x
depends on whether the call is outgoing or incoming and on the connection type:
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 seq
counter).
The resulting aes_key
and aes_iv
are used to encrypt decrypted_body
:
The packet that gets sent consists of msg_key
and encrypted_body
:
When received, the packet gets decrypted using key
and msg_key
, after which msg_key
is checked against the relevant SHA256
substring. If the check fails, the packet must be discarded.
Each of the peers maintains its own 32-bit monotonically increasing counter for outgoing messages, seq
, starting with 1
. This seq
counter is prepended to each sent message and increased by 1
for each new message. No two seq
numbers of the first message in a packet can be the same. If only old messages need to be re-sent, an empty message with a new unique seq
is added to the packet first. When the seq
counter reaches 2^30
, the call must be aborted. Each peer stores seq
values of all the messages it has received (and processed) which are larger than max_received_seq - 64
, where max_received_seq
is the largest seq
number received so far.
If a packet is received, the first message of which has a seq
that is smaller or equal to max_received_seq - 64
or its seq
had already been received, the message is discarded. Otherwise, the seq
values of all incoming messages are memorized and max_received_seq
is adjusted. This guarantees that no two packets will be processed twice.
To verify the key, and ensure that no MITM attack is taking place, both parties concatenate the secret key key with the value g_a of the Caller ( A ), 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 0.9999999999.
+This is because instead of the standard Diffie-Hellman key exchange which requires only two messages between the parties:
+we use a three-message modification thereof that works well when both parties are online (which also happens to be a requirement for voice calls):
+The idea here is that A commits to a specific value of a (and of g_a) without disclosing it to B. B has to choose its value of b and g_b without knowing the true value of g_a, so that it cannot try different values of b to force the final key (g_a)^b to have any specific properties (such as fixed lower 32 bits of SHA256(key)). At this point, B commits to a specific value of g_b without knowing g_a. Then A has to send its value g_a; it cannot change it even though it knows g_b now, because the other party B would accept only a value of g_a that has a hash specified in the very first message of the exchange.
+If some impostor is pretending to be either A or B and tries to perform a Man-in-the-Middle Attack on this Diffie--Hellman key exchange, the above still holds. Party A will generate a shared key with B -- or whoever pretends to be B -- without having a second chance to change its exponent a depending on the value g_b received from the other side; and the impostor will not have a chance to adapt his value of b depending on g_a, because it has to commit to a value of g_b before learning g_a. The same is valid for the key generation between the impostor and the party B.
+The use of hash commitment in the DH exchange constrains the attacker to only one guess 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.
++For a slightly more user-friendly explanation of the above see: How are calls authenticated?
+
++This document describes end-to-end encrypted Secret Chats in MTProto 1.0, its status is DEPRECATED. +For information on end-to-end encryption used in up-to-date Telegram clients, kindly see this document.
+
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 schema for end-to-end encrypted Secret Chats is different from what is used for cloud chats:
+ +The Diffie-Hellman protocol is used for key generation. For more information, see Wikipedia.
+Let us consider the following scenario: User A would like to initiate encrypted communication with User B.
+User A executes messages.getDhConfig to obtain the Diffie-Hellman parameters: a prime p, and a high order element g.
+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 messages.dhConfigNotModified.
+Client is expected to check whether p is a safe 2048-bit prime (meaning that both p and (p-1)/2 are prime, and that 2^2047 < p < 2^2048), and that g generates a cyclic subgroup of prime order (p-1)/2, i.e. is a quadratic residue mod p. Since g is always equal to 2, 3, 4, 5, 6 or 7, this is easily done using quadratic reciprocity law, yielding a simple condition on p mod 4g -- namely, p mod 8 = 7 for g = 2; p mod 3 = 2 for g = 3; no extra condition for g = 4; p mod 5 = 1 or 4 for g = 5; p mod 24 = 19 or 23 for g = 6; and p mod 7 = 3, 5 or 6 for g = 7. After g and p 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 Authorization Key generation.
+If the client has an inadequate random number generator, it makes sense to pass the random_length parameter (random_length> 0) so the server generates its own random sequence random of the appropriate length.
+Important: 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 (client_random) and using final_random := random XOR client_random
.
Client A computes a 2048-bit number a (using sufficient entropy or the server’s random; see above) and executes messages.requestEncryption after passing in g_a := pow(g, a) mod dh_prime
.
User B receives the update updateEncryption for all associated authorization keys (all authorized devices) with the chat constructor encryptedChatRequested. The user must be shown basic information about User A and must be prompted to accept or reject the request.
+Both clients are to check that g, g_a and g_b are greater than one and smaller than p-1. We recommend checking that g_a and g_b are between 2^{2048-64} and p - 2^{2048-64} as well.
+After User B confirms the creation of a secret chat with A in the client interface, Client B also receives up-to-date configuration parameters for the Diffie-Hellman method. Thereafter, it generates a random 2048-bit number, b, using rules similar to those for a.
+Having received g_a from the update with encryptedChatRequested, it can immediately generate the final shared key: key = (pow(g_a, b) mod dh_prime)
. If key length < 256 bytes, add several leading zero bytes as padding — so that the key is exactly 256 bytes long. Its fingerprint, key_fingerprint, is equal to the 64 last bits of SHA1 (key).
Note: 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. Key visualizations 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).
+Client B executes messages.acceptEncryption after passing it g_b := pow(g, b) mod dh_prime
and key_fingerprint.
For all of Client B’s authorized devices, except the current one, updateEncryption updates are sent with the constructor encryptedChatDiscarded. Thereafter, the only device that will be able to access the secret chat is Device B, which made the call to messages.acceptEncryption.
+User A will be sent an updateEncryption update with the constructor encryptedChat, for the authorization key that initiated the chat.
+With g_b from the update, Client A can also receive the shared key key = (pow(g_b, a) mod dh_prime)
. If key length < 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 encryptedChat, incoming messages can be sent and processed. Otherwise, messages.discardEncryption must be executed and the user notified.
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.
+++The re-keying protocol is further described in this article: Perfect Forward Secrecy in Secret Chats.
+
Please note that your client must support Forward Secrecy in Secret Chats to be compatible with official Telegram clients.
+A TL object of type DecryptedMessage is created and contains the message in plain text. For backward compatibility, the object must be wrapped in the constructor decryptedMessageLayer with an indication of the supported layer (starting with 8). +The TL-Schema for end-to-end encrypted messages contents is represented here ».
+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, msg_key, 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 ( key is the shared key obtained during Key Generation; in MTProto 1.0, x = 0 ):
+Data is encrypted with a 256-bit key, aes_key, and a 256-bit initialization vector, aes-iv, using AES-256 encryption with infinite garble extension (IGE). Encryption key fingerprint key_fingerprint and the message key msg_key are added at the top of the resulting byte array.
+Encrypted data is embedded into a messages.sendEncrypted API call and passed to Telegram server for delivery to the other party of the Secret Chat.
+The steps above are performed in reverse order. +When an encrypted message is received, you must check that msg_key is in fact 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.
+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.
+++Proper handling of these counters is further described in this article: Sequence numbers in Secret Chats.
+
Please note that your client must support sequence numbers in Secret Chats to be compatible with official Telegram clients.
+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 file parameter of the messages.sendEncryptedFile method and that the key for direct decryption will be sent in the body of the message (the key parameter in the constructors decryptedMessageMediaPhoto, decryptedMessageMediaVideo and decryptedMessageMediaFile.
+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.
+The key fingerprint is computed as follows:
+The encrypted contents of a file are stored on the server in much the same way as those of a file in cloud chats: piece by piece using calls to upload.saveFilePart. +A subsequent call to messages.sendEncryptedFile will assign an identifier to the stored file and send the address together with the message. The recipient will receive an update with encryptedMessage, and the file parameter will contain file information.
+Incoming and outgoing encrypted files can be forwarded to other secret chats using the constructor inputEncryptedFile to avoid saving the same content on the server twice.
+Secret chats are associated with specific devices (or rather with authorization keys), not users. A conventional message box, which uses pts to describe the client’s status, is not suitable, because it is designed for long-term message storage and message access from different devices.
+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 qts 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.
+As the number of events increases, the value of qts increases monotonically (not always by 1). The initial value may not (and will not) be equal to 0.
+The fact that events from the temporary queue have been received and stored by the client is acknowledged explicitly by a call to the messages.receivedQueue method or implicitly by a call to updates.getDifference (the value of qts 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.
+Upon de-authorization, the event queue of the corresponding device will be forcibly cleared, and the value of qts will become irrelevant.
+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 any packet containing information of an upper layer, i.e.:
+decryptedMessageLayer
with layer>=17, ordecryptedMessageService#aa48327d
).In order to notify the remote client of your local layer, your client must send a message of the decryptedMessageActionNotifyLayer
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 decryptedMessageService
constructor of the obsolete layer 8 (constructor decryptedMessageService#aa48327d
), despite the fact that the decryptedMessageActionNotifyLayer
constructor is actually not present in Layer 8.
There are three cases when your client must notify the remote client about its local layer:
++Note that all pending obsolete layer messages must be sent prior to the layer update notification (more on this in Handling Sequence numbers).
+
++The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
+
To learn how to create and set up a bot, please consult our Introduction to Bots »
You will find all changes to our Bot API on this page.
+++Subscribe to @BotNews to be the first to know about the latest updates and join the discussion in @BotTalk
+
Bot API 5.5
+Note: After this update it will become impossible to forward messages from some chats. Use the fields has_protected_content in the classes Message and Chat to check this.
+Note: After this update users are able to send messages on behalf of channels they own. Bots are expected to use the field sender_chat in the class Message to correctly support such messages.
+Note: 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.
+Bot API 5.4
+creates_join_request
to the methods createChatInviteLink and editChatInviteLink for managing chat invite links that create join requests (read more about this on our blog).creates_join_request
and pending_join_request_count
to the class ChatInviteLink.name
to the class ChatInviteLink and the parameters name
to the methods createChatInviteLink and editChatInviteLink for managing invite link names.+++
WARNING!
User identifiers will become bigger than2^31 - 1
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.
Bot API 5.3
+Personalized Commands
+scope
and language_code
to the method setMyCommands to allow bots specify different commands for different chats and users.scope
and language_code
to the method getMyCommands.Custom Placeholders
+And More
+kickChatMember
to banChatMember. The old method name can still be used.getChatMembersCount
to getChatMemberCount. The old method name can still be used.file_unique_id
in objects of the type PhotoSize and of the fields small_file_unique_id
and big_file_unique_id
in objects of the type ChatPhoto were changed.+++
WARNING!
After one of the upcoming Bot API updates, user identifiers will become bigger than2^31 - 1
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.
Bot API 5.2
++++
WARNING!
After the next Bot API update (Bot API 5.3) there will be a one-time change of the value of the fieldfile_unique_id
in objects of the type PhotoSize and of the fieldssmall_file_unique_id
andbig_file_unique_id
in objects of the type ChatPhoto.
+++
WARNING!
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.
+++
WARNING!
After one of the upcoming Bot API updates, user identifiers will become bigger than2^31 - 1
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.
Bot API 5.1
+Added two new update types
+Improved Invite Links
+Voice Chat Info
+And More
++++
WARNING!
After one of the upcoming Bot API updates, some user identifiers will become bigger than2^31 - 1
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.
Introducing Bot API 5.0
+Run Your Own Bot API Server
+Transfer Bot Ownership
+Webhooks
+Working with Groups
+Working with Files
+Multiple Pinned Messages
+File Albums
+Live Locations
+Anonymous Admins
+And More
+And Last but not Least
+Bot API 4.9
+Bot API 4.8
+Bot API 4.7
+Bot API 4.6
+Bot API 4.5
+<u>/<ins>
(for underlined text) and <s>/<strike>/<del>
(for strikethrough text) in parse mode HTML.__
(for underlined text) and ~
(for strikethrough text). Parse mode Markdown remains unchanged for backward compatibility.Bot API 4.4
+149.154.160.0/20
and 91.108.4.0/22
. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: https://core.telegram.org/bots/webhooks.Bot API 4.3
+Also in this update:
+reply_markup
to the Message object, containing the inline keyboard attached to the message.149.154.160.0/20
and 91.108.4.0/22
. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: https://core.telegram.org/bots/webhooks.Bot API 4.2
+149.154.160.0/20
and 91.108.4.0/22
. Most users won't need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: https://core.telegram.org/bots/webhooks.Bot API 4.1
+Bot API 4.0.
+tg://
URLs now can be used in inline keyboard url buttons and text_link
message entities. Retry-After
response header to configure the delay after which the Bot API will retry the request after an unsuccessful response from a webhook.410 Gone
for all requests for more than 23 hours successively, it can be automatically removed.Bot API 3.6.
+Bot API 3.5.
+Bot API 3.4.
+Bot API 3.3.
+Bot API 3.2. Teach your bot to handle stickers and sticker sets.
+Bot API 3.1. Build your own robotic police force for supergoups with these new methods for admin bots:
+Introducing Bot API 3.0.
+NEW Payment Platform
+See Introduction to Bot Payments for a brief overview. If you're not a developer, you may like this user-friendly blog post better.
+NEW Video Messages
+NEW Multilingual Bots
+More power to admin bots
+Minor Changes
+Introducing Bot API 2.3.1, a nifty little update that will give you more control over how your bot gets its updates.
+Bot API 2.3
+Your bot can now get updates about posts in channels. Added new fields channel_post and edited_channel_post to Update.
+You can now update high scores to a lower value by using the new force parameter in setGameScore. Handy for punishing cheaters or fixing errors in your game's High Score table.
+Bot API 2.2. Introducing a new Gaming Platform! See this introduction for a brief overview.
If you're not a developer, you may like this user-friendly blog post better.
Other changes
+New method getWebhookInfo to check current webhook status.
+Added the option to specify an HTTP URL for a file in all methods where InputFile or file_id 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.
+Introducing Bot API 2.0. Check out this page for a review of this major update.
+Inline bots
+/setinlinegeo
, added field location to the InlineQuery object, added fields location and inline_message_id to the ChosenInlineResult object.Miscellaneous
+setinlinefeedback
command for Botfather, new type ChosenInlineResult, new field chosen_inline_result to the Update object./setinline
to @BotFather.@channelusername
) in the place of chat_id in all methods (and instead of from_chat_id in forwardMessage). For this to work, the bot must be an administrator in the channel (and that's exactly what Telegram clients don't support yet — adding bots as administrators coming soon).The bot platform was officially launched.
++ ++
++The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
+
To learn how to create and set up a bot, please consult our Introduction to Bots and Bot FAQ.
++Subscribe to @BotNews to be the first to know about the latest updates and join the discussion in @BotTalk
+
Bot API 5.5
+Note: After this update it will become impossible to forward messages from some chats. Use the fields has_protected_content in the classes Message and Chat to check this.
+Note: After this update users are able to send messages on behalf of channels they own. Bots are expected to use the field sender_chat in the class Message to correctly support such messages.
+Note: 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.
+Bot API 5.4
+creates_join_request
to the methods createChatInviteLink and editChatInviteLink for managing chat invite links that create join requests (read more about this on our blog).creates_join_request
and pending_join_request_count
to the class ChatInviteLink.name
to the class ChatInviteLink and the parameters name
to the methods createChatInviteLink and editChatInviteLink for managing invite link names.+++
WARNING!
User identifiers can now be bigger than2^31 - 1
and it is no longer possible to store them in a signed 32-bit integer type. User identifiers have up to 52 significant bits, so a 64-bit integer or double-precision float type is safe for storing them. Please make sure that your code can correctly handle such user identifiers.
Bot API 5.3
+Personalized Commands
+scope
and language_code
to the method setMyCommands to allow bots specify different commands for different chats and users.scope
and language_code
to the method getMyCommands.Custom Placeholders
+And More
+kickChatMember
to banChatMember. The old method name can still be used.getChatMembersCount
to getChatMemberCount. The old method name can still be used.file_unique_id
in objects of the type PhotoSize and of the fields small_file_unique_id
and big_file_unique_id
in objects of the type ChatPhoto were changed.+++
WARNING!
User identifiers can now be bigger than2^31 - 1
and it is no longer possible to store them in a signed 32-bit integer type. User identifiers have up to 52 significant bits, so a 64-bit integer or double-precision float type is safe for storing them. Please make sure that your code can correctly handle such user identifiers.
Bot API 5.2
+Each bot is given a unique authentication token when it is created. The token looks something like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
, but we'll use simply <token> in this document instead. You can learn about obtaining tokens and generating new ones in this document.
All queries to the Telegram Bot API must be served over HTTPS and need to be presented in this form: https://api.telegram.org/bot<token>/METHOD_NAME
. Like this for example:
https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/getMe
+We support GET and POST HTTP methods. We support four ways of passing parameters in Bot API requests:
+The response contains a JSON object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals True, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals false and the error is explained in the 'description'. An Integer 'error_code' field is also returned, but its contents are subject to change in the future. Some errors may also have an optional field 'parameters' of the type ResponseParameters, which can help to automatically handle the error.
+If you're using webhooks, you can perform a request to the Bot API while sending an answer to the webhook. Use either application/json or application/x-www-form-urlencoded or multipart/form-data response content type for passing parameters. Specify the method to be invoked in the method parameter of the request. It's not possible to know that such a request was successful or get its result.
+++Please see our FAQ for examples.
+
The Bot API server source code is available at telegram-bot-api. You can run it locally and send the requests to your own server instead of https://api.telegram.org
. If you switch to a local Bot API server, your bot will be able to:
The majority of bots will be OK with the default configuration, running on our servers. But if you feel that you need one of these features, you're welcome to switch to your own at any time.
+There are two mutually exclusive ways of receiving updates for your bot — the getUpdates method on one hand and Webhooks on the other. Incoming updates are stored on the server until the bot receives them either way, but they will not be kept longer than 24 hours.
+Regardless of which option you choose, you will receive JSON-serialized Update objects as a result.
+This object represents an incoming update.
At most one of the optional parameters can be present in any given update.
Field | +Type | +Description | +
---|---|---|
update_id | +Integer | +The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. | +
message | +Message | +Optional. New incoming message of any kind — text, photo, sticker, etc. | +
edited_message | +Message | +Optional. New version of a message that is known to the bot and was edited | +
channel_post | +Message | +Optional. New incoming channel post of any kind — text, photo, sticker, etc. | +
edited_channel_post | +Message | +Optional. New version of a channel post that is known to the bot and was edited | +
inline_query | +InlineQuery | +Optional. New incoming inline query | +
chosen_inline_result | +ChosenInlineResult | +Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. | +
callback_query | +CallbackQuery | +Optional. New incoming callback query | +
shipping_query | +ShippingQuery | +Optional. New incoming shipping query. Only for invoices with flexible price | +
pre_checkout_query | +PreCheckoutQuery | +Optional. New incoming pre-checkout query. Contains full information about checkout | +
poll | +Poll | +Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot | +
poll_answer | +PollAnswer | +Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. | +
my_chat_member | +ChatMemberUpdated | +Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. | +
chat_member | +ChatMemberUpdated | +Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. | +
chat_join_request | +ChatJoinRequest | +Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. | +
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
offset | +Integer | +Optional | +Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten. | +
limit | +Integer | +Optional | +Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100. | +
timeout | +Integer | +Optional | +Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only. | +
allowed_updates | +Array of String | +Optional | +A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time. |
+
++Notes
+
1. This method will not work if an outgoing webhook is set up.
2. In order to avoid getting duplicate updates, recalculate offset after each server response.
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.
+If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>
. Since nobody else knows your bot's token, you can be pretty sure it's us.
Parameter | +Type | +Required | +Description | +
---|---|---|---|
url | +String | +Yes | +HTTPS url to send updates to. Use an empty string to remove webhook integration | +
certificate | +InputFile | +Optional | +Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details. | +
ip_address | +String | +Optional | +The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS | +
max_connections | +Integer | +Optional | +Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput. | +
allowed_updates | +Array of String | +Optional | +A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time. |
+
drop_pending_updates | +Boolean | +Optional | +Pass True to drop all pending updates | +
++Notes
+
1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.
3. Ports currently supported for Webhooks: 443, 80, 88, 8443.NEW! If you're having any trouble setting up webhooks, please check out this amazing guide to Webhooks.
+
Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
drop_pending_updates | +Boolean | +Optional | +Pass True to drop all pending updates | +
Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.
+Contains information about the current status of a webhook.
+Field | +Type | +Description | +
---|---|---|
url | +String | +Webhook URL, may be empty if webhook is not set up | +
has_custom_certificate | +Boolean | +True, if a custom certificate was provided for webhook certificate checks | +
pending_update_count | +Integer | +Number of updates awaiting delivery | +
ip_address | +String | +Optional. Currently used webhook IP address | +
last_error_date | +Integer | +Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook | +
last_error_message | +String | +Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook | +
max_connections | +Integer | +Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery | +
allowed_updates | +Array of String | +Optional. A list of update types the bot is subscribed to. Defaults to all update types except chat_member | +
All types used in the Bot API responses are represented as JSON-objects.
+It is safe to use 32-bit signed integers for storing all Integer fields unless otherwise noted.
+++Optional fields may be not returned when irrelevant.
+
This object represents a Telegram user or bot.
+Field | +Type | +Description | +
---|---|---|
id | +Integer | +Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. | +
is_bot | +Boolean | +True, if this user is a bot | +
first_name | +String | +User's or bot's first name | +
last_name | +String | +Optional. User's or bot's last name | +
username | +String | +Optional. User's or bot's username | +
language_code | +String | +Optional. IETF language tag of the user's language | +
can_join_groups | +Boolean | +Optional. True, if the bot can be invited to groups. Returned only in getMe. | +
can_read_all_group_messages | +Boolean | +Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. | +
supports_inline_queries | +Boolean | +Optional. True, if the bot supports inline queries. Returned only in getMe. | +
This object represents a chat.
+Field | +Type | +Description | +
---|---|---|
id | +Integer | +Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. | +
type | +String | +Type of chat, can be either “private”, “group”, “supergroup” or “channel” | +
title | +String | +Optional. Title, for supergroups, channels and group chats | +
username | +String | +Optional. Username, for private chats, supergroups and channels if available | +
first_name | +String | +Optional. First name of the other party in a private chat | +
last_name | +String | +Optional. Last name of the other party in a private chat | +
photo | +ChatPhoto | +Optional. Chat photo. Returned only in getChat. | +
bio | +String | +Optional. Bio of the other party in a private chat. Returned only in getChat. | +
has_private_forwards | +True | +Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat. |
+
description | +String | +Optional. Description, for groups, supergroups and channel chats. Returned only in getChat. | +
invite_link | +String | +Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. | +
pinned_message | +Message | +Optional. The most recent pinned message (by sending date). Returned only in getChat. | +
permissions | +ChatPermissions | +Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. | +
slow_mode_delay | +Integer | +Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. | +
message_auto_delete_time | +Integer | +Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. | +
has_protected_content | +True | +Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. | +
sticker_set_name | +String | +Optional. For supergroups, name of group sticker set. Returned only in getChat. | +
can_set_sticker_set | +True | +Optional. True, if the bot can change the group sticker set. Returned only in getChat. | +
linked_chat_id | +Integer | +Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat. | +
location | +ChatLocation | +Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat. | +
This object represents a message.
+Field | +Type | +Description | +
---|---|---|
message_id | +Integer | +Unique message identifier inside this chat | +
from | +User | +Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. | +
sender_chat | +Chat | +Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. | +
date | +Integer | +Date the message was sent in Unix time | +
chat | +Chat | +Conversation the message belongs to | +
forward_from | +User | +Optional. For forwarded messages, sender of the original message | +
forward_from_chat | +Chat | +Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat | +
forward_from_message_id | +Integer | +Optional. For messages forwarded from channels, identifier of the original message in the channel | +
forward_signature | +String | +Optional. For messages forwarded from channels, signature of the post author if present | +
forward_sender_name | +String | +Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages | +
forward_date | +Integer | +Optional. For forwarded messages, date the original message was sent in Unix time | +
is_automatic_forward | +True | +Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group | +
reply_to_message | +Message | +Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. | +
via_bot | +User | +Optional. Bot through which the message was sent | +
edit_date | +Integer | +Optional. Date the message was last edited in Unix time | +
has_protected_content | +True | +Optional. True, if the message can't be forwarded | +
media_group_id | +String | +Optional. The unique identifier of a media message group this message belongs to | +
author_signature | +String | +Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator | +
text | +String | +Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters | +
entities | +Array of MessageEntity | +Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text | +
animation | +Animation | +Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set | +
audio | +Audio | +Optional. Message is an audio file, information about the file | +
document | +Document | +Optional. Message is a general file, information about the file | +
photo | +Array of PhotoSize | +Optional. Message is a photo, available sizes of the photo | +
sticker | +Sticker | +Optional. Message is a sticker, information about the sticker | +
video | +Video | +Optional. Message is a video, information about the video | +
video_note | +VideoNote | +Optional. Message is a video note, information about the video message | +
voice | +Voice | +Optional. Message is a voice message, information about the file | +
caption | +String | +Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters | +
caption_entities | +Array of MessageEntity | +Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption | +
contact | +Contact | +Optional. Message is a shared contact, information about the contact | +
dice | +Dice | +Optional. Message is a dice with random value | +
game | +Game | +Optional. Message is a game, information about the game. More about games » | +
poll | +Poll | +Optional. Message is a native poll, information about the poll | +
venue | +Venue | +Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set | +
location | +Location | +Optional. Message is a shared location, information about the location | +
new_chat_members | +Array of User | +Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) | +
left_chat_member | +User | +Optional. A member was removed from the group, information about them (this member may be the bot itself) | +
new_chat_title | +String | +Optional. A chat title was changed to this value | +
new_chat_photo | +Array of PhotoSize | +Optional. A chat photo was change to this value | +
delete_chat_photo | +True | +Optional. Service message: the chat photo was deleted | +
group_chat_created | +True | +Optional. Service message: the group has been created | +
supergroup_chat_created | +True | +Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. | +
channel_chat_created | +True | +Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. | +
message_auto_delete_timer_changed | +MessageAutoDeleteTimerChanged | +Optional. Service message: auto-delete timer settings changed in the chat | +
migrate_to_chat_id | +Integer | +Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. | +
migrate_from_chat_id | +Integer | +Optional. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. | +
pinned_message | +Message | +Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. | +
invoice | +Invoice | +Optional. Message is an invoice for a payment, information about the invoice. More about payments » | +
successful_payment | +SuccessfulPayment | +Optional. Message is a service message about a successful payment, information about the payment. More about payments » | +
connected_website | +String | +Optional. The domain name of the website on which the user has logged in. More about Telegram Login » | +
passport_data | +PassportData | +Optional. Telegram Passport data | +
proximity_alert_triggered | +ProximityAlertTriggered | +Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. | +
voice_chat_scheduled | +VoiceChatScheduled | +Optional. Service message: voice chat scheduled | +
voice_chat_started | +VoiceChatStarted | +Optional. Service message: voice chat started | +
voice_chat_ended | +VoiceChatEnded | +Optional. Service message: voice chat ended | +
voice_chat_participants_invited | +VoiceChatParticipantsInvited | +Optional. Service message: new participants invited to a voice chat | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. |
+
This object represents a unique message identifier.
+Field | +Type | +Description | +
---|---|---|
message_id | +Integer | +Unique message identifier | +
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the entity. Can be “mention” (@username ), “hashtag” (#hashtag ), “cashtag” ($USD ), “bot_command” (/start@jobs_bot ), “url” (https://telegram.org ), “email” (do-not-reply@telegram.org ), “phone_number” (+1-212-555-0123 ), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames) |
+
offset | +Integer | +Offset in UTF-16 code units to the start of the entity | +
length | +Integer | +Length of the entity in UTF-16 code units | +
url | +String | +Optional. For “text_link” only, url that will be opened after user taps on the text | +
user | +User | +Optional. For “text_mention” only, the mentioned user | +
language | +String | +Optional. For “pre” only, the programming language of the entity text | +
This object represents one size of a photo or a file / sticker thumbnail.
+Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
width | +Integer | +Photo width | +
height | +Integer | +Photo height | +
file_size | +Integer | +Optional. File size in bytes | +
This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
+Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
width | +Integer | +Video width as defined by sender | +
height | +Integer | +Video height as defined by sender | +
duration | +Integer | +Duration of the video in seconds as defined by sender | +
thumb | +PhotoSize | +Optional. Animation thumbnail as defined by sender | +
file_name | +String | +Optional. Original animation filename as defined by sender | +
mime_type | +String | +Optional. MIME type of the file as defined by sender | +
file_size | +Integer | +Optional. File size in bytes | +
This object represents an audio file to be treated as music by the Telegram clients.
+Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
duration | +Integer | +Duration of the audio in seconds as defined by sender | +
performer | +String | +Optional. Performer of the audio as defined by sender or by audio tags | +
title | +String | +Optional. Title of the audio as defined by sender or by audio tags | +
file_name | +String | +Optional. Original filename as defined by sender | +
mime_type | +String | +Optional. MIME type of the file as defined by sender | +
file_size | +Integer | +Optional. File size in bytes | +
thumb | +PhotoSize | +Optional. Thumbnail of the album cover to which the music file belongs | +
This object represents a general file (as opposed to photos, voice messages and audio files).
+Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
thumb | +PhotoSize | +Optional. Document thumbnail as defined by sender | +
file_name | +String | +Optional. Original filename as defined by sender | +
mime_type | +String | +Optional. MIME type of the file as defined by sender | +
file_size | +Integer | +Optional. File size in bytes | +
This object represents a video file.
+Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
width | +Integer | +Video width as defined by sender | +
height | +Integer | +Video height as defined by sender | +
duration | +Integer | +Duration of the video in seconds as defined by sender | +
thumb | +PhotoSize | +Optional. Video thumbnail | +
file_name | +String | +Optional. Original filename as defined by sender | +
mime_type | +String | +Optional. Mime type of a file as defined by sender | +
file_size | +Integer | +Optional. File size in bytes | +
This object represents a video message (available in Telegram apps as of v.4.0).
+Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
length | +Integer | +Video width and height (diameter of the video message) as defined by sender | +
duration | +Integer | +Duration of the video in seconds as defined by sender | +
thumb | +PhotoSize | +Optional. Video thumbnail | +
file_size | +Integer | +Optional. File size in bytes | +
This object represents a voice note.
+Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
duration | +Integer | +Duration of the audio in seconds as defined by sender | +
mime_type | +String | +Optional. MIME type of the file as defined by sender | +
file_size | +Integer | +Optional. File size in bytes | +
This object represents a phone contact.
+Field | +Type | +Description | +
---|---|---|
phone_number | +String | +Contact's phone number | +
first_name | +String | +Contact's first name | +
last_name | +String | +Optional. Contact's last name | +
user_id | +Integer | +Optional. Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. | +
vcard | +String | +Optional. Additional data about the contact in the form of a vCard | +
This object represents an animated emoji that displays a random value.
+Field | +Type | +Description | +
---|---|---|
emoji | +String | +Emoji on which the dice throw animation is based | +
value | +Integer | +Value of the dice, 1-6 for “![]() ![]() ![]() ![]() ![]() ![]() |
+
This object contains information about one answer option in a poll.
+Field | +Type | +Description | +
---|---|---|
text | +String | +Option text, 1-100 characters | +
voter_count | +Integer | +Number of users that voted for this option | +
This object represents an answer of a user in a non-anonymous poll.
+Field | +Type | +Description | +
---|---|---|
poll_id | +String | +Unique poll identifier | +
user | +User | +The user, who changed the answer to the poll | +
option_ids | +Array of Integer | +0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. | +
This object contains information about a poll.
+Field | +Type | +Description | +
---|---|---|
id | +String | +Unique poll identifier | +
question | +String | +Poll question, 1-300 characters | +
options | +Array of PollOption | +List of poll options | +
total_voter_count | +Integer | +Total number of users that voted in the poll | +
is_closed | +Boolean | +True, if the poll is closed | +
is_anonymous | +Boolean | +True, if the poll is anonymous | +
type | +String | +Poll type, currently can be “regular” or “quiz” | +
allows_multiple_answers | +Boolean | +True, if the poll allows multiple answers | +
correct_option_id | +Integer | +Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. | +
explanation | +String | +Optional. 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 | +
explanation_entities | +Array of MessageEntity | +Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation | +
open_period | +Integer | +Optional. Amount of time in seconds the poll will be active after creation | +
close_date | +Integer | +Optional. Point in time (Unix timestamp) when the poll will be automatically closed | +
This object represents a point on the map.
+Field | +Type | +Description | +
---|---|---|
longitude | +Float | +Longitude as defined by sender | +
latitude | +Float | +Latitude as defined by sender | +
horizontal_accuracy | +Float number | +Optional. The radius of uncertainty for the location, measured in meters; 0-1500 | +
live_period | +Integer | +Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only. | +
heading | +Integer | +Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only. | +
proximity_alert_radius | +Integer | +Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. | +
This object represents a venue.
+Field | +Type | +Description | +
---|---|---|
location | +Location | +Venue location. Can't be a live location | +
title | +String | +Name of the venue | +
address | +String | +Address of the venue | +
foursquare_id | +String | +Optional. Foursquare identifier of the venue | +
foursquare_type | +String | +Optional. Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) | +
google_place_id | +String | +Optional. Google Places identifier of the venue | +
google_place_type | +String | +Optional. Google Places type of the venue. (See supported types.) | +
This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
+Field | +Type | +Description | +
---|---|---|
traveler | +User | +User that triggered the alert | +
watcher | +User | +User that set the alert | +
distance | +Integer | +The distance between the users | +
This object represents a service message about a change in auto-delete timer settings.
+Field | +Type | +Description | +
---|---|---|
message_auto_delete_time | +Integer | +New auto-delete time for messages in the chat; in seconds | +
This object represents a service message about a voice chat scheduled in the chat.
+Field | +Type | +Description | +
---|---|---|
start_date | +Integer | +Point in time (Unix timestamp) when the voice chat is supposed to be started by a chat administrator | +
This object represents a service message about a voice chat started in the chat. Currently holds no information.
+This object represents a service message about a voice chat ended in the chat.
+Field | +Type | +Description | +
---|---|---|
duration | +Integer | +Voice chat duration in seconds | +
This object represents a service message about new members invited to a voice chat.
+Field | +Type | +Description | +
---|---|---|
users | +Array of User | +Optional. New members that were invited to the voice chat | +
This object represent a user's profile pictures.
+Field | +Type | +Description | +
---|---|---|
total_count | +Integer | +Total number of profile pictures the target user has | +
photos | +Array of Array of PhotoSize | +Requested profile pictures (in up to 4 sizes each) | +
This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>
. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.
++Maximum file size to download is 20 MB
+
Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
file_size | +Integer | +Optional. File size in bytes, if known | +
file_path | +String | +Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. |
+
This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).
+Field | +Type | +Description | +
---|---|---|
keyboard | +Array of Array of KeyboardButton | +Array of button rows, each represented by an Array of KeyboardButton objects | +
resize_keyboard | +Boolean | +Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. | +
one_time_keyboard | +Boolean | +Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. | +
input_field_placeholder | +String | +Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters | +
selective | +Boolean | +Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. |
+
This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields request_contact, request_location, and request_poll are mutually exclusive.
+Field | +Type | +Description | +
---|---|---|
text | +String | +Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed | +
request_contact | +Boolean | +Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only | +
request_location | +Boolean | +Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only | +
request_poll | +KeyboardButtonPollType | +Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only | +
Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message.
Note: request_poll option will only work in Telegram versions released after 23 January, 2020. Older clients will display unsupported message.
This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. | +
Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
+Field | +Type | +Description | +
---|---|---|
remove_keyboard | +True | +Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) | +
selective | +Boolean | +Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. |
+
This object represents an inline keyboard that appears right next to the message it belongs to.
+Field | +Type | +Description | +
---|---|---|
inline_keyboard | +Array of Array of InlineKeyboardButton | +Array of button rows, each represented by an Array of InlineKeyboardButton objects | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message.
+This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
+Field | +Type | +Description | +
---|---|---|
text | +String | +Label text on the button | +
url | +String | +Optional. HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. |
+
login_url | +LoginUrl | +Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. | +
callback_data | +String | +Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes | +
switch_inline_query | +String | +Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be inserted. Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen. |
+
switch_inline_query_current_chat | +String | +Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted. This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. |
+
callback_game | +CallbackGame | +Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row. |
+
pay | +Boolean | +Optional. Specify True, to send a Pay button. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. |
+
This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:
+ + +Telegram apps support these buttons as of version 5.7.
+++Sample bot: @discussbot
+
Field | +Type | +Description | +
---|---|---|
url | +String | +An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data. NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization. |
+
forward_text | +String | +Optional. New text of the button in forwarded messages. | +
bot_username | +String | +Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. | +
request_write_access | +Boolean | +Optional. Pass True to request the permission for your bot to send messages to the user. | +
This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
+Field | +Type | +Description | +
---|---|---|
id | +String | +Unique identifier for this query | +
from | +User | +Sender | +
message | +Message | +Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old | +
inline_message_id | +String | +Optional. Identifier of the message sent via the bot in inline mode, that originated the query. | +
chat_instance | +String | +Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. | +
data | +String | +Optional. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field. | +
game_short_name | +String | +Optional. Short name of a Game to be returned, serves as the unique identifier for the game | +
++NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters).
+
Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
+Field | +Type | +Description | +
---|---|---|
force_reply | +True | +Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' | +
input_field_placeholder | +String | +Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters | +
selective | +Boolean | +Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. | +
++Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:
++
+- Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
+- Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'.
+The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions — without any extra work for the user.
+
This object represents a chat photo.
+Field | +Type | +Description | +
---|---|---|
small_file_id | +String | +File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. | +
small_file_unique_id | +String | +Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
big_file_id | +String | +File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. | +
big_file_unique_id | +String | +Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
Represents an invite link for a chat.
+Field | +Type | +Description | +
---|---|---|
invite_link | +String | +The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”. | +
creator | +User | +Creator of the link | +
creates_join_request | +Boolean | +True, if users joining the chat via the link need to be approved by chat administrators | +
is_primary | +Boolean | +True, if the link is primary | +
is_revoked | +Boolean | +True, if the link is revoked | +
name | +String | +Optional. Invite link name | +
expire_date | +Integer | +Optional. Point in time (Unix timestamp) when the link will expire or has been expired | +
member_limit | +Integer | +Optional. Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 | +
pending_join_request_count | +Integer | +Optional. Number of pending join requests created using this link | +
This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
+Represents a chat member that owns the chat and has all administrator privileges.
+Field | +Type | +Description | +
---|---|---|
status | +String | +The member's status in the chat, always “creator” | +
user | +User | +Information about the user | +
is_anonymous | +Boolean | +True, if the user's presence in the chat is hidden | +
custom_title | +String | +Optional. Custom title for this user | +
Represents a chat member that has some additional privileges.
+Field | +Type | +Description | +
---|---|---|
status | +String | +The member's status in the chat, always “administrator” | +
user | +User | +Information about the user | +
can_be_edited | +Boolean | +True, if the bot is allowed to edit administrator privileges of that user | +
is_anonymous | +Boolean | +True, if the user's presence in the chat is hidden | +
can_manage_chat | +Boolean | +True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | +
can_delete_messages | +Boolean | +True, if the administrator can delete messages of other users | +
can_manage_voice_chats | +Boolean | +True, if the administrator can manage voice chats | +
can_restrict_members | +Boolean | +True, if the administrator can restrict, ban or unban chat members | +
can_promote_members | +Boolean | +True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) | +
can_change_info | +Boolean | +True, if the user is allowed to change the chat title, photo and other settings | +
can_invite_users | +Boolean | +True, if the user is allowed to invite new users to the chat | +
can_post_messages | +Boolean | +Optional. True, if the administrator can post in the channel; channels only | +
can_edit_messages | +Boolean | +Optional. True, if the administrator can edit messages of other users and can pin messages; channels only | +
can_pin_messages | +Boolean | +Optional. True, if the user is allowed to pin messages; groups and supergroups only | +
custom_title | +String | +Optional. Custom title for this user | +
Represents a chat member that has no additional privileges or restrictions.
+Field | +Type | +Description | +
---|---|---|
status | +String | +The member's status in the chat, always “member” | +
user | +User | +Information about the user | +
Represents a chat member that is under certain restrictions in the chat. Supergroups only.
+Field | +Type | +Description | +
---|---|---|
status | +String | +The member's status in the chat, always “restricted” | +
user | +User | +Information about the user | +
is_member | +Boolean | +True, if the user is a member of the chat at the moment of the request | +
can_change_info | +Boolean | +True, if the user is allowed to change the chat title, photo and other settings | +
can_invite_users | +Boolean | +True, if the user is allowed to invite new users to the chat | +
can_pin_messages | +Boolean | +True, if the user is allowed to pin messages | +
can_send_messages | +Boolean | +True, if the user is allowed to send text messages, contacts, locations and venues | +
can_send_media_messages | +Boolean | +True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes | +
can_send_polls | +Boolean | +True, if the user is allowed to send polls | +
can_send_other_messages | +Boolean | +True, if the user is allowed to send animations, games, stickers and use inline bots | +
can_add_web_page_previews | +Boolean | +True, if the user is allowed to add web page previews to their messages | +
until_date | +Integer | +Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever | +
Represents a chat member that isn't currently a member of the chat, but may join it themselves.
+Field | +Type | +Description | +
---|---|---|
status | +String | +The member's status in the chat, always “left” | +
user | +User | +Information about the user | +
Represents a chat member that was banned in the chat and can't return to the chat or view chat messages.
+Field | +Type | +Description | +
---|---|---|
status | +String | +The member's status in the chat, always “kicked” | +
user | +User | +Information about the user | +
until_date | +Integer | +Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever | +
This object represents changes in the status of a chat member.
+Field | +Type | +Description | +
---|---|---|
chat | +Chat | +Chat the user belongs to | +
from | +User | +Performer of the action, which resulted in the change | +
date | +Integer | +Date the change was done in Unix time | +
old_chat_member | +ChatMember | +Previous information about the chat member | +
new_chat_member | +ChatMember | +New information about the chat member | +
invite_link | +ChatInviteLink | +Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. | +
Represents a join request sent to a chat.
+Field | +Type | +Description | +
---|---|---|
chat | +Chat | +Chat to which the request was sent | +
from | +User | +User that sent the join request | +
date | +Integer | +Date the request was sent in Unix time | +
bio | +String | +Optional. Bio of the user. | +
invite_link | +ChatInviteLink | +Optional. Chat invite link that was used by the user to send the join request | +
Describes actions that a non-administrator user is allowed to take in a chat.
+Field | +Type | +Description | +
---|---|---|
can_send_messages | +Boolean | +Optional. True, if the user is allowed to send text messages, contacts, locations and venues | +
can_send_media_messages | +Boolean | +Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages | +
can_send_polls | +Boolean | +Optional. True, if the user is allowed to send polls, implies can_send_messages | +
can_send_other_messages | +Boolean | +Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages | +
can_add_web_page_previews | +Boolean | +Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages | +
can_change_info | +Boolean | +Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups | +
can_invite_users | +Boolean | +Optional. True, if the user is allowed to invite new users to the chat | +
can_pin_messages | +Boolean | +Optional. True, if the user is allowed to pin messages. Ignored in public supergroups | +
Represents a location to which a chat is connected.
+Field | +Type | +Description | +
---|---|---|
location | +Location | +The location to which the supergroup is connected. Can't be a live location. | +
address | +String | +Location address; 1-64 characters, as defined by the chat owner | +
This object represents a bot command.
+Field | +Type | +Description | +
---|---|---|
command | +String | +Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores. | +
description | +String | +Description of the command, 3-256 characters. | +
This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:
+The following algorithm is used to determine the list of commands for a particular user viewing the bot menu. The first list of commands which is set is returned:
+Commands in the chat with the bot
+Commands in group and supergroup chats
+Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Scope type, must be default | +
Represents the scope of bot commands, covering all private chats.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Scope type, must be all_private_chats | +
Represents the scope of bot commands, covering all group and supergroup chats.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Scope type, must be all_group_chats | +
Represents the scope of bot commands, covering all group and supergroup chat administrators.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Scope type, must be all_chat_administrators | +
Represents the scope of bot commands, covering a specific chat.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Scope type, must be chat | +
chat_id | +Integer or String | +Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
+
Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Scope type, must be chat_administrators | +
chat_id | +Integer or String | +Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
+
Represents the scope of bot commands, covering a specific member of a group or supergroup chat.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Scope type, must be chat_member | +
chat_id | +Integer or String | +Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
+
user_id | +Integer | +Unique identifier of the target user | +
Contains information about why a request was unsuccessful.
+Field | +Type | +Description | +
---|---|---|
migrate_to_chat_id | +Integer | +Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. | +
retry_after | +Integer | +Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated | +
This object represents the content of a media message to be sent. It should be one of
+ +Represents a photo to be sent.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be photo | +
media | +String | +File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » | +
caption | +String | +Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the photo caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
Represents a video to be sent.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be video | +
media | +String | +File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » | +
thumb | +InputFile or String | +Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files » | +
caption | +String | +Optional. Caption of the video to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the video caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
width | +Integer | +Optional. Video width | +
height | +Integer | +Optional. Video height | +
duration | +Integer | +Optional. Video duration in seconds | +
supports_streaming | +Boolean | +Optional. Pass True, if the uploaded video is suitable for streaming | +
Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be animation | +
media | +String | +File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » | +
thumb | +InputFile or String | +Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files » | +
caption | +String | +Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the animation caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
width | +Integer | +Optional. Animation width | +
height | +Integer | +Optional. Animation height | +
duration | +Integer | +Optional. Animation duration in seconds | +
Represents an audio file to be treated as music to be sent.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be audio | +
media | +String | +File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » | +
thumb | +InputFile or String | +Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files » | +
caption | +String | +Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the audio caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
duration | +Integer | +Optional. Duration of the audio in seconds | +
performer | +String | +Optional. Performer of the audio | +
title | +String | +Optional. Title of the audio | +
Represents a general file to be sent.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be document | +
media | +String | +File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More info on Sending Files » | +
thumb | +InputFile or String | +Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files » | +
caption | +String | +Optional. Caption of the document to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the document caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
disable_content_type_detection | +Boolean | +Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album. | +
This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.
+There are three ways to send files (photos, stickers, audio, media, etc.):
+Sending by file_id
+Sending by URL
+Objects and methods used in the inline mode are described in the Inline mode section.
+++All methods in the Bot API are case-insensitive. We support GET and POST HTTP methods. Use either URL query string or application/json or application/x-www-form-urlencoded or multipart/form-data for passing parameters in Bot API requests.
+
On successful call, a JSON-object containing the result will be returned.
A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.
+Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters.
+Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters.
+Use this method to send text messages. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
text | +String | +Yes | +Text of the message to be sent, 1-4096 characters after entities parsing | +
parse_mode | +String | +Optional | +Mode for parsing entities in the message text. See formatting options for more details. | +
entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode | +
disable_web_page_preview | +Boolean | +Optional | +Disables link previews for links in this message | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
The Bot API supports basic formatting for messages. You can use bold, italic, underlined and strikethrough text, as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting.
+Note that Telegram clients will display an alert to the user before opening an inline link ('Open this link?' together with the full URL).
+Message entities can be nested, providing following restrictions are met:
- If two entities has common characters then one of them is fully contained inside another.
- bold, italic, underline and strikethrough entities can contain and to be contained in any other entities, except pre and code.
- All other entities can't contain each other.
Links tg://user?id=<user_id>
can be used to mention a user by their ID without using a username. Please note:
To use this mode, pass MarkdownV2 in the parse_mode field. Use the following syntax in your message:
+*bold \*text*
+_italic \*text_
+__underline__
+~strikethrough~
+*bold _italic bold ~italic bold strikethrough~ __underline italic bold___ bold*
+[inline URL](http://www.example.com/)
+[inline mention of a user](tg://user?id=123456789)
+`inline fixed-width code`
+```
+pre-formatted fixed-width code block
+```
+```python
+pre-formatted fixed-width code block written in the Python programming language
+```
+Please note:
+pre
and code
entities, all '`' and '\' characters must be escaped with a preceding '\' character.(...)
part of inline link definition, all ')' and '\' must be escaped with a preceding '\' character.italic
and underline
entities __
is always greadily treated from left to right as beginning or end of underline
entity, so instead of ___italic underline___
use ___italic underline_\r__
, where \r
is a character with code 13, which will be ignored.To use this mode, pass HTML in the parse_mode field. The following tags are currently supported:
+<b>bold</b>, <strong>bold</strong>
+<i>italic</i>, <em>italic</em>
+<u>underline</u>, <ins>underline</ins>
+<s>strikethrough</s>, <strike>strikethrough</strike>, <del>strikethrough</del>
+<b>bold <i>italic bold <s>italic bold strikethrough</s> <u>underline italic bold</u></i> bold</b>
+<a href="http://www.example.com/">inline URL</a>
+<a href="tg://user?id=123456789">inline mention of a user</a>
+<code>inline fixed-width code</code>
+<pre>pre-formatted fixed-width code block</pre>
+<pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>
+Please note:
+<
, >
and &
symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (<
with <
, >
with >
and &
with &
).<
, >
, &
and "
.pre
and code
tags, to define programming language for pre
entity.code
tags.This is a legacy mode, retained for backward compatibility. To use this mode, pass Markdown in the parse_mode field. Use the following syntax in your message:
+*bold text*
+_italic text_
+[inline URL](http://www.example.com/)
+[inline mention of a user](tg://user?id=123456789)
+`inline fixed-width code`
+```
+pre-formatted fixed-width code block
+```
+```python
+pre-formatted fixed-width code block written in the Python programming language
+```
+Please note:
+_snake_\__case_
for italic snake_case
and *2*\**2=4*
for bold 2*2=4
.Use this method to forward messages of any kind. Service messages can't be forwarded. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
from_chat_id | +Integer or String | +Yes | +Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername ) |
+
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
message_id | +Integer | +Yes | +Message identifier in the chat specified in from_chat_id | +
Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
from_chat_id | +Integer or String | +Yes | +Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername ) |
+
message_id | +Integer | +Yes | +Message identifier in the chat specified in from_chat_id | +
caption | +String | +Optional | +New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept | +
parse_mode | +String | +Optional | +Mode for parsing entities in the new caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to send photos. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
photo | +InputFile or String | +Yes | +Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More info on Sending Files » | +
caption | +String | +Optional | +Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional | +Mode for parsing entities in the photo caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
+For sending voice messages, use the sendVoice method instead.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
audio | +InputFile or String | +Yes | +Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » | +
caption | +String | +Optional | +Audio caption, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional | +Mode for parsing entities in the audio caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode | +
duration | +Integer | +Optional | +Duration of the audio in seconds | +
performer | +String | +Optional | +Performer | +
title | +String | +Optional | +Track name | +
thumb | +InputFile or String | +Optional | +Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files » | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
document | +InputFile or String | +Yes | +File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » | +
thumb | +InputFile or String | +Optional | +Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files » | +
caption | +String | +Optional | +Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional | +Mode for parsing entities in the document caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode | +
disable_content_type_detection | +Boolean | +Optional | +Disables automatic server-side content type detection for files uploaded using multipart/form-data | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
video | +InputFile or String | +Yes | +Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More info on Sending Files » | +
duration | +Integer | +Optional | +Duration of sent video in seconds | +
width | +Integer | +Optional | +Video width | +
height | +Integer | +Optional | +Video height | +
thumb | +InputFile or String | +Optional | +Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files » | +
caption | +String | +Optional | +Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional | +Mode for parsing entities in the video caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode | +
supports_streaming | +Boolean | +Optional | +Pass True, if the uploaded video is suitable for streaming | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
animation | +InputFile or String | +Yes | +Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More info on Sending Files » | +
duration | +Integer | +Optional | +Duration of sent animation in seconds | +
width | +Integer | +Optional | +Animation width | +
height | +Integer | +Optional | +Animation height | +
thumb | +InputFile or String | +Optional | +Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files » | +
caption | +String | +Optional | +Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional | +Mode for parsing entities in the animation caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
voice | +InputFile or String | +Yes | +Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » | +
caption | +String | +Optional | +Voice message caption, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional | +Mode for parsing entities in the voice message caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode | +
duration | +Integer | +Optional | +Duration of the voice message in seconds | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
video_note | +InputFile or String | +Yes | +Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported | +
duration | +Integer | +Optional | +Duration of sent video in seconds | +
length | +Integer | +Optional | +Video width and height, i.e. diameter of the video message | +
thumb | +InputFile or String | +Optional | +Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files » | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
media | +Array of InputMediaAudio, InputMediaDocument, InputMediaPhoto and InputMediaVideo | +Yes | +A JSON-serialized array describing messages to be sent, must include 2-10 items | +
disable_notification | +Boolean | +Optional | +Sends messages silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the messages are a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
Use this method to send point on the map. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
latitude | +Float number | +Yes | +Latitude of the location | +
longitude | +Float number | +Yes | +Longitude of the location | +
horizontal_accuracy | +Float number | +Optional | +The radius of uncertainty for the location, measured in meters; 0-1500 | +
live_period | +Integer | +Optional | +Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400. | +
heading | +Integer | +Optional | +For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. | +
proximity_alert_radius | +Integer | +Optional | +For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Optional | +Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Optional | +Required if inline_message_id is not specified. Identifier of the message to edit | +
inline_message_id | +String | +Optional | +Required if chat_id and message_id are not specified. Identifier of the inline message | +
latitude | +Float number | +Yes | +Latitude of new location | +
longitude | +Float number | +Yes | +Longitude of new location | +
horizontal_accuracy | +Float number | +Optional | +The radius of uncertainty for the location, measured in meters; 0-1500 | +
heading | +Integer | +Optional | +Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. | +
proximity_alert_radius | +Integer | +Optional | +Maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. | +
reply_markup | +InlineKeyboardMarkup | +Optional | +A JSON-serialized object for a new inline keyboard. | +
Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Optional | +Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Optional | +Required if inline_message_id is not specified. Identifier of the message with live location to stop | +
inline_message_id | +String | +Optional | +Required if chat_id and message_id are not specified. Identifier of the inline message | +
reply_markup | +InlineKeyboardMarkup | +Optional | +A JSON-serialized object for a new inline keyboard. | +
Use this method to send information about a venue. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
latitude | +Float number | +Yes | +Latitude of the venue | +
longitude | +Float number | +Yes | +Longitude of the venue | +
title | +String | +Yes | +Name of the venue | +
address | +String | +Yes | +Address of the venue | +
foursquare_id | +String | +Optional | +Foursquare identifier of the venue | +
foursquare_type | +String | +Optional | +Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) | +
google_place_id | +String | +Optional | +Google Places identifier of the venue | +
google_place_type | +String | +Optional | +Google Places type of the venue. (See supported types.) | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to send phone contacts. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
phone_number | +String | +Yes | +Contact's phone number | +
first_name | +String | +Yes | +Contact's first name | +
last_name | +String | +Optional | +Contact's last name | +
vcard | +String | +Optional | +Additional data about the contact in the form of a vCard, 0-2048 bytes | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove keyboard or to force a reply from the user. | +
Use this method to send a native poll. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
question | +String | +Yes | +Poll question, 1-300 characters | +
options | +Array of String | +Yes | +A JSON-serialized list of answer options, 2-10 strings 1-100 characters each | +
is_anonymous | +Boolean | +Optional | +True, if the poll needs to be anonymous, defaults to True | +
type | +String | +Optional | +Poll type, “quiz” or “regular”, defaults to “regular” | +
allows_multiple_answers | +Boolean | +Optional | +True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False | +
correct_option_id | +Integer | +Optional | +0-based identifier of the correct answer option, required for polls in quiz mode | +
explanation | +String | +Optional | +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 after entities parsing | +
explanation_parse_mode | +String | +Optional | +Mode for parsing entities in the explanation. See formatting options for more details. | +
explanation_entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in the poll explanation, which can be specified instead of parse_mode | +
open_period | +Integer | +Optional | +Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. | +
close_date | +Integer | +Optional | +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 open_period. | +
is_closed | +Boolean | +Optional | +Pass True, if the poll needs to be immediately closed. This can be useful for poll preview. | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
emoji | +String | +Optional | +Emoji on which the dice throw animation is based. Currently, must be one of “![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
+
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
+++Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot.
+
We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
action | +String | +Yes | +Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes. | +
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
user_id | +Integer | +Yes | +Unique identifier of the target user | +
offset | +Integer | +Optional | +Sequential number of the first photo to be returned. By default, all photos are returned. | +
limit | +Integer | +Optional | +Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. | +
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>
, where <file_path>
is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
Parameter | +Type | +Required | +Description | +
---|---|---|---|
file_id | +String | +Yes | +File identifier to get info about | +
Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
+Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername ) |
+
user_id | +Integer | +Yes | +Unique identifier of the target user | +
until_date | +Integer | +Optional | +Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only. | +
revoke_messages | +Boolean | +Optional | +Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels. | +
Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target group or username of the target supergroup or channel (in the format @username ) |
+
user_id | +Integer | +Yes | +Unique identifier of the target user | +
only_if_banned | +Boolean | +Optional | +Do nothing if the user is not banned | +
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
+
user_id | +Integer | +Yes | +Unique identifier of the target user | +
permissions | +ChatPermissions | +Yes | +A JSON-serialized object for new user permissions | +
until_date | +Integer | +Optional | +Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever | +
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
user_id | +Integer | +Yes | +Unique identifier of the target user | +
is_anonymous | +Boolean | +Optional | +Pass True, if the administrator's presence in the chat is hidden | +
can_manage_chat | +Boolean | +Optional | +Pass True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege | +
can_post_messages | +Boolean | +Optional | +Pass True, if the administrator can create channel posts, channels only | +
can_edit_messages | +Boolean | +Optional | +Pass True, if the administrator can edit messages of other users and can pin messages, channels only | +
can_delete_messages | +Boolean | +Optional | +Pass True, if the administrator can delete messages of other users | +
can_manage_voice_chats | +Boolean | +Optional | +Pass True, if the administrator can manage voice chats | +
can_restrict_members | +Boolean | +Optional | +Pass True, if the administrator can restrict, ban or unban chat members | +
can_promote_members | +Boolean | +Optional | +Pass True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) | +
can_change_info | +Boolean | +Optional | +Pass True, if the administrator can change chat title, photo and other settings | +
can_invite_users | +Boolean | +Optional | +Pass True, if the administrator can invite new users to the chat | +
can_pin_messages | +Boolean | +Optional | +Pass True, if the administrator can pin messages, supergroups only | +
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
+
user_id | +Integer | +Yes | +Unique identifier of the target user | +
custom_title | +String | +Yes | +New custom title for the administrator; 0-16 characters, emoji are not allowed | +
Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
sender_chat_id | +Integer | +Yes | +Unique identifier of the target sender chat | +
Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
sender_chat_id | +Integer | +Yes | +Unique identifier of the target sender chat | +
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
+
permissions | +ChatPermissions | +Yes | +A JSON-serialized object for new default chat permissions | +
Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
++Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink or by calling the getChat method. If your bot needs to generate a new primary invite link replacing its previous one, use exportChatInviteLink again.
+
Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
name | +String | +Optional | +Invite link name; 0-32 characters | +
expire_date | +Integer | +Optional | +Point in time (Unix timestamp) when the link will expire | +
member_limit | +Integer | +Optional | +Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 | +
creates_join_request | +Boolean | +Optional | +True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified | +
Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
invite_link | +String | +Yes | +The invite link to edit | +
name | +String | +Optional | +Invite link name; 0-32 characters | +
expire_date | +Integer | +Optional | +Point in time (Unix timestamp) when the link will expire | +
member_limit | +Integer | +Optional | +Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 | +
creates_join_request | +Boolean | +Optional | +True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified | +
Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier of the target chat or username of the target channel (in the format @channelusername ) |
+
invite_link | +String | +Yes | +The invite link to revoke | +
Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
user_id | +Integer | +Yes | +Unique identifier of the target user | +
Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
user_id | +Integer | +Yes | +Unique identifier of the target user | +
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
photo | +InputFile | +Yes | +New chat photo, uploaded using multipart/form-data | +
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
title | +String | +Yes | +New chat title, 1-255 characters | +
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
description | +String | +Optional | +New chat description, 0-255 characters | +
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Yes | +Identifier of a message to pin | +
disable_notification | +Boolean | +Optional | +Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats. | +
Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Optional | +Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned. | +
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
+
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
+
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
+
Use this method to get the number of members in a chat. Returns Int on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
+
Use this method to get information about a member of a chat. Returns a ChatMember object on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
+
user_id | +Integer | +Yes | +Unique identifier of the target user | +
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
+
sticker_set_name | +String | +Yes | +Name of the sticker set to be set as the group sticker set | +
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
+
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
+++Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like
+t.me/your_bot?start=XXXX
that open your bot with a parameter.
Parameter | +Type | +Required | +Description | +
---|---|---|---|
callback_query_id | +String | +Yes | +Unique identifier for the query to be answered | +
text | +String | +Optional | +Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters | +
show_alert | +Boolean | +Optional | +If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. | +
url | +String | +Optional | +URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game — note that this will only work if the query comes from a callback_game button. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. |
+
cache_time | +Integer | +Optional | +The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. | +
Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
commands | +Array of BotCommand | +Yes | +A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified. | +
scope | +BotCommandScope | +Optional | +A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. | +
language_code | +String | +Optional | +A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands | +
Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
scope | +BotCommandScope | +Optional | +A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. | +
language_code | +String | +Optional | +A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands | +
Use this method to get the current list of the bot's commands for the given scope and user language. Returns Array of BotCommand on success. If commands aren't set, an empty list is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
scope | +BotCommandScope | +Optional | +A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault. | +
language_code | +String | +Optional | +A two-letter ISO 639-1 language code or an empty string | +
Methods and objects used in the inline mode are described in the Inline mode section.
+The following methods allow you to change an existing message in the message history instead of sending a new one with a result of an action. This is most useful for messages with inline keyboards using callback queries, but can also help reduce clutter in conversations with regular chat bots.
+Please note, that it is currently only possible to edit messages without reply_markup or with inline keyboards.
+Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Optional | +Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Optional | +Required if inline_message_id is not specified. Identifier of the message to edit | +
inline_message_id | +String | +Optional | +Required if chat_id and message_id are not specified. Identifier of the inline message | +
text | +String | +Yes | +New text of the message, 1-4096 characters after entities parsing | +
parse_mode | +String | +Optional | +Mode for parsing entities in the message text. See formatting options for more details. | +
entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode | +
disable_web_page_preview | +Boolean | +Optional | +Disables link previews for links in this message | +
reply_markup | +InlineKeyboardMarkup | +Optional | +A JSON-serialized object for an inline keyboard. | +
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Optional | +Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Optional | +Required if inline_message_id is not specified. Identifier of the message to edit | +
inline_message_id | +String | +Optional | +Required if chat_id and message_id are not specified. Identifier of the inline message | +
caption | +String | +Optional | +New caption of the message, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional | +Mode for parsing entities in the message caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional | +A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional | +A JSON-serialized object for an inline keyboard. | +
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Optional | +Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Optional | +Required if inline_message_id is not specified. Identifier of the message to edit | +
inline_message_id | +String | +Optional | +Required if chat_id and message_id are not specified. Identifier of the inline message | +
media | +InputMedia | +Yes | +A JSON-serialized object for a new media content of the message | +
reply_markup | +InlineKeyboardMarkup | +Optional | +A JSON-serialized object for a new inline keyboard. | +
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Optional | +Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Optional | +Required if inline_message_id is not specified. Identifier of the message to edit | +
inline_message_id | +String | +Optional | +Required if chat_id and message_id are not specified. Identifier of the inline message | +
reply_markup | +InlineKeyboardMarkup | +Optional | +A JSON-serialized object for an inline keyboard. | +
Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Yes | +Identifier of the original message with the poll | +
reply_markup | +InlineKeyboardMarkup | +Optional | +A JSON-serialized object for a new message inline keyboard. | +
Use this method to delete a message, including service messages, with the following limitations:
- A message can only be deleted if it was sent less than 48 hours ago.
- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
- Bots can delete outgoing messages in private chats, groups, and supergroups.
- Bots can delete incoming messages in private chats.
- Bots granted can_post_messages permissions can delete outgoing messages in channels.
- If the bot is an administrator of a group, it can delete any message there.
- If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
Returns True on success.
Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
message_id | +Integer | +Yes | +Identifier of the message to delete | +
The following methods and objects allow your bot to handle stickers and sticker sets.
+This object represents a sticker.
+Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
width | +Integer | +Sticker width | +
height | +Integer | +Sticker height | +
is_animated | +Boolean | +True, if the sticker is animated | +
thumb | +PhotoSize | +Optional. Sticker thumbnail in the .WEBP or .JPG format | +
emoji | +String | +Optional. Emoji associated with the sticker | +
set_name | +String | +Optional. Name of the sticker set to which the sticker belongs | +
mask_position | +MaskPosition | +Optional. For mask stickers, the position where the mask should be placed | +
file_size | +Integer | +Optional. File size in bytes | +
This object represents a sticker set.
+Field | +Type | +Description | +
---|---|---|
name | +String | +Sticker set name | +
title | +String | +Sticker set title | +
is_animated | +Boolean | +True, if the sticker set contains animated stickers | +
contains_masks | +Boolean | +True, if the sticker set contains masks | +
stickers | +Array of Sticker | +List of all set stickers | +
thumb | +PhotoSize | +Optional. Sticker set thumbnail in the .WEBP or .TGS format | +
This object describes the position on faces where a mask should be placed by default.
+Field | +Type | +Description | +
---|---|---|
point | +String | +The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”. | +
x_shift | +Float number | +Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. | +
y_shift | +Float number | +Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. | +
scale | +Float number | +Mask scaling coefficient. For example, 2.0 means double size. | +
Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
sticker | +InputFile or String | +Yes | +Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | +Optional | +Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | +
Use this method to get a sticker set. On success, a StickerSet object is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
name | +String | +Yes | +Name of the sticker set | +
Use this method to upload a .PNG file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
user_id | +Integer | +Yes | +User identifier of sticker file owner | +
png_sticker | +InputFile | +Yes | +PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. More info on Sending Files » | +
Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You must use exactly one of the fields png_sticker or tgs_sticker. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
user_id | +Integer | +Yes | +User identifier of created sticker set owner | +
name | +String | +Yes | +Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters. |
+
title | +String | +Yes | +Sticker set title, 1-64 characters | +
png_sticker | +InputFile or String | +Optional | +PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » | +
tgs_sticker | +InputFile | +Optional | +TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements | +
emojis | +String | +Yes | +One or more emoji corresponding to the sticker | +
contains_masks | +Boolean | +Optional | +Pass True, if a set of mask stickers should be created | +
mask_position | +MaskPosition | +Optional | +A JSON-serialized object for position where the mask should be placed on faces | +
Use this method to add a new sticker to a set created by the bot. You must use exactly one of the fields png_sticker or tgs_sticker. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
user_id | +Integer | +Yes | +User identifier of sticker set owner | +
name | +String | +Yes | +Sticker set name | +
png_sticker | +InputFile or String | +Optional | +PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » | +
tgs_sticker | +InputFile | +Optional | +TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements | +
emojis | +String | +Yes | +One or more emoji corresponding to the sticker | +
mask_position | +MaskPosition | +Optional | +A JSON-serialized object for position where the mask should be placed on faces | +
Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
sticker | +String | +Yes | +File identifier of the sticker | +
position | +Integer | +Yes | +New sticker position in the set, zero-based | +
Use this method to delete a sticker from a set created by the bot. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
sticker | +String | +Yes | +File identifier of the sticker | +
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns True on success.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
name | +String | +Yes | +Sticker set name | +
user_id | +Integer | +Yes | +User identifier of the sticker set owner | +
thumb | +InputFile or String | +Optional | +A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/animated_stickers#technical-requirements for animated sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files ». Animated sticker set thumbnail can't be uploaded via HTTP URL. | +
The following methods and objects allow your bot to work in inline mode.
Please see our Introduction to Inline bots for more details.
To enable this option, send the /setinline
command to @BotFather and provide the placeholder text that the user will see in the input field after typing your bot's name.
This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
+Field | +Type | +Description | +
---|---|---|
id | +String | +Unique identifier for this query | +
from | +User | +Sender | +
query | +String | +Text of the query (up to 256 characters) | +
offset | +String | +Offset of the results to be returned, can be controlled by the bot | +
chat_type | +String | +Optional. Type of the chat, from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat | +
location | +Location | +Optional. Sender location, only for bots that request user location | +
Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results per query are allowed.
Parameter | +Type | +Required | +Description | +
---|---|---|---|
inline_query_id | +String | +Yes | +Unique identifier for the answered query | +
results | +Array of InlineQueryResult | +Yes | +A JSON-serialized array of results for the inline query | +
cache_time | +Integer | +Optional | +The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. | +
is_personal | +Boolean | +Optional | +Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query | +
next_offset | +String | +Optional | +Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. | +
switch_pm_text | +String | +Optional | +If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter | +
switch_pm_parameter | +String | +Optional | +Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z , a-z , 0-9 , _ and - are allowed.Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities. |
+
This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
+Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public.
+Represents a link to an article or web page.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be article | +
id | +String | +Unique identifier for this result, 1-64 Bytes | +
title | +String | +Title of the result | +
input_message_content | +InputMessageContent | +Content of the message to be sent | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
url | +String | +Optional. URL of the result | +
hide_url | +Boolean | +Optional. Pass True, if you don't want the URL to be shown in the message | +
description | +String | +Optional. Short description of the result | +
thumb_url | +String | +Optional. Url of the thumbnail for the result | +
thumb_width | +Integer | +Optional. Thumbnail width | +
thumb_height | +Integer | +Optional. Thumbnail height | +
Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be photo | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
photo_url | +String | +A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB | +
thumb_url | +String | +URL of the thumbnail for the photo | +
photo_width | +Integer | +Optional. Width of the photo | +
photo_height | +Integer | +Optional. Height of the photo | +
title | +String | +Optional. Title for the result | +
description | +String | +Optional. Short description of the result | +
caption | +String | +Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the photo caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the photo | +
Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be gif | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
gif_url | +String | +A valid URL for the GIF file. File size must not exceed 1MB | +
gif_width | +Integer | +Optional. Width of the GIF | +
gif_height | +Integer | +Optional. Height of the GIF | +
gif_duration | +Integer | +Optional. Duration of the GIF in seconds | +
thumb_url | +String | +URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result | +
thumb_mime_type | +String | +Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” | +
title | +String | +Optional. Title for the result | +
caption | +String | +Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the GIF animation | +
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be mpeg4_gif | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
mpeg4_url | +String | +A valid URL for the MP4 file. File size must not exceed 1MB | +
mpeg4_width | +Integer | +Optional. Video width | +
mpeg4_height | +Integer | +Optional. Video height | +
mpeg4_duration | +Integer | +Optional. Video duration in seconds | +
thumb_url | +String | +URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result | +
thumb_mime_type | +String | +Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” | +
title | +String | +Optional. Title for the result | +
caption | +String | +Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the video animation | +
Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
+++If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content.
+
Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be video | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
video_url | +String | +A valid URL for the embedded video player or video file | +
mime_type | +String | +Mime type of the content of video url, “text/html” or “video/mp4” | +
thumb_url | +String | +URL of the thumbnail (JPEG only) for the video | +
title | +String | +Title for the result | +
caption | +String | +Optional. Caption of the video to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the video caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
video_width | +Integer | +Optional. Video width | +
video_height | +Integer | +Optional. Video height | +
video_duration | +Integer | +Optional. Video duration in seconds | +
description | +String | +Optional. Short description of the result | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). | +
Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be audio | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
audio_url | +String | +A valid URL for the audio file | +
title | +String | +Title | +
caption | +String | +Optional. Caption, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the audio caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
performer | +String | +Optional. Performer | +
audio_duration | +Integer | +Optional. Audio duration in seconds | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the audio | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
+Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be voice | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
voice_url | +String | +A valid URL for the voice recording | +
title | +String | +Recording title | +
caption | +String | +Optional. Caption, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
voice_duration | +Integer | +Optional. Recording duration in seconds | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the voice recording | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
+Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be document | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
title | +String | +Title for the result | +
caption | +String | +Optional. Caption of the document to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the document caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
document_url | +String | +A valid URL for the file | +
mime_type | +String | +Mime type of the content of the file, either “application/pdf” or “application/zip” | +
description | +String | +Optional. Short description of the result | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the file | +
thumb_url | +String | +Optional. URL of the thumbnail (JPEG only) for the file | +
thumb_width | +Integer | +Optional. Thumbnail width | +
thumb_height | +Integer | +Optional. Thumbnail height | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
+Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be location | +
id | +String | +Unique identifier for this result, 1-64 Bytes | +
latitude | +Float number | +Location latitude in degrees | +
longitude | +Float number | +Location longitude in degrees | +
title | +String | +Location title | +
horizontal_accuracy | +Float number | +Optional. The radius of uncertainty for the location, measured in meters; 0-1500 | +
live_period | +Integer | +Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. | +
heading | +Integer | +Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. | +
proximity_alert_radius | +Integer | +Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the location | +
thumb_url | +String | +Optional. Url of the thumbnail for the result | +
thumb_width | +Integer | +Optional. Thumbnail width | +
thumb_height | +Integer | +Optional. Thumbnail height | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
+Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be venue | +
id | +String | +Unique identifier for this result, 1-64 Bytes | +
latitude | +Float | +Latitude of the venue location in degrees | +
longitude | +Float | +Longitude of the venue location in degrees | +
title | +String | +Title of the venue | +
address | +String | +Address of the venue | +
foursquare_id | +String | +Optional. Foursquare identifier of the venue if known | +
foursquare_type | +String | +Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) | +
google_place_id | +String | +Optional. Google Places identifier of the venue | +
google_place_type | +String | +Optional. Google Places type of the venue. (See supported types.) | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the venue | +
thumb_url | +String | +Optional. Url of the thumbnail for the result | +
thumb_width | +Integer | +Optional. Thumbnail width | +
thumb_height | +Integer | +Optional. Thumbnail height | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
+Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be contact | +
id | +String | +Unique identifier for this result, 1-64 Bytes | +
phone_number | +String | +Contact's phone number | +
first_name | +String | +Contact's first name | +
last_name | +String | +Optional. Contact's last name | +
vcard | +String | +Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the contact | +
thumb_url | +String | +Optional. Url of the thumbnail for the result | +
thumb_width | +Integer | +Optional. Thumbnail width | +
thumb_height | +Integer | +Optional. Thumbnail height | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
+Represents a Game.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be game | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
game_short_name | +String | +Short name of the game | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
Note: This will only work in Telegram versions released after October 1, 2016. Older clients will not display any inline results if a game result is among them.
+Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be photo | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
photo_file_id | +String | +A valid file identifier of the photo | +
title | +String | +Optional. Title for the result | +
description | +String | +Optional. Short description of the result | +
caption | +String | +Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the photo caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the photo | +
Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be gif | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
gif_file_id | +String | +A valid file identifier for the GIF file | +
title | +String | +Optional. Title for the result | +
caption | +String | +Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the GIF animation | +
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be mpeg4_gif | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
mpeg4_file_id | +String | +A valid file identifier for the MP4 file | +
title | +String | +Optional. Title for the result | +
caption | +String | +Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the video animation | +
Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be sticker | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
sticker_file_id | +String | +A valid file identifier of the sticker | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the sticker | +
Note: This will only work in Telegram versions released after 9 April, 2016 for static stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them.
+Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be document | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
title | +String | +Title for the result | +
document_file_id | +String | +A valid file identifier for the file | +
description | +String | +Optional. Short description of the result | +
caption | +String | +Optional. Caption of the document to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the document caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the file | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
+Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be video | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
video_file_id | +String | +A valid file identifier for the video file | +
title | +String | +Title for the result | +
description | +String | +Optional. Short description of the result | +
caption | +String | +Optional. Caption of the video to be sent, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the video caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the video | +
Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be voice | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
voice_file_id | +String | +A valid file identifier for the voice message | +
title | +String | +Voice message title | +
caption | +String | +Optional. Caption, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the voice message | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
+Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Type of the result, must be audio | +
id | +String | +Unique identifier for this result, 1-64 bytes | +
audio_file_id | +String | +A valid file identifier for the audio file | +
caption | +String | +Optional. Caption, 0-1024 characters after entities parsing | +
parse_mode | +String | +Optional. Mode for parsing entities in the audio caption. See formatting options for more details. | +
caption_entities | +Array of MessageEntity | +Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode | +
reply_markup | +InlineKeyboardMarkup | +Optional. Inline keyboard attached to the message | +
input_message_content | +InputMessageContent | +Optional. Content of the message to be sent instead of the audio | +
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
+This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:
+Represents the content of a text message to be sent as the result of an inline query.
+Field | +Type | +Description | +
---|---|---|
message_text | +String | +Text of the message to be sent, 1-4096 characters | +
parse_mode | +String | +Optional. Mode for parsing entities in the message text. See formatting options for more details. | +
entities | +Array of MessageEntity | +Optional. List of special entities that appear in message text, which can be specified instead of parse_mode | +
disable_web_page_preview | +Boolean | +Optional. Disables link previews for links in the sent message | +
Represents the content of a location message to be sent as the result of an inline query.
+Field | +Type | +Description | +
---|---|---|
latitude | +Float | +Latitude of the location in degrees | +
longitude | +Float | +Longitude of the location in degrees | +
horizontal_accuracy | +Float number | +Optional. The radius of uncertainty for the location, measured in meters; 0-1500 | +
live_period | +Integer | +Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. | +
heading | +Integer | +Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. | +
proximity_alert_radius | +Integer | +Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. | +
Represents the content of a venue message to be sent as the result of an inline query.
+Field | +Type | +Description | +
---|---|---|
latitude | +Float | +Latitude of the venue in degrees | +
longitude | +Float | +Longitude of the venue in degrees | +
title | +String | +Name of the venue | +
address | +String | +Address of the venue | +
foursquare_id | +String | +Optional. Foursquare identifier of the venue, if known | +
foursquare_type | +String | +Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) | +
google_place_id | +String | +Optional. Google Places identifier of the venue | +
google_place_type | +String | +Optional. Google Places type of the venue. (See supported types.) | +
Represents the content of a contact message to be sent as the result of an inline query.
+Field | +Type | +Description | +
---|---|---|
phone_number | +String | +Contact's phone number | +
first_name | +String | +Contact's first name | +
last_name | +String | +Optional. Contact's last name | +
vcard | +String | +Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes | +
Represents the content of an invoice message to be sent as the result of an inline query.
+Field | +Type | +Description | +
---|---|---|
title | +String | +Product name, 1-32 characters | +
description | +String | +Product description, 1-255 characters | +
payload | +String | +Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. | +
provider_token | +String | +Payment provider token, obtained via Botfather | +
currency | +String | +Three-letter ISO 4217 currency code, see more on currencies | +
prices | +Array of LabeledPrice | +Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) | +
max_tip_amount | +Integer | +Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145 . See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 |
+
suggested_tip_amounts | +Array of Integer | +Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. | +
provider_data | +String | +Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. | +
photo_url | +String | +Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. | +
photo_size | +Integer | +Optional. Photo size | +
photo_width | +Integer | +Optional. Photo width | +
photo_height | +Integer | +Optional. Photo height | +
need_name | +Boolean | +Optional. Pass True, if you require the user's full name to complete the order | +
need_phone_number | +Boolean | +Optional. Pass True, if you require the user's phone number to complete the order | +
need_email | +Boolean | +Optional. Pass True, if you require the user's email address to complete the order | +
need_shipping_address | +Boolean | +Optional. Pass True, if you require the user's shipping address to complete the order | +
send_phone_number_to_provider | +Boolean | +Optional. Pass True, if user's phone number should be sent to provider | +
send_email_to_provider | +Boolean | +Optional. Pass True, if user's email address should be sent to provider | +
is_flexible | +Boolean | +Optional. Pass True, if the final price depends on the shipping method | +
Represents a result of an inline query that was chosen by the user and sent to their chat partner.
+Field | +Type | +Description | +
---|---|---|
result_id | +String | +The unique identifier for the result that was chosen | +
from | +User | +The user that chose the result | +
location | +Location | +Optional. Sender location, only for bots that require user location | +
inline_message_id | +String | +Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. | +
query | +String | +The query that was used to obtain the result | +
Note: It is necessary to enable inline feedback via @Botfather in order to receive these objects in updates.
+Your bot can accept payments from Telegram users. Please see the introduction to payments for more details on the process and how to set up payments for your bot. Please note that users will need Telegram v.4.0 or higher to use payments (released on May 18, 2017).
+Use this method to send invoices. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer or String | +Yes | +Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
+
title | +String | +Yes | +Product name, 1-32 characters | +
description | +String | +Yes | +Product description, 1-255 characters | +
payload | +String | +Yes | +Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. | +
provider_token | +String | +Yes | +Payments provider token, obtained via Botfather | +
currency | +String | +Yes | +Three-letter ISO 4217 currency code, see more on currencies | +
prices | +Array of LabeledPrice | +Yes | +Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) | +
max_tip_amount | +Integer | +Optional | +The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145 . See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 |
+
suggested_tip_amounts | +Array of Integer | +Optional | +A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. | +
start_parameter | +String | +Optional | +Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter | +
provider_data | +String | +Optional | +A JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. | +
photo_url | +String | +Optional | +URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. | +
photo_size | +Integer | +Optional | +Photo size | +
photo_width | +Integer | +Optional | +Photo width | +
photo_height | +Integer | +Optional | +Photo height | +
need_name | +Boolean | +Optional | +Pass True, if you require the user's full name to complete the order | +
need_phone_number | +Boolean | +Optional | +Pass True, if you require the user's phone number to complete the order | +
need_email | +Boolean | +Optional | +Pass True, if you require the user's email address to complete the order | +
need_shipping_address | +Boolean | +Optional | +Pass True, if you require the user's shipping address to complete the order | +
send_phone_number_to_provider | +Boolean | +Optional | +Pass True, if user's phone number should be sent to provider | +
send_email_to_provider | +Boolean | +Optional | +Pass True, if user's email address should be sent to provider | +
is_flexible | +Boolean | +Optional | +Pass True, if the final price depends on the shipping method | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup | +Optional | +A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price ' button will be shown. If not empty, the first button must be a Pay button. |
+
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
shipping_query_id | +String | +Yes | +Unique identifier for the query to be answered | +
ok | +Boolean | +Yes | +Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible) | +
shipping_options | +Array of ShippingOption | +Optional | +Required if ok is True. A JSON-serialized array of available shipping options. | +
error_message | +String | +Optional | +Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. | +
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
pre_checkout_query_id | +String | +Yes | +Unique identifier for the query to be answered | +
ok | +Boolean | +Yes | +Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems. | +
error_message | +String | +Optional | +Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. | +
This object represents a portion of the price for goods or services.
+Field | +Type | +Description | +
---|---|---|
label | +String | +Portion label | +
amount | +Integer | +Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145 . See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). |
+
This object contains basic information about an invoice.
+Field | +Type | +Description | +
---|---|---|
title | +String | +Product name | +
description | +String | +Product description | +
start_parameter | +String | +Unique bot deep-linking parameter that can be used to generate this invoice | +
currency | +String | +Three-letter ISO 4217 currency code | +
total_amount | +Integer | +Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145 . See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). |
+
This object represents a shipping address.
+Field | +Type | +Description | +
---|---|---|
country_code | +String | +ISO 3166-1 alpha-2 country code | +
state | +String | +State, if applicable | +
city | +String | +City | +
street_line1 | +String | +First line for the address | +
street_line2 | +String | +Second line for the address | +
post_code | +String | +Address post code | +
This object represents information about an order.
+Field | +Type | +Description | +
---|---|---|
name | +String | +Optional. User name | +
phone_number | +String | +Optional. User's phone number | +
String | +Optional. User email | +|
shipping_address | +ShippingAddress | +Optional. User shipping address | +
This object represents one shipping option.
+Field | +Type | +Description | +
---|---|---|
id | +String | +Shipping option identifier | +
title | +String | +Option title | +
prices | +Array of LabeledPrice | +List of price portions | +
This object contains basic information about a successful payment.
+Field | +Type | +Description | +
---|---|---|
currency | +String | +Three-letter ISO 4217 currency code | +
total_amount | +Integer | +Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145 . See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). |
+
invoice_payload | +String | +Bot specified invoice payload | +
shipping_option_id | +String | +Optional. Identifier of the shipping option chosen by the user | +
order_info | +OrderInfo | +Optional. Order info provided by the user | +
telegram_payment_charge_id | +String | +Telegram payment identifier | +
provider_payment_charge_id | +String | +Provider payment identifier | +
This object contains information about an incoming shipping query.
+Field | +Type | +Description | +
---|---|---|
id | +String | +Unique query identifier | +
from | +User | +User who sent the query | +
invoice_payload | +String | +Bot specified invoice payload | +
shipping_address | +ShippingAddress | +User specified shipping address | +
This object contains information about an incoming pre-checkout query.
+Field | +Type | +Description | +
---|---|---|
id | +String | +Unique query identifier | +
from | +User | +User who sent the query | +
currency | +String | +Three-letter ISO 4217 currency code | +
total_amount | +Integer | +Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145 . See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). |
+
invoice_payload | +String | +Bot specified invoice payload | +
shipping_option_id | +String | +Optional. Identifier of the shipping option chosen by the user | +
order_info | +OrderInfo | +Optional. Order info provided by the user | +
Telegram Passport 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.). Please see the manual for details.
+Contains information about Telegram Passport data shared with the bot by the user.
+Field | +Type | +Description | +
---|---|---|
data | +Array of EncryptedPassportElement | +Array with information about documents and other Telegram Passport elements that was shared with the bot | +
credentials | +EncryptedCredentials | +Encrypted credentials required to decrypt the data | +
This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
+Field | +Type | +Description | +
---|---|---|
file_id | +String | +Identifier for this file, which can be used to download or reuse the file | +
file_unique_id | +String | +Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | +
file_size | +Integer | +File size in bytes | +
file_date | +Integer | +Unix time when the file was uploaded | +
Contains information about documents or other Telegram Passport elements shared with the bot by the user.
+Field | +Type | +Description | +
---|---|---|
type | +String | +Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. | +
data | +String | +Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. | +
phone_number | +String | +Optional. User's verified phone number, available only for “phone_number” type | +
String | +Optional. User's verified email address, available only for “email” type | +|
files | +Array of PassportFile | +Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. | +
front_side | +PassportFile | +Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. | +
reverse_side | +PassportFile | +Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. | +
selfie | +PassportFile | +Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. | +
translation | +Array of PassportFile | +Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. | +
hash | +String | +Base64-encoded element hash for using in PassportElementErrorUnspecified | +
Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
+Field | +Type | +Description | +
---|---|---|
data | +String | +Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication | +
hash | +String | +Base64-encoded data hash for data authentication | +
secret | +String | +Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption | +
Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
+Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
user_id | +Integer | +Yes | +User identifier | +
errors | +Array of PassportElementError | +Yes | +A JSON-serialized array describing the errors | +
This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
+Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.
+Field | +Type | +Description | +
---|---|---|
source | +String | +Error source, must be data | +
type | +String | +The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” | +
field_name | +String | +Name of the data field which has the error | +
data_hash | +String | +Base64-encoded data hash | +
message | +String | +Error message | +
Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.
+Field | +Type | +Description | +
---|---|---|
source | +String | +Error source, must be front_side | +
type | +String | +The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” | +
file_hash | +String | +Base64-encoded hash of the file with the front side of the document | +
message | +String | +Error message | +
Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.
+Field | +Type | +Description | +
---|---|---|
source | +String | +Error source, must be reverse_side | +
type | +String | +The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card” | +
file_hash | +String | +Base64-encoded hash of the file with the reverse side of the document | +
message | +String | +Error message | +
Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.
+Field | +Type | +Description | +
---|---|---|
source | +String | +Error source, must be selfie | +
type | +String | +The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” | +
file_hash | +String | +Base64-encoded hash of the file with the selfie | +
message | +String | +Error message | +
Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
+Field | +Type | +Description | +
---|---|---|
source | +String | +Error source, must be file | +
type | +String | +The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” | +
file_hash | +String | +Base64-encoded file hash | +
message | +String | +Error message | +
Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.
+Field | +Type | +Description | +
---|---|---|
source | +String | +Error source, must be files | +
type | +String | +The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” | +
file_hashes | +Array of String | +List of base64-encoded file hashes | +
message | +String | +Error message | +
Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.
+Field | +Type | +Description | +
---|---|---|
source | +String | +Error source, must be translation_file | +
type | +String | +Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” | +
file_hash | +String | +Base64-encoded file hash | +
message | +String | +Error message | +
Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.
+Field | +Type | +Description | +
---|---|---|
source | +String | +Error source, must be translation_files | +
type | +String | +Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” | +
file_hashes | +Array of String | +List of base64-encoded file hashes | +
message | +String | +Error message | +
Represents an issue in an unspecified place. The error is considered resolved when new data is added.
+Field | +Type | +Description | +
---|---|---|
source | +String | +Error source, must be unspecified | +
type | +String | +Type of element of the user's Telegram Passport which has the issue | +
element_hash | +String | +Base64-encoded element hash | +
message | +String | +Error message | +
Your bot can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats. Create games via @BotFather using the /newgame command. Please note that this kind of power requires responsibility: you will need to accept the terms for each game that your bots will be offering.
+Use this method to send a game. On success, the sent Message is returned.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
chat_id | +Integer | +Yes | +Unique identifier for the target chat | +
game_short_name | +String | +Yes | +Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. | +
disable_notification | +Boolean | +Optional | +Sends the message silently. Users will receive a notification with no sound. | +
reply_to_message_id | +Integer | +Optional | +If the message is a reply, ID of the original message | +
allow_sending_without_reply | +Boolean | +Optional | +Pass True, if the message should be sent even if the specified replied-to message is not found | +
reply_markup | +InlineKeyboardMarkup | +Optional | +A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. | +
This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
+Field | +Type | +Description | +
---|---|---|
title | +String | +Title of the game | +
description | +String | +Description of the game | +
photo | +Array of PhotoSize | +Photo that will be displayed in the game message in chats. | +
text | +String | +Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. | +
text_entities | +Array of MessageEntity | +Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc. | +
animation | +Animation | +Optional. Animation that will be displayed in the game message in chats. Upload via BotFather | +
A placeholder, currently holds no information. Use BotFather to set up your game.
+Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
+Parameter | +Type | +Required | +Description | +
---|---|---|---|
user_id | +Integer | +Yes | +User identifier | +
score | +Integer | +Yes | +New score, must be non-negative | +
force | +Boolean | +Optional | +Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters | +
disable_edit_message | +Boolean | +Optional | +Pass True, if the game message should not be automatically edited to include the current scoreboard | +
chat_id | +Integer | +Optional | +Required if inline_message_id is not specified. Unique identifier for the target chat | +
message_id | +Integer | +Optional | +Required if inline_message_id is not specified. Identifier of the sent message | +
inline_message_id | +String | +Optional | +Required if chat_id and message_id are not specified. Identifier of the inline message | +
Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects.
+++This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change.
+
Parameter | +Type | +Required | +Description | +
---|---|---|---|
user_id | +Integer | +Yes | +Target user id | +
chat_id | +Integer | +Optional | +Required if inline_message_id is not specified. Unique identifier for the target chat | +
message_id | +Integer | +Optional | +Required if inline_message_id is not specified. Identifier of the sent message | +
inline_message_id | +String | +Optional | +Required if chat_id and message_id are not specified. Identifier of the inline message | +
This object represents one row of the high scores table for a game.
+Field | +Type | +Description | +
---|---|---|
position | +Integer | +Position in high score table for the game | +
user | +User | +User | +
score | +Integer | +Score | +
And that's about all we've got for now.
If you've got any questions, please check out our Bot FAQ »
از نسخهٔ ۴.۲ تلگرام ما از CDN رمزنگاری شده برای ذخیره فایلهای کانال های عمومی با بیش از ۱۰۰٫۰۰۰ عضو پشتیبانی میکنیم. نقاط ذخیره سازی CDN در مناطقی در نظر گرفته شده اند که تلگرام ترافیک زیادی دارد ولی ما به دلایل مختلف تمایلی به قرارگیری سرورهای تلگرام در آن مناطق نداریم.
+++برای اطلاعات فنی در خصوص نحوه پیاده سازی، رمزنگاری و تایید اعتبار دادهها راهنمای CDN در این لینک را ببینید. همچنین برای توضیحات سیستم از طرف پاول دورُف به این پست مراجعه کنید.
+
ما از سرورهای توزیع شده خود برای افزایش سرعت دانلود در مناطق بدون سانسور که در آنها آزادی بیان تضمین شدهاست استفاده میکنیم. و حتی در آن مناطق نیز به آنها اعتماد نمیکنیم. اما وقتی تلگرام در مناطق دیگر به شدت محبوب میشود، فقط میتوانیم روی CDNها تکیه کنیم؛ که با آنها از نقطه نظر فنی مانند سرویسدهندههای اینترنت (ISP) رفتار میکنیم و آنها فقط دادههای رمزنگاری شدهای را که قادر به کشف رمز آن نیستند دریافت میکنند.
به لطف این فناوری، سرعت دانلود عکسها و فیلمهایی که به صورت عمومی منتشر میشوند در مناطقی نظیر ترکیه، اندونزی، عربستان سعودی، هند، ایران و عراق به مراتب افزایش مییابد، بدون اینکه کمترین خدشهای به امنیت وارد شود.
خیر. هر فایلی که به مراکز داده CDN ارسال میشود، با یک کلید منحصر به فرد با استفاده از تکنولوژی AES-256-CTR رمزگذاری میشود. CDN دسترسی به اطلاعاتی که ذخیره میکند ندارد، چرا که این کلیدها تنها در سرور MTProto (سرور رمزگذاری) اصلی و دستگاه کاربر قابل دسترسی هستند.
+خیر. اطلاعات و دادههای دانلود شده (دریافتی) از سمت نقاط ذخیره سازی CDN همیشه از طرف Telegram بوسیله رمزنگاری hash تایید و بررسی میشود: بدين ترتیب هکرها یا افراد متجاوز نمیتوانند هیچ فایلی را جایگزین کنند.
+خير. CDNها فقط كپى فايل هاى رمزنگارى شده را ذخيره مىكنند، فايلهاى اصلي در سرورهای تلگرام ذخيره مىشوند. كاربر تنها اعلان دريافت فايل را از طريق سرور تلگرام مىگيرد. اگر كه CDN فايل مورد نظر را به كاربر ارسال نكند، كاربر اين فايل را مستقيماً از سرور تلگرام دريافت خواهد كرد.
+خير. تمامى فايلهاى اصلي در سرورهای تلگرام ذخيره مىشوند. CDN ها فقط داده هاى رمزگذاري شده را دريافت مىكنند و قادر نيستند آن را رمزگشايى و يا هيچ گونه داده را جايگزين كنند. اگر مشكلى پيش آيد، فايل مورد نظر مستقيما از سرور هاى تلگرام به كاربران ارسال میشود. كاربران هميشه داده هایشان را دريافت مىكنند و هيچ كس نمىتواند مانع آنها بشود.
+بله. همه میتوانند روش ما برای پیادهسازی CDN را با بررسی کدهای Source Code برنامههای تلگرام و بررسی ترافیک داده بررسی کنند.
+خیر. نقاط ذخیره سازی CDN بخشی از سرور اَبری تلگرام نیستند. CDNها فقط برای ذخیرهسازی فایلهای پر طرفدار از کانالهای پر بازدید استفاده میشوند. اطلاعات خصوصی و شخصی هرگز به آنها راه پیدا نمیکنند.
+خیر. ما وارد هیچ توافق یا تفاهمی با دولتها در این مورد نشدهایم و CDNها بخشی از هیچ معاملهای نیستند. این به دلیل غیر منطقی بودن قوانین محلی نیست – ما هیچگاه سرورهایمان را به کشوری با سابقه سانسور اینترنتی انتقال نمیدهیم.
+تنها هدف استفاده از CDNها این است که کیفیت اتصال در مناطق با تقاضای بالا، که تلگرام نمیتواند سرورهای خود را به آنجا منتقل کند، با روشی ایمن، افزایش یابد.
+خیر. ما احتیاط ویژهای به خرج دادهایم تا مطمئن شویم هیچ کشوری از طریق نقاط ذخیره سازی CDN به قدرت نفوذ روی تلگرام دست نیابد:
- CDNها و نقاط آن به تلگرام تعلق نداشته و همه ریسک آن به گردن شرکت ثالثی که نقاط ذخیره سازی CDN در سراسر دنیا را برای ما تامین میکند خواهد بود.
- ما هیچ سرمایهگذاریای روی این CDNها انجام نمیدهیم و تنها بابت ترافیک مصرفی برای انتقال موارد ذخیره شده از خوشهٔ کامپیوترهای اصلی خودمان به کاربر نهایی، هزینه پرداخت میکنیم.
در نتیجه، اگر کشوری تصمیم به دستکاری CDN در منطقه خودش بگیرد، به چیزی جز پایین آوردن کیفیت اتصال شهروندان خودشان دست نمییابد – و تلگرام هیچ چیز با ارزشی را از دست نخواهد داد.
+++ترجمه فارسى اين پست از كانال رسمى پاول دورُف در تلگرام در زير آمده است:
+
همانطور که پیشتر قول داده بودم، جزئیات بیشتری درباره اینکه چطور نقاط ذخیره سازی CDN ثالث میتوانند سرعت دانلود محتوای عمومیِ پربازدید را در مناطقی که تلگرام تمایل به نصب سرورهای خود در آنجا ندارد، به روشی امن بالا ببرد، منتشر میکنم.
+همانطور که مشاهده میکنید، نقاط ذخیره سازی CDN هیچ ارتباطی با مساله انتقال سرورهای تلگرام یا رعایت قوانین غیر منطقی محلی ندارند. CDNها صرفا ابزاری جهت ارتقا کیفیت اتصال میلیونها کاربر، به روشی امن، هستند. ما با این نقاط CDN دقیقا همانطور رفتار میکنیم که با مراکز تامین کننده اینترنت (ISP) شما رفتار میکنیم. آنها صرفا مشتی دادهٔ رمزنگاری شده دریافت میکنند که قادر به کشف رمز آن نخواهند بود.
+خوبی تلگرام این است که وقتی بحث امنیت مطرح میشود، لازم نیست صرفا روی گفتههای من حساب کنید. هر کسی میتواند نحوه اجرای نقاط CDN در نسخه بروز شده تلگرام برای iOS و اندروید را بررسی کند. همچنین اگر تمایل داشتهباشید میتوانید نگاهی به اسناد ما در لینک فوق بیندازید، تا مطمئن شوید همه چیز امن است.
+ما با یک تامین کننده بینالمللی CDN همکاری میکنیم که با نقاط ذخیره سازی خود در سراسر دنیا به ما کمک میکند. اگر یک دولت محلی تصمیم به توقیف یک نقطه ذخیره سازی در مرزهای خود بگیرد، تلگرام چیزی از دست نخواهد داد؛ چرا که آن CDN جز اموال ما نیست و حتی در تئوری کوچکترین اطلاعات خصوصی تحت تاثیر این عمل قرار نخواهد گرفت. بنابراین به قوانین و دولتهای محلی وابستگی پیدا نمیکنیم و هیچ ریسک حقوقی یا مالی نخواهیم داشت، اما سرعت دانلود محتوای عمومی را بطور چشمگیری افزایش میدهیم.
+چنانچه، با وجود توضیحات فوق، باز هم برخی رسانهها از تیتر های جنجالی مانند «تلگرام سرورهایش را به کره شمالی انتقال داد» استفاده کردند، لطفا مارا با اطلاع رسانی در مورد حقیقت ماجرا که در لینکهای این پیام آمده است، یاری کنید. بابت مطالعه این مطلب از شما تشکر میکنم و مثل همیشه، در همین کانال، شما را از هر خبر بین المللی در مورد تلگرام مطلع خواهم کرد.
+++Please feel free to check out our FAQ for the Technically Inclined. +Client developers are required to comply with the Security Guidelines.
+
This page deals with the basic layer of MTProto encryption used for Cloud chats (server-client encryption). See also:
+ +The protocol is designed for access to a server API from applications running on mobile devices. It must be emphasized that a web browser is not such an application.
+The protocol is subdivided into three virtually independent components:
+++As of version 4.6, major Telegram clients are using MTProto 2.0, described in this article. +MTProto v1.0 (described here for reference) is deprecated and is currently being phased out.
+
From the standpoint of the high-level component, the client and the server exchange messages inside a session. The session is attached to the client device (the application, to be more exact) rather than a specific websocket/http/https/tcp connection. In addition, each session is attached to a user key ID by which authorization is actually accomplished.
+Several connections to a server may be open; messages may be sent in either direction through any of the connections (a response to a query is not necessarily returned through the same connection that carried the original query, although most often, that is the case; however, in no case can a message be returned through a connection belonging to a different session). When the UDP protocol is used, a response might be returned by a different IP address than the one to which the query had been sent.
+There are several types of messages:
+From the standpoint of lower level protocols, a message is a binary data stream aligned along a 4 or 16-byte boundary. The first several fields in the message are fixed and are used by the cryptographic/authorization system.
+Each message, either individual or inside a container, consists of a message identifier (64 bits, see below), a message sequence number within a session (32 bits), the length (of the message body in bytes; 32 bits), and a body (any size which is a multiple of 4 bytes). In addition, when a container or a single message is sent, an internal header is added at the top (see below), then the entire message is encrypted, and an external header is placed at the top of the message (a 64-bit key identifier and a 128-bit message key).
+A message body normally consists of a 32-bit message type followed by type-dependent parameters. In particular, each RPC function has a corresponding message type. For more detail, see Binary Data Serialization, Mobile Protocol: Service Messages.
+All numbers are written as little endian. However, very large numbers (2048-bit) used in RSA and DH are written in the big endian format because that is how the OpenSSL library does it.
+Prior to a message (or a multipart message) being transmitted over a network using a transport protocol, it is encrypted in a certain way, and an external header is added at the top of the message which is: a 64-bit key identifier (that uniquely identifies an authorization key for the server as well as the user) and a 128-bit message key. A user key together with the message key defines an actual 256-bit key which is what encrypts the message using AES-256 encryption. Note that the initial part of the message to be encrypted contains variable data (session, message ID, sequence number, server salt) that obviously influences the message key (and thus the AES key and iv). The message key is defined as the 128 middle bits of the SHA256 of the message body (including session, message ID, etc.), including the padding bytes, prepended by 32 bytes taken from the authorization key. Multipart messages are encrypted as a single message.
+++For a technical specification, see Mobile Protocol: Detailed Description
+
The first thing a client application must do is create an authorization key which is normally generated when it is first run and almost never changes.
+The protocol’s principal drawback is that an intruder passively intercepting messages and then somehow appropriating the authorization key (for example, by stealing a device) will be able to decrypt all the intercepted messages post factum. This probably is not too much of a problem (by stealing a device, one could also gain access to all the information cached on the device without decrypting anything); however, the following steps could be taken to overcome this weakness:
+If client time diverges widely from server time, a server may start ignoring client messages, or vice versa, because of an invalid message identifier (which is closely related to creation time). Under these circumstances, the server will send the client a special message containing the correct time and a certain 128-bit salt (either explicitly provided by the client in a special RPC synchronization request or equal to the key of the latest message received from the client during the current session). This message could be the first one in a container that includes other messages (if the time discrepancy is significant but does not as yet result in the client’s messages being ignored).
+Having received such a message or a container holding it, the client first performs a time synchronization (in effect, simply storing the difference between the server’s time and its own to be able to compute the “correct” time in the future) and then verifies that the message identifiers for correctness.
+Where a correction has been neglected, the client will have to generate a new session to assure the monotonicity of message identifiers.
+Before being sent using the selected transport protocol, the payload has to be wrapped in a secondary protocol header, defined by the appropriate MTProto transport protocol.
+ +The server recognizes these different protocols (and distinguishes them from HTTP, too) by the header. +Additionally, the following transport features can be used:
+ +Example implementations for these protocols can be seen in tdlib and MadelineProto.
+Enables the delivery of encrypted containers together with the external header (hereinafter, Payload) from client to server and back. +Multiple transport protocols are defined:
+(We shall examine only the first five types.)
+To recap, using the ISO/OSI stack as comparison:
+++This document describes MTProto v1.0, its status is DEPRECATED.
+
For information on encryption used in up-to-date Telegram clients, kindly see this document.
This page deals with the basic layer of MTProto encryption used for Cloud chats (server-client encryption). See also:
+ +The protocol is designed for access to a server API from applications running on mobile devices. It must be emphasized that a web browser is not such an application.
+The protocol is subdivided into three virtually independent components:
+++Got questions about this setup? — Check out the Advanced FAQ!
+
Each plaintext message to be encrypted in MTProto always contains the following data to be checked upon decryption in order to make the system robust against known problems with the components:
+See additional comments on our use of IGE, SHA-1 and message authentication.
+Telegram's End-to-end encrypted Secret Chats are using an additional layer of encryption on top of the described above. See Secret Chats, End-to-End encryption for details.
+From the standpoint of the high-level component, the client and the server exchange messages inside a session. The session is attached to the client device (the application, to be more exact) rather than a specific http/https/tcp connection. In addition, each session is attached to a user key ID by which authorization is actually accomplished.
+Several connections to a server may be open; messages may be sent in either direction through any of the connections (a response to a query is not necessarily returned through the same connection that carried the original query, although most often, that is the case; however, in no case can a message be returned through a connection belonging to a different session). When the UDP protocol is used, a response might be returned by a different IP address than the one to which the query had been sent.
+There are several types of messages:
+From the standpoint of lower level protocols, a message is a binary data stream aligned along a 4 or 16-byte boundary. The first several fields in the message are fixed and are used by the cryptographic/authorization system.
+Each message, either individual or inside a container, consists of a message identifier (64 bits, see below), a message sequence number within a session (32 bits), the length (of the message body in bytes; 32 bits), and a body (any size which is a multiple of 4 bytes). In addition, when a container or a single message is sent, an internal header is added at the top (see below), then the entire message is encrypted, and an external header is placed at the top of the message (a 64-bit key identifier and a 128-bit message key).
+A message body normally consists of a 32-bit message type followed by type-dependent parameters. In particular, each RPC function has a corresponding message type. For more detail, see Binary Data Serialization, Mobile Protocol: Service Messages.
+All numbers are written as little endian. However, very large numbers (2048-bit) used in RSA and DH are written in the big endian format because that is what the OpenSSL library does.
+Prior to a message (or a multipart message) being transmitted over a network using a transport protocol, it is encrypted in a certain way, and an external header is added at the top of the message which is: a 64-bit key identifier (that uniquely identifies an authorization key for the server as well as the user) and a 128-bit message key. A user key together with the message key defines an actual 256-bit key which is what encrypts the message using AES-256 encryption. Note that the initial part of the message to be encrypted contains variable data (session, message ID, sequence number, server salt) that obviously influences the message key (and thus the AES key and iv). The message key is defined as the 128 lower-order bits of the SHA1 of the message body (including session, message ID, etc.). Multipart messages are encrypted as a single message.
+For a technical specification, see Mobile Protocol: Detailed Description
The first thing a client application must do is create an authorization key which is normally generated when it is first run and almost never changes.
The protocol’s principal drawback is that an intruder passively intercepting messages and then somehow appropriating the authorization key (for example, by stealing a device) will be able to decrypt all the intercepted messages post factum. This probably is not too much of a problem (by stealing a device, one could also gain access to all the information cached on the device without decrypting anything); however, the following steps could be taken to overcome this weakness:
+If client time diverges widely from server time, a server may start ignoring client messages, or vice versa, because of an invalid message identifier (which is closely related to creation time). Under these circumstances, the server will send the client a special message containing the correct time and a certain 128-bit salt (either explicitly provided by the client in a special RPC synchronization request or equal to the key of the latest message received from the client during the current session). This message could be the first one in a container that includes other messages (if the time discrepancy is significant but does not as yet result in the client’s messages being ignored).
+Having received such a message or a container holding it, the client first performs a time synchronization (in effect, simply storing the difference between the server’s time and its own to be able to compute the “correct” time in the future) and then verifies that the message identifiers for correctness.
+Where a correction has been neglected, the client will have to generate a new session to assure the monotonicity of message identifiers.
+Enables the delivery of encrypted containers together with the external header (hereinafter, Payload) from client to server and back. There are three types of transport:
+We shall examine the first two types.
+Implemented over HTTP/1.1 (with keepalive) running over the traditional TCP Port 80. HTTPS is not used; the above encryption method is used instead.
+An HTTP connection is attached to a session (or rather, to session + key identifier) specified in the most recent user query received; normally, the session is the same in all queries, but crafty HTTP proxies may corrupt that. A server may not return a message into an HTTP connection unless it belongs to the same session, and unless it is the server’s turn (an HTTP request had been received from the client to which a response has not been sent yet).
+The overall arrangement is as follows. The client opens one or more keepalive HTTP connections to the server. If one or more messages need to be sent, they are made into a payload which is followed by a POST request to the URL/api to which the payload is transmitted as data. In addition, Content-Length
, Keepalive
, and Host
are valid HTTP headers.
Having received the query, the server may either wait a little while (if the query requires a response following a short timeout) or immediately return a dummy response (only acknowledging the receipt of the container). In any case, the response may contain any number of messages. The server may at the same time send out any other messages it might be holding for the session.
+In addition, there exists a special long poll RPC query (valid for HTTP connections only) which transmits maximum timeout T. If the server has messages for the session, they are returned immediately; otherwise, a wait state is entered until such time as the server has a message for the client or T seconds have elapsed. If no events occur in the span of T seconds, a dummy response is returned (special message).
+If a server needs to send a message to a client, it checks for an HTTP connection that belongs to the required session and is in the “answering an HTTP request” state (including long poll) whereupon the message is added to the response container for the connection and sent to the user. In a typical case, there is some additional wait time (50 milliseconds) against the eventuality that the server will soon have more messages for the session.
+If no suitable HTTP connection is available, the messages are placed in the current session’s send queue. However, they find their way there anyway until receipt is explicitly or indirectly confirmed by the client. For the HTTP protocol, sending the next query into the same HTTP connection is regarded as an implicit acknowledgment (not any more, the HTTP protocol also requires that explicit acknowledgments be sent); in other cases, the client must return an explicit acknowledgment within a reasonable time (it can be added to a container for the following request).
+Important: if the acknowledgment fails to arrive on time, the message can be resent (possibly, in a different container). The parties must autonomously be ready for this and must store the identifiers of the most recent messages received (and ignore such duplicates rather than repeat actions). In order not to have the identifiers stored forever, there exist special garbage collection messages that take advantage of message identifier monotonicity.
+If the send queue overflows or if messages stay in the queue for over 10 minutes, the server forgets them (or sends them to swap, no genius required). This may happen even faster, if the server is running out of buffer space (for example, because of serious network issues resulting in a large number of connections becoming severed).
+This is very similar to the HTTP transport. May also be implemented over Port 80 (to penetrate all firewalls) and even use the same server IP addresses. In this situation, the server understands whether HTTP or TCP protocol must be used for the connection, based on the first four incoming bytes (for HTTP, it is POST).
+When a TCP connection is created, it is assigned to the session (and the authorization key) transmitted in the first user message, and subsequently used exclusively for this session (multiplexing arrangements are not allowed).
+If a payload (packet) needs to be transmitted from server to client or from client to server, it is encapsulated as follows: 4 length bytes are added at the front (to include the length, the sequence number, and CRC32; always divisible by 4) and 4 bytes with the packet sequence number within this TCP connection (the first packet sent is numbered 0, the next one 1, etc.), and 4 CRC32 bytes at the end (length, sequence number, and payload together).
+There is an abridged version of the same protocol: if the client sends 0xef
as the first byte (important: only prior to the very first data packet), then packet length is encoded by a single byte (0x01..0x7e
= data length divided by 4; or 0x7f
followed by 3 length bytes (little endian) divided by 4) followed by the data themselves (sequence number and CRC32 not added). In this case, server responses look the same (the server does not send 0xef
as the first byte).
In case 4-byte data alignment is needed, an intermediate version of the original protocol may be used: if the client sends 0xeeeeeeee
as the first int (four bytes), then packet length is encoded always by four bytes as in the original version, but the sequence number and CRC32 are omitted, thus decreasing total packet size by 8 bytes.
The full, the intermediate and the abridged versions of the protocol have support for quick acknowledgment. In this case, the client sets the highest-order length bit in the query packet, and the server responds with a special 4 bytes as a separate packet. They are the 32 higher-order SHA1 bits of the encrypted portion of the packet with the most significant bit set to make clear that this is not the length of a regular server response packet; if the abridged version is used, bswap is applied to these four bytes.
+There are no implicit acknowledgments for the TCP transport: all messages must be acknowledged explicitly. Most frequently, acknowledgments are placed in a container with the next query or response if it is transmitted in short order. For example, this is almost always the case for client messages containing RPC queries: the acknowledgment normally arrives with the RPC response.
+In the event of an error, the server may send a packet whose payload consists of 4 bytes as the error code. For example, Error Code 403 corresponds to situations where the corresponding HTTP error would have been returned by the HTTP protocol.
+Below you will find the current TL-schema. More details on TL »
+See also the detailed schema in JSON »
+boolFalse#bc799737 = Bool;
+boolTrue#997275b5 = Bool;
+
+true#3fedd339 = True;
+
+vector#1cb5c415 {t:Type} # [ t ] = Vector t;
+
+error#c4b9f9bb code:int text:string = Error;
+
+null#56730bcc = Null;
+
+inputPeerEmpty#7f3b18ea = InputPeer;
+inputPeerSelf#7da07ec9 = InputPeer;
+inputPeerChat#35a95cb9 chat_id:long = InputPeer;
+inputPeerUser#dde8a54c user_id:long access_hash:long = InputPeer;
+inputPeerChannel#27bcbbfc channel_id:long access_hash:long = InputPeer;
+inputPeerUserFromMessage#a87b0a1c peer:InputPeer msg_id:int user_id:long = InputPeer;
+inputPeerChannelFromMessage#bd2a0840 peer:InputPeer msg_id:int channel_id:long = InputPeer;
+
+inputUserEmpty#b98886cf = InputUser;
+inputUserSelf#f7c1b13f = InputUser;
+inputUser#f21158c6 user_id:long access_hash:long = InputUser;
+inputUserFromMessage#1da448e2 peer:InputPeer msg_id:int user_id:long = InputUser;
+
+inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact;
+
+inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile;
+inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile;
+
+inputMediaEmpty#9664f57f = InputMedia;
+inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia;
+inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;
+inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia;
+inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true force_file:flags.4?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+inputMediaDocument#33473058 flags:# id:InputDocument ttl_seconds:flags.0?int query:flags.1?string = InputMedia;
+inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia;
+inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia;
+inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia;
+inputMediaGame#d33f43f3 id:InputGame = InputMedia;
+inputMediaInvoice#d9799874 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:flags.1?string = InputMedia;
+inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;
+inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;
+inputMediaDice#e66fbf7b emoticon:string = InputMedia;
+
+inputChatPhotoEmpty#1ca48f57 = InputChatPhoto;
+inputChatUploadedPhoto#c642724e flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = InputChatPhoto;
+inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto;
+
+inputGeoPointEmpty#e4c123d6 = InputGeoPoint;
+inputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint;
+
+inputPhotoEmpty#1cd7bf0d = InputPhoto;
+inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto;
+
+inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation;
+inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation;
+inputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
+inputTakeoutFileLocation#29be5899 = InputFileLocation;
+inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation;
+inputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation;
+inputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation;
+inputGroupCallStream#598a92a flags:# call:InputGroupCall time_ms:long scale:int video_channel:flags.0?int video_quality:flags.0?int = InputFileLocation;
+
+peerUser#59511722 user_id:long = Peer;
+peerChat#36c6019a chat_id:long = Peer;
+peerChannel#a2a5371e channel_id:long = Peer;
+
+storage.fileUnknown#aa963b05 = storage.FileType;
+storage.filePartial#40bc6f52 = storage.FileType;
+storage.fileJpeg#7efe0e = storage.FileType;
+storage.fileGif#cae1aadf = storage.FileType;
+storage.filePng#a4f63c0 = storage.FileType;
+storage.filePdf#ae1e508d = storage.FileType;
+storage.fileMp3#528a0677 = storage.FileType;
+storage.fileMov#4b09ebbc = storage.FileType;
+storage.fileMp4#b3cea0e4 = storage.FileType;
+storage.fileWebp#1081464c = storage.FileType;
+
+userEmpty#d3bc4b7a id:long = User;
+user#3ff6ecb0 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
+
+userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
+userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
+
+userStatusEmpty#9d05049 = UserStatus;
+userStatusOnline#edb93949 expires:int = UserStatus;
+userStatusOffline#8c703f was_online:int = UserStatus;
+userStatusRecently#e26f42f1 = UserStatus;
+userStatusLastWeek#7bf09fc = UserStatus;
+userStatusLastMonth#77ebc742 = UserStatus;
+
+chatEmpty#29562865 id:long = Chat;
+chat#41cbf256 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
+chatForbidden#6592a1a7 id:long title:string = Chat;
+channel#8261ac61 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
+channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat;
+
+chatFull#4dbdc099 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string = ChatFull;
+channelFull#e9b27a17 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string = ChatFull;
+
+chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant;
+chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant;
+chatParticipantAdmin#a0933f5b user_id:long inviter_id:long date:int = ChatParticipant;
+
+chatParticipantsForbidden#8763d3e1 flags:# chat_id:long self_participant:flags.0?ChatParticipant = ChatParticipants;
+chatParticipants#3cbc93f8 chat_id:long participants:Vector<ChatParticipant> version:int = ChatParticipants;
+
+chatPhotoEmpty#37c1011c = ChatPhoto;
+chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;
+
+messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message;
+message#85d6cbe2 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int = Message;
+messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message;
+
+messageMediaEmpty#3ded6320 = MessageMedia;
+messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
+messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
+messageMediaContact#70322949 phone_number:string first_name:string last_name:string vcard:string user_id:long = MessageMedia;
+messageMediaUnsupported#9f84f49e = MessageMedia;
+messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia;
+messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
+messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;
+messageMediaGame#fdb19008 game:Game = MessageMedia;
+messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;
+messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;
+messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
+messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;
+
+messageActionEmpty#b6aef7b0 = MessageAction;
+messageActionChatCreate#bd47cbad title:string users:Vector<long> = MessageAction;
+messageActionChatEditTitle#b5a1ce5a title:string = MessageAction;
+messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction;
+messageActionChatDeletePhoto#95e3fbef = MessageAction;
+messageActionChatAddUser#15cefd00 users:Vector<long> = MessageAction;
+messageActionChatDeleteUser#a43f30cc user_id:long = MessageAction;
+messageActionChatJoinedByLink#31224c3 inviter_id:long = MessageAction;
+messageActionChannelCreate#95d2ac92 title:string = MessageAction;
+messageActionChatMigrateTo#e1037f92 channel_id:long = MessageAction;
+messageActionChannelMigrateFrom#ea3948e9 title:string chat_id:long = MessageAction;
+messageActionPinMessage#94bd38ed = MessageAction;
+messageActionHistoryClear#9fbab604 = MessageAction;
+messageActionGameScore#92a72876 game_id:long score:int = MessageAction;
+messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction;
+messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction;
+messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction;
+messageActionScreenshotTaken#4792929b = MessageAction;
+messageActionCustomAction#fae69f56 message:string = MessageAction;
+messageActionBotAllowed#abe9affe domain:string = MessageAction;
+messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;
+messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction;
+messageActionContactSignUp#f3f25f76 = MessageAction;
+messageActionGeoProximityReached#98e0d697 from_id:Peer to_id:Peer distance:int = MessageAction;
+messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int = MessageAction;
+messageActionInviteToGroupCall#502f92f7 call:InputGroupCall users:Vector<long> = MessageAction;
+messageActionSetMessagesTTL#aa1afbfd period:int = MessageAction;
+messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction;
+messageActionSetChatTheme#aa786345 emoticon:string = MessageAction;
+
+dialog#2c171f72 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog;
+dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
+
+photoEmpty#2331b22d id:long = Photo;
+photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;
+
+photoSizeEmpty#e17e23c type:string = PhotoSize;
+photoSize#75c78e60 type:string w:int h:int size:int = PhotoSize;
+photoCachedSize#21e1ad6 type:string w:int h:int bytes:bytes = PhotoSize;
+photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;
+photoSizeProgressive#fa3efb95 type:string w:int h:int sizes:Vector<int> = PhotoSize;
+photoPathSize#d8214d41 type:string bytes:bytes = PhotoSize;
+
+geoPointEmpty#1117dd5f = GeoPoint;
+geoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radius:flags.0?int = GeoPoint;
+
+auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;
+
+auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization;
+auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization;
+
+auth.exportedAuthorization#b434e2b8 id:long bytes:bytes = auth.ExportedAuthorization;
+
+inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer;
+inputNotifyUsers#193b4417 = InputNotifyPeer;
+inputNotifyChats#4a95e84e = InputNotifyPeer;
+inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer;
+
+inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings;
+
+peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings;
+
+peerSettings#733f2961 flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true geo_distance:flags.6?int = PeerSettings;
+
+wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper;
+wallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper;
+
+inputReportReasonSpam#58dbcab8 = ReportReason;
+inputReportReasonViolence#1e22c78d = ReportReason;
+inputReportReasonPornography#2e59d922 = ReportReason;
+inputReportReasonChildAbuse#adf44ee3 = ReportReason;
+inputReportReasonOther#c1e4a2b1 = ReportReason;
+inputReportReasonCopyright#9b89f93a = ReportReason;
+inputReportReasonGeoIrrelevant#dbd4feed = ReportReason;
+inputReportReasonFake#f5ddd6e7 = ReportReason;
+
+userFull#d697ff05 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string = UserFull;
+
+contact#145ade0b user_id:long mutual:Bool = Contact;
+
+importedContact#c13e3c50 user_id:long client_id:long = ImportedContact;
+
+contactStatus#16d9703b user_id:long status:UserStatus = ContactStatus;
+
+contacts.contactsNotModified#b74ba9d2 = contacts.Contacts;
+contacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts;
+
+contacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts;
+
+contacts.blocked#ade1591 blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;
+contacts.blockedSlice#e1664194 count:int blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;
+
+messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
+messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
+messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs;
+
+messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.channelMessages#64479808 flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.messagesNotModified#74535f21 count:int = messages.Messages;
+
+messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;
+messages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats;
+
+messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull;
+
+messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory;
+
+inputMessagesFilterEmpty#57e2f66c = MessagesFilter;
+inputMessagesFilterPhotos#9609a51c = MessagesFilter;
+inputMessagesFilterVideo#9fc00e65 = MessagesFilter;
+inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter;
+inputMessagesFilterDocument#9eddf188 = MessagesFilter;
+inputMessagesFilterUrl#7ef0dd87 = MessagesFilter;
+inputMessagesFilterGif#ffc86587 = MessagesFilter;
+inputMessagesFilterVoice#50f5c392 = MessagesFilter;
+inputMessagesFilterMusic#3751b49e = MessagesFilter;
+inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter;
+inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter;
+inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter;
+inputMessagesFilterRoundVideo#b549da53 = MessagesFilter;
+inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter;
+inputMessagesFilterGeo#e7026d0d = MessagesFilter;
+inputMessagesFilterContacts#e062db83 = MessagesFilter;
+inputMessagesFilterPinned#1bb00451 = MessagesFilter;
+
+updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;
+updateMessageID#4e90bfd6 id:int random_id:long = Update;
+updateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update;
+updateUserTyping#c01e857f user_id:long action:SendMessageAction = Update;
+updateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update;
+updateChatParticipants#7761198 participants:ChatParticipants = Update;
+updateUserStatus#e5bdf8de user_id:long status:UserStatus = Update;
+updateUserName#c3f202e0 user_id:long first_name:string last_name:string username:string = Update;
+updateUserPhoto#f227868c user_id:long date:int photo:UserProfilePhoto previous:Bool = Update;
+updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update;
+updateEncryptedChatTyping#1710f156 chat_id:int = Update;
+updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update;
+updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update;
+updateChatParticipantAdd#3dda5451 chat_id:long user_id:long inviter_id:long date:int version:int = Update;
+updateChatParticipantDelete#e32f3d77 chat_id:long user_id:long version:int = Update;
+updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update;
+updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update;
+updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update;
+updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;
+updateUserPhone#5492a13 user_id:long phone:string = Update;
+updateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update;
+updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update;
+updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update;
+updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update;
+updateChannelTooLong#108d941f flags:# channel_id:long pts:flags.0?int = Update;
+updateChannel#635b4c09 channel_id:long = Update;
+updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update;
+updateReadChannelInbox#922e6e10 flags:# folder_id:flags.0?int channel_id:long max_id:int still_unread_count:int pts:int = Update;
+updateDeleteChannelMessages#c32d5b12 channel_id:long messages:Vector<int> pts:int pts_count:int = Update;
+updateChannelMessageViews#f226ac08 channel_id:long id:int views:int = Update;
+updateChatParticipantAdmin#d7ca61a2 chat_id:long user_id:long is_admin:Bool version:int = Update;
+updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
+updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update;
+updateStickerSets#43ae3dec = Update;
+updateSavedGifs#9375341e = Update;
+updateBotInlineQuery#496f379c flags:# query_id:long user_id:long query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;
+updateBotInlineSend#12f12a07 flags:# user_id:long query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
+updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update;
+updateBotCallbackQuery#b9cfc48d flags:# query_id:long user_id:long peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
+updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update;
+updateInlineBotCallbackQuery#691e9052 flags:# query_id:long user_id:long msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
+updateReadChannelOutbox#b75f99a9 channel_id:long max_id:int = Update;
+updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update;
+updateReadFeaturedStickers#571d2742 = Update;
+updateRecentStickers#9a422c20 = Update;
+updateConfig#a229dd06 = Update;
+updatePtsChanged#3354678f = Update;
+updateChannelWebPage#2f2ba99f channel_id:long webpage:WebPage pts:int pts_count:int = Update;
+updateDialogPinned#6e6fe51c flags:# pinned:flags.0?true folder_id:flags.1?int peer:DialogPeer = Update;
+updatePinnedDialogs#fa0f3ca2 flags:# folder_id:flags.1?int order:flags.0?Vector<DialogPeer> = Update;
+updateBotWebhookJSON#8317c0c3 data:DataJSON = Update;
+updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update;
+updateBotShippingQuery#b5aefd7d query_id:long user_id:long payload:bytes shipping_address:PostAddress = Update;
+updateBotPrecheckoutQuery#8caa9a96 flags:# query_id:long user_id:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update;
+updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update;
+updateLangPackTooLong#46560264 lang_code:string = Update;
+updateLangPack#56022f4d difference:LangPackDifference = Update;
+updateFavedStickers#e511996d = Update;
+updateChannelReadMessagesContents#44bdd535 channel_id:long messages:Vector<int> = Update;
+updateContactsReset#7084a7be = Update;
+updateChannelAvailableMessages#b23fc698 channel_id:long available_min_id:int = Update;
+updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update;
+updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update;
+updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update;
+updateFolderPeers#19360dc0 folder_peers:Vector<FolderPeer> pts:int pts_count:int = Update;
+updatePeerSettings#6a7e7366 peer:Peer settings:PeerSettings = Update;
+updatePeerLocated#b4afcfb0 peers:Vector<PeerLocated> = Update;
+updateNewScheduledMessage#39a51dfb message:Message = Update;
+updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector<int> = Update;
+updateTheme#8216fba3 theme:Theme = Update;
+updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update;
+updateLoginToken#564fe691 = Update;
+updateMessagePollVote#106395c9 poll_id:long user_id:long options:Vector<bytes> qts:int = Update;
+updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update;
+updateDialogFilterOrder#a5d72105 order:Vector<int> = Update;
+updateDialogFilters#3504914f = Update;
+updatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update;
+updateChannelMessageForwards#d29a27f4 channel_id:long id:int forwards:int = Update;
+updateReadChannelDiscussionInbox#d6b19546 flags:# channel_id:long top_msg_id:int read_max_id:int broadcast_id:flags.0?long broadcast_post:flags.0?int = Update;
+updateReadChannelDiscussionOutbox#695c9e7c channel_id:long top_msg_id:int read_max_id:int = Update;
+updatePeerBlocked#246a4b22 peer_id:Peer blocked:Bool = Update;
+updateChannelUserTyping#8c88c923 flags:# channel_id:long top_msg_id:flags.0?int from_id:Peer action:SendMessageAction = Update;
+updatePinnedMessages#ed85eab5 flags:# pinned:flags.0?true peer:Peer messages:Vector<int> pts:int pts_count:int = Update;
+updatePinnedChannelMessages#5bb98608 flags:# pinned:flags.0?true channel_id:long messages:Vector<int> pts:int pts_count:int = Update;
+updateChat#f89a6a4e chat_id:long = Update;
+updateGroupCallParticipants#f2ebdb4e call:InputGroupCall participants:Vector<GroupCallParticipant> version:int = Update;
+updateGroupCall#14b24500 chat_id:long call:GroupCall = Update;
+updatePeerHistoryTTL#bb9bb9a5 flags:# peer:Peer ttl_period:flags.0?int = Update;
+updateChatParticipant#d087663a flags:# chat_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChatParticipant new_participant:flags.1?ChatParticipant invite:flags.2?ExportedChatInvite qts:int = Update;
+updateChannelParticipant#985d3abb flags:# channel_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant invite:flags.2?ExportedChatInvite qts:int = Update;
+updateBotStopped#c4870a49 user_id:long date:int stopped:Bool qts:int = Update;
+updateGroupCallConnection#b783982 flags:# presentation:flags.0?true params:DataJSON = Update;
+updateBotCommands#4d712f2e peer:Peer bot_id:long commands:Vector<BotCommand> = Update;
+
+updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
+
+updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference;
+updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference;
+updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference;
+updates.differenceTooLong#4afe8f6d pts:int = updates.Difference;
+
+updatesTooLong#e317af7e = Updates;
+updateShortMessage#313bc7f8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
+updateShortChatMessage#4d6deea5 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:long chat_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
+updateShort#78d4dec1 update:Update date:int = Updates;
+updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
+updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
+updateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
+
+photos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos;
+photos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos;
+
+photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
+
+upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
+upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;
+
+dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
+
+config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;
+
+nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
+
+help.appUpdate#ccbbce30 flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string sticker:flags.3?Document = help.AppUpdate;
+help.noAppUpdate#c45a6536 = help.AppUpdate;
+
+help.inviteText#18cb9f78 message:string = help.InviteText;
+
+encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat;
+encryptedChatWaiting#66b25953 id:int access_hash:long date:int admin_id:long participant_id:long = EncryptedChat;
+encryptedChatRequested#48f1d94c flags:# folder_id:flags.0?int id:int access_hash:long date:int admin_id:long participant_id:long g_a:bytes = EncryptedChat;
+encryptedChat#61f0d4c7 id:int access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long = EncryptedChat;
+encryptedChatDiscarded#1e1c7c45 flags:# history_deleted:flags.0?true id:int = EncryptedChat;
+
+inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat;
+
+encryptedFileEmpty#c21f497e = EncryptedFile;
+encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile;
+
+inputEncryptedFileEmpty#1837c364 = InputEncryptedFile;
+inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile;
+inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile;
+inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile;
+
+encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage;
+encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage;
+
+messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig;
+messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig;
+
+messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage;
+messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage;
+
+inputDocumentEmpty#72f0eaae = InputDocument;
+inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument;
+
+documentEmpty#36f8c871 id:long = Document;
+document#1e87342b flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
+
+help.support#17c6b5f6 phone_number:string user:User = help.Support;
+
+notifyPeer#9fd40bd8 peer:Peer = NotifyPeer;
+notifyUsers#b4c83b4c = NotifyPeer;
+notifyChats#c007cec3 = NotifyPeer;
+notifyBroadcasts#d612e8ef = NotifyPeer;
+
+sendMessageTypingAction#16bf744e = SendMessageAction;
+sendMessageCancelAction#fd5ec8f5 = SendMessageAction;
+sendMessageRecordVideoAction#a187d66f = SendMessageAction;
+sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction;
+sendMessageRecordAudioAction#d52f73f7 = SendMessageAction;
+sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction;
+sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction;
+sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction;
+sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
+sendMessageChooseContactAction#628cbc6f = SendMessageAction;
+sendMessageGamePlayAction#dd6a8f48 = SendMessageAction;
+sendMessageRecordRoundAction#88f27fbc = SendMessageAction;
+sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction;
+speakingInGroupCallAction#d92c2285 = SendMessageAction;
+sendMessageHistoryImportAction#dbda9246 progress:int = SendMessageAction;
+sendMessageChooseStickerAction#b05ac6b1 = SendMessageAction;
+sendMessageEmojiInteraction#25972bcb emoticon:string msg_id:int interaction:DataJSON = SendMessageAction;
+sendMessageEmojiInteractionSeen#b665902e emoticon:string = SendMessageAction;
+
+contacts.found#b3134d9d my_results:Vector<Peer> results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found;
+
+inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey;
+inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey;
+inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey;
+inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey;
+inputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey;
+inputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey;
+inputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey;
+inputPrivacyKeyAddedByPhone#d1219bdd = InputPrivacyKey;
+
+privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey;
+privacyKeyChatInvite#500e6dfa = PrivacyKey;
+privacyKeyPhoneCall#3d662b7b = PrivacyKey;
+privacyKeyPhoneP2P#39491cc8 = PrivacyKey;
+privacyKeyForwards#69ec56a3 = PrivacyKey;
+privacyKeyProfilePhoto#96151fed = PrivacyKey;
+privacyKeyPhoneNumber#d19ae46d = PrivacyKey;
+privacyKeyAddedByPhone#42ffd42b = PrivacyKey;
+
+inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule;
+inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule;
+inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule;
+inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule;
+inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule;
+inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule;
+inputPrivacyValueAllowChatParticipants#840649cf chats:Vector<long> = InputPrivacyRule;
+inputPrivacyValueDisallowChatParticipants#e94f0f86 chats:Vector<long> = InputPrivacyRule;
+
+privacyValueAllowContacts#fffe1bac = PrivacyRule;
+privacyValueAllowAll#65427b82 = PrivacyRule;
+privacyValueAllowUsers#b8905fb2 users:Vector<long> = PrivacyRule;
+privacyValueDisallowContacts#f888fa1a = PrivacyRule;
+privacyValueDisallowAll#8b73e763 = PrivacyRule;
+privacyValueDisallowUsers#e4621141 users:Vector<long> = PrivacyRule;
+privacyValueAllowChatParticipants#6b134e8e chats:Vector<long> = PrivacyRule;
+privacyValueDisallowChatParticipants#41c87565 chats:Vector<long> = PrivacyRule;
+
+account.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules;
+
+accountDaysTTL#b8d0afdf days:int = AccountDaysTTL;
+
+documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
+documentAttributeAnimated#11b58939 = DocumentAttribute;
+documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute;
+documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute;
+documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute;
+documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
+documentAttributeHasStickers#9801d2f7 = DocumentAttribute;
+
+messages.stickersNotModified#f1749a22 = messages.Stickers;
+messages.stickers#30a6ec7e hash:long stickers:Vector<Document> = messages.Stickers;
+
+stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;
+
+messages.allStickersNotModified#e86602c3 = messages.AllStickers;
+messages.allStickers#cdbbcebb hash:long sets:Vector<StickerSet> = messages.AllStickers;
+
+messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages;
+
+webPageEmpty#eb1477e8 id:long = WebPage;
+webPagePending#c586da1c id:long date:int = WebPage;
+webPage#e89c45b2 flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page attributes:flags.12?Vector<WebPageAttribute> = WebPage;
+webPageNotModified#7311ca11 flags:# cached_page_views:flags.0?int = WebPage;
+
+authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true encrypted_requests_disabled:flags.3?true call_requests_disabled:flags.4?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization;
+
+account.authorizations#1250abde authorizations:Vector<Authorization> = account.Authorizations;
+
+account.password#185b184f flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int = account.Password;
+
+account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings;
+
+account.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings;
+
+auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery;
+
+receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage;
+
+chatInviteExported#b18105e8 flags:# revoked:flags.0?true permanent:flags.5?true link:string admin_id:long date:int start_date:flags.4?int expire_date:flags.1?int usage_limit:flags.2?int usage:flags.3?int = ExportedChatInvite;
+
+chatInviteAlready#5a686d7c chat:Chat = ChatInvite;
+chatInvite#dfc2f58e flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:Photo participants_count:int participants:flags.4?Vector<User> = ChatInvite;
+chatInvitePeek#61695cb0 chat:Chat expires:int = ChatInvite;
+
+inputStickerSetEmpty#ffb62b95 = InputStickerSet;
+inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
+inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
+inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
+inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;
+inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet;
+
+stickerSet#d7df217a flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int count:int hash:int = StickerSet;
+
+messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
+
+botCommand#c27ac8c7 command:string description:string = BotCommand;
+
+botInfo#1b74b335 user_id:long description:string commands:Vector<BotCommand> = BotInfo;
+
+keyboardButton#a2fa4880 text:string = KeyboardButton;
+keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;
+keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;
+keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton;
+keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton;
+keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton;
+keyboardButtonGame#50f41ccf text:string = KeyboardButton;
+keyboardButtonBuy#afd93fbb text:string = KeyboardButton;
+keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton;
+inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton;
+keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton;
+
+keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow;
+
+replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup;
+replyKeyboardForceReply#86b40b08 flags:# single_use:flags.1?true selective:flags.2?true placeholder:flags.3?string = ReplyMarkup;
+replyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup;
+replyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup;
+
+messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity;
+messageEntityMention#fa04579d offset:int length:int = MessageEntity;
+messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity;
+messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity;
+messageEntityUrl#6ed02538 offset:int length:int = MessageEntity;
+messageEntityEmail#64e475c2 offset:int length:int = MessageEntity;
+messageEntityBold#bd610bc9 offset:int length:int = MessageEntity;
+messageEntityItalic#826f8b60 offset:int length:int = MessageEntity;
+messageEntityCode#28a20571 offset:int length:int = MessageEntity;
+messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity;
+messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity;
+messageEntityMentionName#dc7b1140 offset:int length:int user_id:long = MessageEntity;
+inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity;
+messageEntityPhone#9b69e34b offset:int length:int = MessageEntity;
+messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity;
+messageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity;
+messageEntityStrike#bf0693d4 offset:int length:int = MessageEntity;
+messageEntityBlockquote#20df5d0 offset:int length:int = MessageEntity;
+messageEntityBankCard#761e6af4 offset:int length:int = MessageEntity;
+
+inputChannelEmpty#ee8c1e86 = InputChannel;
+inputChannel#f35aec28 channel_id:long access_hash:long = InputChannel;
+inputChannelFromMessage#5b934f9d peer:InputPeer msg_id:int channel_id:long = InputChannel;
+
+contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer;
+
+messageRange#ae30253 min_id:int max_id:int = MessageRange;
+
+updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference;
+updates.channelDifferenceTooLong#a4bcc6fe flags:# final:flags.0?true timeout:flags.1?int dialog:Dialog messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
+updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
+
+channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter;
+channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter;
+
+channelParticipant#c00c07c0 user_id:long date:int = ChannelParticipant;
+channelParticipantSelf#28a8bc67 user_id:long inviter_id:long date:int = ChannelParticipant;
+channelParticipantCreator#2fe601d3 flags:# user_id:long admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant;
+channelParticipantAdmin#34c3bb53 flags:# can_edit:flags.0?true self:flags.1?true user_id:long inviter_id:flags.1?long promoted_by:long date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant;
+channelParticipantBanned#6df8014e flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights = ChannelParticipant;
+channelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant;
+
+channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter;
+channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter;
+channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter;
+channelParticipantsBots#b0d1865b = ChannelParticipantsFilter;
+channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter;
+channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter;
+channelParticipantsContacts#bb6ae88d q:string = ChannelParticipantsFilter;
+channelParticipantsMentions#e04b5ceb flags:# q:flags.0?string top_msg_id:flags.1?int = ChannelParticipantsFilter;
+
+channels.channelParticipants#9ab0feaf count:int participants:Vector<ChannelParticipant> chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipants;
+channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants;
+
+channels.channelParticipant#dfb80317 participant:ChannelParticipant chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipant;
+
+help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector<MessageEntity> min_age_confirm:flags.1?int = help.TermsOfService;
+
+messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs;
+messages.savedGifs#84a02a0d hash:long gifs:Vector<Document> = messages.SavedGifs;
+
+inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaInvoice#d7e78225 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+
+inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult;
+
+botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaInvoice#354a9b09 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument currency:string total_amount:long reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+
+botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult;
+botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult;
+
+messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults;
+
+exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
+
+messageFwdHeader#5f777dce flags:# imported:flags.7?true from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;
+
+auth.codeTypeSms#72a3158c = auth.CodeType;
+auth.codeTypeCall#741cd3e3 = auth.CodeType;
+auth.codeTypeFlashCall#226ccefb = auth.CodeType;
+
+auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType;
+auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
+auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;
+auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
+
+messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;
+
+messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData;
+
+inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID;
+inputBotInlineMessageID64#b6d915d7 dc_id:int owner_id:long id:int access_hash:long = InputBotInlineMessageID;
+
+inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM;
+
+messages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs;
+
+topPeer#edcdc05b peer:Peer rating:double = TopPeer;
+
+topPeerCategoryBotsPM#ab661b5b = TopPeerCategory;
+topPeerCategoryBotsInline#148677e2 = TopPeerCategory;
+topPeerCategoryCorrespondents#637b7ed = TopPeerCategory;
+topPeerCategoryGroups#bd17a14a = TopPeerCategory;
+topPeerCategoryChannels#161d9628 = TopPeerCategory;
+topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory;
+topPeerCategoryForwardUsers#a8406ca9 = TopPeerCategory;
+topPeerCategoryForwardChats#fbeec0f0 = TopPeerCategory;
+
+topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers;
+
+contacts.topPeersNotModified#de266ef5 = contacts.TopPeers;
+contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers;
+contacts.topPeersDisabled#b52c939d = contacts.TopPeers;
+
+draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage;
+draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage;
+
+messages.featuredStickersNotModified#c6dc0c66 count:int = messages.FeaturedStickers;
+messages.featuredStickers#84c02310 hash:long count:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers;
+
+messages.recentStickersNotModified#b17f890 = messages.RecentStickers;
+messages.recentStickers#88d37c56 hash:long packs:Vector<StickerPack> stickers:Vector<Document> dates:Vector<int> = messages.RecentStickers;
+
+messages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers;
+
+messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult;
+messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult;
+
+stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered;
+stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered;
+
+maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords;
+
+inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia;
+inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia;
+
+game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game;
+
+inputGameID#32c3e77 id:long access_hash:long = InputGame;
+inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame;
+
+highScore#73a379eb pos:int user_id:long score:int = HighScore;
+
+messages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores;
+
+textEmpty#dc3d824f = RichText;
+textPlain#744694e0 text:string = RichText;
+textBold#6724abc4 text:RichText = RichText;
+textItalic#d912a59c text:RichText = RichText;
+textUnderline#c12622c4 text:RichText = RichText;
+textStrike#9bf8bb95 text:RichText = RichText;
+textFixed#6c3f19b9 text:RichText = RichText;
+textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText;
+textEmail#de5a0dd6 text:RichText email:string = RichText;
+textConcat#7e6260d7 texts:Vector<RichText> = RichText;
+textSubscript#ed6a8504 text:RichText = RichText;
+textSuperscript#c7fb5e01 text:RichText = RichText;
+textMarked#34b8621 text:RichText = RichText;
+textPhone#1ccb966a text:RichText phone:string = RichText;
+textImage#81ccf4f document_id:long w:int h:int = RichText;
+textAnchor#35553762 text:RichText name:string = RichText;
+
+pageBlockUnsupported#13567e8a = PageBlock;
+pageBlockTitle#70abc3fd text:RichText = PageBlock;
+pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock;
+pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock;
+pageBlockHeader#bfd064ec text:RichText = PageBlock;
+pageBlockSubheader#f12bb6e1 text:RichText = PageBlock;
+pageBlockParagraph#467a0766 text:RichText = PageBlock;
+pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock;
+pageBlockFooter#48870999 text:RichText = PageBlock;
+pageBlockDivider#db20b188 = PageBlock;
+pageBlockAnchor#ce0d37b0 name:string = PageBlock;
+pageBlockList#e4e88011 items:Vector<PageListItem> = PageBlock;
+pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock;
+pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock;
+pageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock;
+pageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock;
+pageBlockCover#39f23300 cover:PageBlock = PageBlock;
+pageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock;
+pageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:PageCaption = PageBlock;
+pageBlockCollage#65a0fa4d items:Vector<PageBlock> caption:PageCaption = PageBlock;
+pageBlockSlideshow#31f9590 items:Vector<PageBlock> caption:PageCaption = PageBlock;
+pageBlockChannel#ef1751b5 channel:Chat = PageBlock;
+pageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock;
+pageBlockKicker#1e148390 text:RichText = PageBlock;
+pageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector<PageTableRow> = PageBlock;
+pageBlockOrderedList#9a8ae1e1 items:Vector<PageListOrderedItem> = PageBlock;
+pageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector<PageBlock> title:RichText = PageBlock;
+pageBlockRelatedArticles#16115a96 title:RichText articles:Vector<PageRelatedArticle> = PageBlock;
+pageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock;
+
+phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason;
+phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason;
+phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason;
+phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason;
+
+dataJSON#7d748d04 data:string = DataJSON;
+
+labeledPrice#cb296bf8 label:string amount:long = LabeledPrice;
+
+invoice#cd886e0 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector<LabeledPrice> max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector<long> = Invoice;
+
+paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge;
+
+postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress;
+
+paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo;
+
+paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials;
+
+webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;
+webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;
+
+inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument;
+
+inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation;
+inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation;
+
+upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile;
+
+payments.paymentForm#1694761b flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:long invoice:Invoice provider_id:long url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm;
+
+payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo;
+
+payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult;
+payments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult;
+
+payments.paymentReceipt#70c4fe03 flags:# date:int bot_id:long provider_id:long title:string description:string photo:flags.2?WebDocument invoice:Invoice info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption tip_amount:flags.3?long currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt;
+
+payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo;
+
+inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials;
+inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials;
+inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials;
+inputPaymentCredentialsGooglePay#8ac32801 payment_token:DataJSON = InputPaymentCredentials;
+
+account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword;
+
+shippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption;
+
+inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem;
+
+inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall;
+
+phoneCallEmpty#5366c915 id:long = PhoneCall;
+phoneCallWaiting#c5226f17 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall;
+phoneCallRequested#14b0ed0c flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall;
+phoneCallAccepted#3660c311 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_b:bytes protocol:PhoneCallProtocol = PhoneCall;
+phoneCall#967f7c67 flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int = PhoneCall;
+phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall;
+
+phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;
+phoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection;
+
+phoneCallProtocol#fc878fc8 flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int library_versions:Vector<string> = PhoneCallProtocol;
+
+phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall;
+
+upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile;
+upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile;
+
+cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey;
+
+cdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig;
+
+langPackString#cad181f6 key:string value:string = LangPackString;
+langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString;
+langPackStringDeleted#2979eeb2 key:string = LangPackString;
+
+langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference;
+
+langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage;
+
+channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangePhoto#434bd2af prev_photo:Photo new_photo:Photo = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction;
+channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction;
+channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeLinkedChat#50c7ac8 prev_value:long new_value:long = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction;
+channelAdminLogEventActionStartGroupCall#23209745 call:InputGroupCall = ChannelAdminLogEventAction;
+channelAdminLogEventActionDiscardGroupCall#db9f9140 call:InputGroupCall = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantMute#f92424d2 participant:GroupCallParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantUnmute#e64429c0 participant:GroupCallParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleGroupCallSetting#56d6a247 join_muted:Bool = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantJoinByInvite#5cdada77 invite:ExportedChatInvite = ChannelAdminLogEventAction;
+channelAdminLogEventActionExportedInviteDelete#5a50fca4 invite:ExportedChatInvite = ChannelAdminLogEventAction;
+channelAdminLogEventActionExportedInviteRevoke#410a134e invite:ExportedChatInvite = ChannelAdminLogEventAction;
+channelAdminLogEventActionExportedInviteEdit#e90ebb59 prev_invite:ExportedChatInvite new_invite:ExportedChatInvite = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantVolume#3e7f6847 participant:GroupCallParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int = ChannelAdminLogEventAction;
+
+channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
+
+channels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults;
+
+channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true = ChannelAdminLogEventsFilter;
+
+popularContact#5ce14175 client_id:long importers:int = PopularContact;
+
+messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers;
+messages.favedStickers#2cb51097 hash:long packs:Vector<StickerPack> stickers:Vector<Document> = messages.FavedStickers;
+
+recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl;
+recentMeUrlUser#b92c09e2 url:string user_id:long = RecentMeUrl;
+recentMeUrlChat#b2da71d2 url:string chat_id:long = RecentMeUrl;
+recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl;
+recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl;
+
+help.recentMeUrls#e0310d7 urls:Vector<RecentMeUrl> chats:Vector<Chat> users:Vector<User> = help.RecentMeUrls;
+
+inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector<MessageEntity> = InputSingleMedia;
+
+webAuthorization#a6f8f452 hash:long bot_id:long domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization;
+
+account.webAuthorizations#ed56c9fc authorizations:Vector<WebAuthorization> users:Vector<User> = account.WebAuthorizations;
+
+inputMessageID#a676a322 id:int = InputMessage;
+inputMessageReplyTo#bad88395 id:int = InputMessage;
+inputMessagePinned#86872538 = InputMessage;
+inputMessageCallbackQuery#acfa1a7e id:int query_id:long = InputMessage;
+
+inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer;
+inputDialogPeerFolder#64600527 folder_id:int = InputDialogPeer;
+
+dialogPeer#e56dbf05 peer:Peer = DialogPeer;
+dialogPeerFolder#514519e2 folder_id:int = DialogPeer;
+
+messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets;
+messages.foundStickerSets#8af09dd2 hash:long sets:Vector<StickerSetCovered> = messages.FoundStickerSets;
+
+fileHash#6242c773 offset:int limit:int hash:bytes = FileHash;
+
+inputClientProxy#75588b3f address:string port:int = InputClientProxy;
+
+help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;
+help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;
+
+inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile;
+inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile;
+
+secureFileEmpty#64199744 = SecureFile;
+secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile;
+
+secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData;
+
+securePlainPhone#7d6099dd phone:string = SecurePlainData;
+securePlainEmail#21ec5a5f email:string = SecurePlainData;
+
+secureValueTypePersonalDetails#9d2a81e3 = SecureValueType;
+secureValueTypePassport#3dac6a00 = SecureValueType;
+secureValueTypeDriverLicense#6e425c4 = SecureValueType;
+secureValueTypeIdentityCard#a0d0744b = SecureValueType;
+secureValueTypeInternalPassport#99a48f23 = SecureValueType;
+secureValueTypeAddress#cbe31e26 = SecureValueType;
+secureValueTypeUtilityBill#fc36954e = SecureValueType;
+secureValueTypeBankStatement#89137c0d = SecureValueType;
+secureValueTypeRentalAgreement#8b883488 = SecureValueType;
+secureValueTypePassportRegistration#99e3806a = SecureValueType;
+secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType;
+secureValueTypePhone#b320aadb = SecureValueType;
+secureValueTypeEmail#8e3ca7ee = SecureValueType;
+
+secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector<SecureFile> files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue;
+
+inputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector<InputSecureFile> files:flags.4?Vector<InputSecureFile> plain_data:flags.5?SecurePlainData = InputSecureValue;
+
+secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash;
+
+secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError;
+secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
+secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError;
+secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError;
+secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
+
+secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted;
+
+account.authorizationForm#ad2e1cd8 flags:# required_types:Vector<SecureRequiredType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm;
+
+account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode;
+
+help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo;
+help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector<MessageEntity> = help.DeepLinkInfo;
+
+savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact;
+
+account.takeout#4dba4501 id:long = account.Takeout;
+
+passwordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo;
+passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo;
+
+securePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo;
+securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo;
+securePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo;
+
+secureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings;
+
+inputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP;
+inputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP;
+
+secureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType;
+secureRequiredTypeOneOf#27477b4 types:Vector<SecureRequiredType> = SecureRequiredType;
+
+help.passportConfigNotModified#bfb9f457 = help.PassportConfig;
+help.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig;
+
+inputAppEvent#1d1b1245 time:double type:string peer:long data:JSONValue = InputAppEvent;
+
+jsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue;
+
+jsonNull#3f6d7b68 = JSONValue;
+jsonBool#c7345e6a value:Bool = JSONValue;
+jsonNumber#2be0dfa4 value:double = JSONValue;
+jsonString#b71e767a value:string = JSONValue;
+jsonArray#f7444763 value:Vector<JSONValue> = JSONValue;
+jsonObject#99c1d49d value:Vector<JSONObjectValue> = JSONValue;
+
+pageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell;
+
+pageTableRow#e0c0c5e5 cells:Vector<PageTableCell> = PageTableRow;
+
+pageCaption#6f747657 text:RichText credit:RichText = PageCaption;
+
+pageListItemText#b92fb6cd text:RichText = PageListItem;
+pageListItemBlocks#25e073fc blocks:Vector<PageBlock> = PageListItem;
+
+pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem;
+pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector<PageBlock> = PageListOrderedItem;
+
+pageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle;
+
+page#98657f0d flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> views:flags.3?int = Page;
+
+help.supportName#8c05f1c9 name:string = help.SupportName;
+
+help.userInfoEmpty#f3ae2eed = help.UserInfo;
+help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo;
+
+pollAnswer#6ca9c2e9 text:string option:bytes = PollAnswer;
+
+poll#86e18161 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll;
+
+pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters;
+
+pollResults#dcb82ea3 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<long> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults;
+
+chatOnlines#f041e250 onlines:int = ChatOnlines;
+
+statsURL#47a971e0 url:string = StatsURL;
+
+chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true = ChatAdminRights;
+
+chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true until_date:int = ChatBannedRights;
+
+inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper;
+inputWallPaperSlug#72091c80 slug:string = InputWallPaper;
+inputWallPaperNoFile#967a462e id:long = InputWallPaper;
+
+account.wallPapersNotModified#1c199183 = account.WallPapers;
+account.wallPapers#cdc3858c hash:long wallpapers:Vector<WallPaper> = account.WallPapers;
+
+codeSettings#debebe83 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true = CodeSettings;
+
+wallPaperSettings#1dc1bca4 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings;
+
+autoDownloadSettings#e04232f3 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true photo_size_max:int video_size_max:int file_size_max:int video_upload_maxbitrate:int = AutoDownloadSettings;
+
+account.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings;
+
+emojiKeyword#d5b3b9f9 keyword:string emoticons:Vector<string> = EmojiKeyword;
+emojiKeywordDeleted#236df622 keyword:string emoticons:Vector<string> = EmojiKeyword;
+
+emojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int keywords:Vector<EmojiKeyword> = EmojiKeywordsDifference;
+
+emojiURL#a575739d url:string = EmojiURL;
+
+emojiLanguage#b3fb5361 lang_code:string = EmojiLanguage;
+
+folder#ff544e65 flags:# autofill_new_broadcasts:flags.0?true autofill_public_groups:flags.1?true autofill_new_correspondents:flags.2?true id:int title:string photo:flags.3?ChatPhoto = Folder;
+
+inputFolderPeer#fbd2c296 peer:InputPeer folder_id:int = InputFolderPeer;
+
+folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer;
+
+messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter;
+
+urlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult;
+urlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult;
+urlAuthResultDefault#a9d6db1f = UrlAuthResult;
+
+channelLocationEmpty#bfb5ad8b = ChannelLocation;
+channelLocation#209b82db geo_point:GeoPoint address:string = ChannelLocation;
+
+peerLocated#ca461b5d peer:Peer expires:int distance:int = PeerLocated;
+peerSelfLocated#f8ec284b expires:int = PeerLocated;
+
+restrictionReason#d072acb4 platform:string reason:string text:string = RestrictionReason;
+
+inputTheme#3c5693e9 id:long access_hash:long = InputTheme;
+inputThemeSlug#f5890df1 slug:string = InputTheme;
+
+theme#e802b8dc flags:# creator:flags.0?true default:flags.1?true for_chat:flags.5?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?ThemeSettings installs_count:flags.4?int = Theme;
+
+account.themesNotModified#f41eb622 = account.Themes;
+account.themes#9a3d8c6d hash:long themes:Vector<Theme> = account.Themes;
+
+auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken;
+auth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken;
+auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken;
+
+account.contentSettings#57e28221 flags:# sensitive_enabled:flags.0?true sensitive_can_change:flags.1?true = account.ContentSettings;
+
+messages.inactiveChats#a927fec5 dates:Vector<int> chats:Vector<Chat> users:Vector<User> = messages.InactiveChats;
+
+baseThemeClassic#c3a12462 = BaseTheme;
+baseThemeDay#fbd81688 = BaseTheme;
+baseThemeNight#b7b31ea8 = BaseTheme;
+baseThemeTinted#6d5f77ee = BaseTheme;
+baseThemeArctic#5b11125a = BaseTheme;
+
+inputThemeSettings#8fde504f flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector<int> wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings;
+
+themeSettings#fa58b6d4 flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector<int> wallpaper:flags.1?WallPaper = ThemeSettings;
+
+webPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector<Document> settings:flags.1?ThemeSettings = WebPageAttribute;
+
+messageUserVote#34d247b4 user_id:long option:bytes date:int = MessageUserVote;
+messageUserVoteInputOption#3ca5b0ec user_id:long date:int = MessageUserVote;
+messageUserVoteMultiple#8a65e557 user_id:long options:Vector<bytes> date:int = MessageUserVote;
+
+messages.votesList#823f649 flags:# count:int votes:Vector<MessageUserVote> users:Vector<User> next_offset:flags.0?string = messages.VotesList;
+
+bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl;
+
+payments.bankCardData#3e24e573 title:string open_urls:Vector<BankCardOpenUrl> = payments.BankCardData;
+
+dialogFilter#7438f7e8 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> exclude_peers:Vector<InputPeer> = DialogFilter;
+
+dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested;
+
+statsDateRangeDays#b637edaf min_date:int max_date:int = StatsDateRangeDays;
+
+statsAbsValueAndPrev#cb43acde current:double previous:double = StatsAbsValueAndPrev;
+
+statsPercentValue#cbce2fe0 part:double total:double = StatsPercentValue;
+
+statsGraphAsync#4a27eb2d token:string = StatsGraph;
+statsGraphError#bedc9822 error:string = StatsGraph;
+statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph;
+
+messageInteractionCounters#ad4fc9bd msg_id:int views:int forwards:int = MessageInteractionCounters;
+
+stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector<MessageInteractionCounters> = stats.BroadcastStats;
+
+help.promoDataEmpty#98f6ac75 expires:int = help.PromoData;
+help.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_type:flags.1?string psa_message:flags.2?string = help.PromoData;
+
+videoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize;
+
+statsGroupTopPoster#9d04af9b user_id:long messages:int avg_chars:int = StatsGroupTopPoster;
+
+statsGroupTopAdmin#d7584c87 user_id:long deleted:int kicked:int banned:int = StatsGroupTopAdmin;
+
+statsGroupTopInviter#535f779d user_id:long invitations:int = StatsGroupTopInviter;
+
+stats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector<StatsGroupTopPoster> top_admins:Vector<StatsGroupTopAdmin> top_inviters:Vector<StatsGroupTopInviter> users:Vector<User> = stats.MegagroupStats;
+
+globalPrivacySettings#bea2f424 flags:# archive_and_mute_new_noncontact_peers:flags.0?Bool = GlobalPrivacySettings;
+
+help.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector<string> patterns:flags.1?Vector<string> = help.CountryCode;
+
+help.country#c3878e23 flags:# hidden:flags.0?true iso2:string default_name:string name:flags.1?string country_codes:Vector<help.CountryCode> = help.Country;
+
+help.countriesListNotModified#93cc1f32 = help.CountriesList;
+help.countriesList#87d0759e countries:Vector<help.Country> hash:int = help.CountriesList;
+
+messageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:flags.2?MessageReplies = MessageViews;
+
+messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> users:Vector<User> = messages.MessageViews;
+
+messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
+
+messageReplyHeader#a6d57763 flags:# reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader;
+
+messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;
+
+peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked;
+
+stats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats;
+
+groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall;
+groupCall#d597650c flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int = GroupCall;
+
+inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall;
+
+groupCallParticipant#eba636fe flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true video_joined:flags.15?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long video:flags.6?GroupCallParticipantVideo presentation:flags.14?GroupCallParticipantVideo = GroupCallParticipant;
+
+phone.groupCall#9e727aad call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string chats:Vector<Chat> users:Vector<User> = phone.GroupCall;
+
+phone.groupParticipants#f47751b6 count:int participants:Vector<GroupCallParticipant> next_offset:string chats:Vector<Chat> users:Vector<User> version:int = phone.GroupParticipants;
+
+inlineQueryPeerTypeSameBotPM#3081ed9d = InlineQueryPeerType;
+inlineQueryPeerTypePM#833c0fac = InlineQueryPeerType;
+inlineQueryPeerTypeChat#d766c50a = InlineQueryPeerType;
+inlineQueryPeerTypeMegagroup#5ec4be43 = InlineQueryPeerType;
+inlineQueryPeerTypeBroadcast#6334ee9a = InlineQueryPeerType;
+
+messages.historyImport#1662af0b id:long = messages.HistoryImport;
+
+messages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true title:flags.2?string = messages.HistoryImportParsed;
+
+messages.affectedFoundMessages#ef8d3e6c pts:int pts_count:int offset:int messages:Vector<int> = messages.AffectedFoundMessages;
+
+chatInviteImporter#b5cd5f4 user_id:long date:int = ChatInviteImporter;
+
+messages.exportedChatInvites#bdc62dcc count:int invites:Vector<ExportedChatInvite> users:Vector<User> = messages.ExportedChatInvites;
+
+messages.exportedChatInvite#1871be50 invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite;
+messages.exportedChatInviteReplaced#222600ef invite:ExportedChatInvite new_invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite;
+
+messages.chatInviteImporters#81b6b00a count:int importers:Vector<ChatInviteImporter> users:Vector<User> = messages.ChatInviteImporters;
+
+chatAdminWithInvites#f2ecef23 admin_id:long invites_count:int revoked_invites_count:int = ChatAdminWithInvites;
+
+messages.chatAdminsWithInvites#b69b72d7 admins:Vector<ChatAdminWithInvites> users:Vector<User> = messages.ChatAdminsWithInvites;
+
+messages.checkedHistoryImportPeer#a24de717 confirm_text:string = messages.CheckedHistoryImportPeer;
+
+phone.joinAsPeers#afe5623f peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = phone.JoinAsPeers;
+
+phone.exportedGroupCallInvite#204bd158 link:string = phone.ExportedGroupCallInvite;
+
+groupCallParticipantVideoSourceGroup#dcb118b7 semantics:string sources:Vector<int> = GroupCallParticipantVideoSourceGroup;
+
+groupCallParticipantVideo#67753ac8 flags:# paused:flags.0?true endpoint:string source_groups:Vector<GroupCallParticipantVideoSourceGroup> audio_source:flags.1?int = GroupCallParticipantVideo;
+
+stickers.suggestedShortName#85fea03f short_name:string = stickers.SuggestedShortName;
+
+botCommandScopeDefault#2f6cb2ab = BotCommandScope;
+botCommandScopeUsers#3c4f04d8 = BotCommandScope;
+botCommandScopeChats#6fe1a881 = BotCommandScope;
+botCommandScopeChatAdmins#b9aa606a = BotCommandScope;
+botCommandScopePeer#db9d897d peer:InputPeer = BotCommandScope;
+botCommandScopePeerAdmins#3fd863d1 peer:InputPeer = BotCommandScope;
+botCommandScopePeerUser#a1321f3 peer:InputPeer user_id:InputUser = BotCommandScope;
+
+account.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordResult;
+account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult;
+account.resetPasswordOk#e926d63e = account.ResetPasswordResult;
+
+chatTheme#ed0b5c33 emoticon:string theme:Theme dark_theme:Theme = ChatTheme;
+
+account.chatThemesNotModified#e011e1c4 = account.ChatThemes;
+account.chatThemes#fe4cbebd hash:int themes:Vector<ChatTheme> = account.ChatThemes;
+
+sponsoredMessage#2a3c381f flags:# random_id:bytes from_id:Peer start_param:flags.0?string message:string entities:flags.1?Vector<MessageEntity> = SponsoredMessage;
+
+messages.sponsoredMessages#65a4c7d5 messages:Vector<SponsoredMessage> chats:Vector<Chat> users:Vector<User> = messages.SponsoredMessages;
+
+---functions---
+
+invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
+invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X;
+initConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;
+invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
+invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;
+invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X;
+invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
+
+auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
+auth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;
+auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization;
+auth.logOut#5717da40 = Bool;
+auth.resetAuthorizations#9fab0d1a = Bool;
+auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;
+auth.importAuthorization#a57a7dad id:long bytes:bytes = auth.Authorization;
+auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool;
+auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization;
+auth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization;
+auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery;
+auth.recoverPassword#37096c70 flags:# code:string new_settings:flags.0?account.PasswordInputSettings = auth.Authorization;
+auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode;
+auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool;
+auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool;
+auth.exportLoginToken#b7e085fe api_id:int api_hash:string except_ids:Vector<long> = auth.LoginToken;
+auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken;
+auth.acceptLoginToken#e894ad4d token:bytes = Authorization;
+auth.checkRecoveryPassword#d36bf79 code:string = Bool;
+
+account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<long> = Bool;
+account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector<long> = Bool;
+account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool;
+account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings;
+account.resetNotifySettings#db7e1747 = Bool;
+account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User;
+account.updateStatus#6628562c offline:Bool = Bool;
+account.getWallPapers#7967d36 hash:long = account.WallPapers;
+account.reportPeer#c5ba3d86 peer:InputPeer reason:ReportReason message:string = Bool;
+account.checkUsername#2714d86c username:string = Bool;
+account.updateUsername#3e0bdd7c username:string = User;
+account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules;
+account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules;
+account.deleteAccount#418d4e0b reason:string = Bool;
+account.getAccountTTL#8fc711d = AccountDaysTTL;
+account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool;
+account.sendChangePhoneCode#82574ae5 phone_number:string settings:CodeSettings = auth.SentCode;
+account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User;
+account.updateDeviceLocked#38df3532 period:int = Bool;
+account.getAuthorizations#e320c158 = account.Authorizations;
+account.resetAuthorization#df77f3bc hash:long = Bool;
+account.getPassword#548a30f5 = account.Password;
+account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings;
+account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool;
+account.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode;
+account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool;
+account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword;
+account.getWebAuthorizations#182e6d6f = account.WebAuthorizations;
+account.resetWebAuthorization#2d01b9ef hash:long = Bool;
+account.resetWebAuthorizations#682d2594 = Bool;
+account.getAllSecureValues#b288bc7d = Vector<SecureValue>;
+account.getSecureValue#73665bc2 types:Vector<SecureValueType> = Vector<SecureValue>;
+account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue;
+account.deleteSecureValue#b880bc4b types:Vector<SecureValueType> = Bool;
+account.getAuthorizationForm#a929597a bot_id:long scope:string public_key:string = account.AuthorizationForm;
+account.acceptAuthorization#f3ed4c73 bot_id:long scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool;
+account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode;
+account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool;
+account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode;
+account.verifyEmail#ecba39db email:string code:string = Bool;
+account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout;
+account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool;
+account.confirmPasswordEmail#8fdf1920 code:string = Bool;
+account.resendPasswordEmail#7a7f2a15 = Bool;
+account.cancelPasswordEmail#c1cbd5b6 = Bool;
+account.getContactSignUpNotification#9f07c728 = Bool;
+account.setContactSignUpNotification#cff43f61 silent:Bool = Bool;
+account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true peer:flags.0?InputNotifyPeer = Updates;
+account.getWallPaper#fc8ddbea wallpaper:InputWallPaper = WallPaper;
+account.uploadWallPaper#dd853661 file:InputFile mime_type:string settings:WallPaperSettings = WallPaper;
+account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool;
+account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool;
+account.resetWallPapers#bb3b9804 = Bool;
+account.getAutoDownloadSettings#56da0b3f = account.AutoDownloadSettings;
+account.saveAutoDownloadSettings#76f36233 flags:# low:flags.0?true high:flags.1?true settings:AutoDownloadSettings = Bool;
+account.uploadTheme#1c3db333 flags:# file:InputFile thumb:flags.0?InputFile file_name:string mime_type:string = Document;
+account.createTheme#8432c21f flags:# slug:string title:string document:flags.2?InputDocument settings:flags.3?InputThemeSettings = Theme;
+account.updateTheme#5cb367d5 flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument settings:flags.3?InputThemeSettings = Theme;
+account.saveTheme#f257106c theme:InputTheme unsave:Bool = Bool;
+account.installTheme#7ae43737 flags:# dark:flags.0?true format:flags.1?string theme:flags.1?InputTheme = Bool;
+account.getTheme#8d9d742b format:string theme:InputTheme document_id:long = Theme;
+account.getThemes#7206e458 format:string hash:long = account.Themes;
+account.setContentSettings#b574b16b flags:# sensitive_enabled:flags.0?true = Bool;
+account.getContentSettings#8b9b4dae = account.ContentSettings;
+account.getMultiWallPapers#65ad71dc wallpapers:Vector<InputWallPaper> = Vector<WallPaper>;
+account.getGlobalPrivacySettings#eb2b4cf6 = GlobalPrivacySettings;
+account.setGlobalPrivacySettings#1edaaac2 settings:GlobalPrivacySettings = GlobalPrivacySettings;
+account.reportProfilePhoto#fa8cc6f5 peer:InputPeer photo_id:InputPhoto reason:ReportReason message:string = Bool;
+account.resetPassword#9308ce1b = account.ResetPasswordResult;
+account.declinePasswordReset#4c9409f6 = Bool;
+account.getChatThemes#d6d71d7b hash:int = account.ChatThemes;
+
+users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
+users.getFullUser#ca30a5b1 id:InputUser = UserFull;
+users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector<SecureValueError> = Bool;
+
+contacts.getContactIDs#7adc669d hash:long = Vector<int>;
+contacts.getStatuses#c4a353ee = Vector<ContactStatus>;
+contacts.getContacts#5dd69e12 hash:long = contacts.Contacts;
+contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts;
+contacts.deleteContacts#96a0e00 id:Vector<InputUser> = Updates;
+contacts.deleteByPhones#1013fd9e phones:Vector<string> = Bool;
+contacts.block#68cc1411 id:InputPeer = Bool;
+contacts.unblock#bea65d50 id:InputPeer = Bool;
+contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked;
+contacts.search#11f812d8 q:string limit:int = contacts.Found;
+contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer;
+contacts.getTopPeers#973478b6 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:long = contacts.TopPeers;
+contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool;
+contacts.resetSaved#879537f1 = Bool;
+contacts.getSaved#82f1e39f = Vector<SavedContact>;
+contacts.toggleTopPeers#8514bdda enabled:Bool = Bool;
+contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates;
+contacts.acceptContact#f831a20f id:InputUser = Updates;
+contacts.getLocated#d348bc44 flags:# background:flags.1?true geo_point:InputGeoPoint self_expires:flags.0?int = Updates;
+contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_history:flags.1?true report_spam:flags.2?true msg_id:int = Updates;
+
+messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
+messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs;
+messages.getHistory#4423e6c5 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;
+messages.search#a0fda762 flags:# peer:InputPeer q:string from_id:flags.0?InputPeer top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;
+messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;
+messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int = messages.AffectedHistory;
+messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
+messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
+messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;
+messages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int = Updates;
+messages.reportSpam#cf1592db peer:InputPeer = Bool;
+messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings;
+messages.report#8953ab4e peer:InputPeer id:Vector<int> reason:ReportReason message:string = Bool;
+messages.getChats#49e9528f id:Vector<long> = messages.Chats;
+messages.getFullChat#aeb00b34 chat_id:long = messages.ChatFull;
+messages.editChatTitle#73783ffd chat_id:long title:string = Updates;
+messages.editChatPhoto#35ddd674 chat_id:long photo:InputChatPhoto = Updates;
+messages.addChatUser#f24753e3 chat_id:long user_id:InputUser fwd_limit:int = Updates;
+messages.deleteChatUser#a2185cab flags:# revoke_history:flags.0?true chat_id:long user_id:InputUser = Updates;
+messages.createChat#9cb126e users:Vector<InputUser> title:string = Updates;
+messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig;
+messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat;
+messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat;
+messages.discardEncryption#f393aea0 flags:# delete_history:flags.0?true chat_id:int = Bool;
+messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool;
+messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool;
+messages.sendEncrypted#44fa7a15 flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
+messages.sendEncryptedFile#5559481d flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage;
+messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
+messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>;
+messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool;
+messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages;
+messages.getStickers#d5a5d3a1 emoticon:string hash:long = messages.Stickers;
+messages.getAllStickers#b8a0a1a8 hash:long = messages.AllStickers;
+messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector<MessageEntity> = MessageMedia;
+messages.exportChatInvite#14b9bcd7 flags:# legacy_revoke_permanent:flags.2?true peer:InputPeer expire_date:flags.0?int usage_limit:flags.1?int = ExportedChatInvite;
+messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
+messages.importChatInvite#6c50051c hash:string = Updates;
+messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
+messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult;
+messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
+messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates;
+messages.getMessagesViews#5784d3e1 peer:InputPeer id:Vector<int> increment:Bool = messages.MessageViews;
+messages.editChatAdmin#a85bd1c2 chat_id:long user_id:InputUser is_admin:Bool = Bool;
+messages.migrateChat#a2875319 chat_id:long = Updates;
+messages.searchGlobal#4bc6589a flags:# folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
+messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector<long> = Bool;
+messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document;
+messages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs;
+messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool;
+messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;
+messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool;
+messages.sendInlineBotResult#220815b0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string schedule_date:flags.10?int = Updates;
+messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData;
+messages.editMessage#48f71778 flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int = Updates;
+messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Bool;
+messages.getBotCallbackAnswer#9342ca07 flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes password:flags.2?InputCheckPasswordSRP = messages.BotCallbackAnswer;
+messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool;
+messages.getPeerDialogs#e470bcfd peers:Vector<InputDialogPeer> = messages.PeerDialogs;
+messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> = Bool;
+messages.getAllDrafts#6a3f8d65 = Updates;
+messages.getFeaturedStickers#64780b14 hash:long = messages.FeaturedStickers;
+messages.readFeaturedStickers#5b118126 id:Vector<long> = Bool;
+messages.getRecentStickers#9da9403b flags:# attached:flags.0?true hash:long = messages.RecentStickers;
+messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool;
+messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool;
+messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers;
+messages.getMaskStickers#640f82b8 hash:long = messages.AllStickers;
+messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector<StickerSetCovered>;
+messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates;
+messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool;
+messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores;
+messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores;
+messages.getCommonChats#e40ca104 user_id:InputUser max_id:long limit:int = messages.Chats;
+messages.getAllChats#875f74be except_ids:Vector<long> = messages.Chats;
+messages.getWebPage#32ca8f91 url:string hash:int = WebPage;
+messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool;
+messages.reorderPinnedDialogs#3b1adf37 flags:# force:flags.0?true folder_id:int order:Vector<InputDialogPeer> = Bool;
+messages.getPinnedDialogs#d6b94df2 folder_id:int = messages.PeerDialogs;
+messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool;
+messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool;
+messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia;
+messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates;
+messages.getFavedStickers#4f1aaa9 hash:long = messages.FavedStickers;
+messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;
+messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
+messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory;
+messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages;
+messages.sendMultiMedia#cc0110cb flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int = Updates;
+messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile;
+messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets;
+messages.getSplitRanges#1cff7e08 = Vector<MessageRange>;
+messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool;
+messages.getDialogUnreadMarks#22e24e22 = Vector<DialogPeer>;
+messages.clearAllDrafts#7e58ee9c = Bool;
+messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?true pm_oneside:flags.2?true peer:InputPeer id:int = Updates;
+messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates;
+messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates;
+messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;
+messages.editChatAbout#def60797 peer:InputPeer about:string = Bool;
+messages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates;
+messages.getEmojiKeywords#35a0e062 lang_code:string = EmojiKeywordsDifference;
+messages.getEmojiKeywordsDifference#1508b6af lang_code:string from_version:int = EmojiKeywordsDifference;
+messages.getEmojiKeywordsLanguages#4e9963b2 lang_codes:Vector<string> = Vector<EmojiLanguage>;
+messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL;
+messages.getSearchCounters#732eef00 peer:InputPeer filters:Vector<MessagesFilter> = Vector<messages.SearchCounter>;
+messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult;
+messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult;
+messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool;
+messages.getScheduledHistory#f516760b peer:InputPeer hash:long = messages.Messages;
+messages.getScheduledMessages#bdbb0464 peer:InputPeer id:Vector<int> = messages.Messages;
+messages.sendScheduledMessages#bd38850a peer:InputPeer id:Vector<int> = Updates;
+messages.deleteScheduledMessages#59ae2b16 peer:InputPeer id:Vector<int> = Updates;
+messages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?bytes offset:flags.1?string limit:int = messages.VotesList;
+messages.toggleStickerSets#b5052fea flags:# uninstall:flags.0?true archive:flags.1?true unarchive:flags.2?true stickersets:Vector<InputStickerSet> = Bool;
+messages.getDialogFilters#f19ed96d = Vector<DialogFilter>;
+messages.getSuggestedDialogFilters#a29cd42c = Vector<DialogFilterSuggested>;
+messages.updateDialogFilter#1ad4a04a flags:# id:int filter:flags.0?DialogFilter = Bool;
+messages.updateDialogFiltersOrder#c563c1e4 order:Vector<int> = Bool;
+messages.getOldFeaturedStickers#7ed094a1 offset:int limit:int hash:long = messages.FeaturedStickers;
+messages.getReplies#22ddd30c peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;
+messages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage;
+messages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool;
+messages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory;
+messages.deleteChat#5bd0ee50 chat_id:long = Bool;
+messages.deletePhoneCallHistory#f9cbe409 flags:# revoke:flags.0?true = messages.AffectedFoundMessages;
+messages.checkHistoryImport#43fe19f3 import_head:string = messages.HistoryImportParsed;
+messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport;
+messages.uploadImportedMedia#2a862092 peer:InputPeer import_id:long file_name:string media:InputMedia = MessageMedia;
+messages.startHistoryImport#b43df344 peer:InputPeer import_id:long = Bool;
+messages.getExportedChatInvites#a2b5a3f6 flags:# revoked:flags.3?true peer:InputPeer admin_id:InputUser offset_date:flags.2?int offset_link:flags.2?string limit:int = messages.ExportedChatInvites;
+messages.getExportedChatInvite#73746f5c peer:InputPeer link:string = messages.ExportedChatInvite;
+messages.editExportedChatInvite#2e4ffbe flags:# revoked:flags.2?true peer:InputPeer link:string expire_date:flags.0?int usage_limit:flags.1?int = messages.ExportedChatInvite;
+messages.deleteRevokedExportedChatInvites#56987bd5 peer:InputPeer admin_id:InputUser = Bool;
+messages.deleteExportedChatInvite#d464a42b peer:InputPeer link:string = Bool;
+messages.getAdminsWithInvites#3920e6ef peer:InputPeer = messages.ChatAdminsWithInvites;
+messages.getChatInviteImporters#26fb7289 peer:InputPeer link:string offset_date:int offset_user:InputUser limit:int = messages.ChatInviteImporters;
+messages.setHistoryTTL#b80e5fe4 peer:InputPeer period:int = Updates;
+messages.checkHistoryImportPeer#5dc60f03 peer:InputPeer = messages.CheckedHistoryImportPeer;
+messages.setChatTheme#e63be13f peer:InputPeer emoticon:string = Updates;
+messages.getMessageReadParticipants#2c6f97b7 peer:InputPeer msg_id:int = Vector<long>;
+
+updates.getState#edd4882a = updates.State;
+updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
+updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference;
+
+photos.updateProfilePhoto#72d4742c id:InputPhoto = photos.Photo;
+photos.uploadProfilePhoto#89f30f69 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = photos.Photo;
+photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>;
+photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos;
+
+upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool;
+upload.getFile#b15a9afc flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:int limit:int = upload.File;
+upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool;
+upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile;
+upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile;
+upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector<FileHash>;
+upload.getCdnFileHashes#4da54231 file_token:bytes offset:int = Vector<FileHash>;
+upload.getFileHashes#c7025931 location:InputFileLocation offset:int = Vector<FileHash>;
+
+help.getConfig#c4f9186b = Config;
+help.getNearestDc#1fb33026 = NearestDc;
+help.getAppUpdate#522d5a7d source:string = help.AppUpdate;
+help.getInviteText#4d392343 = help.InviteText;
+help.getSupport#9cdf08cd = help.Support;
+help.getAppChangelog#9010ef6f prev_app_version:string = Updates;
+help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool;
+help.getCdnConfig#52029342 = CdnConfig;
+help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;
+help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
+help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
+help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
+help.getAppConfig#98914110 = JSONValue;
+help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool;
+help.getPassportConfig#c661ad08 hash:int = help.PassportConfig;
+help.getSupportName#d360e72c = help.SupportName;
+help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo;
+help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo;
+help.getPromoData#c0977421 = help.PromoData;
+help.hidePromoData#1e251c95 peer:InputPeer = Bool;
+help.dismissSuggestion#f50dbaa1 peer:InputPeer suggestion:string = Bool;
+help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList;
+
+channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
+channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
+channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory;
+channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool;
+channels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages;
+channels.getParticipants#77ced9d0 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:long = channels.ChannelParticipants;
+channels.getParticipant#a0ab6cc6 channel:InputChannel participant:InputPeer = channels.ChannelParticipant;
+channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;
+channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
+channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates;
+channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates;
+channels.editTitle#566decd0 channel:InputChannel title:string = Updates;
+channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;
+channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool;
+channels.updateUsername#3514b3de channel:InputChannel username:string = Bool;
+channels.joinChannel#24b524c5 channel:InputChannel = Updates;
+channels.leaveChannel#f836aa95 channel:InputChannel = Updates;
+channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates;
+channels.deleteChannel#c0111fe3 channel:InputChannel = Updates;
+channels.exportMessageLink#e63fadeb flags:# grouped:flags.0?true thread:flags.1?true channel:InputChannel id:int = ExportedMessageLink;
+channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates;
+channels.getAdminedPublicChannels#f8b036af flags:# by_location:flags.0?true check_limit:flags.1?true = messages.Chats;
+channels.editBanned#96e6cd81 channel:InputChannel participant:InputPeer banned_rights:ChatBannedRights = Updates;
+channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector<InputUser> max_id:long min_id:long limit:int = channels.AdminLogResults;
+channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool;
+channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool;
+channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool;
+channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates;
+channels.getLeftChannels#8341ecc0 offset:int = messages.Chats;
+channels.getGroupsForDiscussion#f5dad378 = messages.Chats;
+channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;
+channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates;
+channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool;
+channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates;
+channels.getInactiveChannels#11e831ee = messages.InactiveChats;
+channels.convertToGigagroup#b290c69 channel:InputChannel = Updates;
+channels.viewSponsoredMessage#beaedb94 channel:InputChannel random_id:bytes = Bool;
+channels.getSponsoredMessages#ec210fbf channel:InputChannel = messages.SponsoredMessages;
+
+bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
+bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
+bots.setBotCommands#517165a scope:BotCommandScope lang_code:string commands:Vector<BotCommand> = Bool;
+bots.resetBotCommands#3d8de0f9 scope:BotCommandScope lang_code:string = Bool;
+bots.getBotCommands#e34c0dd6 scope:BotCommandScope lang_code:string = Vector<BotCommand>;
+
+payments.getPaymentForm#8a333c8d flags:# peer:InputPeer msg_id:int theme_params:flags.0?DataJSON = payments.PaymentForm;
+payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;
+payments.validateRequestedInfo#db103170 flags:# save:flags.0?true peer:InputPeer msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo;
+payments.sendPaymentForm#30c3bc9d flags:# form_id:long peer:InputPeer msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials tip_amount:flags.2?long = payments.PaymentResult;
+payments.getSavedInfo#227d824b = payments.SavedInfo;
+payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool;
+payments.getBankCardData#2e79d779 number:string = payments.BankCardData;
+
+stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true animated:flags.1?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet;
+stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
+stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet;
+stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet;
+stickers.setStickerSetThumb#9a364e30 stickerset:InputStickerSet thumb:InputDocument = messages.StickerSet;
+stickers.checkShortName#284b3639 short_name:string = Bool;
+stickers.suggestShortName#4dafc503 title:string = stickers.SuggestedShortName;
+
+phone.getCallConfig#55451fa9 = DataJSON;
+phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
+phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
+phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall;
+phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool;
+phone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates;
+phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates;
+phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool;
+phone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool;
+phone.createGroupCall#48cdc6d8 flags:# peer:InputPeer random_id:int title:flags.0?string schedule_date:flags.1?int = Updates;
+phone.joinGroupCall#b132ff7b flags:# muted:flags.0?true video_stopped:flags.2?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string params:DataJSON = Updates;
+phone.leaveGroupCall#500377f9 call:InputGroupCall source:int = Updates;
+phone.inviteToGroupCall#7b393160 call:InputGroupCall users:Vector<InputUser> = Updates;
+phone.discardGroupCall#7a777135 call:InputGroupCall = Updates;
+phone.toggleGroupCallSettings#74bbb43d flags:# reset_invite_hash:flags.1?true call:InputGroupCall join_muted:flags.0?Bool = Updates;
+phone.getGroupCall#41845db call:InputGroupCall limit:int = phone.GroupCall;
+phone.getGroupParticipants#c558d8ab call:InputGroupCall ids:Vector<InputPeer> sources:Vector<int> offset:string limit:int = phone.GroupParticipants;
+phone.checkGroupCall#b59cf977 call:InputGroupCall sources:Vector<int> = Vector<int>;
+phone.toggleGroupCallRecord#f128c708 flags:# start:flags.0?true video:flags.2?true call:InputGroupCall title:flags.1?string video_portrait:flags.2?Bool = Updates;
+phone.editGroupCallParticipant#a5273abf flags:# call:InputGroupCall participant:InputPeer muted:flags.0?Bool volume:flags.1?int raise_hand:flags.2?Bool video_stopped:flags.3?Bool video_paused:flags.4?Bool presentation_paused:flags.5?Bool = Updates;
+phone.editGroupCallTitle#1ca6ac0a call:InputGroupCall title:string = Updates;
+phone.getGroupCallJoinAs#ef7c213a peer:InputPeer = phone.JoinAsPeers;
+phone.exportGroupCallInvite#e6aa647f flags:# can_self_unmute:flags.0?true call:InputGroupCall = phone.ExportedGroupCallInvite;
+phone.toggleGroupCallStartSubscription#219c34e6 call:InputGroupCall subscribed:Bool = Updates;
+phone.startScheduledGroupCall#5680e342 call:InputGroupCall = Updates;
+phone.saveDefaultGroupCallJoinAs#575e1f8c peer:InputPeer join_as:InputPeer = Bool;
+phone.joinGroupCallPresentation#cbea6bc4 call:InputGroupCall params:DataJSON = Updates;
+phone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates;
+
+langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
+langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;
+langpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:int = LangPackDifference;
+langpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>;
+langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage;
+
+folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
+folders.deleteFolder#1c295881 folder_id:int = Updates;
+
+stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats;
+stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
+stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats;
+stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
+stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;
+++Below you will find the current end-to-end TL-schema. More details on TL »
+
See also:
+End-to-end encryption in MTProto, Secret Chats
+Detailed schema in JSON
===8===
+decryptedMessage#1f814f1f random_id:long random_bytes:bytes message:string media:DecryptedMessageMedia = DecryptedMessage;
+decryptedMessageService#aa48327d random_id:long random_bytes:bytes action:DecryptedMessageAction = DecryptedMessage;
+decryptedMessageMediaEmpty#89f5c4a = DecryptedMessageMedia;
+decryptedMessageMediaPhoto#32798a8c thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaVideo#4cee6ef3 thumb:bytes thumb_w:int thumb_h:int duration:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaGeoPoint#35480a59 lat:double long:double = DecryptedMessageMedia;
+decryptedMessageMediaContact#588a0a97 phone_number:string first_name:string last_name:string user_id:int = DecryptedMessageMedia;
+decryptedMessageActionSetMessageTTL#a1733aec ttl_seconds:int = DecryptedMessageAction;
+decryptedMessageMediaDocument#b095434b thumb:bytes thumb_w:int thumb_h:int file_name:string mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaAudio#6080758f duration:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageActionReadMessages#c4f40be random_ids:Vector<long> = DecryptedMessageAction;
+decryptedMessageActionDeleteMessages#65614304 random_ids:Vector<long> = DecryptedMessageAction;
+decryptedMessageActionScreenshotMessages#8ac1f475 random_ids:Vector<long> = DecryptedMessageAction;
+decryptedMessageActionFlushHistory#6719e45c = DecryptedMessageAction;
+
+===17===
+decryptedMessage#204d3878 random_id:long ttl:int message:string media:DecryptedMessageMedia = DecryptedMessage;
+decryptedMessageService#73164160 random_id:long action:DecryptedMessageAction = DecryptedMessage;
+decryptedMessageMediaVideo#524a415d thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaAudio#57e0a9cb duration:int mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageLayer#1be31789 random_bytes:bytes layer:int in_seq_no:int out_seq_no:int message:DecryptedMessage = DecryptedMessageLayer;
+sendMessageTypingAction#16bf744e = SendMessageAction;
+sendMessageCancelAction#fd5ec8f5 = SendMessageAction;
+sendMessageRecordVideoAction#a187d66f = SendMessageAction;
+sendMessageUploadVideoAction#92042ff7 = SendMessageAction;
+sendMessageRecordAudioAction#d52f73f7 = SendMessageAction;
+sendMessageUploadAudioAction#e6ac8a6f = SendMessageAction;
+sendMessageUploadPhotoAction#990a3c1a = SendMessageAction;
+sendMessageUploadDocumentAction#8faee98e = SendMessageAction;
+sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
+sendMessageChooseContactAction#628cbc6f = SendMessageAction;
+decryptedMessageActionResend#511110b0 start_seq_no:int end_seq_no:int = DecryptedMessageAction;
+decryptedMessageActionNotifyLayer#f3048883 layer:int = DecryptedMessageAction;
+decryptedMessageActionTyping#ccb27641 action:SendMessageAction = DecryptedMessageAction;
+
+===20===
+decryptedMessageActionRequestKey#f3c9611b exchange_id:long g_a:bytes = DecryptedMessageAction;
+decryptedMessageActionAcceptKey#6fe1735b exchange_id:long g_b:bytes key_fingerprint:long = DecryptedMessageAction;
+decryptedMessageActionAbortKey#dd05ec6b exchange_id:long = DecryptedMessageAction;
+decryptedMessageActionCommitKey#ec2e0b9b exchange_id:long key_fingerprint:long = DecryptedMessageAction;
+decryptedMessageActionNoop#a82fdd63 = DecryptedMessageAction;
+
+===23===
+documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
+documentAttributeAnimated#11b58939 = DocumentAttribute;
+documentAttributeSticker#fb0a5727 = DocumentAttribute;
+documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute;
+documentAttributeAudio#51448e5 duration:int = DocumentAttribute;
+documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
+photoSizeEmpty#e17e23c type:string = PhotoSize;
+photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
+photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
+fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation;
+fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation;
+decryptedMessageMediaExternalDocument#fa95b0dd id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector<DocumentAttribute> = DecryptedMessageMedia;
+
+===45===
+decryptedMessage#36b091de flags:# random_id:long ttl:int message:string media:flags.9?DecryptedMessageMedia entities:flags.7?Vector<MessageEntity> via_bot_name:flags.11?string reply_to_random_id:flags.3?long = DecryptedMessage;
+decryptedMessageMediaPhoto#f1fa8d78 thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia;
+decryptedMessageMediaVideo#970c8c0e thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia;
+decryptedMessageMediaDocument#7afe8ae2 thumb:bytes thumb_w:int thumb_h:int mime_type:string size:int key:bytes iv:bytes attributes:Vector<DocumentAttribute> caption:string = DecryptedMessageMedia;
+documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute;
+documentAttributeAudio#ded218e0 duration:int title:string performer:string = DocumentAttribute;
+messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity;
+messageEntityMention#fa04579d offset:int length:int = MessageEntity;
+messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity;
+messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity;
+messageEntityUrl#6ed02538 offset:int length:int = MessageEntity;
+messageEntityEmail#64e475c2 offset:int length:int = MessageEntity;
+messageEntityBold#bd610bc9 offset:int length:int = MessageEntity;
+messageEntityItalic#826f8b60 offset:int length:int = MessageEntity;
+messageEntityCode#28a20571 offset:int length:int = MessageEntity;
+messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity;
+messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity;
+inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
+inputStickerSetEmpty#ffb62b95 = InputStickerSet;
+decryptedMessageMediaVenue#8a0df56f lat:double long:double title:string address:string provider:string venue_id:string = DecryptedMessageMedia;
+decryptedMessageMediaWebPage#e50511d8 url:string = DecryptedMessageMedia;
+
+===46===
+documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute;
+
+===66===
+documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute;
+sendMessageRecordRoundAction#88f27fbc = SendMessageAction;
+sendMessageUploadRoundAction#bb718624 = SendMessageAction;
+
+===73===
+decryptedMessage#91cc4674 flags:# no_webpage:flags.1?true silent:flags.5?true random_id:long ttl:int message:string media:flags.9?DecryptedMessageMedia entities:flags.7?Vector<MessageEntity> via_bot_name:flags.11?string reply_to_random_id:flags.3?long grouped_id:flags.17?long = DecryptedMessage;
+Below you will find the current MTProto TL-schema. More details on TL »
+See also the detailed schema in JSON »
+int ? = Int;
+long ? = Long;
+double ? = Double;
+string ? = String;
+
+vector {t:Type} # [ t ] = Vector t;
+
+int128 4*[ int ] = Int128;
+int256 8*[ int ] = Int256;
+
+resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector<long> = ResPQ;
+
+p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data;
+p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data;
+
+server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params;
+
+server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:bytes g_a:bytes server_time:int = Server_DH_inner_data;
+
+client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:bytes = Client_DH_Inner_Data;
+
+dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;
+dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer;
+dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer;
+
+bind_auth_key_inner#75a3f765 nonce:long temp_auth_key_id:long perm_auth_key_id:long temp_session_id:long expires_at:int = BindAuthKeyInner;
+
+rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult;
+rpc_error#2144ca19 error_code:int error_message:string = RpcError;
+
+rpc_answer_unknown#5e2ad36e = RpcDropAnswer;
+rpc_answer_dropped_running#cd78e586 = RpcDropAnswer;
+rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer;
+
+future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt;
+future_salts#ae500895 req_msg_id:long now:int salts:vector<future_salt> = FutureSalts;
+
+pong#347773c5 msg_id:long ping_id:long = Pong;
+
+destroy_session_ok#e22045fc session_id:long = DestroySessionRes;
+destroy_session_none#62d350c9 session_id:long = DestroySessionRes;
+
+new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession;
+
+msg_container#73f1f8dc messages:vector<%Message> = MessageContainer;
+message msg_id:long seqno:int bytes:int body:Object = Message;
+msg_copy#e06046b2 orig_message:Message = MessageCopy;
+
+gzip_packed#3072cfa1 packed_data:bytes = Object;
+
+msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck;
+
+bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification;
+bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification;
+
+msg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq;
+msgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq;
+msgs_state_info#04deb57d req_msg_id:long info:bytes = MsgsStateInfo;
+msgs_all_info#8cc0d131 msg_ids:Vector<long> info:bytes = MsgsAllInfo;
+msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo;
+msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo;
+
+destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes;
+destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes;
+destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes;
+
+---functions---
+
+req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;
+
+req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:bytes q:bytes public_key_fingerprint:long encrypted_data:bytes = Server_DH_Params;
+
+set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer;
+
+rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer;
+get_future_salts#b921bd04 num:int = FutureSalts;
+ping#7abe77ec ping_id:long = Pong;
+ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong;
+destroy_session#e7512126 session_id:long = DestroySessionRes;
+
+http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait;
+
+destroy_auth_key#d1435160 = DestroyAuthKeyRes;
TDLib (Telegram Database Library) is a cross-platform, fully functional Telegram client. We designed it to help third-party developers create their own custom apps using the Telegram platform.
++ ++
+ ++
TDLib is fully open source, all code is available on GitHub.
+See also:
+ +TDLib is a fully functional Telegram client which takes care of all networking, local storage and data consistency details. In this tutorial we describe the main concepts understanding of which is required for effecient TDLib usage.
+In this text, Client means an interface for interaction with a TDLib instance and Application means the program that uses TDLib to interact with Telegram.
+The main TDLib API is fully-asyncronous. An Application can send a request to TDLib through Client.send
method and receive a response asynchronously through the Client.receive
method when it becomes available. The exact naming of these methods and the way in which requests are matched with responses is different for different TDLib interfaces, but the concept as a whole remains the same. For example, in TDLib JSON interface these methods are called td_json_client_send
and td_json_client_receive
, and their @extra field should be used to match requests with the corresponding responses.
In a high-level interface used by an Application the matching of responses with corresponding requests is often automated and transformed by some wrapper into a call to a continuation, a callback, a Promise or a Future to simplify the handling of responses.
+Aside from responses to requests, an Application receives a lot of important data through incoming updates. Updates are used to pass new data from TDLib to the Application and often control the behavior of the Application, leaving no chance to implement something wrong. The correct handling of updates is crucial for creating an Application that is efficient and works correctly.
+++You can find a list of all available TDLib API methods in our web-documentation. You can also find the descriptions of all available TDLib methods and classes in the TDLIB API scheme.
+TDLib can be used from any programming language. You can find a lot of examples of TDLib-based frameworks in various programming languages in our examples section.
+
This section describes the basic notions required for understanding the TDLib API. If you have used the TDLib-based Telegram Bot API most of them should be already familiar to you.
+Telegram is a messenger, so the main object is a message. Each message belongs to some chat and has a unique identifier within that chat. Messages inside a chat should be sorted by that identifier. Telegram supports many different kinds of messages, so a message can have many different kinds of message content. Currently there are more than 40 different kinds of message content, for example messageText for text messages, messagePhoto for photos, or messageScreenshotTaken for notifications about screenshots taken by the other party.
+A Telegram user is called user. Each user has a unique identifier and a first name, and can also have an optional last name, username and profile photo among other useful fields. Bot is a special type of user which can be controlled through the Telegram Bot API.
+Each chat has members, i.e. users that immediately receive all messages sent to the chat. Currently there are 6 possible chat member statuses which describe different rights and restrictions a user can have in a chat, ranging from the owner of the chat who has more rights in the chat than any other user, to a user banned in the chat who is banned in the chat and can't return to it by self or even view chat messages, even if the chat is public.
+As noted earlier, each message belongs to a chat. Currently there are 4 different types of chats on Telegram:
+Each chat has a unique identifier, a title and an optional chat photo. Chats comprise sorted lists shown to the user, position in which is determined, roughly speaking, by the time of latest activity. The correct order of chats in chat lists is maintained by TDLib, so the Application only needs to listen to updates that change the chat.positions
field and sort all chats by the pair (position.order, chat.id)
in a given position.list
.
Messages, chat photos and many other objects can have a file inside of them. Each file has an identifier and may be available locally on a hard drive or remotely on a cloud server. A file can be usually downloaded to the local hard drive or uploaded to Telegram cloud servers.
+Messages with media content like photos or videos can have a short accompanying text called caption. The texts of text messages and media captions can contain fragments, which should be formatted in some unusual way. These fragments are called text entities and the combination of a text and its entities are referred together as a formatted text.
+TDLib sends a lot of important data to the Application through updates. For example, if there is a user unknown to the Application, or some data about a user has changed, then TDLib immediately sends an updateUser to the Application.
+++You can find list of all currently available updates here »
+
Authorization is an example of a behavior, which is controlled by TDLib through updates. Whenever an action is required to proceed with user authorization, the Application receives an updateAuthorizationState with the description of the current AuthorizationState. The Application only needs to handle this update appropriately to correctly implement user authorization.
+The first authorization state received by the Application is always of the type authorizationStateWaitTdlibParameters
. When it is received, the Application should provide parameters for TDLib initialization by calling the setTdlibParameters method. In this method the Application will need to specify, among other parameters:
After call to setTdlibParameters
in case of success Application will receive updateAuthorizationState
with new state and just needs to handle that update, nothing should be done explicitly. If setTdlibParameters
fails, then authorization state is not changed and the Application should try to handle the current authorization state again.
The second received authorization state is always authorizationStateWaitEncryptionKey
. When it is received, the database encryption key should be provided through a call to checkDatabaseEncryptionKey
. For most mobile apps, you can provide an empty database encryption key here (more info). If user isn't authorized yet, then some of authorizationStateWaitPhoneNumber
, authorizationStateWaitCode
, authorizationStateWaitRegistration
and authorizationStateWaitPassword
authorization states may be received. After completing these authorization steps, the Application will receive authorizationStateReady
, meaning that authorization was successful and ordinary requests can be sent now.
++You can find complete examples of user authorization in our Java and C# examples.
+
To send any kind of message, the Application needs to call the method sendMessage providing a chat identifier
and the content of the message to be sent. For example, the Application can send a text message using inputMessageText class as input message content, a photo using inputMessagePhoto or a location using inputMessageLocation. The Application can use inputFileLocal as InputFile in these objects to send a local file from the hard drive.
++You can find examples of sending a text message in our Java and C# examples.
+
All updates and responses to requests should be handled in the order they are received. Here is a list of the most important updates and how they should be handled:
+chat_id
, it never needs to use a getChat
request to receive the chat object. Instead it should maintain a cache of chats received through this update and take all the necessary data about chats from this cache.user_id
, it never needs to use the getUser
request to receive the user object. Instead it should maintain a cache of users received through this update and take all the necessary data about users from this cache.basic_group_id
, it never needs to use the getBasicGroup
request to receive the basicGroup
object. Instead it should maintain a cache of basic groups received through this update and take all the necessary data about basic groups from this cache.supergroup_id
, it never needs to use the getSupergroup
request to receive the supergroup object. Instead it should maintain a cache of supergroups received through this update and take all the necessary data about supergroups from this cache.secret_chat_id
, it never needs to use the getSecretChat
request to receive the secret chat object. Instead it should maintain a cache of secret chats received through this update and take all the necessary data about secret chats from this cache.++For a full list of currently available updates see the documentation for the Update class.
+You can find an example of correct handling of some updates in our Java example.
+
Currently there are 3 different types of chat lists:
- Main chat list.
- Archive chat list.
- A folder chat list.
The positions of chats in chat lists are managed by TDLib, so the Application only needs to listen to updates that change the chat.positions
field, maintain the list of all chats, sorted by the pair (position.order, chat.id)
in descending order, and call getChats
only if there are not enough known chats. Responses to getChats
can be often safely ignored, because if all updates changing chat.positions
are processed correctly, then the chat list should already be up to date. Because chats are sorted in descending order of position.order
, the first request to getChats
should have offset_order == 2^63 - 1 == 9223372036854775807
— the maximum possible value that a signed 64-bit integer can have. For optimal performance, the number of returned chats is chosen by TDLib and can be smaller than the specified limit. If the Application needs more chats, it should repeat the request with adjusted offset_order
and offset_chat_id
parameters.
++You can find an example of retrieving the Main chat list in our Java example.
+
The Application can use the getChatHistory
method to get messages in a chat. The messages will be returned in the reverse chronological order (i.e., in descending order of message_id
). The Application can pass from_message_id == 0
to get messages from the last message. To get more messages than can be returned in one response, the Application needs to pass the identifier of the last message it has received as from_message_id
to next request. For optimal performance, the number of the returned messages is chosen by TDLib and can be smaller than the specified limit. If the Application needs more messages, it needs to adjust the from_message_id
parameter and repeat the request.
This article describes the TDLib Notification API introduced in TDLib 1.4.0.
+TDLib takes care of everything that is related to handling notifications (as usually, except for how exactly the notifications will be shown to the user). TDLib controls when notifications are shown to the user, when they are edited and removed, guarantees consistency of notifications with the database state and persistence of active notifications between client restarts.
+All notifications shown to the user are combined into notification groups. For example, notifications about ordinary messages from the one chat belong to one notification group. This grouping is done automatically by TDLib based on message content and the user's notification settings. Currently, there are 4 different notification group types:
+Messages
notification groups contain notifications with ordinary unread messages from a chat.Mentions
notification groups contain notifications with unread mentions of the current user, replies to their messages, and notifications about pinned messages in a chat.SecretChat
notification groups contain a single notification about creating a new secret chat.Calls
notification groups contain notifications about received calls in a chat.TDLib ensures that the number of notification groups shown to the user any given moment is limited by the value of the notification_group_count_max
option and that the number of active notifications, shown to the user in a notification group at any given time, is limited by the value of the notification_group_size_max
option. Whenever the number of notification groups with active notifications exceeds notification_group_count_max
, TDLib sends an update hiding all notifications from the oldest group. If subsequently all notifications are hidden in some other group, that first group can be silently brought back by an update from TDLib. Similarly, whenever the number of active notifications in a group exceeds notification_group_size_max
, TDLib sends an update hiding the oldest notifications in the group. If subsequently some newer notifications are removed from the group, older notifications can be silently brought back by an update from TDLib.
To enable the TDLib Notificaition API you need to set option notification_group_count_max
to a positive value, to disable the Notification API you can change the option value back to 0 or set the option value to empty.
Every notification group has a unique ID, which is a persistent small integer number, assigned consequently from 1. The client should not assume that the group‘s type and other fields are fixed, because TDLib may reuse the notification group ID whenever it’s known that the group will never be used again in the future. Every notification belongs to a notification group and has a globally unique ID, which is a persistent small integer number, assigned consequently from 1. Notification IDs are never reused and can be used together with their notification group ID to uniquely identify a notification. Within a notification group, notifications must be shown in the order defined by their IDs. If notification grouping isn't available in your operating system, the existence of notification groups can be safely ignored and notifications can be handled separately just by their unique ID.
+Currently, there are 4 different kinds of notifications:
+NewMessage
notifications contain the full information about a new incoming message received from the server. They may be located in Messages and Mentions notification groups.NewPushMessage
notifications contain information about a new incoming message received in a push notification. They contain only partial data about the message and will be replaced by NewMessage notifications as soon as the client downloads the necessary data. They may be located in Messages and Mentions notification groups.NewSecretChat
notifications inform about creating a new secret chat. Only one will be located in each SecretChat notification group. The group may be reused as soon as the notification is removed.NewCall
notifications contain information about a new incoming call. They are located in a Calls notification group. The group may be reused as soon as the notifications are removed.Messages from new push message notifications will not be shown in the chat message list, but their message identifiers are known and they can be replied to and used in ViewMessages
calls anyway.
Notification API introduced 4 new updates from TDLib, namely updateActiveNotifications
, updateNotificationGroup
, updateNotification
and updateHavePendingNotifications
.
If Notification API is enabled, the client receives an updateActiveNotifications
update on startup, containing all notifications that are to be shown to the user. The client needs to synchronize the list of notifications that is shown to the user with the list received in updateActiveNotifications
and save information about all active notifications in memory, because subsequent updates will contain only changes to the list of active notifications.
Whenever a notification is added to a group or is removed from a group, TDLib sends an updateNotificationGroup
update to the client. Aside from the list of added notifications and list of identifiers of removed notifications, the update contains full information about the new type of the notification group, the identifier of the chat to which all notifications in the group now belong, the identifier of the chat the notification settings of which must be used to show the notification, a flag determining whether the notification must be shown with or without sound and the new total count of unread notifications in the group. Be aware that the total count of unread notifications in a group can be higher than the number of active notifications. Also note that some old notifications can be added through updateNotificationGroup
when newer notifications are removed, so the client must ensure the correct notification order based on notification identifiers. Whenever possible, updateNotificationGroup
updates for a group are combined into a single update, so the client can apply the changes together. TDLib also controls the delay before notifications are shown to the user in order to give them a chance to read the messages from a different device before the notification is shown, therefore the updates should be processed on the client side immediately without any additional delays.
Whenever an active notification is changed, TDLib sends an updateNotification
update to the client. The update contains new content of the notification. The client should be ready to handle the change of notification type, for example, from NewPushMessage
to NewMessage
.
Whenever there are some received but delayed notifications or there can be some yet unreceived notifications because of unavailable network connection to the Telegram servers, TDLib informs the client about that via updateHavePendingNotifications
update. Client is supposed to keep the application running in order to receive all delayed notifications. If there is no possibility to keep the application running, the client can close the TDLib instance in order to immediately receive all delayed notification updates.
TDLib tries to ensure that whenever a notification about a pinned message is sent, the pinned message is already available locally in the memory, so the client can use a new request getMessageLocally
to get the pinned message. Also, updateNotification
will be sent whenever pinned message is changed, despite that the notification itself wasn't changed.
The client controls the maximum number of active notification groups by using the option notification_group_count_max
. This option's value defaults to 0, i.e. there are no active notification groups and the Notification API is effectively disabled. Any integer value between 0 and 25 can be used as the value of the option. Values above 25 are not allowed because most operating systems will not show so many notification groups anyway.
The client also controls the maximum number of active notifications in a group by using the option notification_group_size_max
. This option's value defaults to 10 and can be set to any integer value between 1 and 25. Values above 25 are not allowed, because most operating systems will not show so many notifications in a group anyway.
The user may choose to show pinned messages or mentions among ordinary messages in the Messages
notification group instead of the Mentions
notification group and choose to not apply notification settings from the sender's private chat to them. This can be done on a per chat basis or for the whole chats notification scope via the new options disable_pinned_message_notifications
and disable_mention_notifications
which were added to chatNotificationSettings
and scopeNotificationSettings
classes.
In order to support multiple accounts in one app, the method registerDevice
now returns a globally unique identifier of the push notification subscription. This identifier can be used to match a push notification with the corresponding account and process the notification only by the account for which the notification was sent.
Whenever a push notification is received, the client needs to call the synchronous method getPushReceiverId
with the payload of the push notification. The method will return a globally unique identifier of the push notification subscription (aka push receiver ID), which can be used to find the TDLib instance which needs to be launched and used to process the push notification. If the method returns 0 as a push receiver ID, then the push notification should be processed by all clients (this usually happens when there is only one client).
To process a notification, the method processPushNotification
needs to be called in the TDLib instance (or instances) found by push receiver ID. This method can be called before authorization and its execution will be automatically postponed until TDLib initialization. The method returns the result only after all updates caused by the push notification have been sent and the TDLib instance can be safely closed. If the method returns an error with the code 406, then the push notification is known to be unsupported and connection to the server is required to fetch new data. If any other error is returned, an error occurred while processing the push notification, i.e. the notification payload has failed to decrypt or parse. In that case, connection to the server isn't required, but there can be new notifications there. After a successful response from processPushNotification
the TDLib instance can be immediately closed in order to reduce battery usage. Alternatively, the client can wait for an updateHavePendingNotifications
update telling that there are no more delayed or unreceived notifications.
Android and iOS clients can opt-in to receive end-to-end encrypted push notifications via a Firebase Cloud Messaging or Apple Push Notification service VoIP notifications while subscribing to push notifications through registerDevice
method. In case of Firebase Cloud Messaging, if end-to-end encrypted push notifications are disabled, push notifications are sent without content, so there no notifications of the type NewPushMessage
will be created, the client will always need to connect to Telegram servers to download new messages whenever a push notification is received.
Examples of push notification payloads, which are accepted by TDLib:
+{
+ "date": 1234567890,
+ "data": {
+ "custom": {
+ "msg_id": "1234567",
+ "from_id": "12345678",
+ "mtpeer": {
+ "ah": "-1234567",
+ "ph": {
+ "volume_id": "987654321",
+ "local_id": "98765",
+ "secret": "998877665544332211",
+ "file_reference": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ "dc_id": 6,
+ "_": "fileLocation"
+ }
+ }
+ },
+ "badge": "239",
+ "loc_key": "MESSAGE_TEXT",
+ "loc_args": [
+ "First name Last name",
+ "qwerty"
+ ],
+ "line1": "First name Last name",
+ "line2": "qwerty",
+ "random_id": 728931540,
+ "text": "First name Last name: qwerty",
+ "system": "Windows 10.0.20573.1"
+ }
+}
+{
+ "google.sent_time": 1234567890123,
+ "p": "jdTXkJnEMUTK6R82AB-55bLA3U_RB-2K-CLDz7mWp7ckjMIfnCoHEcm710SkN"
+}
+{
+ "date": 1234567890,
+ "loc_key": "CHAT_MESSAGE_TEXT",
+ "loc_args": [
+ "First name Last name",
+ "Chat title",
+ "qwerty"
+ ],
+ "custom": {
+ "msg_id": "1234567",
+ "channel_id": "56781234",
+ "chat_from_id": "12345678",
+ "mention": "1"
+ },
+ "badge": "239"
+}
+There are two methods for removing notifications from the list of active notifications when they are hidden by the user. If the user removes a single notification, it can be removed by calling the method removeNotification
. If the user dismisses the whole notification group, this can be achieved using the method removeNotificationGroup
. Removed notifications will never return to the list of active notifications, but can be still counted in the total count of unread notifications of the group.
TDLib has many options that affect the behavior of the library. Each option has a name and a value. Value may be of one of the following types:
+Type of value | +Default value | +Value range | +
Integer | +0 | +64-bit integer | +
Boolean | +false | +True or false | +
String | ++ | Any Unicode string | +
Options not mentioned in this list may be safely ignored.
+Name | +Type | +Writable | +Description | +
always_parse_markdown | +Boolean | +Yes | +If true, text entities will be automatically parsed in all inputMessageText objects |
+
archive_and_mute_new_chats_from_unknown_users | +Boolean | +Yes | +If true, new chats from non-contacts will be automatically archived and muted. The option can be set only if the option “can_archive_and_mute_new_chats_from_unknown_users” is true. getOption needs to be called explicitly to fetch the latest value of the option, changed from another device |
+
disable_contact_registered_notifications | +Boolean | +Yes | +If true, notifications about the user's contacts who have joined Telegram will be disabled. User will still receive the corresponding message in the private chat. getOption needs to be called explicitly to fetch the latest value of the option, changed from another device |
+
disable_persistent_network_statistics | +Boolean | +Yes | +If true, persistent network statistics will be disabled, which significantly reduces disk usage | +
disable_sent_scheduled_message_notifications | +Boolean | +Yes | +If true, notifications about outgoing scheduled messages that were sent will be disabled | +
disable_time_adjustment_protection | +Boolean | +Yes | +If true, protection from external time adjustment will be disabled, which significantly reduces disk usage | +
disable_top_chats | +Boolean | +Yes | +If true, support for top chats and statistics collection is disabled | +
ignore_background_updates | +Boolean | +Yes | +If true, allows to skip all updates received while the TDLib instance was not running. The option does nothing if the database or secret chats are used | +
ignore_default_disable_notification | +Boolean | +Yes | +If true, the disable_notification value specified in the request will be always used instead of the default value |
+
ignore_inline_thumbnails | +Boolean | +Yes | +If true, prevents file thumbnails sent by the server along with messages from being saved on the disk | +
ignore_platform_restrictions | +Boolean | +Yes | +If true, chat and message restrictions specific to the currently used operating system will be ignored | +
ignore_sensitive_content_restrictions | +Boolean | +Yes | +If true, sensitive content will be shown on all user devices. getOption needs to be called explicitly to fetch the latest value of the option, changed from another device |
+
is_location_visible | +Boolean | +Yes | +If true, other users will be allowed to see the current user's location | +
language_pack_database_path | +String | +Yes | +Path to a database for storing language pack strings, so that this database can be shared between different accounts. By default, language pack strings are stored only in memory. Changes of value of this option will be applied only after TDLib restart, so it should be set before call to setTdlibParameters . |
+
language_pack_id | +String | +Yes | +Identifier of the currently used language pack from the current localization target | +
localization_target | +String | +Yes | +Name for the current localization target (currently supported: “android”, “android_x”, “ios”, “macos” and “tdesktop”) | +
message_unload_delay | +Integer | +Yes | +The maximum time messages are stored in memory before they are unloaded, 60-86400; in seconds. Defaults to 60 for users and 1800 for bots | +
notification_group_count_max | +Integer | +Yes | +Maximum number of notification groups to be shown simultaneously, 0-25 | +
notification_group_size_max | +Integer | +Yes | +Maximum number of simultaneously shown notifications in a group, 1-25. Defaults to 10 | +
online | +Boolean | +Yes | +Online status of the current user | +
prefer_ipv6 | +Boolean | +Yes | +If true, IPv6 addresses will be preferred over IPv4 addresses | +
use_pfs | +Boolean | +Yes | +If true, Perfect Forward Secrecy will be enabled for interaction with the Telegram servers for cloud chats | +
use_quick_ack | +Boolean | +Yes | +If true, quick acknowledgement will be enabled for outgoing messages | +
use_storage_optimizer | +Boolean | +Yes | +If true, the background storage optimizer will be enabled | +
animated_emoji_sticker_set_name | +String | +No | +Name of a sticker set with animated emojis | +
animation_search_bot_username | +String | +No | +Username of a bot which can be used in inline mode for animations search | +
authorization_date | +Integer | +No | +Point in time (Unix timestamp) when authorization was received | +
basic_group_size_max | +Integer | +No | +Maximum number of members in a basic group | +
call_connect_timeout_ms | +Integer | +No | +Maximum time to wait for call connection creation to be passed to libtgvoip | +
call_packet_timeout_ms | +Integer | +No | +Maximum time to wait for call packet delivery to be passed to libtgvoip | +
can_archive_and_mute_new_chats_from_unknown_users | +Boolean | +No | +If true, the option “archive_and_mute_new_chats_from_unknown_users” can be changed | +
can_ignore_sensitive_content_restrictions | +Boolean | +No | +If true, the option “ignore_sensitive_content_restrictions” can be changed | +
enabled_proxy_id | +Integer | +No | +Identifier of the enabled proxy | +
expect_blocking | +Boolean | +No | +If true, access to Telegram is likely blocked for the user | +
favorite_stickers_limit | +Integer | +No | +Maximum number of favorite stickers | +
forwarded_message_count_max | +Integer | +No | +Maximum number of forwarded messages per one request | +
group_anonymous_bot_user_id | +Integer | +No | +Identifier of the bot which is shown as the sender of anonymous messages in groups when viewed from an outdated client | +
message_caption_length_max | +Integer | +No | +Maximum length of a message caption | +
message_text_length_max | +Integer | +No | +Maximum length of a message text | +
my_id | +Integer | +No | +Identifier of the current user | +
pinned_archived_chat_count_max | +Integer | +No | +Maximum number of pinned cloud chats in the Archive chat list. The same amount of secret chats can be pinned locally | +
pinned_chat_count_max | +Integer | +No | +Maximum number of pinned cloud chats in the Main chat list. The same amount of secret chats can be pinned locally | +
photo_search_bot_username | +String | +No | +Username of a bot which can be used in inline mode for photos search | +
replies_bot_chat_id | +Integer | +No | +Identifier of the @replies bot | +
suggested_language_pack_id | +String | +No | +Identifier of the language pack, suggested for the user by the server | +
supergroup_size_max | +Integer | +No | +Maximum number of members in a supergroup | +
t_me_url | +String | +No | +Current value of t.me URL, i.e. https://t.me/ |
+
telegram_service_notifications_chat_id | +Integer | +No | +Identifier of the Telegram Service Notifications chat | +
test_mode | +Boolean | +No | +If true, the test environment is being used instead of the production environment | +
unix_time | +Integer | +No | +An estimation of the current Unix timestamp. The option will not be updated automatically unless the difference between the previous estimation and the locally available monotonic clocks changes significantly | +
venue_search_bot_username | +String | +No | +Username of a bot which can be used in inline mode for venues search | +
version | +String | +No | +TDLib version. This options is guaranteed to come before all other updates since TDLib 1.4.0 | +
Additionally any option beginning with 'x' or 'X' is writeable and can be safely used by the application to persistently store some small amount of data.
+++This FAQ about MTProto is intended for advanced users. You may also want to check out our Basic FAQ.
+
Please note, that client developers are required to comply with the Security Guidelines.
Protection against known attacks
+In order to achieve reliability on weak mobile connections as well as speed when dealing with large files (such as photos, large videos and files up to 2 GB each), MTProto uses an original approach. This document is intended to clarify certain details of our setup, as well as address some important points that might be overlooked at first glance.
+Detailed protocol documentation is available here. Please note that MTProto supports two layers: client-server encryption that is used in Telegram cloud chats and end-to-end encryption that is used in Telegram Secret Chats. See below for more information.
+If you have any comments, feel free to reach out to security@telegram.org
+Server-client encryption is used in Telegram Cloud Chats. Here's a brief overview of the setup:
+ + +Each plaintext message to be encrypted in MTProto always contains the following data to be checked upon decryption in order to make the system robust against known problems with the components:
+See additional comments on our use of IGE and message authentication.
+Telegram's End-to-end encrypted Secret Chats are using an additional layer of encryption on top of the described above.
+End-to-end encryption is used in Telegram Secret Chats, as well as voice and video calls. You can read more about it here: Secret Chats, End-to-End encryption. Here's a brief overview of the setup:
+ + +Please see these articles for details:
+While other ways of achieving the same cryptographic goals, undoubtedly, exist, we feel that the present solution is both robust and also sucсeeds at our secondary task of beating unencrypted messengers in terms of delivery time and stability.
+We prefer to use well-known algorithms, created in the days when bandwidth and processing power were both a much rarer commodity. This has valuable side-effects for modern-day mobile development and sending large files, provided one takes care of the known drawbacks.
+The weakspots of such algorithms are also well-known, and have been exploited for decades. We use these algorithms in such a combination that, to the best of our knowledge, prevents any known attacks.
+Any comments on Telegram's security are welcome at security@telegram.org. All submissions which result in a change of code or configuration are eligible for bounties, ranging from $100 to $100,000 or more, depending on the severity of the issue.
+Please note that we can not offer bounties for issues that are disclosed to the public before they are addressed.
+All Telegram apps ensure that msg_key is equal to SHA-256 of a fragment of the auth_key concatenated with the decrypted message (including 12…1024 bytes of random padding). It is important that the plaintext always contains message length, server salt, session_id and other data not known to the attacker.
+It is crucial that AES decryption keys depend both on msg_key, and on auth_key, known only to the parties involved in the exchange.
+We do none of the above, strictly speaking. For message authentication, we compute SHA-256(auth_key_fragment + AES_decrypt(…,encrypted_message)) upon message receipt and compare this value to the msg_key received with the encrypted message.
+++See also: Why not Encrypt-then-MAC?
+
Using encrypt-then-MAC, e.g. involving GCM (Galois Counter Mode), would enable the receiving party to detect unauthorized or modified ciphertexts, thus eliminating the need to decrypt them in case of tampering.
+In MTProto, the clients and the server authenticate messages by ensuring that SHA-256(auth_key_fragment + plaintext + padding) = msg_key and that the plaintext always contains message length, server salt, session_id and other data not known to a potential attacker before accepting any message. These security checks performed on the client before any message is accepted ensure that invalid or tampered with messages will always be safely (and silently) discarded.
+This way we arrive at the same result. The difference is that the security check is performed before decryption in Encrypt-then-MAC and after decryption in MTProto – but in either case before a message is accepted. AES encryption / decryption on devices currently in use is comparable in speed with the additional HMAC computation required for the encrypt-then-MAC approach.
+The current version of the protocol is using SHA-256. MTProto 1.0 used to rely on SHA-1 (see this FAQ for details).
+In MTProto 2.0, SHA-1 is used only where the choice of hash function is irrelevant for security, e.g.:
+Yes, we use IGE, but it is not broken in our implementation. The fact that we do not use IGE as MAC together with other properties of our system makes the known attacks on IGE irrelevant.
+IGE, just as the ubiquitous CBC, is vulnerable to blockwise-adaptive CPA. But adaptive attacks are only a threat for as long as the same key can be used in several messages (not so in MTProto).
+Adaptive attacks are even theoretically impossible in MTProto, because in order to be encrypted the message must be fully formed first, since the key is dependent on the message content. As for non-adaptive CPA, IGE is secure against them, as is CBC.
+The DH exchange is authenticated with the server's public RSA-key that is built into the client (the same RSA-key is also used for protection against MitM attacks).
+Various secrets (nonce, server_nonce, new_nonce) exchanged during key generation guarantee that the DH-key can only be obtained by the instance that initiated the exchange.
+Notice that new_nonce is transferred explicitly only once, inside an RSA-encrypted message from the client to the server.
+Keys for end-to-end encrypted secret chats are generated by a new instance of DH key exchange, so they are known only to the parties involved and not to the server. To establish the identities of these parties and to ensure that no MitM is in place, it is recommended to compare identicons, generated from hashes of the DH secret chat keys (key visualizations).
+Keys for end-to-end encrypted calls are generated using the Diffie-Hellman key exchange. Users who are on a call can ensure that there is no MitM by comparing key visualizations.
+To make key verification practical in the context of a voice call, Telegram uses a three-message modification of the standard DH key exchange for calls:
+The idea is that Alice commits to a specific value of a (and of g_a), but does not reveal g_a to Bob (or Eve) until the very last step. Bob has to choose his value of b and g_b without knowing the true value of g_a. If Eve is performing a Man-in-the-Middle attack, she cannot change a depending on the value of g_b received from Bob and she also can't tune her value of b depending on g_a. As a result, Eve only gets one shot at injecting her parameters — and she must fire this shot with her eyes closed.
+Thanks to this modification, it becomes possible to prevent eavesdropping (MitM attacks on DH) with a probability of more than 0.9999999999 by using just over 33 bits of entropy in the visualization. These bits are presented to the users in the form of four emoticons. We have selected a pool of 333 emoji that all look quite different from one another and can be easily described in simple words in any language.
+You can read more about key verification for Telegram calls here.
+Telegram's Secret chats support Perfect Forward Secrecy, you can read more about it here.
+By definition, the known-plaintext attack (KPA) is an attack model for cryptanalysis where the attacker has samples of both the plaintext, and its encrypted version (ciphertext).
+AES IGE that is used in MTProto is robust against KPA attacks (see this, if you wonder how one can securely use IGE). On top of that, the plaintext in MTProto always contains server_salt and session id.
+By definition, a chosen-plaintext attack (CPA) is an attack model for cryptanalysis which presumes that the attacker has the capability to choose arbitrary plaintexts to be encrypted and obtain the corresponding ciphertexts.
+MTProto uses AES in IGE mode (see this, if you wonder how one can securely use IGE) that is secure against non-adaptive CPAs. IGE is known to be not secure against blockwise-adaptive CPA, but MTProto fixes this in the following manner:
+Each plaintext message to be encrypted always contains the following to be checked upon decryption:
+On top of this, in order to replace the plaintext, you would also need to use the right AES key and iv, both dependent on the auth_key. This makes MTProto robust against a CPA.
+By definition, a chosen-ciphertext attack (CCA) is an attack model for cryptanalysis in which the cryptanalyst gathers information, at least in part, by choosing a ciphertext and obtaining its decryption under an unknown key. In the attack, an adversary has a chance to enter one or more known ciphertexts into the system and obtain the resulting plaintexts. From these pieces of information the adversary can attempt to recover the hidden secret key used for decryption.
+Each time a message is decrypted in MTProto, a check is performed to see whether msg_key is equal to the SHA-256 of a fragment of the auth_key concatenated with the decrypted message (including 12…1024 bytes of random padding). The plaintext (decrypted data) also always contains message length, server salt and sequence number. This negates known CCAs.
+MTProto 2.0 satisfies the conditions for indistinguishability under chosen ciphertext attack (IND-CCA).
++ ++
Replay attacks are denied because each plaintext to be encrypted contains the server salt and the unique message id and sequence number.
+This means that each message can only be sent once.
+Telegram has two modes of communication — ordinary chats using client-server encryption and Secret Chats using end-to-end encryption.
+Client-Server communication is protected from MiTM-attacks during DH key generation by means of a server RSA public key embedded into client software. After that, if both clients trust the server software, the Secret Chats between them are protected by the server from MiTM attacks.
+The interface offers a way of comparing Secret Chat keys for users who do not trust the server. Visualizations of the key are presented in the form of identicons (example here). By comparing key visualizations users can make sure no MITM attack had taken place.
+Currently, the fingerprint uses 128-bits of SHA-1 concatenated with 160 bits from the SHA-256 of the key, yielding a total of 288 fingerprint bits, thus negating the possibility of hash-collision attacks.
+++Read more about fingerprints in earlier versions of Telegram
+
By definition, length extension attacks are a type of attack when certain types of hashes are misused as message authentication codes, allowing for inclusion of extra information.
+A message in MTProto consists of an msg_key, equal to the SHA-256 of a fragment of the auth_key concatenated with the plaintext (including 12…1024 bytes of random padding and some additional parameters), followed by the ciphertext. The attacker cannot append extra bytes to the end and recompute the SHA-256, since the SHA-256 is computed from the plaintext, not the ciphertext, and the attacker has no way to obtain the ciphertext corresponding to the extra plaintext bytes she may want to add.
+Apart from that, changing the msg_key would also change the AES decryption key for the message in a way unpredictable for the attacker, so even the original prefix would decrypt to garbage — which would be immediately detected since the app performs a security check to ensure that the SHA-256 of the plaintext (combined with a fragment of the auth_key) matches the msg_key received.
+As of Telegram 4.2, we support encrypted CDNs for caching media from public channels with over 100.000 members. The CDN caching nodes are located in regions with significant Telegram traffic where we wouldn't want to place Telegram servers for various reasons.
+++For technical details of the implementation, encryption and verification of data, see the CDN manual.
+
See this document for a Persian version of this FAQ.
بخش فارسی
We use our own distributed servers to speed up downloads in regions where freedom of speech is guaranteed — and even there we don't take this for granted. But when Telegram becomes immensely popular in other areas, we can only rely on CDNs which we treat rather like ISPs from the technical standpoint in that they only get encrypted data they can't decipher.
+Thanks to this technology, the download speed for public photos and videos can become significantly higher in regions like Turkey, Indonesia, South America, India, Iran or Iraq without the slightest compromise in security.
+No. Each file that is to be sent to the CDN is encrypted with a unique key using AES-256-CTR encryption. The CDN can't access the data it stores because these keys are only accessible to the main MTProto server and to the authorized client.
+No. Data downloaded from CDN caching nodes is always verified by the receiving Telegram app by way of a hash: attackers won’t be able to replace any files with their own versions.
+No. CDN nodes only cache encrypted copies of files, originals are stored on the Telegram servers. The user is notified about receiving the file by the Telegram server. If the CDN caching node doesn't give the file to the user, the user will receive the file from the Telegram server directly.
+No. All original files are stored on the Telegram servers. The CDNs only get encrypted data — and they can't decipher it. They can't substitute any data. And in case of any problems with the CDN, the file will be simply delivered to the users directly from the Telegram servers. Users will always get their data, nobody can stop this.
+Yes. Anyone can verify our CDN implementation by checking the source code of Telegram apps and inspecting traffic.
+No. The CDN caching nodes are not a part of the Telegram cloud. CDN caching nodes are used only for caching popular public media from massive channels. Private data never goes there.
+No. We haven't entered in any agreements with any government regarding the CDNs and the CDNs are not part of any deal. The only purpose of CDNs is to securely improve connectivity in high demand regions where Telegram can't place its servers.
+No. We have taken special precautions to make sure that no country gains any leverage over Telegram by way of the CDN caching nodes:
+As the result, if any country decides to mess with the CDN in their region, they gain nothing except for reducing connectivity for their own citizens – and Telegram loses nothing of value.
+If the user has successfully provided the login code, but they forgot the 2FA password, the account should be reset: this can be done using account.deleteAccount.
+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 service message will be sent to the user, containing a link in one of the following formats:
+https://telegram.me/confirmphone?phone=XXX&hash=YYYY
tg://confirmphone?phone=XXX&hash=YYYY
When clicked, account.sendConfirmPhoneCode must be called with the specified hash
, using the account with the specified phone
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 login code, and auth.cancelCode with auth.resendCode can be used as well, to resend or cancel the phone code as for the login code.
Once the SMS code is received, the account.confirmPhone method will have to be called with the SMS code and the phone hash received from the account.sendConfirmPhoneCode method.
+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.
+How to register a user's phone to start using the API.
Graphical telegram clients should transform emojis into their respective animated version.
+inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
+
+messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
+
+---functions---
+
+messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
+On startup, clients should fetch the animated emoji stickerset by calling the messages.getStickerSet method, providing inputStickerSetAnimatedEmoji to the stickerset
field.
+The returned stickerset will contain a set of animated stickers, one for each of the supported emojis.
Clients should substitute messages containing only one instance of one of the allowed emojis with the respective animated sticker.
+Animated emojis should loop only once when first sent or received, or when clicked.
+For supported emojis, 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: click here for more info ».
For special dice emojis like ,
, or
, clients are supposed to behave differently both when sending and receiving such emojis: click here for more info ».
Certained animated emojis should play sound when clicked, as specified by server-side configuration.
+The returned JSON object will contain the following map, with a list of file IDs to download:
+ "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"
+ },
+ }
+The file reference field should be base64-decoded before downloading the file.
+inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet;
+
+messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
+
+stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;
+
+sendMessageEmojiInteraction#25972bcb emoticon:string msg_id:int interaction:DataJSON = SendMessageAction;
+sendMessageEmojiInteractionSeen#b665902e emoticon:string = SendMessageAction;
+
+updateUserTyping#c01e857f user_id:long action:SendMessageAction = Update;
+
+---functions---
+
+messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
+
+messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;
+On startup, clients should fetch the animated reaction emoji stickerset by calling the messages.getStickerSet method, providing inputStickerSetAnimatedEmojiAnimations to the stickerset
field.
+The returned stickerset will contain a set of animated emoji reactions, one or more for each of the supported emojis.
+If a set of reactions for the emoji is returned, the same reactions should also be assigned to the
,
,
,
,
,
,
and
emojis.
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.
+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:
At each tap, clients should store all occurred taps in a local list.
+After 1 second has elapsed with no more taps, the local list should be cleared and stored taps should be sent using messages.setTyping, passing a sendMessageEmojiInteraction constructor with the following fields:
emoticon
- The emoji we're reacting tomsg_id
- Message ID of the animated emoji that was clickedinteraction
- A JSON object with interaction info, containing the following keys:v
- An integer indicating the object version, currently 1
a
- An array of JSON objects, each containing the following keys:t
- float, number of seconds that passed since the previous tap in the array, the first tap uses a value of 0.0
.i
- integer, 1-based index of the randomly chosen animation for the tap (equivalent to the index of a specific emoji-related animation in stickerPack + 1).1 second after the receiving user has seen the last reaction animation for a specific emoji, an acknowledgement must be sent using messages.setTyping, passing a sendMessageEmojiInteractionSeen with that emoji.
Authorization is associated with a client’s encryption key identifier: auth_key_id. No additional parameters need to be passed into methods following authorization.
+To log in as a bot, follow these instructions ».
+Example implementations: telegram for android, tdlib.
+To show a nicely formatted and validated phone number field, the help.countriesList constructor can be obtained using the help.getCountriesList method.
The help.countriesList config is then used as described here ».
Authorization requires that a text message containing an authorization code first be sent to the user’s phone.
This may be done using the auth.sendCode method.
The system will automatically choose how to send the authorization code; there are four possible ways the code can arrive:
The auth.sendCode method also has parameters for enabling/disabling use of flash 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 android SMS receiver APIs.
The returned auth.SentCode object will contain multiple parameters:
+flags | +# | +Flags, see TL conditional fields | +
type | +auth.SentCodeType | +Phone code type | +
phone_code_hash | +string | +Phone code hash, to be stored and later re-used with auth.signIn | +
next_type | +flags.1?auth.CodeType | +Phone code type that will be sent next, if the phone code is not received within timeout seconds: to send it use auth.resendCode |
+
timeout | +flags.2?int | +Timeout for reception of the phone code | +
If the message takes too long (timeout
seconds) to arrive at the phone, the auth.resendCode method may be invoked to resend a code of type next_type
.
If the same happens again, you can use auth.resendCode with the next_type
returned by the previous call to auth.resendCode.
To cancel the verification code use auth.cancelCode.
When user enters verification code, the auth.signIn method must be used to validate it and possibly sign user in.
+If the code was entered correctly, but the method returns auth.authorizationSignUpRequired, 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 (auth.signUp) must be invoked.
+When trying to sign in using auth.signIn, an error 400 SESSION_PASSWORD_NEEDED may be returned, if the user has two-factor authentication enabled.
In this case, instructions for SRP 2FA authentication must be followed.
To set up two-factor authorization on an already authorized account, follow the SRP 2FA authentication docs.
+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.
+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 Test DCs (their IP addresses for TCP transport are availble in API development tools panel after api_id was obtained, URI format for HTTPS/Websocket transport).
+If you wish to emulate an application of a user associated with DC number X, it is sufficient to specify the phone number as 99966XYYYY
, where YYYY are random numbers, when registering the user. A user like this would always get XXXXXX as the login confirmation code (the DC number, repeated six 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).
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.
+Proceed with User Authorization flows in Production DCs only after you make sure everything works correctly on Test DCs first to avoid reaching flood limits.
+++To help you with working on production DCs, logins with the same phone number with which the
+api_id
was registered have more generous flood limits.
As a result of authorization, the client key, auth_key_id, 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.
+Only a small portion of the API methods are available to unauthorized users:
+Other methods will result in an error: 401 UNAUTHORIZED.
+Working with bots, using the MTProto API.
+See here for more info about bots.
+Please note that you can also use the simplified HTTP Bot API to use bots, see here for more info ».
+---functions---
+
+auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization;
+In order to login as a bot, instead of using the standard login code flow, simply provide the bot token generated by @botfather.
+You must still provide your API ID, as per user logins.
After successful authorization, you will be able to use most MTProto API methods, just as any normal user.
+Methods that can be called by bots will have a Bots can use this method notice.
Bots offer a set of commands that can be used by users in private, or in a chat.
+Users can interact with your bot via buttons or even inline buttons, straight from inline messages in any chat.
+Users can interact with your bot via inline queries, straight from the text input field in any chat.
+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.
Users can interact with your bot via buttons or even inline buttons, straight from inline messages in any chat.
+This article describes the full button flow, using the MTProto API.
For a simplified description using the HTTP bot API, see here ».
+keyboardButton#a2fa4880 text:string = KeyboardButton;
+keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;
+keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;
+keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton;
+keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton;
+keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton;
+keyboardButtonGame#50f41ccf text:string = KeyboardButton;
+keyboardButtonBuy#afd93fbb text:string = KeyboardButton;
+keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton;
+inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton;
+keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton;
+
+keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow;
+
+replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup;
+replyKeyboardForceReply#86b40b08 flags:# single_use:flags.1?true selective:flags.2?true placeholder:flags.3?string = ReplyMarkup;
+replyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup;
+replyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup;
+
+message#85d6cbe2 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int = Message;
+
+---functions---
+
+messages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+Bots can attach a ReplyMarkup constructor to outgoing messages, to attach an inline keyboard or a custom reply keyboard:
+keyboardButton#a2fa4880 text:string = KeyboardButton;
+keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;
+keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;
+keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton;
+keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton;
+keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton;
+keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton;
+keyboardButtonGame#50f41ccf text:string = KeyboardButton;
+keyboardButtonBuy#afd93fbb text:string = KeyboardButton;
+keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton;
+
+// Used by bots to send a keyboardButtonUrlAuth
+inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton;
+
+keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow;
+Both reply and inline keyboards are composed of a vector of rows, each row containing a vector of buttons, for each column.
+Each row can have a different number of columns, and user clients should properly handle clicking buttons of every type.
Buttons available only in reply keyboards:
+quiz
flag), replying to the message that attached the reply keyboardButtons available only in inline keyboards:
+keyboardButtonSwitchInline.same_peer
is set, insert the bot's username and keyboardButtonSwitchInline.query
in the current chat's input field, triggering an inline query.keyboardButtonSwitchInline.same_peer
is not set, prompt the user to select one of their chats, and then insert the bot's username and keyboardButtonSwitchInline.query
in the current chat's input field, triggering an inline query.keyboardButtonCallback buttons can be used to send the specified data
payload back to the bot, when they are clicked.
+Additionally, a bot can verify a user's identity by requiring they verify their 2FA password with SRP.
keyboardButtonGame#50f41ccf text:string = KeyboardButton;
+keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;
+
+messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;
+
+---functions---
+
+messages.getBotCallbackAnswer#9342ca07 flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes password:flags.2?InputCheckPasswordSRP = messages.BotCallbackAnswer;
+When the user clicks on a keyboardButtonCallback in a message sent by a bot, or generated by an inline query, messages.getBotCallbackAnswer should be called, passing the peer and ID of the message.
+The same should happen when clicking on keyboardButtonGame buttons, with the difference that the game
flag must be set instead of the data
parameter.
Make sure to properly handle bot timeouts in the form of BOT_RESPONSE_TIMEOUT
RPC errors, as the bot may be offline and unable to reply.
The returned messages.botCallbackAnswer constructor contains:
+message
if specified, a message that should be shown in a non-blocking toast notificationalert
indicates whether the message
should be shown as a dismissable prompt, instead of a simple toast notificationhas_url
Whether an URL is presenturl
if specified, the client should open the URL, without showing a confirmation prompt. t.me/bot?start=aaa
)native_ui
whether to open game URLs in a WebView or in native UI.cache_time
specifies for how long should this answer be cached, client-sideIf the requires_password
flag is set, the SRP 2FA payload must also be generated and attached to the query, to verify the identity of the user.
Note that the bot will NOT be able to access your password or the SRP payload.
+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.
+This is just a way of verifying the identity of the user, mainly used by the official @botfather bot to allow securely transferring the ownership of a bot to another user.
updateBotCallbackQuery#b9cfc48d flags:# query_id:long user_id:long peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
+
+updateInlineBotCallbackQuery#691e9052 flags:# query_id:long user_id:long msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
+
+---functions---
+
+messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool;
+After the user invokes messages.getBotCallbackAnswer, an updateBotCallbackQuery or updateInlineBotCallbackQuery 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 inline query.
+Either way, bots must reply to the query as quickly as possible using messages.setBotCallbackAnswer:
+query_id
is the query_id
from messages.getBotCallbackAnswer, an updateBotCallbackQuery or updateInlineBotCallbackQuerymessage
, alert
, url
can contain messages and URLs to trigger different client behaviour, as specified above »cache_time
indicates the maximum amount of time in seconds that the result of the callback query may be cached by the client. If a game_short_name
is present in the update, the bot should return the URL of the game with the specified name.
+The messages.setBotCallbackAnswer method must be called anyway, even if no message
or url
is returned, to avoid timeouts on the client.
Bots offer a set of commands that can be used by users in private, or in a chat.
+For a simplified description using the HTTP bot API, see here ».
+botCommand#c27ac8c7 command:string description:string = BotCommand;
+
+botInfo#1b74b335 user_id:long description:string commands:Vector<BotCommand> = BotInfo;
+
+channelFull#e9b27a17 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string = ChatFull;
+userFull#d697ff05 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string = UserFull;
+
+user#3ff6ecb0 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
+The botInfo constructors contained in the userFull, chatFull, channelFull contain a list of commands, and for groups, the ID and a description of each bot.
+In graphical clients, when users begin a message with a /
, 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.
If the command list of a bot changes, the bot_info_version
contained in the user constructor received in updates will change; this indicates that the client should refetch full bot information using users.getFullUser.
botCommand#c27ac8c7 command:string description:string = BotCommand;
+
+---functions---
+
+bots.setBotCommands#517165a scope:BotCommandScope lang_code:string commands:Vector<BotCommand> = Bool;
+The command list can be changed by the owner of the bot through @botfather, but bots can also change their own command list by invoking bots.setBotCommands.
Users can interact with your bot via inline queries, straight from the text input field in any chat.
+This article describes the full inline bot flow, using the MTProto API.
For a simplified description using the HTTP bot API, see here ».
+messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults;
+
+---functions---
+
+messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;
+When, in a graphical client, the user starts a message with an @
, clients should:
bot
- The bot peerpeer
- The chat where the user made the querygeo_point
- The user's current geolocation, if the bot requires location-based inline results (the bot_inline_geo
flag of the bot's user constructor will be set)query
- What the user typed after the bot's usernameoffset
- If the user scrolls past the first len(results)
results, and next_offset
field is set, the inline query should be repeated with this offset.inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
+
+inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult;
+inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult;
+
+updateBotInlineQuery#496f379c flags:# query_id:long user_id:long query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;
+
+---functions---
+
+messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool;
+Bots can answer to incoming updateBotInlineQuery updates using messages.setInlineBotResults.
+Just like its bot API counterpart, the method can be used to send a set of inline results to the user; see the constructor page for more info on the MTProto method parameters ».
In general, the method accepts a vector of InputBotInlineResult constructors, that when chosen, generates a message with optionally attached media, and even inline buttons.
+botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
+
+botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult;
+botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult;
+
+messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults;
+
+---functions---
+
+messages.sendInlineBotResult#220815b0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string schedule_date:flags.10?int = Updates;
+The user client should display the results
obtained during querying in a list, making sure to handle eventual bot timeouts in the form of a BOT_RESPONSE_TIMEOUT
RPC error, by simply not displaying anything.
If the user then chooses a specific BotInlineResult
, the messages.sendInlineBotResult method should be invoked, passing:
query_id
from messages.botResults
id
of the chosen resultpeer
where to send the chosen resultThe resulting message will have the via_bot_id
field set, to indicate that the result was generated by the bot that generated the inline result.
+Graphical clients should display the bot @username
in the header of the message, allowing the user to click on it, automatically starting an inline query by inserting @username
in the text bar.
inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID;
+
+updateBotInlineSend#12f12a07 flags:# user_id:long query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
+If feedback collection is enabled, the bot may receive an updateBotInlineSend when the user chooses and sends an inline result.
+Even if the probability setting is set to 100%, not all inline results may be reported due to caching (see the cache_time
parameter in Answering a callback query).
+Feedback collection can also create load issues for popular bots, so adjust the probability setting to a lower value in such cases.
Either way, feedback collection should only be used for statistical purposes rather than functional.
+The updateBotInlineSend will contain:
+id
- The ID of the chosen resultmsg_id
- The ID of the sent inline messageuser_id
- The ID of the user that chose the resultquery
- The query string that was used to obtain the resultgeo
- For bots requiring location-based inline results, the user's locationupdateInlineBotCallbackQuery#691e9052 flags:# query_id:long user_id:long msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
+
+inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID;
+
+---functions---
+
+messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Bool;
+Sent inline messages can be edited by the bot, for example in response to a button press callback query.
+Simply pass the inputBotInlineMessageID specified in the updateInlineBotCallbackQuery to messages.editInlineBotMessage along with the new message, making sure to send the query to the datacenter specified in inputBotInlineMessageID.dc_id
.
The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods.
+config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;
+nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
+
+---functions---
+
+help.getConfig#c4f9186b = Config;
+help.getNearestDc#1fb33026 = NearestDc;
+The huge config 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 constructor page for more information.
+jsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue;
+
+jsonNull#3f6d7b68 = JSONValue;
+jsonBool#c7345e6a value:Bool = JSONValue;
+jsonNumber#2be0dfa4 value:double = JSONValue;
+jsonString#b71e767a value:string = JSONValue;
+jsonArray#f7444763 value:Vector<JSONValue> = JSONValue;
+jsonObject#99c1d49d value:Vector<JSONObjectValue> = JSONValue;
+
+---functions---
+
+help.getAppConfig#98914110 = JSONValue;
+The help.getAppConfig method returns a JSON object containing rapidly evolving, client-specific configuration parameters.
+While help.getConfig returns MTProto-specific configuration with information about server-side limitations and other MTProto-related information, help.getAppConfig returns configuration parameters useful for graphical Telegram clients.
Typical fields included in the resulting JSON object are:
+emojies_animated_zoom
- Animated emojis and animated dice should be scaled by this factor before being shown to the user (float)keep_alive_service
- Whether app clients should start a keepalive service to keep the app running and fetch updates even when the app is closed (boolean)background_connection
- Whether app clients should start a background TCP connection for MTProto update fetching (boolean)emojies_send_dice
- A list of supported animated dice stickers (array of strings).emojies_send_dice_success
- For animated dice emojis other than the basic value
and frame_start
float values)emojies_sounds
- A map of soundbites to be played when the user clicks on the specified animated emoji; the file reference field should be base64-decoded before downloading the file (map of file IDs, with emoji string keys)gif_search_branding
- Specifies the name of the service providing GIF search through gif_search_username (string)gif_search_emojies
- Specifies a list of emojies that should be suggested as search term in a bar above the GIF search box (array of string emojis)stickers_emoji_suggest_only_api
- Specifies that the app should not display local sticker suggestions for emojis at all and just use the result of messages.getStickers (bool)stickers_emoji_cache_time
- Specifies the validity period of the local cache of messages.getStickers, also relevant when generating the pagination hash when invoking the method. (int)qr_login_camera
- Whether the Settings->Devices menu should show an option to scan a QR login code (boolean)qr_login_code
- Whether the login screen should show a QR code login option, possibly as default login method (string, "disabled", "primary" or "secondary")dialog_filters_enabled
- Whether clients should show an option for managing dialog filters AKA folders (boolean)dialog_filters_tooltip
- Whether clients should actively show a tooltip, inviting the user to configure dialog filters AKA folders; typically this happens when the chat list is long enough to start getting cluttered. (boolean)autoarchive_setting_available
- Whether clients can invoke account.setGlobalPrivacySettings with globalPrivacySettings.archive_and_mute_new_noncontact_peers = boolTrue
, to automatically archive and mute new incoming chats from non-contacts. (boolean)pending_suggestions
- Contains a list of suggestions that should be actively shown as a tooltip to the user. (Array of strings, possible values shown in the suggestions section ». url_auth_domains
- A list of domains that support automatic login with manual user confirmation, click here for more info on URL authorization ». (array of strings)autologin_domains
- A list of Telegram domains that support automatic login with no user confirmation, click here for more info on URL authorization ». (array of strings)autologin_token
- Autologin token, click here for more info on URL authorization ». (string)round_video_encoding
- Contains a set of recommended codec parameters for round videos. chat_read_mark_size_threshold
- Per-user read receipts, fetchable using messages.getMessageReadParticipants will be available in groups with less than chat_read_mark_size_threshold
participants. (int)chat_read_mark_expire_period
- To protect user privacy, read receipts are only stored for chat_read_mark_expire_period
seconds after the message was sent. (int)Example value:
+{
+ "test": 1,
+ "emojies_animated_zoom": 0.625,
+ "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": "AGFhvoKbftK5O9K9RpgN1ZtgSzWy"
+ },
+ "\u26b0": {
+ "id": "4956223179606458540",
+ "access_hash": "-1498869544183595185",
+ "file_reference_base64": "AGFhvoJIm8Uz0qSMIdm3AsKlK7wJ"
+ },
+ "\ud83e\udddf\u200d\u2642": {
+ "id": "4960929110848176331",
+ "access_hash": "3986395821757915468",
+ "file_reference_base64": "AGFhvoLtXSSIclmvfg6ePz3KsHQF"
+ },
+ "\ud83e\udddf": {
+ "id": "4960929110848176332",
+ "access_hash": "-8929417974289765626",
+ "file_reference_base64": "AGFhvoImaz5Umt4GvMUD5nocIu0W"
+ },
+ "\ud83e\udddf\u200d\u2640": {
+ "id": "4960929110848176333",
+ "access_hash": "9161696144162881753",
+ "file_reference_base64": "AGFhvoIm1QZsb48xlpRfh4Mq7EMG"
+ },
+ "\ud83c\udf51": {
+ "id": "4963180910661861548",
+ "access_hash": "-7431729439735063448",
+ "file_reference_base64": "AGFhvoKLrwl_WKr5LR0Jjs7o3RyT"
+ },
+ "\ud83c\udf8a": {
+ "id": "5094064004578410732",
+ "access_hash": "8518192996098758509",
+ "file_reference_base64": "AGFhvoKMNffRV2J3vKED0O6d8e42"
+ },
+ "\ud83c\udf84": {
+ "id": "5094064004578410733",
+ "access_hash": "-4142643820629256996",
+ "file_reference_base64": "AGFhvoJ1ulPBbXEURlTZWwJFx6xZ"
+ },
+ "\ud83e\uddbe": {
+ "id": "5094064004578410734",
+ "access_hash": "-8934384022571962340",
+ "file_reference_base64": "AGFhvoL4zdMRmYv9z3L8KPaX4JQL"
+ }
+ },
+ "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,
+ "qr_login_camera": false,
+ "qr_login_code": "disabled",
+ "dialog_filters_enabled": true,
+ "dialog_filters_tooltip": false,
+ "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"
+ ],
+ "url_auth_domains": [
+ "somedomain.telegram.org"
+ ],
+ "round_video_encoding": {
+ "diameter": 384,
+ "video_bitrate": 1000,
+ "audio_bitrate": 64,
+ "max_size": 12582912
+ },
+ "chat_read_mark_size_threshold": 50,
+ "chat_read_mark_expire_period": 604800
+}
+The API can return a set of useful suggestions for users of graphical clients.
+jsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue;
+
+jsonNull#3f6d7b68 = JSONValue;
+jsonBool#c7345e6a value:Bool = JSONValue;
+jsonNumber#2be0dfa4 value:double = JSONValue;
+jsonString#b71e767a value:string = JSONValue;
+jsonArray#f7444763 value:Vector<JSONValue> = JSONValue;
+jsonObject#99c1d49d value:Vector<JSONObjectValue> = JSONValue;
+
+---functions---
+
+help.getAppConfig#98914110 = JSONValue;
+The help.getAppConfig method returns a JSON object containing rapidly evolving, client-specific configuration parameters.
+A full list of these parameters can be seen in the Client Configuration section », but we're mostly interested in the pending_suggestions
and autoarchive_setting_available
fields of the returned JSON object:
autoarchive_setting_available
- Whether clients can invoke account.setGlobalPrivacySettings with globalPrivacySettings.archive_and_mute_new_noncontact_peers = boolTrue
, to automatically archive and mute new incoming chats from non-contacts. (boolean)pending_suggestions
- Contains a list of suggestions that should be actively shown as a tooltip to the user. Array of strings, possible values shown below:"AUTOARCHIVE_POPULAR"
- Users should invoke account.setGlobalPrivacySettings with globalPrivacySettings.archive_and_mute_new_noncontact_peers = boolTrue
, to automatically archive and mute new incoming chats from non-contacts."VALIDATE_PASSWORD"
- Users should make sure they still remember their 2-step verification password."VALIDATE_PHONE_NUMBER"
- Users should check whether their authorization phone number is correct and change the phone number if it is inaccessible."NEWCOMER_TICKS"
- Show the user a hint about the meaning of one and two ticks on sent messages.messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull;
+
+channelFull#e9b27a17 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string = ChatFull;
+
+---functions---
+
+channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
+Some channel/supergroup-related suggestions can also be contained in the pending_suggestions
field of the channelFull constructor, returned by channels.getFullChannel.
+Here's a list of possible suggestions:
CONVERT_GIGAGROUP
- The supergroup has many participants: the admin should call channels.convertToGigagroup to convert it to a gigagroup.boolFalse#bc799737 = Bool;
+boolTrue#997275b5 = Bool;
+
+---functions---
+
+help.dismissSuggestion#f50dbaa1 peer:InputPeer suggestion:string = Bool;
+help.dismissSuggestion can be used to dismiss a suggestion.
+Pass inputPeerEmpty to peer
for basic suggestions and the channel/supergroup's peer for channel suggestions.
help.appUpdate#ccbbce30 flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string sticker:flags.3?Document = help.AppUpdate;
+help.noAppUpdate#c45a6536 = help.AppUpdate;
+
+updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
+updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update;
+
+help.inviteText#18cb9f78 message:string = help.InviteText;
+
+---functions---
+
+help.getAppUpdate#522d5a7d source:string = help.AppUpdate;
+help.getAppChangelog#9010ef6f prev_app_version:string = Updates;
+
+help.getInviteText#4d392343 = help.InviteText;
+help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;
+help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;
+
+help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector<MessageEntity> min_age_confirm:flags.1?int = help.TermsOfService;
+
+auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization;
+
+---functions---
+
+help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
+help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
+
+auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization;
+
+account.deleteAccount#418d4e0b reason:string = Bool;
+These methods can be used for managing consent to Telegram's Terms Of Service.
+Typically, before a user signs up by invoking auth.signUp, apps should show a pop-up (if the popup
flag of the help.termsOfService 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.
When signing up for the first time, the help.termsOfService is to be obtained from the auth.authorizationSignUpRequired constructor returned by the auth.signIn.
+After signing up, or when logging in as an existing user, apps are supposed to call help.getTermsOfServiceUpdate to check for any updates to the Terms of Service; this call should be repeated after expires
seconds have elapsed.
+If an update to the Terms Of Service is available, clients are supposed to show a consent popup; if accepted, clients should call help.acceptTermsOfService, providing the termsOfService id
JSON object; in case of denial, clients are to delete the account using account.deleteAccount, providing Decline ToS update
as deletion reason
.
Example implementation: android (signup), android (after login)
+user#3ff6ecb0 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
+
+help.support#17c6b5f6 phone_number:string user:User = help.Support;
+help.supportName#8c05f1c9 name:string = help.SupportName;
+
+---functions---
+
+help.getSupport#9cdf08cd = help.Support;
+help.getSupportName#d360e72c = help.SupportName;
+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.
+help.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector<string> patterns:flags.1?Vector<string> = help.CountryCode;
+
+help.country#c3878e23 flags:# hidden:flags.0?true iso2:string default_name:string name:flags.1?string country_codes:Vector<help.CountryCode> = help.Country;
+
+help.countriesListNotModified#93cc1f32 = help.CountriesList;
+help.countriesList#87d0759e countries:Vector<help.Country> hash:int = help.CountriesList;
+
+---functions---
+help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList;
+help.getCountriesList can be used to fetch a list of localized names for all available countries and phone code patterns for logging in.
+The phone code pattern should be used when showing the login screen, or when changing phone number: for example, a pattern value of XXX XXX XXX
with country_code
+39
indicates that the phone field for login should accept a spaced pattern like +39 123 456 789
.
+Also, the beginning of the national part of the phone number (123 456 789
) should match one of the prefixes
, if any were returned.
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 help.getConfig:
dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
+config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;
+---functions---
+help.getConfig#c4f9186b = Config;
+In this context, this_dc is the number of the current DC, dc_options is a list of all DCs available at the moment, each of which has an id, ip, and port for establishing a connection. Please note that ip and port may change frequently, based on proxy server load and the user's current location.
Typically, each DC has at least one IPv4 and one IPv6 endpoint available.
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.
+The auth.sendCode 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.
+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 phone_number 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).
There are reserved phone number prefixes to test the correctness of the application’s handling of redirects between DCs. Read more in User Authorization article.
+A file saved by a user with upload.saveFilePart will be available for direct download only from the DC where the query was executed. That is why each file has a dc_id parameter:
+document#1e87342b flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
+photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;
+
+encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile;
+
+userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
+chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;
+To download the file, an encrypted connection to DC dc_id must be established and used to execute the upload.getFile query.
If an attempt is made to download the file over a wrong connection, the FILE_MIGRATE_X error will be returned.
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 authorization transfer.
+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.
+The following methods can be used to eliminate the need for users to enter the code from a text message every time:
+auth.exportedAuthorization#b434e2b8 id:long bytes:bytes = auth.ExportedAuthorization;
+auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization;
+---functions---
+auth.importAuthorization#a57a7dad id:long bytes:bytes = auth.Authorization;
+auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;
+auth.exportAuthorization must be executed in the current DC (the DC with which a connection has already been established), passing in dc_id 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.
+Telegram supports sending animated dice emojis.
+This is implemented by using the dice constructors:
inputMediaDice#e66fbf7b emoticon:string = InputMedia;
+messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;
+
+inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;
+
+messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
+
+---functions---
+
+messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+
+messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
+
+help.getAppConfig#98914110 = JSONValue;
+On startup, clients should fetch app configuration using help.getAppConfig.
+Then, for each dice emoji contained in the emojies_send_dice
field, clients should fetch the dice emoji stickerset by calling the messages.getStickerSet method, providing the properly populated inputStickerSetDice to the stickerset
field.
+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.
If a user attempts to send a single emoji from the ones specified in emojies_send_dice
, the dice should be sent using messages.sendMedia, providing the dice emoji to the emoticon
field.
Incoming dice stickers will be received as a messageMediaDice constructor, along with a randomly generated server-side value, ranging from 1 to the maximum allowed value for this type of dice.
+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, value
can be used to directly index the documents
sticker array from the animated stickerset.
The emojies_send_dice_success
configuration parameter contains more info about dice emojis other than the basic :
"emojies_send_dice_success": {
+ "\ud83c\udfaf": {
+ "value": 6,
+ "frame_start": 62
+ },
+ "\ud83c\udfc0": {
+ "value": 5,
+ "frame_start": 110
+ }
+ }
+For each of the dice emojis, a maximum "winning" value is specified, along with the frame number at which to show the fireworks .
+Please note that dice animated stickers should loop only once, right after being sent/received for the first time; clicking on the dice sticker should bring up a popup, inviting the user to send a new dice of the same type.
Groups can be associated to a channel as a discussion group, to allow users to discuss about posts.
+boolFalse#bc799737 = Bool;
+boolTrue#997275b5 = Bool;
+
+channelFull#e9b27a17 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string = ChatFull;
+
+messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;
+
+---functions---
+
+channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;
+channels.getGroupsForDiscussion#f5dad378 = messages.Chats;
+A discussion group can be associated to a channel using channels.setDiscussionGroup.
+The discussion group can be accessed in the client by clicking on the discuss button of the channel, or by accessing the comment section of a specific post; the discussion group ID is also present in the linked_chat_id
field of the channelFull constructor.
All messages sent to the channel will also be sent to the linked group (with sender peer from_id
equal to the peer of the linked channel); those messages will also be automatically pinned in the group.
To obtain a list of admined supergroups that a channel admin can possibly associate to a channel, use channels.getGroupsForDiscussion.
+Returned legacy group chats must be first upgraded to supergroups before they can be set as a discussion group.
+Before linking a supergroup to a channel, access to the supergroup's old messages must also be enabled using channels.togglePreHistoryHidden.
To set a returned supergroup as a discussion group use channels.setDiscussionGroup.
+Schema:
+boolFalse#bc799737 = Bool;
+boolTrue#997275b5 = Bool;
+
+messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;
+
+---functions---
+
+channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;
+channels.getGroupsForDiscussion#f5dad378 = messages.Chats;
+
+channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates;
Telegram supports styled text using message entities.
+A client that wants to send styled messages would simply have to integrate a Markdown/HTML parser, and generate an array of message entities by iterating through the parsed tags.
+Special care must be taken to consider the UTF-8 length of strings when generating message entities, see example implementations: tdlib, MadelineProto.
+Nested entities are supported.
+For example the following HTML/Markdown aliases for message entities can be used:
<b>bold</b>
, <strong>bold</strong>
, **bold**
<i>italic</i>
, <em>italic</em>
*italic*
messageEntityCode
=> <code>code</code>
, `code`
<s>strike</s>
, <strike>strike</strike>
, <del>strike</del>
, ~~strike~~
<u>underline</u>
messageEntityPre
=> <pre language="c++">code</pre>
, +```c++ +code +``` ++
The following entities can also be used to mention users:
+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.
+There are a number of API methods to save files. The schema of the types and methods used is presented below:
+inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile;
+inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile;
+
+
+inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile;
+inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile;
+
+inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile;
+inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile;
+
+inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true force_file:flags.4?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+
+inputChatUploadedPhoto#c642724e flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = InputChatPhoto;
+
+
+---functions---
+
+messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia;
+messages.sendEncryptedFile#5559481d flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage;
+
+photos.uploadProfilePhoto#89f30f69 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = photos.Photo;
+
+upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool;
+upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool;
+Before transmitting the contents of the file itself, the file has to be assigned a unique 64-bit client identifier: file_id.
+The file’s binary content is then split into parts. All parts must have the same size ( part_size ) and the following conditions must be met:
+part_size % 1024 = 0
(divisible by 1KB)524288 % part_size = 0
(512KB must be evenly divisible by part_size)The last part does not have to satisfy these conditions, provided its size is less than part_size.
+Each part should have a sequence number, file_part, with a value ranging from 0 to 2,999.
+After the file has been partitioned you need to choose a method for saving it on the server. Use upload.saveBigFilePart in case the full size of the file is more than 10 MB and upload.saveFilePart for smaller files.
+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.
+When using one of the methods mentioned above to save file parts, one of the following data input errors may be returned:
+1..3000
0 and 2,999
.While the parts are being uploaded, an MD5 hash of the file contents can also be computed to be used later as the md5_checksum parameter in the inputFile 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 inputFile object. In case the upload.saveBigFilePart method is used, the inputFileBig constructor must be passed, in other cases use inputFile.
+The file save operation may return one of the following data input errors:
+inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true force_file:flags.4?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;
+
+inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector<MessageEntity> = InputSingleMedia;
+
+---functions---
+
+messages.sendMultiMedia#cc0110cb flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int = Updates;
+Telegram allows grouping photos into albums and generic files (audio, docuemnts) into media groups.
+To do this, messages.sendMultiMedia is used, wrapping each InputMedia constructor (uploaded or pre-existing, maximum 10 per media group) into an inputSingleMedia constructor, optionally providing a custom per-file caption in message
.
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.
+Other grouped media can display a caption under each file.
document#1e87342b flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
+
+---functions---
+
+messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document;
+For some types of documents like GIFs, messages.getDocumentByHash 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 document is returned.
+photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;
+
+photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
+
+inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto;
+
+inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile;
+
+inputChatUploadedPhoto#c642724e flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = InputChatPhoto;
+inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto;
+
+---functions---
+
+photos.updateProfilePhoto#72d4742c id:InputPhoto = photos.Photo;
+photos.uploadProfilePhoto#89f30f69 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = photos.Photo;
+
+messages.editChatPhoto#35ddd674 chat_id:long photo:InputChatPhoto = Updates;
+
+channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;
+User profile pictures can be uploaded using the photos.uploadProfilePhoto method: the actual profile picture has to be uploaded as for normal files.
+photos.uploadProfilePhoto can also be used to reupload previously uploaded profile pictures.
Animated profile pictures are also supported, by populating the video
constructor: square MPEG4 videos up to 1080x1080
are supported, 800x800
is the recommended resolution.
+The video_start_ts
is a floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview.
Chat, channel and supergroup profile photos and videos can be uploaded using messages.editChatPhoto (legacy groups) or channels.editPhoto (channels, supergroups).
+Use the inputChatPhoto to reuse previously uploaded profile pictures.
There are methods available to download files which have been successfully uploaded. The schema of the types and methods used is presented below:
+upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
+upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;
+
+storage.fileUnknown#aa963b05 = storage.FileType;
+storage.fileJpeg#7efe0e = storage.FileType;
+storage.fileGif#cae1aadf = storage.FileType;
+storage.filePng#a4f63c0 = storage.FileType;
+storage.fileMp3#528a0677 = storage.FileType;
+storage.fileMov#4b09ebbc = storage.FileType;
+storage.filePartial#40bc6f52 = storage.FileType;
+storage.fileMp4#b3cea0e4 = storage.FileType;
+storage.fileWebp#1081464c = storage.FileType;
+
+---functions---
+
+upload.getFile#b15a9afc flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:int limit:int = upload.File;
+Any file can be downloaded by calling upload.getFile. +The data for the input parameter of the InputFileLocation type is generated as follows:
+inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation;
+inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation;
+inputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
+inputTakeoutFileLocation#29be5899 = InputFileLocation;
+inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
+inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation;
+inputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation;
+inputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation;
+inputGroupCallStream#598a92a flags:# call:InputGroupCall time_ms:long scale:int video_channel:flags.0?int video_quality:flags.0?int = InputFileLocation;
+
+inputStickerSetEmpty#ffb62b95 = InputStickerSet;
+inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
+inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
+inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
+inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;
+inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet;
+
+inputPeerSelf#7da07ec9 = InputPeer;
+inputPeerChat#35a95cb9 chat_id:long = InputPeer;
+inputPeerUser#dde8a54c user_id:long access_hash:long = InputPeer;
+inputPeerChannel#27bcbbfc channel_id:long access_hash:long = InputPeer;
+
+photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;
+document#1e87342b flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
+
+photoSize#75c78e60 type:string w:int h:int size:int = PhotoSize;
+photoCachedSize#21e1ad6 type:string w:int h:int bytes:bytes = PhotoSize;
+
+chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;
+userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
+For photos, inputPhotoFileLocation is used:
+ +For profile pictures of users, channels, supergroups and groups, inputPeerPhotoFileLocation has to be used:
+peer
is the identifier of the peer whose photo we want to downloadbig
is used to choose whether to download the full-resolution picture, or just the thumbnailphoto_id
is extracted from the chatPhoto or userProfilePhoto of the desired profile photoFor documents, inputDocumentFileLocation is used:
+ +For previews of sticker sets, inputStickerSetThumb is used (note: to download stickers and previews of stickers use the document method described above for documents):
+stickerset
is set to the InputStickerSet constructor generated from stickerSetthumb_version
is copied from the same field in stickerSetFor encrypted secret chat and telegram passport documents, respectively inputEncryptedFileLocation and inputSecureFileLocation have to be used, with parameters extracted from encryptedFile and secureFile (passport docs).
+For livestream chunks, inputGroupCallStream is used:
+call
contains the related group call ID+access hash, taken from the groupCall constructor.time_ms
specifies the timestamp to fetchscale
specifies the duration of the video segment to fetch in milliseconds, by bitshifting 1000
to the right scale
times: duration_ms := 1000 >> scale
video_channel
specifies the video channel to fetchvideo_quality
specifies the selected video quality (0 = lowest, 1 = medium, 2 = best)For old deprecated photos, if the client has cached some old fileLocations with the deprecated secret
identifier, inputFileLocation or inputPhotoLegacyFileLocation is used (this is mainly used for backwards compatiblity with bot API file IDs, all user clients must use the modern inputPhotoFileLocation file IDs):
file_reference
, access_hash
and id
, which are taken from the photo constructor (the last two fields are used only if available, in which case inputPhotoLegacyFileLocation is used instead of inputFileLocation).The size of each file in bytes is available, which makes it possible to download the file in parts using the parameters offset and limit, similar to the way files are uploaded.
+If precise flag is not specified, then
+If precise is specified, then
+In any case the requested part should be within one 1 MB chunk from the beginning of the file, i. e.
+The file download operation may return a FILE_REFERENCE_EXPIRED
error (or another error starting with FILE_REFERENCE_
): in this case, the file_reference
field of the input location must be refreshed.
+The file download operation may return an upload.fileCdnRedirect constructor: in this case, these instructions must be followed for downloading CDN files.
+The file download operation may also return one of the following data input errors:
fileHash#6242c773 offset:int limit:int hash:bytes = FileHash;
+
+---functions---
+
+upload.getFileHashes#c7025931 location:InputFileLocation offset:int = Vector<FileHash>;
+In order to confirm the integrity of the downloaded file, clients are recommended to verify hashes for each downloaded part, as for CDN DCs.
+upload.getFileHashes contain FileHash constructors. Each of these constructors contains the SHA-256 hash of a part of the file that starts with offset
and takes limit
bytes.
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 upload.getFileHashes method to obtain the missing hash.
+Schema:
+photoSizeEmpty#e17e23c type:string = PhotoSize;
+photoSize#75c78e60 type:string w:int h:int size:int = PhotoSize;
+photoCachedSize#21e1ad6 type:string w:int h:int bytes:bytes = PhotoSize;
+photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;
+photoSizeProgressive#fa3efb95 type:string w:int h:int sizes:Vector<int> = PhotoSize;
+photoPathSize#d8214d41 type:string bytes:bytes = PhotoSize;
+
+videoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize;
+
+document#1e87342b flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
+photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;
+
+photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;
+Telegram attaches a vector of thumbnails with reduced resolution to all uploaded media.
+The server also generates a trimmed and scaled down video preview for videos, GIFs and animated profile pictures.
Each photo preview has a specific type
, indicating the resolution and image transform that was applied server-side.
Type | +Image filter | +Size | +
---|---|---|
s |
+box | +100x100 | +
m |
+box | +320x320 | +
x |
+box | +800x800 | +
y |
+box | +1280x1280 | +
w |
+box | +2560x2560 | +
a |
+crop | +160x160 | +
b |
+crop | +320x320 | +
c |
+crop | +640x640 | +
d |
+crop | +1280x1280 | +
Special types:
+Type | +Image filter | +
---|---|
i |
+strip | +
j |
+outline | +
photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;
+A photoStrippedSize (with type i
) is an extremely low-res thumbnail, embedded directly inside media location objects.
+It should be shown to the user in chat message previews, or while still downloading the most appropriately sized photoSize through the media DCs as described above.
The stripped bytes
payload should be inflated to a JPG payload as seen here ».
photoPathSize#d8214d41 type:string bytes:bytes = PhotoSize;
+Messages with animated stickers can have a compressed svg (< 300 bytes) to show the outline of the sticker before fetching the actual lottie animation.
+Animated sticker outlines will have a j
type photoPathSize thumbnail.
This specific vector thumbnail consists in an SVG path, specially encoded to save space.
+This path will be the outline of the animated sticker, and should be shown to the user while downloading the actual sticker.
As for stripped sizes, the payload should be inflated using the following algorithm:
+encoded := photoPathSize.bytes
+
+lookup := "AACAAAAHAAALMAAAQASTAVAAAZaacaaaahaaalmaaaqastava.az0123456789-,"
+
+path := "M"
+
+len := strlen(encoded)
+for (i = 0; i < len; i++) {
+ num := ord(encoded[i])
+ if (num >= 128 + 64) {
+ path += lookup[num - 128 - 64]
+ } else {
+ if (num >= 128) {
+ path += ','
+ } else if (num >= 64) {
+ path += '-'
+ }
+ path += itoa(num & 63)
+ }
+}
+path += "z"
+path
will contain the actual SVG path that can be directly inserted in the d
attribute of an svg <path> element:
<?xml version="1.0" encoding="utf-8"?>
+<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">
+<path d="{$path}"/>
+</svg>
+videoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize;
+A videoSize constructor is typically used for animated profile pictures and video previews.
+Type | +Description | +Format | +
---|---|---|
u |
+Animated profile picture | +MPEG4 | +
v |
+Video preview | +MPEG4 | +
Remote HTTP files sent by inline bots in response to inline queries and in other places are represented by WebDocument constructors. +When forwarding such remote HTTP files, they should be sent using external InputMedia constructors. +Remote HTTP files can only be downloaded directly by the client if contained in a webDocumentNoProxy constructor: in this case, the file is deemed safe to download (this is the case for HTTPS files from certain trusted domains).
+However, if the remote file is contained in a webDocument, to avoid leaking sensitive information the file must be downloaded through telegram's servers. +This can be done in a manner similar to normal files, with the difference that upload.getWebFile must be used, instead.
+upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile;
+
+storage.fileUnknown#aa963b05 = storage.FileType;
+storage.fileJpeg#7efe0e = storage.FileType;
+storage.fileGif#cae1aadf = storage.FileType;
+storage.filePng#a4f63c0 = storage.FileType;
+storage.fileMp3#528a0677 = storage.FileType;
+storage.fileMov#4b09ebbc = storage.FileType;
+storage.filePartial#40bc6f52 = storage.FileType;
+storage.fileMp4#b3cea0e4 = storage.FileType;
+storage.fileWebp#1081464c = storage.FileType;
+
+ ---functions---
+
+upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile;
+The InputWebFileLocation constructor is generated as follows.
+inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation;
+inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation;
+
+webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument;
+
+inputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint;
+
+geoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radius:flags.0?int = GeoPoint;
+url
and access_hash
fields of the webDocument constructor.geo_point
is generated from the lat
, long
accuracy_radius
parameters of the geoPointaccess_hash
is the access hash of the geoPointw
- Map width in pixels before applying scale; 16-1024h
- Map height in pixels before applying scale; 16-1024zoom
- Map zoom level; 13-20scale
- Map scale; 1-3It is recommended that large queries (upload.getFile, upload.saveFilePart, upload.getWebFile) 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 getting updates and other method calls.
+How to handle file references.
Deprecated old docs. This was definitely not the droid you were looking for.
Telegram allows importing messages and media from foreign chat apps.
+++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 Telegram blog post.
+
messages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true title:flags.2?string = messages.HistoryImportParsed;
+
+---functions---
+
+messages.checkHistoryImport#43fe19f3 import_head:string = messages.HistoryImportParsed;
+The import process begins by calling messages.checkHistoryImport, passing to import_head
up to 100 lines of the chat export file, starting from the beginning of the file.
The returned constructor contains information about the exported chat, including its title or type.
+If the pm
flag is set, the chat export file was generated from a private chat.
+If the group
flag is set, the chat export file was generated from a group chat.
+If neither the pm
or group
flags are set, the specified chat export was generated from a chat of unknown type.
messages.checkedHistoryImportPeer#a24de717 confirm_text:string = messages.CheckedHistoryImportPeer;
+
+---functions---
+
+messages.checkHistoryImportPeer#5dc60f03 peer:InputPeer = messages.CheckedHistoryImportPeer;
+Using messages.checkHistoryImportPeer, check whether chat history exported from another chat app can be imported into a specific Telegram peer
, chosen by the user.
+Typically, history imports are allowed for private chats with a mutual contact or supergroups with change_info
administrator rights ».
If the check succeeds, and no RPC errors are returned, a messages.CheckedHistoryImportPeer constructor will be returned, with a confirmation text to be shown to the user in a confirmation prompt.
+Upon final user confirmation, the import process is initialized.
messages.historyImport#1662af0b id:long = messages.HistoryImport;
+
+---functions---
+
+messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport;
+Use messages.initHistoryImport to initialize the import process, passing the following parameters:
+peer
- The Telegram chat where the history should be imported.file
- The chat export file.media_count
- The number of media files associated with the export, to be uploaded in the next step. ---functions---
+
+messages.uploadImportedMedia#2a862092 peer:InputPeer import_id:long file_name:string media:InputMedia = MessageMedia;
+Use messages.uploadImportedMedia to upload media files eventually associated with the chat export.
+import_id
is the id
contained in the messages.historyImport constructor, returned by messages.initHistoryImport in the previous step.
message#85d6cbe2 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int = Message;
+
+messageFwdHeader#5f777dce flags:# imported:flags.7?true from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;
+
+---functions---
+
+messages.startHistoryImport#b43df344 peer:InputPeer import_id:long = Bool;
+Finally, invoke messages.startHistoryImport to complete the history import process, importing all messages into the chat.
+As usual, import_id
is the id
contained in the messages.historyImport constructor, returned by messages.initHistoryImport.
Imported messages will show in the chat history as messages containing a fwd_from
messageFwdHeader constructor with the imported
flag, and should be appropriately marked in the UI as messages imported from a foreign chat app.
Below you will find information on schema changes. For more details on the use of layers, see Invoking API methods.
+Group message receipts, animated emoji reactions » and switch to 64-bit identifiers for users, groups, supergroups and channels.
+Over 160 constructors and methods were changed, changing parameter types from int to long, including user, chat and channel: the full changelog is elided for space reasons.
You can visit the schema for an updated list of constructors.
Also note that the hashing algorithm for pagination was also changed to account for 64-bit IDs.
+Chat themes and sponsored messages, save video recordings of group calls and livestreams.
+chatFull#49a0a5d9 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string = ChatFull;\
+
+userFull#d697ff05 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string = UserFull;\
+
+channelFull#2f532f3c flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string = ChatFull;\
+
+theme#e802b8dc flags:# creator:flags.0?true default:flags.1?true for_chat:flags.5?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?ThemeSettings installs_count:flags.4?int = Theme;\
+
+inputThemeSettings#ff38f912 flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int message_colors:flags.0?Vector<int> wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings;\
+
+themeSettings#8db4e76c flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int message_colors:flags.0?Vector<int> wallpaper:flags.1?WallPaper = ThemeSettings;\
+
+messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;\
+
+inputGroupCallStream#0598a92a flags:# call:InputGroupCall time_ms:long scale:int video_channel:flags.0?int video_quality:flags.0?int = InputFileLocation;\
+
+chatTheme#ed0b5c33 emoticon:string theme:Theme dark_theme:Theme = ChatTheme;\
+
+account.chatThemesNotModified#e011e1c4 = account.ChatThemes;
+account.chatThemes#fe4cbebd hash:int themes:Vector<ChatTheme> = account.ChatThemes;\
+
+messageActionSetChatTheme#aa786345 emoticon:string = MessageAction;\
+
+sendMessageChooseStickerAction#b05ac6b1 = SendMessageAction;
+sponsoredMessage#2a3c381f flags:# random_id:bytes from_id:Peer start_param:flags.0?string message:string entities:flags.1?Vector<MessageEntity> = SponsoredMessage;\
+
+messages.sponsoredMessages#65a4c7d5 messages:Vector<SponsoredMessage> chats:Vector<Chat> users:Vector<User> = messages.SponsoredMessages;\
+
+---functions---\
+
+phone.toggleGroupCallRecord#f128c708 flags:# start:flags.0?true video:flags.2?true call:InputGroupCall title:flags.1?string video_portrait:flags.2?Bool = Updates;\
+
+account.getChatThemes#d6d71d7b hash:int = account.ChatThemes;\
+
+messages.setChatTheme#e63be13f peer:InputPeer emoticon:string = Updates;\
+
+channels.viewSponsoredMessage#beaedb94 channel:InputChannel random_id:bytes = Bool;
+channels.getSponsoredMessages#ec210fbf channel:InputChannel = messages.SponsoredMessages;\
+
2FA password reset for logged-in accounts, add a method to check the validity of the e-mail recovery code before use.
+account.password#185b184f flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int = account.Password;\
+
+groupCall#d597650c flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int = GroupCall;
+groupCallParticipantVideo#67753ac8 flags:# paused:flags.0?true endpoint:string source_groups:Vector<GroupCallParticipantVideoSourceGroup> audio_source:flags.1?int = GroupCallParticipantVideo;\
+
+account.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordResult;
+account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult;
+account.resetPasswordOk#e926d63e = account.ResetPasswordResult;\
+
+updateBotCommands#cf7e0873 peer:Peer bot_id:int commands:Vector<BotCommand> = Update;\
+
+---functions---\
+
+auth.recoverPassword#37096c70 flags:# code:string new_settings:flags.0?account.PasswordInputSettings = auth.Authorization;\
+
+phone.getGroupCall#041845db call:InputGroupCall limit:int = phone.GroupCall;\
+
+account.resetPassword#9308ce1b = account.ResetPasswordResult;
+account.declinePasswordReset#4c9409f6 = Bool;
+auth.checkRecoveryPassword#0d36bf79 code:string = Bool;\
+
Custom placeholder for bot reply keyboards.
+replyKeyboardForceReply#86b40b08 flags:# single_use:flags.1?true selective:flags.2?true placeholder:flags.3?string = ReplyMarkup;
+replyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup;\
+
Group call screen sharing, short name suggestions for stickerpacks, scoped bot commands, imported stickers, wallpaper and group call improvements.
+help.appUpdate#ccbbce30 flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string sticker:flags.3?Document = help.AppUpdate;\
+
+wallPaperSettings#1dc1bca4 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings;\
+
+inputWallPaperNoFile#967a462e id:long = InputWallPaper;\
+
+wallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper;\
+
+updateMessagePollVote#37f69f0b poll_id:long user_id:int options:Vector<bytes> qts:int = Update;\
+
+groupCall#653dbaad flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int version:int = GroupCall;
+groupCallParticipant#eba636fe flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true video_joined:flags.15?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long video:flags.6?GroupCallParticipantVideo presentation:flags.14?GroupCallParticipantVideo = GroupCallParticipant;
+groupCallParticipantVideoSourceGroup#dcb118b7 semantics:string sources:Vector<int> = GroupCallParticipantVideoSourceGroup;
+groupCallParticipantVideo#78e41663 flags:# paused:flags.0?true endpoint:string source_groups:Vector<GroupCallParticipantVideoSourceGroup> = GroupCallParticipantVideo;\
+
+updateGroupCallConnection#0b783982 flags:# presentation:flags.0?true params:DataJSON = Update;\
+
+stickers.suggestedShortName#85fea03f short_name:string = stickers.SuggestedShortName;\
+
+botCommandScopeDefault#2f6cb2ab = BotCommandScope;
+botCommandScopeUsers#3c4f04d8 = BotCommandScope;
+botCommandScopeChats#6fe1a881 = BotCommandScope;
+botCommandScopeChatAdmins#b9aa606a = BotCommandScope;
+botCommandScopePeer#db9d897d peer:InputPeer = BotCommandScope;
+botCommandScopePeerAdmins#3fd863d1 peer:InputPeer = BotCommandScope;
+botCommandScopePeerUser#0a1321f3 peer:InputPeer user_id:InputUser = BotCommandScope;\
+
+---functions---\
+
+stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true animated:flags.1?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet;\
+
+bots.setBotCommands#0517165a scope:BotCommandScope lang_code:string commands:Vector<BotCommand> = Bool;\
+
+phone.checkGroupCall#b59cf977 call:InputGroupCall sources:Vector<int> = Vector<int>;
+phone.editGroupCallParticipant#a5273abf flags:# call:InputGroupCall participant:InputPeer muted:flags.0?Bool volume:flags.1?int raise_hand:flags.2?Bool video_stopped:flags.3?Bool video_paused:flags.4?Bool presentation_paused:flags.5?Bool = Updates;
+phone.joinGroupCallPresentation#cbea6bc4 call:InputGroupCall params:DataJSON = Updates;
+phone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates;\
+
+stickers.checkShortName#284b3639 short_name:string = Bool;
+stickers.suggestShortName#4dafc503 title:string = stickers.SuggestedShortName;\
+
+bots.resetBotCommands#3d8de0f9 scope:BotCommandScope lang_code:string = Bool;
+bots.getBotCommands#e34c0dd6 scope:BotCommandScope lang_code:string = Vector<BotCommand>;\
+
Deprecate legacy profile picture locations, group call improvements.
See the file documentation article for more info on the new file constructors ».
userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;\
+
+chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;\
+
+photoSize#75c78e60 type:string w:int h:int size:int = PhotoSize;
+photoCachedSize#021e1ad6 type:string w:int h:int bytes:bytes = PhotoSize;\
+
+inputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation;
+inputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation;\
+
+videoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize;\
+
+photoSizeProgressive#fa3efb95 type:string w:int h:int sizes:Vector<int> = PhotoSize;\
+
+---functions---\
+
+phone.editGroupCallParticipant#aec610e4 flags:# call:InputGroupCall participant:InputPeer muted:flags.0?Bool volume:flags.1?int raise_hand:flags.2?Bool video_muted:flags.3?Bool = Updates;\
+
Scheduled group calls, payments in channels, payment tips, stripped profile picture thumbnails.
+userProfilePhoto#cc656077 flags:# has_video:flags.0?true photo_id:long photo_small:FileLocation photo_big:FileLocation stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;\
+
+chatPhoto#4790ee05 flags:# has_video:flags.0?true photo_small:FileLocation photo_big:FileLocation stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;\
+
+stickerSet#d7df217a flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int count:int hash:int = StickerSet;\
+
+invoice#0cd886e0 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector<LabeledPrice> max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector<long> = Invoice;
+inputMediaInvoice#d9799874 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:flags.1?string = InputMedia;\
+
+payments.paymentForm#8d0b2415 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm;
+payments.paymentReceipt#10b555d0 flags:# date:int bot_id:int provider_id:int title:string description:string photo:flags.2?WebDocument invoice:Invoice info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption tip_amount:flags.3?long currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt;\
+
+groupCall#c95c6654 flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true id:long access_hash:long participants_count:int params:flags.0?DataJSON title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int version:int = GroupCall;
+groupCallParticipant#b96b25ee flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long params:flags.6?DataJSON = GroupCallParticipant;\
+
+inputBotInlineMessageMediaInvoice#d7e78225 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\
+
+botInlineMessageMediaInvoice#354a9b09 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument currency:string total_amount:long reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\
+
+messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction;\
+
+---functions---\
+
+payments.getPaymentForm#8a333c8d flags:# peer:InputPeer msg_id:int theme_params:flags.0?DataJSON = payments.PaymentForm;
+payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;
+payments.validateRequestedInfo#db103170 flags:# save:flags.0?true peer:InputPeer msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo;
+payments.sendPaymentForm#30c3bc9d flags:# form_id:long peer:InputPeer msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials tip_amount:flags.2?long = payments.PaymentResult;
+phone.createGroupCall#48cdc6d8 flags:# peer:InputPeer random_id:int title:flags.0?string schedule_date:flags.1?int = Updates;
+phone.toggleGroupCallStartSubscription#219c34e6 call:InputGroupCall subscribed:Bool = Updates;
+phone.startScheduledGroupCall#5680e342 call:InputGroupCall = Updates;
+phone.saveDefaultGroupCallJoinAs#575e1f8c peer:InputPeer join_as:InputPeer = Bool;\
+
Ban channels in chats.
+channels.channelParticipants#9ab0feaf count:int participants:Vector<ChannelParticipant> chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipants;
+channels.channelParticipant#dfb80317 participant:ChannelParticipant chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipant;
+channelParticipantBanned#50a1dfd6 flags:# left:flags.0?true peer:Peer kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant;
+channelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant;\
+
+---functions---\
+
+channels.getParticipant#a0ab6cc6 channel:InputChannel participant:InputPeer = channels.ChannelParticipant;
+channels.editBanned#96e6cd81 channel:InputChannel participant:InputPeer banned_rights:ChatBannedRights = Updates;\
+
Voice chats in channels.
+Saved messages
(the chat with ourselves).chatFull#8a1e2983 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer = ChatFull;\
+
+updateChatUserTyping#86cadb6c chat_id:int from_id:Peer action:SendMessageAction = Update;\
+
+channelFull#548c3f93 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer = ChatFull;\
+
+updateChannelUserTyping#6b171718 flags:# channel_id:int top_msg_id:flags.0?int from_id:Peer action:SendMessageAction = Update;\
+
+groupCall#c0c2052e flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true id:long access_hash:long participants_count:int params:flags.0?DataJSON title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int version:int = GroupCall;
+groupCallParticipant#19adba89 flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long = GroupCallParticipant;\
+
+phone.groupCall#9e727aad call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string chats:Vector<Chat> users:Vector<User> = phone.GroupCall;
+phone.groupParticipants#f47751b6 count:int participants:Vector<GroupCallParticipant> next_offset:string chats:Vector<Chat> users:Vector<User> version:int = phone.GroupParticipants;\
+
+inputGroupCallStream#bba51639 call:InputGroupCall time_ms:long scale:int = InputFileLocation;\
+
+phone.joinAsPeers#afe5623f peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = phone.JoinAsPeers;
+phone.exportedGroupCallInvite#204bd158 link:string = phone.ExportedGroupCallInvite;\
+
+---functions---\
+
+messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult;
+messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult;\
+
+phone.joinGroupCall#b132ff7b flags:# muted:flags.0?true video_stopped:flags.2?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string params:DataJSON = Updates;
+phone.toggleGroupCallSettings#74bbb43d flags:# reset_invite_hash:flags.1?true call:InputGroupCall join_muted:flags.0?Bool = Updates;
+phone.getGroupParticipants#c558d8ab call:InputGroupCall ids:Vector<InputPeer> sources:Vector<int> offset:string limit:int = phone.GroupParticipants;
+phone.toggleGroupCallRecord#c02a66d7 flags:# start:flags.0?true call:InputGroupCall title:flags.1?string = Updates;
+phone.editGroupCallParticipant#d975eb80 flags:# muted:flags.0?true call:InputGroupCall participant:InputPeer volume:flags.1?int raise_hand:flags.2?Bool = Updates;
+phone.editGroupCallTitle#1ca6ac0a call:InputGroupCall title:string = Updates;
+phone.getGroupCallJoinAs#ef7c213a peer:InputPeer = phone.JoinAsPeers;
+phone.exportGroupCallInvite#e6aa647f flags:# can_self_unmute:flags.0?true call:InputGroupCall = phone.ExportedGroupCallInvite;\
+
Expiring invite links, self-destruction settings for all messages in a chat, gigagroups, chat import improvements.
+chatFull#f06c4018 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int = ChatFull;\
+
+message#bce383d2 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int = Message;
+messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message;\
+
+inputReportReasonOther#c1e4a2b1 = ReportReason;\
+
+userFull#139a9a77 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int = UserFull;
+updateShortMessage#faeff833 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
+updateShortChatMessage#1157b858 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
+updateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;\
+
+channelFull#2548c037 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> = ChatFull;\
+
+messageActionSetMessagesTTL#aa1afbfd period:int = MessageAction;\
+
+updatePeerHistoryTTL#bb9bb9a5 flags:# peer:Peer ttl_period:flags.0?int = Update;
+updateChatParticipant#f3b3781f flags:# chat_id:int date:int actor_id:int user_id:int prev_participant:flags.0?ChatParticipant new_participant:flags.1?ChatParticipant invite:flags.2?ExportedChatInvite qts:int = Update;
+updateChannelParticipant#7fecb1ec flags:# channel_id:int date:int actor_id:int user_id:int prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant invite:flags.2?ExportedChatInvite qts:int = Update;
+updateBotStopped#07f9488a user_id:int date:int stopped:Bool qts:int = Update;\
+
+chatInviteImporter#1e3e6680 user_id:int date:int = ChatInviteImporter;\
+
+messages.exportedChatInvites#bdc62dcc count:int invites:Vector<ExportedChatInvite> users:Vector<User> = messages.ExportedChatInvites;
+messages.exportedChatInvite#1871be50 invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite;
+messages.exportedChatInviteReplaced#222600ef invite:ExportedChatInvite new_invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite;
+messages.chatInviteImporters#81b6b00a count:int importers:Vector<ChatInviteImporter> users:Vector<User> = messages.ChatInviteImporters;\
+
+chatAdminWithInvites#dfd2330f admin_id:int invites_count:int revoked_invites_count:int = ChatAdminWithInvites;\
+
+messages.chatAdminsWithInvites#b69b72d7 admins:Vector<ChatAdminWithInvites> users:Vector<User> = messages.ChatAdminsWithInvites;\
+
+channelAdminLogEventActionParticipantJoinByInvite#5cdada77 invite:ExportedChatInvite = ChannelAdminLogEventAction;
+channelAdminLogEventActionExportedInviteDelete#5a50fca4 invite:ExportedChatInvite = ChannelAdminLogEventAction;
+channelAdminLogEventActionExportedInviteRevoke#410a134e invite:ExportedChatInvite = ChannelAdminLogEventAction;
+channelAdminLogEventActionExportedInviteEdit#e90ebb59 prev_invite:ExportedChatInvite new_invite:ExportedChatInvite = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantVolume#3e7f6847 participant:GroupCallParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int = ChannelAdminLogEventAction;\
+
+messages.checkedHistoryImportPeer#a24de717 confirm_text:string = messages.CheckedHistoryImportPeer;\
+
+---functions---\
+
+account.reportPeer#c5ba3d86 peer:InputPeer reason:ReportReason message:string = Bool;\
+
+messages.report#8953ab4e peer:InputPeer id:Vector<int> reason:ReportReason message:string = Bool;
+messages.exportChatInvite#14b9bcd7 flags:# legacy_revoke_permanent:flags.2?true peer:InputPeer expire_date:flags.0?int usage_limit:flags.1?int = ExportedChatInvite;\
+
+help.dismissSuggestion#f50dbaa1 peer:InputPeer suggestion:string = Bool;\
+
+messages.getExportedChatInvites#a2b5a3f6 flags:# revoked:flags.3?true peer:InputPeer admin_id:InputUser offset_date:flags.2?int offset_link:flags.2?string limit:int = messages.ExportedChatInvites;
+messages.getExportedChatInvite#73746f5c peer:InputPeer link:string = messages.ExportedChatInvite;
+messages.editExportedChatInvite#02e4ffbe flags:# revoked:flags.2?true peer:InputPeer link:string expire_date:flags.0?int usage_limit:flags.1?int = messages.ExportedChatInvite;
+messages.deleteRevokedExportedChatInvites#56987bd5 peer:InputPeer admin_id:InputUser = Bool;
+messages.deleteExportedChatInvite#d464a42b peer:InputPeer link:string = Bool;
+messages.getAdminsWithInvites#3920e6ef peer:InputPeer = messages.ChatAdminsWithInvites;
+messages.getChatInviteImporters#26fb7289 peer:InputPeer link:string offset_date:int offset_user:InputUser limit:int = messages.ChatInviteImporters;
+messages.setHistoryTTL#b80e5fe4 peer:InputPeer period:int = Updates;\
+
+account.reportProfilePhoto#fa8cc6f5 peer:InputPeer photo_id:InputPhoto reason:ReportReason message:string = Bool;\
+
+channels.convertToGigagroup#0b290c69 channel:InputChannel = Updates;\
+
+messages.checkHistoryImportPeer#5dc60f03 peer:InputPeer = messages.CheckedHistoryImportPeer;\
+
Import messages from foreign chat apps, delete history for both users upon deletion of a secret chat, delete phone call history, group call improvements.
+chatFull#f3474af6 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall = ChatFull;\
+
+messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message;\
+
+encryptedChatDiscarded#1e1c7c45 flags:# history_deleted:flags.0?true id:int = EncryptedChat;\
+
+chatInviteExported#6e24fc9d flags:# revoked:flags.0?true permanent:flags.5?true link:string admin_id:int date:int start_date:flags.4?int expire_date:flags.1?int usage_limit:flags.2?int usage:flags.3?int = ExportedChatInvite;\
+
+user#938458c1 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;\
+
+channel#d31a961e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
+channelFull#7a7de4f7 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall = ChatFull;\
+
+groupCallParticipant#64c62a15 flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true user_id:int date:int active_date:flags.3?int source:int volume:flags.7?int = GroupCallParticipant;\
+
+inputPaymentCredentialsGooglePay#8ac32801 payment_token:DataJSON = InputPaymentCredentials;\
+
+messages.historyImport#1662af0b id:long = messages.HistoryImport;\
+
+sendMessageHistoryImportAction#dbda9246 progress:int = SendMessageAction;\
+
+messages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true title:flags.2?string = messages.HistoryImportParsed;\
+
+inputReportReasonFake#f5ddd6e7 = ReportReason;\
+
+messages.affectedFoundMessages#ef8d3e6c pts:int pts_count:int offset:int messages:Vector<int> = messages.AffectedFoundMessages;\
+
+---functions---\
+
+messages.deleteChatUser#c534459a flags:# revoke_history:flags.0?true chat_id:int user_id:InputUser = Updates;
+messages.discardEncryption#f393aea0 flags:# delete_history:flags.0?true chat_id:int = Bool;\
+
+phone.editGroupCallMember#a5e76cd8 flags:# muted:flags.0?true call:InputGroupCall user_id:InputUser volume:flags.1?int = Updates;\
+
+messages.deleteChat#83247d11 chat_id:int = Bool;
+messages.deletePhoneCallHistory#f9cbe409 flags:# revoke:flags.0?true = messages.AffectedFoundMessages;
+messages.checkHistoryImport#43fe19f3 import_head:string = messages.HistoryImportParsed;
+messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport;
+messages.uploadImportedMedia#2a862092 peer:InputPeer import_id:long file_name:string media:InputMedia = MessageMedia;
+messages.startHistoryImport#b43df344 peer:InputPeer import_id:long = Bool;\
+
Group calls.
+{1} ended a voice chat in the group {2}
{1} invited {3} to a voice chat in the group {2}
{1} invited you to a voice chat in the group {2}
{1} started a voice chat in the group {2}
{1} posted a map
to {1} posted a location
in CHANNEL_MESSAGE_GEO{1} posted a {2}sticker
to {1} posted a {2} sticker
in CHANNEL_MESSAGE_STICKER{1} kicked {3} from the group {2}
to {1} removed {3} from the group {2}
in CHAT_DELETE_MEMBER{1} kicked you from the group {2}
to {1} removed you from the group {2}
in CHAT_DELETE_YOU{1} has joined the group {2}
to {1} joined the group {2}
in CHAT_JOINED{1} has left the group {2}
to {1} left the group {2}
in CHAT_LEFT{1} invited the group {2} to play {3}.
to {1} invited the group {2} to play {3}
in CHAT_MESSAGE_GAME{1} sent a map to the group {2}
to {1} sent a location to the group {2}
in CHAT_MESSAGE_GEO{1} started sharing their live location with {2}
to {1} shared a live location with the group {2}
in CHAT_MESSAGE_GEOLIVE{1} sent a {3}sticker to the group {2}
to {1} sent a {3} sticker to the group {2}
in CHAT_MESSAGE_STICKER{1}@{2}: {3}
to {1} @ {2}: {3}
in CHAT_MESSAGE_TEXT{1} edited the group's {2} photo
to {1} changed the group photo for {2}
in CHAT_PHOTO_EDITED{1} has returned to the group {2}
to {1} returned to the group {2}
in CHAT_RETURNED{1} edited the group's {2} name
to {1} renamed the group {2}
in CHAT_TITLE_EDITED{1} sent you a map
to {1} sent you a location
in MESSAGE_GEO{1} started sharing their live location
to {1} sent you a live location
in MESSAGE_GEOLIVE{1} sent you a {2}sticker
to {1} sent you a {2} sticker
in MESSAGE_STICKER{1} pinned a {2}sticker
to {1} pinned a {2} sticker
in PINNED_STICKERchat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
+chatFull#0dc8c181 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall = ChatFull;\
+
+peerSettings#733f2961 flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true geo_distance:flags.6?int = PeerSettings;\
+
+inputMediaDocument#33473058 flags:# id:InputDocument ttl_seconds:flags.0?int query:flags.1?string = InputMedia;\
+
+stickerSet#40e237a8 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int count:int hash:int = StickerSet;\
+
+channel#d31a961e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
+channelFull#ef3a6acd flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall = ChatFull;\
+
+updateBotInlineQuery#3f2038db flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;\
+
+messageFwdHeader#5f777dce flags:# imported:flags.7?true from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;\
+
+channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true = ChannelAdminLogEventsFilter;
+chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true = ChatAdminRights;\
+
+speakingInGroupCallAction#d92c2285 = SendMessageAction;\
+
+groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall;
+groupCall#55903081 flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true id:long access_hash:long participants_count:int params:flags.0?DataJSON version:int = GroupCall;\
+
+inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall;\
+
+messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int = MessageAction;
+messageActionInviteToGroupCall#76b9f11a call:InputGroupCall users:Vector<int> = MessageAction;\
+
+groupCallParticipant#56b087c9 flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true user_id:int date:int active_date:flags.3?int source:int = GroupCallParticipant;\
+
+updateChat#1330a196 chat_id:int = Update;
+updateGroupCallParticipants#f2ebdb4e call:InputGroupCall participants:Vector<GroupCallParticipant> version:int = Update;
+updateGroupCall#a45eb99b chat_id:int call:GroupCall = Update;\
+
+phone.groupCall#66ab0bfc call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string users:Vector<User> = phone.GroupCall;
+phone.groupParticipants#9cfeb92d count:int participants:Vector<GroupCallParticipant> next_offset:string users:Vector<User> version:int = phone.GroupParticipants;\
+
+inlineQueryPeerTypeSameBotPM#3081ed9d = InlineQueryPeerType;
+inlineQueryPeerTypePM#833c0fac = InlineQueryPeerType;
+inlineQueryPeerTypeChat#d766c50a = InlineQueryPeerType;
+inlineQueryPeerTypeMegagroup#5ec4be43 = InlineQueryPeerType;
+inlineQueryPeerTypeBroadcast#6334ee9a = InlineQueryPeerType;\
+
+channelAdminLogEventActionStartGroupCall#23209745 call:InputGroupCall = ChannelAdminLogEventAction;
+channelAdminLogEventActionDiscardGroupCall#db9f9140 call:InputGroupCall = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantMute#f92424d2 participant:GroupCallParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionParticipantUnmute#e64429c0 participant:GroupCallParticipant = ChannelAdminLogEventAction;
+channelAdminLogEventActionToggleGroupCallSetting#56d6a247 join_muted:Bool = ChannelAdminLogEventAction;\
+
+---functions---\
+
+messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int = Updates;\
+
+channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates;\
+
+phone.createGroupCall#bd3dabe0 peer:InputPeer random_id:int = Updates;
+phone.joinGroupCall#5f9c8e62 flags:# muted:flags.0?true call:InputGroupCall params:DataJSON = Updates;
+phone.leaveGroupCall#500377f9 call:InputGroupCall source:int = Updates;
+phone.editGroupCallMember#63146ae4 flags:# muted:flags.0?true call:InputGroupCall user_id:InputUser = Updates;
+phone.inviteToGroupCall#7b393160 call:InputGroupCall users:Vector<InputUser> = Updates;
+phone.discardGroupCall#7a777135 call:InputGroupCall = Updates;
+phone.toggleGroupCallSettings#74bbb43d flags:# call:InputGroupCall join_muted:flags.0?Bool = Updates;
+phone.getGroupCall#0c7cb017 call:InputGroupCall = phone.GroupCall;
+phone.getGroupParticipants#c9f1d285 call:InputGroupCall ids:Vector<int> sources:Vector<int> offset:string limit:int = phone.GroupParticipants;
+phone.checkGroupCall#b74a7bea call:InputGroupCall source:int = Bool;\
+
Added SVG path previews for animated stickers.
+photoPathSize#d8214d41 type:string bytes:bytes = PhotoSize;\
+
Added message statistics, and a method to unpin all pinned messages in a chat.
+{1} posted {2} files
{1} posted {2} music files
{1} sent {3} files to the group {2}
{1} sent {3} music files to the group {2}
{1} sent you {2} files
{1} sent you {2} music files
inputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint;\
+
+geoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radius:flags.0?int = GeoPoint;\
+
+messages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
+messages.channelMessages#64479808 flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;\
+
+inputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;\
+
+botInlineMessageMediaGeo#051846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;\
+
+inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;\
+
+messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;\
+
+inputMessageCallbackQuery#acfa1a7e id:int query_id:long = InputMessage;\
+
+channelParticipantLeft#c3c6796b user_id:int = ChannelParticipant;
+channelParticipantsMentions#e04b5ceb flags:# q:flags.0?string top_msg_id:flags.1?int = ChannelParticipantsFilter;\
+
+updatePinnedMessages#ed85eab5 flags:# pinned:flags.0?true peer:Peer messages:Vector<int> pts:int pts_count:int = Update;
+updatePinnedChannelMessages#8588878b flags:# pinned:flags.0?true channel_id:int messages:Vector<int> pts:int pts_count:int = Update;\
+
+inputMessagesFilterPinned#1bb00451 = MessagesFilter;\
+
+stats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats;\
+
+messageActionGeoProximityReached#98e0d697 from_id:Peer to_id:Peer distance:int = MessageAction;\
+
+---functions---\
+
+messages.search#0c352eec flags:# peer:InputPeer q:string from_id:flags.0?InputPeer top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;\
+
+stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
+stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;\
+
+messages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory;\
+
Added message threads and comment sections in channel posts.
+@replies
message#58ae39c9 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> = Message;
+messageService#286fa604 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction = Message;\
+
+contacts.blocked#0ade1591 blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;
+contacts.blockedSlice#e1664194 count:int blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked;\
+
+updateShortMessage#2296d2c8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> = Updates;
+updateShortChatMessage#402d5dbb flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> = Updates;\
+
+channelParticipantCreator#447dca4b flags:# user_id:int admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant;\
+
+messageFwdHeader#5f777dce flags:# from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;
+messageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:flags.2?MessageReplies = MessageViews;\
+
+updateChannelMessageForwards#6e8a84df channel_id:int id:int forwards:int = Update;\
+
+photoSizeProgressive#5aa86a51 type:string location:FileLocation w:int h:int sizes:Vector<int> = PhotoSize;\
+
+messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> users:Vector<User> = messages.MessageViews;\
+
+updateReadChannelDiscussionInbox#1cc7de54 flags:# channel_id:int top_msg_id:int read_max_id:int broadcast_id:flags.0?int broadcast_post:flags.0?int = Update;
+updateReadChannelDiscussionOutbox#4638a26c channel_id:int top_msg_id:int read_max_id:int = Update;\
+
+messages.discussionMessage#f5dd8f9d flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
+messageReplyHeader#a6d57763 flags:# reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader;
+messageReplies#4128faac flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?int max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;\
+
+updatePeerBlocked#246a4b22 peer_id:Peer blocked:Bool = Update;\
+
+peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked;\
+
+updateChannelUserTyping#ff2abe9f flags:# channel_id:int top_msg_id:flags.0?int user_id:int action:SendMessageAction = Update;\
+
+---functions---\
+
+contacts.block#68cc1411 id:InputPeer = Bool;
+contacts.unblock#bea65d50 id:InputPeer = Bool;\
+
+messages.search#4e17810b flags:# peer:InputPeer q:string from_id:flags.0?InputUser top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
+messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;
+messages.getMessagesViews#5784d3e1 peer:InputPeer id:Vector<int> increment:Bool = messages.MessageViews;
+messages.searchGlobal#4bc6589a flags:# folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;\
+
+channels.exportMessageLink#e63fadeb flags:# grouped:flags.0?true thread:flags.1?true channel:InputChannel id:int = ExportedMessageLink;\
+
+messages.getReplies#24b581ba peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
+messages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage;
+messages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool;\
+
+contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_history:flags.1?true report_spam:flags.2?true msg_id:int = Updates;\
+
Added method for fetching country names and phone patterns.
+keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;\
+
+help.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector<string> patterns:flags.1?Vector<string> = help.CountryCode;
+help.country#c3878e23 flags:# hidden:flags.0?true iso2:string default_name:string name:flags.1?string country_codes:Vector<help.CountryCode> = help.Country;
+help.countriesListNotModified#93cc1f32 = help.CountriesList;
+help.countriesList#87d0759e countries:Vector<help.Country> hash:int = help.CountriesList;\
+
+---functions---\
+
+messages.sendEncrypted#44fa7a15 flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
+messages.sendEncryptedFile#5559481d flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage;
+messages.getBotCallbackAnswer#9342ca07 flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes password:flags.2?InputCheckPasswordSRP = messages.BotCallbackAnswer;\
+
+help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList;\
+
Added WebRTC endpoint constructors.
+phoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection;\
+
Added supergroup statistics and global privacy settings.
+inputChatUploadedPhoto#c642724e flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = InputChatPhoto;\
+
+userProfilePhoto#69d3ab26 flags:# has_video:flags.0?true photo_id:long photo_small:FileLocation photo_big:FileLocation dc_id:int = UserProfilePhoto;\
+
+chatPhoto#d20b9f3c flags:# has_video:flags.0?true photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;\
+
+photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;
+peerSettings#733f2961 flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true geo_distance:flags.6?int = PeerSettings;\
+
+encryptedChatRequested#62718a82 flags:# folder_id:flags.0?int id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat;\
+
+videoSize#e831c556 flags:# type:string location:FileLocation w:int h:int size:int video_start_ts:flags.0?double = VideoSize;\
+
+statsGroupTopPoster#18f3d0f7 user_id:int messages:int avg_chars:int = StatsGroupTopPoster;
+statsGroupTopAdmin#6014f412 user_id:int deleted:int kicked:int banned:int = StatsGroupTopAdmin;
+statsGroupTopInviter#31962a4c user_id:int invitations:int = StatsGroupTopInviter;
+stats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector<StatsGroupTopPoster> top_admins:Vector<StatsGroupTopAdmin> top_inviters:Vector<StatsGroupTopInviter> users:Vector<User> = stats.MegagroupStats;\
+
+globalPrivacySettings#bea2f424 flags:# archive_and_mute_new_noncontact_peers:flags.0?Bool = GlobalPrivacySettings;\
+
+updateChannelParticipant#65d2b464 flags:# channel_id:int date:int user_id:int prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant qts:int = Update;\
+
+---functions---\
+
+photos.updateProfilePhoto#72d4742c id:InputPhoto = photos.Photo;
+photos.uploadProfilePhoto#89f30f69 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = photos.Photo;\
+
+stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats;\
+
+account.getGlobalPrivacySettings#eb2b4cf6 = GlobalPrivacySettings;
+account.setGlobalPrivacySettings#1edaaac2 settings:GlobalPrivacySettings = GlobalPrivacySettings;\
+
+help.dismissSuggestion#077fa99f suggestion:string = Bool;\
+
Added a chat invitation that also allows peeking into the group to read messages without joining it.
+chatInvitePeek#61695cb0 chat:Chat expires:int = ChatInvite;\
+
Added WebRTC signaling methods.
+userFull#edf17c12 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int = UserFull;\
+
+inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true force_file:flags.4?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia;\
+
+document#1e87342b flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;\
+
+user#938458c1 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;\
+
+channelFull#f0e6672a flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int = ChatFull;\
+
+phoneCallWaiting#1b8f4ad1 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall;
+phoneCallRequested#87eabb53 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall;
+phoneCallAccepted#997c454a flags:# video:flags.6?true id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall;
+phoneCall#8742ae7f flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int = PhoneCall;
+phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall;\
+
+chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true = ChatAdminRights;\
+
+videoSize#435bb987 type:string location:FileLocation w:int h:int size:int = VideoSize;\
+
+updatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update;\
+
+---functions---\
+
+messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int = Updates;
+messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?true pm_oneside:flags.2?true peer:InputPeer id:int = Updates;\
+
+phone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool;\
+
Public Service Announcement constructors and better PUSH notifications.
Notice that all PINNED_*
PUSH notifications have two variants: one for groups, and one for channels.
{1} posted a quiz {2}
{1} sent a quiz {3} to the group {2}
{1} sent you a quiz {2}
{1} pinned a quiz {2}
messageFwdHeader#353a686b flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;\
+
+help.promoDataEmpty#98f6ac75 expires:int = help.PromoData;
+help.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_type:flags.1?string psa_message:flags.2?string = help.PromoData;\
+
+---functions---\
+
+help.getPromoData#c0977421 = help.PromoData;
+help.hidePromoData#1e251c95 peer:InputPeer = Bool;\
+
messages.featuredStickersNotModified#c6dc0c66 count:int = messages.FeaturedStickers;
+messages.featuredStickers#b6abc341 hash:int count:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers;\
+
+poll#86e18161 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll;
+pollResults#badcc1a3 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<int> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults;\
+
+inputMediaPoll#0f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;
+inputMediaDice#e66fbf7b emoticon:string = InputMedia;\
+
+messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;\
+
+inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;\
+
+---functions---\
+
+initConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;\
+
+messages.getOldFeaturedStickers#5fe7025b offset:int limit:int hash:int = messages.FeaturedStickers;\
+
Folders, channel stats, bot and sticker improvements
+channelFull#f0e6672a flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true can_set_location:flags.16?true has_scheduled:flags.19?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int = ChatFull;\
+
+webPageNotModified#7311ca11 flags:# cached_page_views:flags.0?int = WebPage;\
+
+phoneCallProtocol#fc878fc8 flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int library_versions:Vector<string> = PhoneCallProtocol;
+page#98657f0d flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> views:flags.3?int = Page;\
+
+dialogFilter#7438f7e8 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> exclude_peers:Vector<InputPeer> = DialogFilter;
+dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested;\
+
+updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update;
+updateDialogFilterOrder#a5d72105 order:Vector<int> = Update;
+updateDialogFilters#3504914f = Update;\
+
+statsDateRangeDays#b637edaf min_date:int max_date:int = StatsDateRangeDays;
+statsAbsValueAndPrev#cb43acde current:double previous:double = StatsAbsValueAndPrev;
+statsPercentValue#cbce2fe0 part:double total:double = StatsPercentValue;
+statsGraphAsync#4a27eb2d token:string = StatsGraph;
+statsGraphError#bedc9822 error:string = StatsGraph;
+statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph;\
+
+messageInteractionCounters#ad4fc9bd msg_id:int views:int forwards:int = MessageInteractionCounters;\
+
+stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector<MessageInteractionCounters> = stats.BroadcastStats;\
+
+inputMediaDice#aeffa807 = InputMedia;\
+
+messageMediaDice#638fe46b value:int = MessageMedia;\
+
+inputStickerSetDice#79e21a53 = InputStickerSet;\
+
+---functions---\
+
+initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;\
+
+stickers.createStickerSet#f1036780 flags:# masks:flags.0?true animated:flags.1?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> = messages.StickerSet;\
+
+messages.getDialogFilters#f19ed96d = Vector<DialogFilter>;
+messages.getSuggestedDialogFilters#a29cd42c = Vector<DialogFilterSuggested>;
+messages.updateDialogFilter#1ad4a04a flags:# id:int filter:flags.0?DialogFilter = Bool;
+messages.updateDialogFiltersOrder#c563c1e4 order:Vector<int> = Bool;\
+
+stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats;
+stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
+stickers.setStickerSetThumb#9a364e30 stickerset:InputStickerSet thumb:InputDocument = messages.StickerSet;\
+
+bots.setBotCommands#805d46f6 commands:Vector<BotCommand> = Bool;\
+
Credit card information
+messageEntityBankCard#761e6af4 offset:int length:int = MessageEntity;\
+
+bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl;\
+
+payments.bankCardData#3e24e573 title:string open_urls:Vector<BankCardOpenUrl> = payments.BankCardData;
+peerSelfLocated#f8ec284b expires:int = PeerLocated;\
+
+---functions---\
+
+initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X;\
+
+contacts.getLocated#d348bc44 flags:# background:flags.1?true geo_point:InputGeoPoint self_expires:flags.0?int = Updates;\
+
+payments.getBankCardData#2e79d779 number:string = payments.BankCardData;\
+
Non-anonymous polls, improved sticker management
+option
was provided to messages.getPollVotes)pollResults#c87024a2 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<int> = PollResults;\
+
+inputMediaPoll#abe9ca25 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> = InputMedia;\
+
+updateMessagePollVote#42f88f2c poll_id:long user_id:int options:Vector<bytes> = Update;\
+
+messageUserVote#a28e5559 user_id:int option:bytes date:int = MessageUserVote;
+messageUserVoteInputOption#36377430 user_id:int date:int = MessageUserVote;
+messageUserVoteMultiple#0e8fe0de user_id:int options:Vector<bytes> date:int = MessageUserVote;
+messages.votesList#0823f649 flags:# count:int votes:Vector<MessageUserVote> users:Vector<User> next_offset:flags.0?string = messages.VotesList;\
+
+keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton;\
+
+---functions---\
+
+initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;\
+
+messages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?bytes offset:flags.1?string limit:int = messages.VotesList;
+messages.toggleStickerSets#b5052fea flags:# uninstall:flags.0?true archive:flags.1?true unarchive:flags.2?true stickersets:Vector<InputStickerSet> = Bool;\
+
Login with QR-code, sensitive content settings, quizes, multiple-choice and public polls, get inactive chats, improved wallpapers and themes.
+unsave=true
) wallpapers using account.saveWallPaper, specifying just the wallpaper ID.unsave=true
) wallpapers using account.saveWallPaper, specifying just the wallpaper ID. webPage#e89c45b2 flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page attributes:flags.12?Vector<WebPageAttribute> = WebPage;\
+
+poll#d5529d06 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector<PollAnswer> = Poll;
+pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters;\
+
+wallPaperSettings#05086cf8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings;\
+
+autoDownloadSettings#e04232f3 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true photo_size_max:int video_size_max:int file_size_max:int video_upload_maxbitrate:int = AutoDownloadSettings;\
+
+inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation;\
+
+theme#028f1114 flags:# creator:flags.0?true default:flags.1?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?ThemeSettings installs_count:int = Theme;\
+
+updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update;
+updateLoginToken#564fe691 = Update;\
+
+auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken;
+auth.loginTokenMigrateTo#068e9916 dc_id:int token:bytes = auth.LoginToken;
+auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken;
+account.contentSettings#57e28221 flags:# sensitive_enabled:flags.0?true sensitive_can_change:flags.1?true = account.ContentSettings;\
+
+messages.inactiveChats#a927fec5 dates:Vector<int> chats:Vector<Chat> users:Vector<User> = messages.InactiveChats;\
+
+baseThemeClassic#c3a12462 = BaseTheme;
+baseThemeDay#fbd81688 = BaseTheme;
+baseThemeNight#b7b31ea8 = BaseTheme;
+baseThemeTinted#6d5f77ee = BaseTheme;
+baseThemeArctic#5b11125a = BaseTheme;\
+
+inputWallPaperNoFile#8427bbac = InputWallPaper;\
+
+wallPaperNoFile#8af40b25 flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper;\
+
+inputThemeSettings#bd507cd1 flags:# base_theme:BaseTheme accent_color:int message_top_color:flags.0?int message_bottom_color:flags.0?int wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings;\
+
+themeSettings#9c14984a flags:# base_theme:BaseTheme accent_color:int message_top_color:flags.0?int message_bottom_color:flags.0?int wallpaper:flags.1?WallPaper = ThemeSettings;\
+
+webPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector<Document> settings:flags.1?ThemeSettings = WebPageAttribute;\
+
+---functions---\
+
+upload.getFile#b15a9afc flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:int limit:int = upload.File;\
+
+account.createTheme#8432c21f flags:# slug:string title:string document:flags.2?InputDocument settings:flags.3?InputThemeSettings = Theme;
+account.updateTheme#5cb367d5 flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument settings:flags.3?InputThemeSettings = Theme;
+auth.exportLoginToken#b1b41517 api_id:int api_hash:string except_ids:Vector<int> = auth.LoginToken;
+auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken;
+auth.acceptLoginToken#e894ad4d token:bytes = Authorization;
+account.setContentSettings#b574b16b flags:# sensitive_enabled:flags.0?true = Bool;
+account.getContentSettings#8b9b4dae = account.ContentSettings;\
+
+channels.getInactiveChannels#11e831ee = messages.InactiveChats;\
+
+account.getMultiWallPapers#65ad71dc wallpapers:Vector<InputWallPaper> = Vector<WallPaper>;\
+
The API underwent huge changes, a full reread of the documentation is required.
+contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus;
+config#7dae33e0 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_big_size:int chat_size_max:int broadcast_size_max:int disabled_features:Vector<DisabledFeature> = Config;\
+
+inputMediaUploadedDocument#ffe76b78 file:InputFile mime_type:string attributes:Vector<DocumentAttribute> = InputMedia;
+inputMediaUploadedThumbDocument#41481486 file:InputFile thumb:InputFile mime_type:string attributes:Vector<DocumentAttribute> = InputMedia;\
+
+document#f9a39f4f id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector<DocumentAttribute> = Document;\
+
+userStatusRecently#e26f42f1 = UserStatus;
+userStatusLastWeek#07bf09fc = UserStatus;
+userStatusLastMonth#77ebc742 = UserStatus;
+updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;\
+
+inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey;\
+
+privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey;\
+
+inputPrivacyValueAllowContacts#0d09e07b = InputPrivacyRule;
+inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule;
+inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule;
+inputPrivacyValueDisallowContacts#0ba52007 = InputPrivacyRule;
+inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule;
+inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule;\
+
+privacyValueAllowContacts#fffe1bac = PrivacyRule;
+privacyValueAllowAll#65427b82 = PrivacyRule;
+privacyValueAllowUsers#4d5bbe0c users:Vector<int> = PrivacyRule;
+privacyValueDisallowContacts#f888fa1a = PrivacyRule;
+privacyValueDisallowAll#8b73e763 = PrivacyRule;
+privacyValueDisallowUsers#0c7f49b7 users:Vector<int> = PrivacyRule;\
+
+account.privacyRules#554abb6f rules:Vector<PrivacyRule> users:Vector<User> = account.PrivacyRules;
+accountDaysTTL#b8d0afdf days:int = AccountDaysTTL;
+account.sentChangePhoneCode#a4f58c4c phone_code_hash:string send_call_timeout:int = account.SentChangePhoneCode;\
+
+updateUserPhone#12b9417b user_id:int phone:string = Update;\
+
+documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
+documentAttributeAnimated#11b58939 = DocumentAttribute;
+documentAttributeSticker#fb0a5727 = DocumentAttribute;
+documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute;
+documentAttributeAudio#051448e5 duration:int = DocumentAttribute;
+documentAttributeFilename#15590068 file_name:string = DocumentAttribute;\
+
+messages.stickersNotModified#f1749a22 = messages.Stickers;
+messages.stickers#8a8ecd32 hash:string stickers:Vector<Document> = messages.Stickers;\
+
+stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;\
+
+messages.allStickersNotModified#e86602c3 = messages.AllStickers;
+messages.allStickers#dcef3102 hash:string packs:Vector<StickerPack> documents:Vector<Document> = messages.AllStickers;\
+
+disabledFeature#ae636f24 feature:string description:string = DisabledFeature;\
+
+---functions---\
+
+account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules;
+account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules;
+account.deleteAccount#418d4e0b reason:string = Bool;
+account.getAccountTTL#08fc711d = AccountDaysTTL;
+account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool;\
+
+invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;\
+
+contacts.resolveUsername#0bf0131c username:string = User;\
+
+account.sendChangePhoneCode#a407a8f4 phone_number:string = account.SentChangePhoneCode;
+account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User;\
+
+messages.getStickers#ae22e045 emoticon:string hash:string = messages.Stickers;
+messages.getAllStickers#aa3bc868 hash:string = messages.AllStickers;\
+
+account.updateDeviceLocked#38df3532 period:int = Bool;\
+
===20===\
+
+decryptedMessageActionRequestKey#f3c9611b exchange_id:long g_a:bytes = DecryptedMessageAction;
+decryptedMessageActionAcceptKey#6fe1735b exchange_id:long g_b:bytes key_fingerprint:long = DecryptedMessageAction;
+decryptedMessageActionAbortKey#dd05ec6b exchange_id:long = DecryptedMessageAction;
+decryptedMessageActionCommitKey#ec2e0b9b exchange_id:long key_fingerprint:long = DecryptedMessageAction;
+decryptedMessageActionNoop#a82fdd63 = DecryptedMessageAction;\
+
+===23===
+documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
+documentAttributeAnimated#11b58939 = DocumentAttribute;
+documentAttributeSticker#fb0a5727 = DocumentAttribute;
+documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute;
+documentAttributeAudio#051448e5 duration:int = DocumentAttribute;
+documentAttributeFilename#15590068 file_name:string = DocumentAttribute;\
+
+photoSizeEmpty#0e17e23c type:string = PhotoSize;
+photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
+photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;\
+
+fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation;
+fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation;\
+
+decryptedMessageMediaExternalDocument#fa95b0dd id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector<DocumentAttribute> = DecryptedMessageMedia;\
+
Added username support and a new type of updates for service messages.
+contactFound user_id:int = ContactFound;
+
+contacts.found results:Vector<ContactFound> users:Vector<User> = contacts.Found;
+
+updateUserName user_id:int first_name:string last_name:string username:string = Update;
+
+userSelf id:int first_name:string last_name:string username:string phone:string photo:UserProfilePhoto status:UserStatus inactive:Bool = User;
+userContact id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
+userRequest id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
+userForeign id:int first_name:string last_name:string username:string access_hash:long photo:UserProfilePhoto status:UserStatus = User;
+userDeleted id:int first_name:string last_name:string username:string = User;
+
+updateServiceNotification type:string message:string media:MessageMedia popup:Bool = Update;
+
+---functions---
+
+account.checkUsername username:string = Bool;
+account.updateUsername username:string = User;
+
+contacts.search q:string limit:int = contacts.Found;
+
+invokeWithLayer18#1c900537 {X:Type} query:!X = X;
+Added new events for recording and uploading media, selecting contacts and locations to share.
+Read status for multimedia (messages containing messageMediaVideo or messageMediaAudio) was moved to the new method messages.readMessageContents. In case read_contents is not passed or messages.readHistory is used with an older layer, messages will be marked as read in the traditional way.
+sendMessageTypingAction = SendMessageAction;
+sendMessageCancelAction = SendMessageAction;
+sendMessageRecordVideoAction = SendMessageAction;
+sendMessageUploadVideoAction = SendMessageAction;
+sendMessageRecordAudioAction = SendMessageAction;
+sendMessageUploadAudioAction = SendMessageAction;
+sendMessageUploadPhotoAction = SendMessageAction;
+sendMessageUploadDocumentAction = SendMessageAction;
+sendMessageGeoLocationAction = SendMessageAction;
+sendMessageChooseContactAction = SendMessageAction;
+
+updateUserTyping user_id:int action:SendMessageAction = Update;
+updateChatUserTyping chat_id:int user_id:int action:SendMessageAction = Update;
+
+// Message object
+message flags:int id:int from_id:int to_id:Peer date:int message:string media:MessageMedia = Message;
+messageForwarded flags:int id:int fwd_from_id:int fwd_date:int from_id:int to_id:Peer date:int message:string media:MessageMedia = Message;
+messageService flags:int id:int from_id:int to_id:Peer date:int action:MessageAction = Message;
+
+---functions---
+
+messages.setTyping peer:InputPeer action:SendMessageAction = Bool;
+
+messages.readHistory peer:InputPeer max_id:int offset:int read_contents:Bool = messages.AffectedHistory;
+messages.readMessageContents id:Vector<int> = Vector<int>;
+
+invokeWithLayer17#50858a19 {X:Type} query:!X = X;
+===17===
+
+
+// Layer
+decryptedMessageLayer random_bytes:bytes layer:int in_seq_no:int out_seq_no:int message:DecryptedMessage = DecryptedMessageLayer;
+
+decryptedMessageMediaAudio duration:int mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaVideo thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+
+sendMessageTypingAction = SendMessageAction;
+sendMessageCancelAction = SendMessageAction;
+sendMessageRecordVideoAction = SendMessageAction;
+sendMessageUploadVideoAction = SendMessageAction;
+sendMessageRecordAudioAction = SendMessageAction;
+sendMessageUploadAudioAction = SendMessageAction;
+sendMessageUploadPhotoAction = SendMessageAction;
+sendMessageUploadDocumentAction = SendMessageAction;
+sendMessageGeoLocationAction = SendMessageAction;
+sendMessageChooseContactAction = SendMessageAction;
+
+decryptedMessageActionNotifyLayer layer:int = DecryptedMessageAction;
+decryptedMessageActionTyping action:SendMessageAction = DecryptedMessageAction;
+
+decryptedMessage random_id:long ttl:int message:string media:DecryptedMessageMedia = DecryptedMessage;
+decryptedMessageService random_id:long action:DecryptedMessageAction = DecryptedMessage;
+Added new sms_type = 5
in the method auth.sendCode.
auth.sentAppCode phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
+
+---functions---
+
+auth.sendSms phone_number:string phone_code_hash:string = Bool;
+
+invokeWithLayer16#cf5f0987 {X:Type} query:!X = X;
+Modified behavior of the offset parameter in the method messages.getHistory. From now on it's possible to combine message_id offset and a numeric offset.
+invokeWithLayer15#b4418b64 {X:Type} query:!X = X;
+notifyPeer peer:Peer = NotifyPeer;
+notifyUsers = NotifyPeer;
+notifyChats = NotifyPeer;
+notifyAll = NotifyPeer;
+
+dialog peer:Peer top_message:int unread_count:int notify_settings:PeerNotifySettings = Dialog;
+
+updateUserBlocked user_id:int blocked:Bool = Update;
+updateNotifySettings peer:NotifyPeer notify_settings:PeerNotifySettings = Update;
+
+---functions---
+
+invokeWithLayer14#2b9b08fa {X:Type} query:!X = X;
+contacts.importedContacts imported:Vector<ImportedContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts;
+
+inputMediaUploadedAudio file:InputFile duration:int mime_type:string = InputMedia;
+inputMediaUploadedVideo file:InputFile duration:int w:int h:int mime_type:string = InputMedia;
+inputMediaUploadedThumbVideo file:InputFile thumb:InputFile duration:int w:int h:int mime_type:string = InputMedia;
+
+audio id:long access_hash:long user_id:int date:int duration:int mime_type:string size:int dc_id:int = Audio;
+video id:long access_hash:long user_id:int date:int caption:string duration:int mime_type:string size:int thumb:PhotoSize dc_id:int w:int h:int = Video;
+
+---functions---
+
+invokeWithLayer13#427c8ea2 {X:Type} query:!X = X;
+auth.sentCode phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
+
+config date:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int broadcast_size_max:int = Config;
+
+help.support phone_number:string user:User = help.Support;
+
+---functions---
+
+help.getSupport = help.Support;
+
+invokeWithLayer12#dda60d3c {X:Type} query:!X = X;
+encryptedChatRequested id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat;
+encryptedChat id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat;
+
+---functions---
+
+invokeWithLayer11#a6b88fdf {X:Type} query:!X = X;
+Added brief constructors for editing group members. Added new attachment types for ordinary and secret chats.
+updateChatParticipantAdd chat_id:int user_id:int inviter_id:int version:int = Update;
+updateChatParticipantDelete chat_id:int user_id:int version:int = Update;
+
+
+inputMediaUploadedAudio file:InputFile duration:int = InputMedia;
+inputMediaAudio id:InputAudio = InputMedia;
+
+inputMediaUploadedDocument file:InputFile file_name:string mime_type:string = InputMedia;
+inputMediaUploadedThumbDocument file:InputFile thumb:InputFile file_name:string mime_type:string = InputMedia;
+inputMediaDocument id:InputDocument = InputMedia;
+
+messageMediaDocument document:Document = MessageMedia;
+messageMediaAudio audio:Audio = MessageMedia;
+
+// Input Audio
+inputAudioEmpty = InputAudio;
+inputAudio id:long access_hash:long = InputAudio;
+
+// Input Document
+inputDocumentEmpty = InputDocument;
+inputDocument id:long access_hash:long = InputDocument;
+
+// Input location
+inputAudioFileLocation id:long access_hash:long = InputFileLocation;
+inputDocumentFileLocation id:long access_hash:long = InputFileLocation;
+
+
+decryptedMessageMediaDocument thumb:bytes thumb_w:int thumb_h:int file_name:string mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaAudio duration:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+
+
+// Audio object
+audioEmpty id:long = Audio;
+audio id:long access_hash:long user_id:int date:int duration:int size:int dc_id:int = Audio;
+
+// Video object
+documentEmpty id:long = Document;
+document id:long access_hash:long user_id:int date:int file_name:string mime_type:string size:int thumb:PhotoSize dc_id:int = Document;
+
+---functions---
+
+invokeWithLayer10#39620c41 {X:Type} query:!X = X;
+Added MESSAGE_DOC, MESSAGE_AUDIO notifications — a message with document or audio received Added CHAT_MESSAGE_DOC, CHAT_MESSAGE_AUDIO notifications — a message with document or audio received in a group
+Increased efficiency when loading big files. Added important checks for certain methods.
+inputFileBig id:long parts:int name:string = InputFile;
+
+inputEncryptedFileBigUploaded id:long parts:int key_fingerprint:int = InputEncryptedFile;
+
+---functions---
+
+upload.saveBigFilePart file_id:long file_part:int file_total_parts:int bytes:bytes = Bool;
+
+initConnection#69796de9 {X:Type} api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X;
+
+invokeWithLayer9#76715a63 {X:Type} query:!X = X;
+Added support for end-to-end encryption in secret chats. More…
+updateNewEncryptedMessage message:EncryptedMessage qts:int = Update;
+updateEncryptedChatTyping chat_id:int = Update;
+updateEncryption chat:EncryptedChat date:int = Update;
+updateEncryptedMessagesRead chat_id:int max_date:int = Update;
+
+// EncryptedChat object
+encryptedChatEmpty id:int = EncryptedChat;
+encryptedChatWaiting id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat;
+encryptedChatRequested id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat;
+encryptedChat id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat;
+encryptedChatDiscarded id:int = EncryptedChat;
+
+inputEncryptedChat chat_id:int access_hash:long = InputEncryptedChat;
+
+// EncryptedFile object
+encryptedFileEmpty = EncryptedFile;
+encryptedFile id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile;
+
+inputEncryptedFileEmpty = InputEncryptedFile;
+inputEncryptedFileUploaded id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile;
+inputEncryptedFile id:long access_hash:long = InputEncryptedFile;
+
+inputEncryptedFileLocation id:long access_hash:long = InputFileLocation;
+
+// Encrypted message
+encryptedMessage random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage;
+encryptedMessageService random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage;
+
+// Diffie-Hellman config
+messages.dhConfigNotModified random:bytes = messages.DhConfig;
+messages.dhConfig g:int p:bytes version:int random:bytes = messages.DhConfig;
+
+messages.sentEncryptedMessage date:int = messages.SentEncryptedMessage;
+messages.sentEncryptedFile date:int file:EncryptedFile = messages.SentEncryptedMessage;
+
+// Updated state with qts
+updates.state pts:int qts:int date:int seq:int unread_count:int = updates.State;
+updates.difference new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference;
+updates.differenceSlice new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference;
+
+---functions---
+
+messages.getDhConfig version:int random_length:int = messages.DhConfig;
+messages.requestEncryption user_id:InputUser random_id:int g_a:bytes = EncryptedChat;
+messages.acceptEncryption peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat;
+messages.discardEncryption chat_id:int = Bool;
+
+messages.setEncryptedTyping peer:InputEncryptedChat typing:Bool = Bool;
+messages.readEncryptedHistory peer:InputEncryptedChat max_date:int = Bool;
+messages.sendEncrypted peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
+messages.sendEncryptedFile peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage;
+messages.sendEncryptedService peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
+messages.receivedQueue max_qts:int = Vector<long>;
+
+updates.getDifference pts:int date:int qts:int = updates.Difference;
+
+invokeWithLayer8#e9abd9fd {X:Type} query:!X = X;
+===8===
+decryptedMessage random_id:long random_bytes:bytes message:string media:DecryptedMessageMedia = DecryptedMessage;
+decryptedMessageService random_id:long random_bytes:bytes action:DecryptedMessageAction = DecryptedMessage;
+
+decryptedMessageMediaEmpty = DecryptedMessageMedia;
+decryptedMessageMediaPhoto thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaVideo thumb:bytes thumb_w:int thumb_h:int duration:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaGeoPoint lat:double long:double = DecryptedMessageMedia;
+decryptedMessageMediaContact phone_number:string first_name:string last_name:string user_id:int = DecryptedMessageMedia;
+
+decryptedMessageActionSetMessageTTL ttl_seconds:int = DecryptedMessageAction;
+
+decryptedMessageMediaDocument thumb:bytes thumb_w:int thumb_h:int file_name:string mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
+decryptedMessageMediaAudio duration:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
+
+decryptedMessageActionReadMessages random_ids:Vector<long> = DecryptedMessageAction;
+decryptedMessageActionDeleteMessages random_ids:Vector<long> = DecryptedMessageAction;
+decryptedMessageActionScreenshotMessages random_ids:Vector<long> = DecryptedMessageAction;
+decryptedMessageActionFlushHistory = DecryptedMessageAction;
+Added wallpaper constructor wallPaperSolid.
+wallPaperSolid id:int title:string bg_color:int color:int = WallPaper;
+---functions---
+invokeWithLayer7#a5be56d3 {X:Type} query:!X = X;
+Added location identifiers from foursquare.
+geoChat id:int access_hash:long title:string address:string venue:string geo:GeoPoint photo:ChatPhoto participants_count:int date:int checked_in:Bool version:int = Chat;
+---functions---
+geochats.createGeoChat title:string geo_point:InputGeoPoint address:string venue:string = geochats.StatedMessage;
+
+invokeWithLayer6#3a64d54d {X:Type} query:!X = X;
+Added parameters for internationalization.
+---functions---
+auth.sendCode phone_number:string sms_type:int api_id:int api_hash:string lang_code:string = auth.SentCode;
+account.registerDevice token_type:int token:string device_model:string system_version:string app_version:string app_sandbox:Bool lang_code:string = Bool;
+
+invokeWithLayer5#417a57ae {X:Type} query:!X = X;
+Added geochats. More…
+inputGeoChat chat_id:int access_hash:long = InputGeoChat;
+
+geoChat id:int access_hash:long title:string address:string geo:GeoPoint photo:ChatPhoto participants_count:int date:int left:Bool version:int = Chat;
+
+geoChatMessageEmpty chat_id:int id:int = GeoChatMessage;
+geoChatMessage chat_id:int id:int from_id:int date:int message:string media:MessageMedia = GeoChatMessage;
+geoChatMessageService chat_id:int id:int from_id:int date:int action:MessageAction = GeoChatMessage;
+
+geochats.statedMessage message:GeoChatMessage chats:Vector<Chat> users:Vector<User> seq:int = geochats.StatedMessage;
+
+geochats.located results:Vector<ChatLocated> messages:Vector<GeoChatMessage> chats:Vector<Chat> users:Vector<User> = geochats.Located;
+
+geochats.messages messages:Vector<GeoChatMessage> chats:Vector<Chat> users:Vector<User> = geochats.Messages;
+geochats.messagesSlice count:int messages:Vector<GeoChatMessage> chats:Vector<Chat> users:Vector<User> = geochats.Messages;
+
+messageActionGeoChatCreate title:string address:string = MessageAction;
+messageActionGeoChatCheckin = MessageAction;
+updateNewGeoChatMessage message:GeoChatMessage = Update;
+updates.state pts:int date:int seq:int unread_count:int friends_unread_count:int = updates.State;
+
+---functions---
+
+geochats.getLocated geo_point:InputGeoPoint radius:int limit:int = geochats.Located;
+geochats.checkin peer:InputGeoChat = geochats.StatedMessage;
+geochats.getFullChat peer:InputGeoChat = messages.ChatFull;
+geochats.editChatTitle peer:InputGeoChat title:string address:string = geochats.StatedMessage;
+geochats.editChatPhoto peer:InputGeoChat photo:InputChatPhoto = geochats.StatedMessage;
+geochats.search peer:InputGeoChat q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = geochats.Messages;
+geochats.getHistory peer:InputGeoChat offset:int max_id:int limit:int = geochats.Messages;
+geochats.setTyping peer:InputGeoChat typing:Bool = Bool;
+geochats.sendMessage peer:InputGeoChat message:string random_id:long = geochats.StatedMessage;
+geochats.sendMedia peer:InputGeoChat media:InputMedia random_id:long = geochats.StatedMessage;
+geochats.createGeoChat title:string geo_point:InputGeoPoint address:string = geochats.StatedMessage;
+
+invokeWithLayer4#dea0d430 {X:Type} query:!X = X;
+Support for link changes for a contact when a message is sent. Now, if user X has user Y in the contact list and if user Y writes a message to user X, number X will become available for him.
+messages.statedMessagesLinks messages:Vector<Message> chats:Vector<Chat> users:Vector<User> links:Vector<contacts.Link> pts:int seq:int = messages.StatedMessages;
+messages.statedMessageLink message:Message chats:Vector<Chat> users:Vector<User> links:Vector<contacts.Link> pts:int seq:int = messages.StatedMessage;
+messages.sentMessageLink id:int date:int pts:int seq:int links:Vector<contacts.Link> = messages.SentMessage;
+
+---functions---
+
+messages.forwardMessage peer:InputPeer id:int random_id:long = messages.StatedMessage;
+messages.sendBroadcast contacts:Vector<InputUser> message:string media:InputMedia = messages.StatedMessages;
+
+invokeWithLayer3#b7475268 {X:Type} query:!X = X;
+Support for notifications on changes of contact profile images. It is assumed that receiving such image changed notification a client will add a record on this event in the message history with this contact.
+inputPeerNotifySettings mute_until:int sound:string show_previews:Bool events_mask:int = InputPeerNotifySettings;
+peerNotifySettings mute_until:int sound:string show_previews:Bool events_mask:int = PeerNotifySettings;
+updateUserPhoto user_id:int date:int photo:UserProfilePhoto previous:Bool = Update;
+userProfilePhoto photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto;
+
+---functions---
+
+photos.getUserPhotos user_id:InputUser offset:int max_id:int limit:int = photos.Photos;
+
+invokeWithLayer2#289dd1f6 {X:Type} query:!X = X;
+Telegram allows sending the live geolocation of a user in a chat, optionally setting a proximity alert.
+inputGeoPointEmpty#e4c123d6 = InputGeoPoint;
+
+inputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint;
+
+inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;
+
+---functions---
+
+messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+
+messages.editMessage#48f71778 flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int = Updates;
+To send a live geolocation, use messages.sendMedia with an inputMediaGeoLive media
.
The inputMediaGeoLive allows sending the geolocation as an inputGeoPoint with floating point latitude and longitude, with an optional accuracy_radius
in meters.
+Clients can also provide a heading
, a direction in degrees (1-360) that can be used to indicate the direction of the user, a validity period
for the current location, and a proximity_notification_radius
.
The sent geolocation should be updated perioducally using messages.editMessage at most every period
seconds, in order to implement the "live" part of live geolocations.
To stop sharing the location, pass inputGeoPointEmpty as location and set the stopped
flag to true in a last messages.editMessage call.
geoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radius:flags.0?int = GeoPoint;
+messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;
+
+updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update;
+Clients will receive a message with a messageMediaGeoLive, containing the information passed by the sender; when the geolocation message is marked as read, an updateGeoLiveViewed is generated.
+Periodically, the geolocation will be updated with updateEditMessage/updateEditChannelMessage updates.
+inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation;
+
+inputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint;
+
+---functions---
+
+upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile;
+A map preview can be generated by passing the received geoPoint to upload.getWebFile, to download an image preview of the map.
+geo_point
is generated from the lat
, long
accuracy_radius
parameters of the geoPointaccess_hash
is the access hash of the geoPointw
- Map width in pixels before applying scale; 16-1024h
- Map height in pixels before applying scale; 16-1024zoom
- Map zoom level; 13-20scale
- Map scale; 1-3The image is then downloaded as specified here »
+messageActionGeoProximityReached#98e0d697 from_id:Peer to_id:Peer distance:int = MessageAction;
+
+messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message;
+If:
+proximity_notification_radius
when sending a locationproximity_notification_radius
meters of the first user, and updates their location accordinglyAn updateNewMessage/updateNewChannelMessage is generated for all chat members, containing a messageService with action messageActionGeoProximityReached:
+messageActionGeoProximityReached.to_id
is the peer that enabled proximity alertsmessageActionGeoProximityReached.from_id
is the peer that is now in proximity of messageActionGeoProximityReached.to_id
messageActionGeoProximityReached.distance
is the distance between them, in metersTelegram 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.
+messageEntityMention#fa04579d offset:int length:int = MessageEntity;
+messageEntityMentionName#dc7b1140 offset:int length:int user_id:long = MessageEntity;
+inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity;
+
+message#85d6cbe2 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int = Message;
+
+channelParticipantsMentions#e04b5ceb flags:# q:flags.0?string top_msg_id:flags.1?int = ChannelParticipantsFilter;
+
+---functions---
+
+messages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
+
+channels.getParticipants#77ced9d0 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:long = channels.ChannelParticipants;
+Mentions are implemented as message entities, passed to the messages.sendMessage method:
+Incoming messages mentioning to the current user will have the mentioned
flag set, and will contain one or more messageEntityMention and messageEntityMentionName constructors.
Graphical clients can show a list of mentionable users when the user starts entering an @
in the text bar; for this purpose, the channelParticipantsMentions filter can be used in channels.getParticipants.
+This filter can be enhanced by providing an additional query string q
(anything the user enters after @
); it will also return non-participant users, in case of channel users commenting in post comment sections.
dialog#2c171f72 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog;
+
+---functions---
+
+messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
+messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory;
+Graphical clients are supposed to show a blue mention indicator next to the message counter of chats in the dialog list.
+The dialog constructor contains an unread_mentions_count
field to isolate chats with unread mentions; the actual mention counter should be shown inside of the chat itself, above an @
button that can be used, by clicking multiple times, to navigate back (using messages.getUnreadMentions) through the mention history.
When the last unread mention is read, or when long-clicking on the @
button, all mentions for a chat should marked as read using messages.readMentions.
In some situations user and channel constructors have reduced set of fields present (although id
is always there) and min
flag set. This is done for performance and privacy reasons.
When receiving said constructors, the client must first check if user or chat object without min
flag is already present in local cache. If it is present, then the client should just ignore constructors with min
flag and use local one instead.
The rest of article assumes the client receives min-constructor without full object in local cache.
+The client must store the context (similar to file references) 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 input*FromMessage
constructor, instead of normal inputUser
, inputChannel
or inputPeer
.
The access_hash
value, if present, is only suitable to use in inputPeerPhotoFileLocation
, to directly download the profile pictures of channels and users without having to generate an inputPeer*FromMessage
, simply using inputPeer*
with the specified access hash.
Usually min
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.
Assume a message with id 34
is received from supergroup (actually channel) 123456789
.
+Said message was sent by from_id
102424212
.
+The updates container that contained the message has a user with ID 102424212
in the users
field, but it has the min
flag set, and the provided access_hash
may be absent, or otherwise can't be used to generate a typical inputPeerUser constructor to send messages or do other actions.
What the client does is associate 102424212
with the channel 123456789
and message ID 34
.
+When and if the client will need to interact with user 102424212
, it will generate one of the *FromMessage
constructors mentioned above, setting:
msg_id
to 34
peer
to the InputPeer associated with channel 123456789
user_id
to 102424212
user_id
can also be set to the IDs of users met in the fwd_header
(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 messageEntityMentionName in a message can also be used.
The same can be done with min
channels.
Example implementations: Telegram for iOS, tdlib.
++This article is about Perfect Forward Secrecy in cloud chats, see also PFS in Secret Chats.
+
Telegram supports Perfect Forward Secrecy (PFS).
+To make this possible, the client generates a permanent authorization key using p_q_inner_data and a temporary key using p_q_inner_data_temp. (See Creating an Authorization Key for more info.) These 2 operations may be done in parallel and even using the same connection. The client must save an expires_at unix timestamp expires_at = time + expires_in
.
Important: in order to achieve PFS, the client must never use the permanent auth_key_id directly. Every message that is sent to MTProto, must be encrypted by a temp_auth_key_id, that was bound to the perm_auth_key_id.
+An unbound temp_auth_key_id may only be used with the following methods:
+ +In order to bind a temporary authorization key to the permanent key the client creates a special binding message and executes the auth.bindTempAuthKey method using temp_auth_key. Once auth.bindTempAuthKey has been executed successfully, the client may signUp / signIn using other auth.* methods and continue using the API as usual; the client must also rewrite client info using initConnection after each binding. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one.
+Once the temporary key expires, the client needs to generate a new temporary key using p_q_inner_data_temp. 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.
+For additional security, the client can store the temporary authorization key in RAM only and never save it in persistent storage.
+A temporary authorization key may expire at any moment before expires_at, 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).
QR code login flow.
+Related TL schema:
+auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken;
+auth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken;
+auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken;
+
+updateLoginToken#564fe691 = Update;
+
+authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization;
+
+---functions---
+
+auth.exportLoginToken#b7e085fe api_id:int api_hash:string except_ids:Vector<long> = auth.LoginToken;
+auth.acceptLoginToken#e894ad4d token:bytes = Authorization;
+auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken;
+First of all, auth.exportLoginToken must be called by the app that wants to log in to an existing Telegram account.
+The method will return an auth.loginToken constructor, containing a binary login token
and an expiry date (usually 30 seconds).
The login token
must be encoded using base64url, embedded in a tg://login?token=base64encodedtoken
URL and shown in the form of a QR code to the user.
+After the expiration of the current QR code, the auth.exportLoginToken method must be recalled and a new QR code must be generated automatically.
In order to log in, the QR code must be scanned and accepted by an already logged-in Telegram app using auth.acceptLoginToken.
+The token must be extracted from the tg://login
URI and base64url-decoded before using it in the method.
Possible errors returned by the method are:
+AUTH_TOKEN_INVALID
, an invalid authorization token was providedAUTH_TOKEN_EXPIRED
, the provided authorization token has expired and the updated QR-code must be re-scannedAUTH_TOKEN_ALREADY_ACCEPTED
, the authorization token was already usedThe method will return an authorization object, containing info about the app and session that we just authorized.
+After the logged-in app calls auth.acceptLoginToken and accepts the login token, the app that is trying to login will receive an updateLoginToken update, which should trigger a second call to the auth.exportLoginToken method.
+This second call should then return an auth.loginTokenSuccess constructor, indicating successful login, essentially allowing further authorized interaction with the API.
+If, however, there is a DC mismatch between the two apps, auth.loginTokenMigrateTo is returned instead, to which the app that is trying to login should respond by calling auth.importLoginToken with the specified token
, to the specified DC.
This call should then finally return a auth.loginTokenSuccess constructor.
Channels and supergroups allow setting granular permissions both for admins and specific users. +Channels, supergroups and legacy groups also allow setting global granular permissions for users.
+They can be modified as follows:
+channels.editAdmin can be used to modify the admin rights of a user in a channel or supergroup. +Legacy groups do not allow setting granular admin permissions, messages.editChatAdmin has to be used, instead.
+Permissions are defined by the chatAdminRights constructor, some admin rights can only be used for channels, others both for channels and supergroups (see the constructor page).
+channels.editBanned 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. +Legacy groups do not allow setting granular user permissions for single users, single users can only be removed from groups using messages.deleteChatUser: however, setting global granular permissions with legacy groups is supported.
+Permissions are defined by the chatBannedRights constructor, for more info see the constructor page.
+messages.editChatDefaultBannedRights can be used to modify the rights of all users in a channel, supergroup or legacy group, to restrict them from doing certain things.
+Permissions are defined by the chatBannedRights constructor: all flags can be used except for view_messages
, for more info see the constructor page.
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.
+Update events are sent to an authorized user into the last active connection (except for connections needed for downloading / uploading files).
+So to start receiving updates the client needs to init connection and call API method, e.g. to fetch current state.
+All events are received from the socket as a sequence of TL-serialized Updates objects, which might be optionally gzip-compressed in the same way as responses to queries.
+Each Updates object may contain single or multiple Update objects, representing different events happening.
+In order to apply all updates in precise order and to guarantee that no update is missed or applied twice there is seq
attribute in Updates constructors, and pts
(with pts_count
) or qts
attributes in Update constructors. The client must use those attributes values in combination with locally stored state to correctly apply incoming updates.
When a gap in updates sequence occurs, it must be filled via calling one of the API methods. More below »
+As said earlier, each payload with updates has a TL-type Updates. It can be seen from the schema below that this type has several constructors.
+updatesTooLong#e317af7e = Updates;
+updateShort#78d4dec1 update:Update date:int = Updates;
+updateShortMessage#313bc7f8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
+updateShortChatMessage#4d6deea5 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:long chat_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
+updateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
+updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
+updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
+updatesTooLong indicates that there are too many events pending to be pushed to the client, so one needs to fetch them manually.
+Events inside updateShort 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 (updateChatUserTyping).
+The updateShortMessage, updateShortSentMessage and updateShortChatMessage constructors are redundant but help significantly reduce the transmitted message size for 90% of the updates. They should be transformed to updateShort upon receiving.
+Two remaining constructors updates and updatesCombined are part of the Updates sequence. Both of them have seq
attribute, which indicates the remote Updates state after the generation of the Updates, and seq_start
indicates the remote Updates state after the first of the Updates in the packet is generated. For updates, seq_start
attribute is omitted, because it is assumed that it is always equal to seq
.
Each event related to a message box (message created, message edited, message deleted, etc) is identified by a unique autoincremented pts, or qts in case of secret chat updates, certain bot updates, etc.
+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).
+Update object may contain info about multiple events (for example, updateDeleteMessages).
+That's why all single updates might have pts_count parameter indicating the number of events contained in the received update (with some exceptions, in this case, the pts_count is considered to be 0
).
Each channel and supergroup has its message box and its event sequence as a result; private chats and legacy groups of one user have another common event sequence. +Secret chats, certain bot events and other kinds of updates have yet another common secondary event sequence.
+To recap, the client has to take care of the integrity of the following sequences to properly handle updates:
+The common update state is represented by the updates.State constructor. +When the user logs in for the first time, call to updates.getState 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 updates.differenceTooLong.
+The channel update state is represented simply by the pts of the event sequence: when first logging in, the initial channel state can be obtained from the dialog constructor when fetching dialogs, from the full channel info, or it can be received as an updateChannelTooLong update.
+The secondary update state is represented by the qts of the secret event sequence, it is contained in the updates.State of the common update state.
+The Updates sequence state is represented by the date and seq of the Updates sequence, it is contained in the updates.State of the common update state.
+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.
+When the client receives payload with serialized updates, first of all, it needs to walk through all of the nested Update objects and check if they belong to any of message box sequences (have pts
or qts
parameters). Those updates need to be handled separately according to corresponding local state and new pts
/qts
values. Details below »
After message box updates are handled, if there are any other updates remaining the client needs to handle them with respect to seq
. Details below »
pts
: checking and applyingHere, local_pts
will be the local state, pts
will be the remote state, pts_count
will be the number of events in the update.
If local_pts + pts_count === pts
, the update can be applied.
+If local_pts + pts_count > pts
, the update was already applied, and must be ignored.
+If local_pts + pts_count < pts
, there's an update gap that must be filled.
For example, let's assume the client has the following local state for the channel 123456789
:
local_pts = 131
+Now let's assume an updateNewChannelMessage from channel 123456789
is received with pts = 132
and pts_count=1
.
+Since local_pts + pts_count === pts
, the total number of events since the last stored state is, in fact, equal to pts_count
: this means the update can be safely accepted and the remote pts
applied:
local_pts = 132
+Since:
+pts
indicates the server state after the new channel message events are generatedpts_count
indicates the number of events in the new channel updatepts_before = pts - pts_count = 131
, which is, in fact, equal to our local state.Now let's assume an updateNewChannelMessage from channel 123456789
is received with pts = 132
and pts_count=1
.
+Since local_pts + pts_count > pts
(133 > 132
), the update is skipped because we've already handled this update (in fact, our current local_pts
was set by this same update, and it was resent twice due to network issues or other issues).
Now let's assume an updateDeleteChannelMessages from channel 123456789
is received with pts = 140
and pts_count=5
.
+Since local_pts + pts_count < pts
(137 < 140
), this means that updates were missed, and the gap must be recovered.
The whole process is very similar for secret chats and certain bot updates, but there is qts
instead of pts
, and events are never grouped, so it's assumed that qts_count
is always equal to 1.
seq
: checking and applyingOn top level when handling received updates and updatesCombined there are three possible cases:
+If local_seq + 1 === seq_start
, the updates can be applied.
+If local_seq + 1 > seq_start
, the updates were already applied, and must be ignored.
+If local_seq + 1 < seq_start
, there's an updates gap that must be filled (updates.getDifference must be used as with common and secret event sequences).
If the updates were applied, local Updates state must be updated with seq
and date
from the constructor.
For all the other Updates type constructors there is no need to check seq
or change a local state.
To do this, updates.getDifference (common/secret state) or updates.getChannelDifference (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:
+When calling updates.getDifference if the updates.differenceSlice constructor is returned in response, the full difference was too large to be received in one request. The intermediate status, intermediate_state, must be saved on the client and the query must be repeated, using the intermediate status as the current status.
+To fetch the updates difference of a channel, updates.getChannelDifference is used.
+If the difference is too large to be received in one request, the final
flag of the result is not set (see docs).
+The intermediate status, represented by the pts, must be saved on the client and the query must be repeated, using the intermediate status as the current status.
For perfomance reasons and for better user experience, client can set maximum gap size to be filled: pts_total_limit
parameter of updates.getDifference and limit
parameter for updates.getChannelDifference can be used.
If the gap is too large and there are too many updates to fetch, a *TooLong
constructor will be returned. In this case, the client must re-fetch the state, re-start fetching updates from that state and follow the instructions that can be found here.
It is recommended to use limit 10-100
for channels and 1000-10000
otherwise.
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.
+Example implementations: tdlib, MadelineProto.
+An interesting and easy way this can be implemented, instead of using various locks, is by running background loops, like in MadelineProto ».
+If a client does not have an active connection at the time of an event, PUSH Notifications will also be useful.
Bots or Telegram websites may ask users to login to a certain website via Telegram when clicking on certain links or URL buttons in inline keyboards.
+When the user clicks on keyboardButtonUrlAuth, messages.requestUrlAuth should be called, providing the button_id
of the button and the ID and peer of the container message.
+The returned urlAuthResultRequest object will contain more details about the authorization request:
domain
parameter will contain the domain name of the website on which the user will log in (example: comments.app).bot
parameter will contain info about the bot which will be used for user authorization (example: DiscussBot).request_write_access
will be set if the bot would like to send messages to the user.The info should be shown in a prompt:
+ +If the user agrees to login to the URL, messages.acceptUrlAuth should be called (eventually setting the write_allowed
if the permission was requested and the user consented).
+The result will be a urlAuthResultAccepted with the final URL to open, which will include a query string with the requested info and a hash that must be verified upon receival by the service.
urlAuthResultDefault could also be returned, instead, in which case the url
of the keyboardButtonUrlAuth must be opened, instead.
+The same must be done if the user opens the link while refusing the authorization request.
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 keyboardButtonUrl.
+Clients should automatically authenticate users when opening official Telegram websites, listed in the url_auth_domains
key of the client configuration object ».
Upon clicking a link, the URL must be modified by appending the autologin_token
from the client configuration object » to the query string, like so:
Original URL: https://somedomain.telegram.org/path?query=string#fragment=value
+Modified URL: https://somedomain.telegram.org/path?query=string&autologin_token=$autologin_token#fragment=value
Make sure that the used autologin_token
is no more than 10000
seconds old, if it is older it must be refetched before use as described in the client configuration section ».
Clients should show a confirmation prompt similar to the one used for bots, to authenticate users when opening certain Telegram websites, listed in the url_auth_domains
key of the client configuration object ».
messages.requestUrlAuth should be called, providing only the original url
.
+The returned urlAuthResultRequest object will contain more details about the authorization request:
domain
parameter will contain the domain name of the website on which the user will log in (example: comments.app).request_write_access
will be set if the website would like to send messages to the user.The info should be shown in a prompt.
+If the user agrees to login to the URL, messages.acceptUrlAuth should be called (eventually setting the write_allowed
if the permission was requested and the user consented).
+The result will be a urlAuthResultAccepted with the final URL to open.
urlAuthResultDefault 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.
+The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods.
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.
+Games and payment gateways can generate events that are meant to be received by the Telegram apps.
Typically events are generated by using the postEvent
method of the GamingCommunication library.
The postEvent
function will try sending the event to the Telegram app in a number of different ways.
In mobile apps, the event receiver API should be typically exposed as a window.TelegramWebviewProxy
object with a postEvent
method.
window.TelegramWebviewProxy.postEvent(eventType, eventData)
+Alternatively, a window.external.notify
method can be exposed, accepting a string JSON payload with the event type and payload:
window.external.notify(JSON.stringify({eventType: eventType, eventData: eventData}));
+Finally, web MTProto clients that need to open a game or process a payment in an iframe can use the postMessage API to receive events from iframes.
The GamingCommunication library by default will use '*'
as targetOrigin
, sending messages to parent pages regardless of the origin of the embedder.
window.parent.postMessage(JSON.stringify({eventType: eventType, eventData: eventData}), targetOrigin);
+eventType
is a simple string indicating the event type, and eventData
is a payload with an object that will be parsed by the Telegram app.
eventType | +eventData | +Description | +
---|---|---|
payment_form_submit |
+JSON object with data and title fields |
+title is the censored credit card title.data is a service-specific JSON payload with information about the payment credentials provided by the user to the payment system.Neither Telegram, nor bots will have access to your credit card information. Credit card details will be handled only by the payment system. |
+
share_score |
+null | +Will be called by games when the user explicitly clicks on the share score button to share the game, along with his score. Typically done by using messages.forwardMessages on the game message with the with_my_score flag. |
+
share_game |
+null | +Will be called by games when the user explicitly clicks on the share game button to share the game, without sharing his score. Typically done by using messages.forwardMessages on the game message without the with_my_score flag, or by sharing the game's short URL. |
+
game_over |
+null | +Can be called by games when the user loses a game | +
game_loaded |
+null | +Can be called by games once the game fully loads | +
resize_frame |
+JSON object with height field |
+Called by supported pages inside of IV iframe embeds, indicates the new size of the embed frame. | +
Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands and inline requests. You control your bots using HTTPS requests to our Bot API.
+To name just a few things, you could use bots to:
+Get customized notifications and news. A bot can act as a smart newspaper, sending you relevant content as soon as it's published.
+Integrate with other services. A bot can enrich Telegram chats with content from external services. +Gmail Bot, GIF bot, IMDB bot, Wiki bot, Music bot, Youtube bot, GitHubBot
+Accept payments from Telegram users. A bot can offer paid services or work as a virtual storefront. Read more » +Demo Shop Bot, Demo Store
+Create custom tools. A bot may provide you with alerts, weather forecasts, translations, formatting or other services. +Markdown bot, Sticker bot, Vote bot, Like bot
+Build single- and multiplayer games. A bot can offer rich HTML5 experiences, from simple arcades and puzzles to 3D-shooters and real-time strategy games. +GameBot, Gamee
+Build social services. A bot could connect people looking for conversation partners based on common interests or proximity.
+Do virtually anything else. Except for dishes — bots are terrible at doing the dishes.
+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:
+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 Bot API.
+++A detailed description of the Bot API is available on this page »
+
There's a... bot for that. Just talk to BotFather (described below) and follow a few simple steps. Once you've created a bot and received your authentication token, head down to the Bot API manual to see what you can teach your bot to do.
+++You may also like to check out some code examples here »
+
t.me/<bot_username>
links or username search to find your bot.Telegram bots are unique in many ways — we offer two kinds of keyboards, additional interfaces for default commands and deep linking as well as text formatting, integrated payments and more.
+Users can interact with your bot via inline queries straight from the text input field in any chat. All they need to do is start a message with your bot's username and then type a query.
+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's currently opened chat. This way, people can request content from your bot in any of their chats, groups or channels.
+Check out this blog to see a sample inline bot in action. You can also try the @sticker and @music bots to see for yourself.
+ +We've also implemented an easy way for your bot to switch between inline and PM modes.
++ ++
You can use bots to accept payments from Telegram users around the world.
+@ShopBot ...
in any chat for an inline invoice.+ ++
Bots can offer their users HTML5 games 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 high scores for every game played in every chat. Whenever there’s a new leader in the game, other playing members in the chat are notified that they need to step it up.
+ +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:
+ +You can also check out the @gamee bot that has more than 20 games.
++ ++
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 custom keyboards can become extremely useful.
+Whenever your bot sends a message, it can pass along a special keyboard with predefined reply options (see ReplyKeyboardMarkup). 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.
+We currently support text and emoji for your buttons. Here are some custom keyboard examples:
+<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>
+++For more technical information on custom keyboards, please consult the Bot API manual (see sendMessage).
+
There are times when you'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.
+Unlike with custom reply keyboards, pressing buttons on inline keyboards doesn't result in messages sent to the chat. Instead, inline keyboards support buttons that work behind the scenes: callback buttons, URL buttons and switch to inline buttons.
+ +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: @music, @vote, @like.
++ ++
Commands present a more flexible way to communicate with your bot. The following syntax may be used:
+/command
+A command must always start with the '/' symbol and may not be longer than 32 characters. Commands can use latin letters, numbers and underscores. Here are a few examples:
+/get_messages_stats
+/set_timer 10min Alarm!
+/get_timezone London, UK
+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:
+<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>
+If multiple bots are in a group, it is possible to add bot usernames to commands in order to avoid confusion:
+/start@TriviaBot
+/start@ApocalypseBot
+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.
+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 interface shortcuts for these commands.
+Users will see a Start button when they first open a conversation with your bot. Help and Settings links will be available in the menu on the bot's profile page.
+You can use bold, italic or fixed-width text, as well as inline links in your bots' messages. Telegram clients will render them accordingly.
++ ++
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't selling my chat history to my competitors?" The answer is — privacy mode.
+A bot running in privacy mode will not receive all messages that people send to the group. Instead, it will only receive:
+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't need to process tens of thousands irrelevant messages each day.
+Privacy mode is enabled by default for all bots, except bots that were added to the group as admins (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 re-added 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's current privacy setting in the group members list. In most cases, using the force reply option for the bot's messages should be more than enough.
+So what messages exactly will my bot get? »
+Telegram bots have a deep linking 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's Telegram account to their account on some external service.
+Each bot has a link that opens a conversation with it in Telegram — https://t.me/<bot username>
. You can add the parameters start or startgroup to this link, with values up to 64 characters long. For example:
https://t.me/triviabot?startgroup=test
+A-Z
, a-z
, 0-9
, _
and -
are allowed. We recommend using base64url to encode parameters with binary and other types of content.
Following a link with the start parameter will open a one-on-one conversation with the bot, showing a START button in the place of the input field. If the startgroup 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:
+/start PAYLOAD
+PAYLOAD
stands for the value of the start or startgroup parameter that was passed in the link.
Suppose the website example.com would like to send notifications to its users via a Telegram bot. Here's what they could do to enable notifications for a user with the ID 123
.
$memcache_key = "vCH1vGWJxfSeofSAs0K5PA"
123
with the key $memcache_key
into Memcache for 3600 seconds (one hour) https://t.me/ExampleComBot?start=vCH1vGWJxfSeofSAs0K5PA
/start
. If the key exists, record the chat_id passed to the webhook as telegram_chat_id for the user 123
. Remove the key from Memcache.123
, check if they have the field telegram_chat_id. If yes, use the sendMessage method in the Bot API to send them a message in Telegram.Some bots need extra data from the user to work properly. For example, knowing the user's location helps provide more relevant geo-specific results. The user's phone number can be very useful for integrations with other services, like banks, etc.
+Bots can ask a user for their location and phone number using special buttons. Note that both phone number and location request buttons will only work in private chats.
+ +When these buttons are pressed, Telegram clients will display a confirmation alert that tells the user what's about to happen.
++ ++
++Jump to top to learn everything about Telegram bots »
+
BotFather is the one bot to rule them all. It will help you create new bots and change settings for existing ones.
+Use the /newbot 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.
+The name of your bot is displayed in contact details and elsewhere.
+The Username 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's username must end in 'bot', e.g. 'tetris_bot' or 'TetrisBot'.
+The token is a string along the lines of 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
that is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot.
If your existing token is compromised or you lost it for some reason, use the /token command to generate a new one.
+The remaining commands are pretty self-explanatory:
+Edit bots
+/
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 '/' in a conversation with your bot.Edit settings
+Manage games
+++Please note, that it may take a few minutes for changes to take effect.
+
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.
+We will be checking the number of replies and the request/response conversion rate for popular bots (~300 requests per minute: but don'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.
+By default, you will only get one alert per bot per hour. Each alert has the following buttons:
+We will currently notify you about the following issues:
+1.
+Too few **private messages** are sent compared to previous weeks: **{value}**
+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.
+2.
+Too few replies to incoming **private messages**. Conversion rate: **{value}**
+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 message updates by calling send... methods (e.g. sendMessage).
+3.
+Too few answers to **inline queries**. Conversion rate: **{value}**
+Your bot is not replying to all inline queries that are being sent to it, calculated in the same way as above. Respond to inline_query updates by calling answerInlineQuery.
+4.
+Too few answers to **callback queries**. Conversion rate: **{value}**
+Too few answers to **callback game queries**. Conversion rate: **{value}**
+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 callback_query updates by calling answerCallbackQuery.
+++Please note that the status alerts feature is still being tested and will be improved in the future.
+
That's it for the introduction. You are now definitely ready to proceed to the BOT API MANUAL.
+If you've got any questions, please check out our Bot FAQ »
Contains info on a confirmation code message sent via Telegram.
+You can force resending the message via SMS by invoking the method auth.sendSms.
+Constructor schema is available as of layer 50. Switch »
+Name | +Type | +Description | +
---|---|---|
phone_registered | +Bool | +The given number corresponds to a registered Telegram user | +
phone_code_hash | +string | +Message identifier | +
send_call_timeout | +int | +Delay in seconds before calling auth.sendCall | +
is_password | +Bool | +The sent code is a text password | +
New document with a thumbnail.
+Constructor schema is available as of layer 22. Switch »
+Name | +Type | +Description | +
---|---|---|
file | +InputFile | +Document, saved in parts by using the methods upload.saveFilePart or upload.saveBigFilePart | +
thumb | +InputFile | +Thumbnail file, saved in parts by using upload.saveFilePart | +
file_name | +string | +File name with extension | +
mime_type | +string | +File MIME-type | +
Info on successfully sent message and on changes links.
+Constructor schema is available as of layer 24. Switch »
+Name | +Type | +Description | +
---|---|---|
id | +int | +Message ID | +
date | +int | +Date of sending | +
pts | +int | +New value of pts parameter of a current state | +
seq | +int | +New value of seq parameter of a current state | +
links | +Vector<contacts.Link> | +List of changes links | +
Message with auxiliary data, state data and the list of changed links.
+Constructor schema is available as of layer 24. Switch »
+Name | +Type | +Description | +
---|---|---|
message | +Message | +Message | +
chats | +Vector<Chat> | +List of chats mentioned in message | +
users | +Vector<User> | +List of users mentioned in message and chats | +
links | +Vector<contacts.Link> | +List of changed links | +
pts | +int | +Number of events occurred in text box | +
seq | +int | +Number of sent updates | +
Message with auxiliary data, state data and the list of changed links.
+Constructor schema is available as of layer 24. Switch »
+Name | +Type | +Description | +
---|---|---|
messages | +Vector<Message> | +List of messages | +
chats | +Vector<Chat> | +List of cats mentioned in messages | +
users | +Vector<User> | +List of users mentioned in messages and cahts | +
links | +Vector<contacts.Link> | +List of changed links | +
pts | +int | +Number of event occurred in a text box | +
seq | +int | +Number of sent updates | +
User was added to the blacklist (method contacts.block) or removed from the blacklist (method contacts.unblock).
+Constructor schema is available as of layer 119. Switch »
+Name | +Type | +Description | +
---|---|---|
user_id | +int | +User id | +
blocked | +Bool | +(boolTrue) if the the user is blocked | +
The constructor can be interpreted as a booleantrue
value.
Adds the user to the blacklist.
+Deletes the user from the blacklist.
One-color background wallpaper (no image).
+Constructor schema is available as of layer 93. Switch »
+Name | +Type | +Description | +
---|---|---|
id | +int | +Identifier | +
title | +string | +Name | +
bg_color | +int | +Background color (RGB) | +
color | +int | +Basic background color (RGB) | +
Returns information on whether the passed phone number was registered.
+ Method schema is available as of layer 78. Switch »
+Name | +Type | +Description | +
---|---|---|
phone_number | +string | +Phone number in the international format | +
The method returns an auth.CheckedPhone type object with information on whether an account with such a phone number has already been registered, as well as whether invitations were sent to this number (using the auth.sendInvites method).
+(auth.checkPhone "79123413132")
+=
+(auth.checkedPhone
+ phone_registered:(boolFalse)
+ phone_invited:(boolFalse)
+)
+Code | +Type | +Description | +
---|---|---|
400 | +PHONE_NUMBER_BANNED | +The provided phone number is banned from telegram | +
400 | +PHONE_NUMBER_INVALID | +Invalid phone number | +
Makes a voice call to the passed phone number. A robot will repeat the confirmation code from a previously sent SMS message.
+{schema}
+Name | +Type | +Description | +
---|---|---|
phone_number | +string | +Phone number in the international format | +
phone_code_hash | +string | +SMS-message ID | +
(auth.sendCall "79991234567" "2dc02d2cda9e615c84")
+=
+(boolTrue)
+
+03c51564 3939370b 33323139 37363534 63643212 32643230 39616463 35313665 00343863 64e1a61b
+=
+997275b5
+Code | +Type | +Description | +
---|---|---|
400 | +PHONE_NUMBER_INVALID | +Invalid phone number | +
400 | +PHONE_CODE_HASH_EMPTY | +phone_code_hash was not sent | +
400 | +PHONE_CODE_EXPIRED | +SMS expired | +
Saves information that the current user sent SMS-messages with invitations to its unregistered contacts.
+{schema}
+Name | +Type | +Description | +
---|---|---|
phone_numbers | +Vector<string> | +List of phone numbers of message recipients in the international format | +
message | +string | +Message text | +
Code | +Type | +Description | +
---|---|---|
400 | +MESSAGE_EMPTY | +The provided message is empty | +
Forces sending an SMS message to the specified phone number. Use this method if auth.sentAppCode was returned as a response to auth.sendCode, but the user can't reach the device with Telegram.
+{schema}
+Name | +Type | +Description | +
---|---|---|
phone_number | +string | +Phone number in international format | +
phone_code_hash | +string | +SMS-message ID | +
Code | +Type | +Description | +
---|---|---|
400 | +PHONE_NUMBER_INVALID | +Invalid phone number | +
400 | +PHONE_CODE_HASH_EMPTY | +phone_code_hash was not sent | +
400 | +PHONE_CODE_EXPIRED | +SMS expired | +
Enable/disable top peers
+boolFalse#bc799737 = Bool;
+boolTrue#997275b5 = Bool;
+---functions---
+contacts.toggleTopPeers#8514bdda enabled:Bool = Bool;
+Name | +Type | +Description | +
---|---|---|
enabled | +Bool | +Enable/disable | +
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).
Forwards single messages.
+{schema}
+Name | +Type | +Description | +
---|---|---|
peer | +InputPeer | +User or chat where a message will be forwarded | +
id | +int | +Forwarded message ID | +
random_id | +long | +Unique client message ID required to prevent message resending | +
Code | +Type | +Description | +
---|---|---|
400 | +CHAT_ID_INVALID | +The provided chat id is invalid | +
400 | +MESSAGE_ID_INVALID | +The provided message id is invalid | +
400 | +PEER_ID_INVALID | +The provided peer id is invalid | +
400 | +YOU_BLOCKED_USER | +You blocked this user | +
Get full message reaction list
+ Method schema is available as of layer 136. Switch »
+Name | +Type | +Description | +
---|---|---|
flags | +# | +Flags, see TL conditional fields | +
peer | +InputPeer | +Peer | +
id | +int | +Message ID | +
reaction | +flags.0?string | +Get only reactions of this type (UTF8 emoji) | +
offset | +flags.1?string | +Offset (typically taken from the next_offset field of the returned MessageReactionsList) |
+
limit | +int | +Maximum number of results to return, see pagination | +
List of message reactions
+How to fetch results from large lists of objects.
Search for GIFs
+ Method schema is available as of layer 114. Switch »
+Name | +Type | +Description | +
---|---|---|
q | +string | +Text query | +
offset | +int | +Offset for pagination » | +
Code | +Type | +Description | +
---|---|---|
400 | +METHOD_INVALID | +The specified method is invalid. | +
400 | +SEARCH_QUERY_EMPTY | +The search query is empty. | +
How to fetch results from large lists of objects.
Sends multiple messages to contacts.
+{schema}
+Name | +Type | +Description | +
---|---|---|
contacts | +Vector<InputUser> | +List of user ID to whom a message will be sent | +
message | +string | +Message text | +
media | +InputMedia | +Message media-contents | +
Send reaction to message
+ Method schema is available as of layer 136. Switch »
+Name | +Type | +Description | +
---|---|---|
flags | +# | +Flags, see TL conditional fields | +
peer | +InputPeer | +Peer | +
msg_id | +int | +Message ID to react to | +
reaction | +flags.0?string | +Reaction (a UTF8 emoji) | +
Code | +Type | +Description | +
---|---|---|
400 | +MESSAGE_ID_INVALID | +The provided message id is invalid. | +
400 | +REACTION_EMPTY | +Empty reaction provided. | +
Edit information about a given group call participant
+ Method schema is available as of layer 123. Switch »
+flags | +# | +Flags, see TL conditional fields | +
muted | +flags.0?true | +Whether to mute or unmute the user | +
call | +InputGroupCall | +Group call | +
user_id | +InputUser | +The user in question | +
Name | +Description | +
---|---|
help.getTermsOfServiceUpdate | +Look for updates of telegram's terms of service | +
help.acceptTermsOfService | +Accept the new terms of service | +
Name | +Description | +
---|---|
account.reportPeer | +Report a peer for violation of telegram's Terms of Service | +
account.reportProfilePhoto | +Report a profile photo of a dialog | +
channels.reportSpam | +Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup | +
messages.report | +Report a message in a chat for violation of telegram's Terms of Service | +
messages.reportSpam | +Report a new incoming chat for spam, if the peer settings of the chat allow us to do that | +
messages.reportEncryptedSpam | +Report a secret chat for spam | +
Name | +Description | +
---|---|
help.getAppChangelog | +Get changelog of current app. Typically, an updates constructor will be returned, containing one or more updateServiceNotification updates with app-specific changelogs. |
+
help.getAppConfig | +Get app-specific configuration, see client configuration for more info on the result. | +
help.getAppUpdate | +Returns information on update availability for the current application. | +
help.getConfig | +Returns current configuration, including data center configuration. | +
help.getInviteText | +Returns localized text of a text message with an invitation. | +
help.getNearestDc | +Returns info on data centre nearest to the user. | +
help.getSupport | +Returns the support user for the 'ask a question' feature. | +
help.getSupportName | +Get localized name of the telegram support user | +
help.getCountriesList | +Get name, ISO code, localized name and phone codes/patterns of all available countries | +
help.dismissSuggestion | +Dismiss a suggestion, see here for more info ». | +
Name | +Description | +
---|---|
auth.exportLoginToken | +Generate a login token, for login via QR code. The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken URL in the QR code.For more info, see login via QR code. |
+
auth.acceptLoginToken | +Accept QR code login token, logging in the app that generated it. Returns info about the new session. For more info, see login via QR code. |
+
auth.importLoginToken | +Login using a redirected login token, generated in case of DC mismatch during QR code login. For more info, see login via QR code. |
+
Name | +Description | +
---|---|
help.saveAppLog | +Saves logs of application on the server. | +
initConnection | +Initialize connection | +
invokeAfterMsg | +Invokes a query after successfull completion of one of the previous queries. | +
invokeAfterMsgs | +Invokes a query after a successfull completion of previous queries | +
invokeWithLayer | +Invoke the specified query using the specified API layer | +
invokeWithoutUpdates | +Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). | +
Name | +Description | +
---|---|
auth.bindTempAuthKey | +Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id . Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one.For more information, see Perfect Forward Secrecy. |
+
auth.cancelCode | +Cancel the login verification code | +
auth.checkPassword | +Try logging to an account protected by a 2FA password. | +
account.resetPassword | +Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » | +
auth.checkRecoveryPassword | +Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. | +
auth.dropTempAuthKeys | +Delete all temporary authorization keys except for the ones specified | +
auth.exportAuthorization | +Returns data for copying authorization to another data-centre. | +
auth.importAuthorization | +Logs in a user using a key transmitted from his native data-centre. | +
auth.importBotAuthorization | +Login as a bot | +
auth.logOut | +Logs out the user. | +
auth.recoverPassword | +Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. | +
auth.requestPasswordRecovery | +Request recovery code of a 2FA password, only for accounts with a recovery email configured. | +
auth.resendCode | +Resend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see login for more info. | +
auth.resetAuthorizations | +Terminates all user's authorized sessions except for the current one. After calling this method it is necessary to reregister the current device using the method account.registerDevice |
+
auth.sendCode | +Send the verification code for login | +
auth.signIn | +Signs in a user with a validated phone number. | +
auth.signUp | +Registers a validated phone number in the system. | +
Name | +Description | +
---|---|
account.initTakeoutSession | +Initialize account takeout session | +
account.finishTakeoutSession | +Finish account takeout session | +
messages.getSplitRanges | +Get message ranges for saving the user's chat history | +
channels.getLeftChannels | +Get a list of channels/supergroups we left | +
invokeWithMessagesRange | +Invoke with the given message range | +
invokeWithTakeout | +Invoke a method within a takeout session | +
Name | +Description | +
---|---|
messages.getSavedGifs | +Get saved GIFs | +
messages.saveGif | +Add GIF to saved gifs list | +
messages.searchGifs | +Search for GIFs | +
Name | +Description | +
---|---|
help.hidePromoData | +Hide MTProxy/Public Service Announcement information | +
help.getPromoData | +Get MTProxy/Public Service Announcement information | +
Name | +Description | +
---|---|
help.editUserInfo | +Internal use | +
help.getUserInfo | +Internal use | +
Name | +Description | +
---|---|
account.confirmPasswordEmail | +Verify an email to use as 2FA recovery method. | +
account.resendPasswordEmail | +Resend the code to verify an email to use as 2FA recovery method. | +
account.cancelPasswordEmail | +Cancel the code that was sent to verify an email to use as 2FA recovery method. | +
account.getPassword | +Obtain configuration for two-factor authorization with password | +
account.getPasswordSettings | +Get private info associated to the password info (recovery email, telegram passport info & so on) | +
account.updatePasswordSettings | +Set a new 2FA password | +
account.declinePasswordReset | +Abort a pending 2FA password reset, see here for more info » | +
Name | +Description | +
---|---|
messages.requestUrlAuth | +Get more info about a Seamless Telegram Login authorization request, for more info click here » | +
messages.acceptUrlAuth | +Use this to accept a Seamless Telegram Login authorization request, for more info click here » | +
account.getWebAuthorizations | +Get web login widget authorizations | +
account.resetWebAuthorization | +Log out an active web telegram login session | +
account.resetWebAuthorizations | +Reset all active web telegram login sessions | +
Name | +Description | +
---|---|
phone.acceptCall | +Accept incoming call | +
phone.confirmCall | +Complete phone call E2E encryption key exchange » | +
phone.discardCall | +Refuse or end running call | +
phone.getCallConfig | +Get phone call configuration to be passed to libtgvoip's shared config | +
phone.receivedCall | +Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. | +
phone.requestCall | +Start a telegram phone call | +
phone.saveCallDebug | +Send phone call debug data to server | +
phone.sendSignalingData | +Send VoIP signaling data | +
phone.setCallRating | +Rate a call | +
messages.deletePhoneCallHistory | +Delete the entire phone call history. | +
Name | +Description | +
---|---|
channels.createChannel | +Create a supergroup/channel. | +
channels.getInactiveChannels | +Get inactive channels and supergroups | +
channels.deleteChannel | +Delete a channel/supergroup | +
channels.deleteHistory | +Delete the history of a supergroup | +
channels.deleteMessages | +Delete messages in a channel/supergroup | +
channels.deleteUserHistory | +Delete all messages sent by a certain user in a supergroup | +
channels.editAdmin | +Modify the admin rights of a user in a supergroup/channel. | +
channels.editBanned | +Ban/unban/kick a user in a supergroup/channel. | +
channels.editCreator | +Transfer channel ownership | +
channels.editLocation | +Edit location of geogroup | +
channels.editPhoto | +Change the photo of a channel/supergroup | +
channels.editTitle | +Edit the name of a channel/supergroup | +
channels.exportMessageLink | +Get link and embed info of a message in a channel/supergroup | +
channels.getAdminLog | +Get the admin log of a channel/supergroup | +
channels.getAdminedPublicChannels | +Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the limit for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups. | +
channels.getChannels | +Get info about channels/supergroups | +
channels.getFullChannel | +Get full info about a channel | +
channels.getGroupsForDiscussion | +Get all groups that can be used as discussion groups. Returned legacy group chats must be first upgraded to supergroups before they can be set as a discussion group. To set a returned supergroup as a discussion group, access to its old messages must be enabled using channels.togglePreHistoryHidden, first. |
+
channels.getMessages | +Get channel/supergroup messages | +
channels.getParticipant | +Get info about a channel/supergroup participant | +
channels.getParticipants | +Get the participants of a supergroup/channel | +
channels.inviteToChannel | +Invite users to a channel/supergroup | +
channels.joinChannel | +Join a channel/supergroup | +
channels.leaveChannel | +Leave a channel/supergroup | +
channels.readHistory | +Mark channel/supergroup history as read | +
channels.readMessageContents | +Mark channel/supergroup message contents as read | +
channels.setDiscussionGroup | +Associate a group to a channel as discussion group for that channel | +
channels.setStickers | +Associate a stickerset to the supergroup | +
channels.togglePreHistoryHidden | +Hide/unhide message history for new channel/supergroup users | +
channels.toggleSignatures | +Enable/disable message signatures in channels | +
channels.toggleSlowMode | +Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds |
+
Name | +Description | +
---|---|
messages.getMessageReadParticipants | +Get which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info ». |
+
messages.addChatUser | +Adds a user to a chat and sends a service message on it. | +
messages.checkChatInvite | +Check the validity of a chat invite link and get basic info about it | +
messages.createChat | +Creates a new chat. | +
messages.deleteChatUser | +Deletes a user from a chat and sends a service message on it. | +
messages.editChatAbout | +Edit the description of a group/supergroup/channel. | +
messages.editChatAdmin | +Make a user admin in a legacy group. | +
messages.editChatDefaultBannedRights | +Edit the default banned rights of a channel/supergroup/group. | +
messages.editChatPhoto | +Changes chat photo and sends a service message on it | +
messages.editChatTitle | +Chanages chat name and sends a service message on it. | +
messages.exportChatInvite | +Export an invite link for a chat | +
messages.getAllChats | +Get all chats, channels and supergroups | +
messages.getChats | +Returns chat basic info on their IDs. | +
messages.getAdminsWithInvites | +Get info about chat invites generated by admins. | +
messages.deleteExportedChatInvite | +Delete a chat invite | +
messages.getChatInviteImporters | +Get info about the users that joined the chat using a specific chat invite | +
messages.deleteRevokedExportedChatInvites | +Delete all revoked chat invites | +
messages.deleteChat | +Delete a chat | +
messages.getCommonChats | +Get chats in common with a user | +
messages.getFullChat | +Returns full chat info according to its ID. | +
messages.importChatInvite | +Import a chat invite and join a private chat/supergroup/channel | +
messages.getExportedChatInvite | +Get info about a chat invite | +
messages.editExportedChatInvite | +Edit an exported chat invite | +
messages.getExportedChatInvites | +Get info about the chat invites of a specific chat | +
messages.migrateChat | +Turn a legacy group into a supergroup | +
channels.convertToGigagroup | +Convert a supergroup to a gigagroup, when requested by channel suggestions. | +
Name | +Description | +
---|---|
messages.startBot | +Start a conversation with a bot using a deep linking parameter | +
help.getDeepLinkInfo | +Get info about a t.me link |
+
help.getRecentMeUrls | +Get recently used t.me links |
+
Name | +Description | +
---|---|
help.getCdnConfig | +Get configuration for CDN file downloads. | +
upload.getCdnFile | +Download a CDN file. | +
upload.getCdnFileHashes | +Get SHA256 hashes for verifying downloaded CDN files | +
upload.reuploadCdnFile | +Request a reupload of a certain file to a CDN DC. | +
upload.getFile | +Returns content of a whole file or its part. | +
upload.getFileHashes | +Get SHA256 hashes for verifying downloaded files | +
upload.getWebFile | +Returns content of an HTTP file or a part, by proxying the request through telegram. | +
upload.saveBigFilePart | +Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. | +
upload.saveFilePart | +Saves a part of file for futher sending to one of the methods. | +
messages.uploadEncryptedFile | +Upload encrypted file and associate it to a secret chat | +
messages.uploadMedia | +Upload a file and associate it to a chat (without actually sending it to the chat) | +
messages.getDocumentByHash | +Get a document by its SHA256 hash, mainly used for gifs | +
Name | +Description | +
---|---|
messages.getWebPage | +Get instant view page | +
messages.getWebPagePreview | +Get preview of webpage | +
Name | +Description | +
---|---|
messages.setEncryptedTyping | +Send typing event by the current user to a secret chat. | +
messages.readEncryptedHistory | +Marks message history within a secret chat as read. | +
messages.acceptEncryption | +Confirms creation of a secret chat | +
messages.discardEncryption | +Cancels a request for creation and/or delete info on secret chat. | +
messages.requestEncryption | +Sends a request to start a secret chat to the user. | +
messages.sendEncrypted | +Sends a text message to a secret chat. | +
messages.sendEncryptedFile | +Sends a message with a file attachment to a secret chat | +
messages.sendEncryptedService | +Sends a service message to a secret chat. | +
messages.getDhConfig | +Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. | +
messages.receivedQueue | +Confirms receipt of messages in a secret chat by client, cancels push notifications. | +
Name | +Description | +
---|---|
account.sendVerifyEmailCode | +Send the verification email code for telegram passport. | +
account.verifyEmail | +Verify an email address for telegram passport. | +
account.sendVerifyPhoneCode | +Send the verification phone code for telegram passport. | +
account.verifyPhone | +Verify a phone number for telegram passport. | +
account.acceptAuthorization | +Sends a Telegram Passport authorization form, effectively sharing data with the service | +
account.getAuthorizationForm | +Returns a Telegram Passport authorization form for sharing data with a service | +
account.getAuthorizations | +Get logged-in sessions | +
account.deleteSecureValue | +Delete stored Telegram Passport documents, for more info see the passport docs » | +
account.getAllSecureValues | +Get all saved Telegram Passport documents, for more info see the passport docs » | +
account.getSecureValue | +Get saved Telegram Passport document, for more info see the passport docs » | +
account.saveSecureValue | +Securely save Telegram Passport document, for more info see the passport docs » | +
help.getPassportConfig | +Get passport configuration | +
users.setSecureValueErrors | +Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. |
+
Name | +Description | +
---|---|
updates.getChannelDifference | +Returns the difference between the current state of updates of a certain channel and transmitted. | +
updates.getDifference | +Get new updates. | +
updates.getState | +Returns a current state of updates. | +
Name | +Description | +
---|---|
messages.getInlineBotResults | +Query an inline bot | +
messages.setInlineBotResults | +Answer an inline query, for bots only | +
messages.sendInlineBotResult | +Send a result obtained using messages.getInlineBotResults. | +
messages.getBotCallbackAnswer | +Press an inline callback button and get a callback answer from the bot | +
messages.setBotCallbackAnswer | +Set the callback answer to a user button press (bots only) | +
messages.editInlineBotMessage | +Edit an inline bot message | +
Name | +Description | +
---|---|
bots.resetBotCommands | +Clear bot commands for the specified bot scope and language code | +
bots.getBotCommands | +Obtain a list of bot commands for the specified bot scope and language code | +
bots.setBotCommands | +Set bot command list | +
Name | +Description | +
---|---|
bots.answerWebhookJSONQuery | +Answers a custom query; for bots only | +
bots.sendCustomRequest | +Sends a custom request; for bots only | +
help.setBotUpdatesStatus | +Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only | +
Name | +Description | +
---|---|
account.updateTheme | +Update theme | +
account.uploadTheme | +Upload theme | +
account.getThemes | +Get installed themes | +
account.createTheme | +Create a theme | +
account.installTheme | +Install a theme | +
account.saveTheme | +Save a theme | +
account.getTheme | +Get theme information | +
account.getChatThemes | +Get all available chat themes | +
messages.setChatTheme | +Change the chat theme of a certain chat | +
Name | +Description | +
---|---|
account.getContactSignUpNotification | +Whether the user will receive notifications when contacts sign up | +
account.setContactSignUpNotification | +Toggle contact sign up notifications | +
contacts.acceptContact | +If the peer settings of a new user allow us to add him as contact, add that user as contact | +
contacts.addContact | +Add an existing telegram user as contact. Use contacts.importContacts to add contacts by phone number, without knowing their Telegram ID. |
+
contacts.block | +Adds the user to the blacklist. | +
contacts.deleteByPhones | +Delete contacts by phone number | +
contacts.deleteContacts | +Deletes several contacts from the list. | +
contacts.getBlocked | +Returns the list of blocked users. | +
contacts.getContactIDs | +Get contact by telegram IDs | +
contacts.getContacts | +Returns the current user's contact list. | +
contacts.getLocated | +Get contacts near you | +
contacts.getSaved | +Get all contacts | +
contacts.getStatuses | +Returns the list of contact statuses. | +
contacts.getTopPeers | +Get most used peers | +
contacts.importContacts | +Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. Use contacts.addContact to add Telegram contacts without actually using their phone number. |
+
contacts.resetSaved | +Delete saved contacts | +
contacts.resetTopPeerRating | +Reset rating of top peer | +
contacts.search | +Returns users found by username substring. | +
contacts.toggleTopPeers | +Enable/disable top peers | +
contacts.unblock | +Deletes the user from the blacklist. | +
Name | +Description | +
---|---|
payments.getBankCardData | +Get info about a credit card | +
Name | +Description | +
---|---|
messages.getDialogs | +Returns the current user dialog list. | +
messages.getPeerDialogs | +Get dialog info of specified peers | +
messages.getPinnedDialogs | +Get pinned dialogs | +
messages.toggleDialogPin | +Pin/unpin a dialog | +
messages.reorderPinnedDialogs | +Reorder pinned dialogs | +
messages.getDialogUnreadMarks | +Get dialogs manually marked as unread | +
messages.markDialogUnread | +Manually mark dialog as unread | +
messages.getPeerSettings | +Get peer settings | +
messages.hidePeerSettingsBar | +Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the peer's settings. | +
messages.getOnlines | +Get count of online users in a chat | +
messages.sendScreenshotNotification | +Notify the other user in a private chat that a screenshot of the chat was taken | +
messages.setTyping | +Sends a current user typing event (see SendMessageAction for all event types) to a conversation partner or group. | +
messages.setHistoryTTL | +Set maximum Time-To-Live of all messages in the specified chat | +
Name | +Description | +
---|---|
messages.clearAllDrafts | +Clear all drafts. | +
messages.getAllDrafts | +Save get all message drafts. | +
messages.saveDraft | +Save a message draft associated to a chat. | +
Name | +Description | +
---|---|
messages.getEmojiKeywords | +Get localized emoji keywords | +
messages.getEmojiKeywordsDifference | +Get changed emoji keywords | +
messages.getEmojiKeywordsLanguages | +Get info about an emoji keyword localization | +
messages.getEmojiURL | +Returns an HTTP URL which can be used to automatically log in into translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation | +
Name | +Description | +
---|---|
messages.updateDialogFiltersOrder | +Reorder folders | +
messages.getDialogFilters | +Get folders | +
messages.getSuggestedDialogFilters | +Get suggested folders | +
messages.updateDialogFilter | +Update folder | +
folders.deleteFolder | +Delete a peer folder | +
folders.editPeerFolders | +Edit peers in peer folder | +
Name | +Description | +
---|---|
messages.getGameHighScores | +Get highscores of a game | +
messages.getInlineGameHighScores | +Get highscores of a game sent using an inline bot | +
messages.setGameScore | +Use this method to set the score of the specified user in a game sent as a normal message (bots only). | +
messages.setInlineGameScore | +Use this method to set the score of the specified user in a game sent as an inline message (bots only). | +
Name | +Description | +
---|---|
phone.exportGroupCallInvite | +Get an invite link for a group call or livestream | +
phone.getGroupCallJoinAs | +Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. | +
phone.editGroupCallParticipant | +Edit information about a given group call participant Note: flags.N?Bool parameters can have three possible values: - If the TL flag is not set, the previous value will not be changed. - If the TL flag is set and contains a boolTrue, the previous value will be overwritten to true .- If the TL flag is set and contains a boolFalse, the previous value will be overwritten to false . |
+
phone.toggleGroupCallRecord | +Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). |
+
phone.editGroupCallTitle | +Edit the title of a group call or livestream | +
phone.getGroupParticipants | +Get group call participants | +
phone.checkGroupCall | +Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs | +
phone.createGroupCall | +Create a group call or livestream | +
phone.toggleGroupCallStartSubscription | +Subscribe or unsubscribe to a scheduled group call | +
phone.leaveGroupCall | +Leave a group call | +
phone.toggleGroupCallSettings | +Change group call settings | +
phone.inviteToGroupCall | +Invite a set of users to a group call. | +
phone.getGroupCall | +Get info about a group call | +
phone.joinGroupCall | +Join a group call | +
phone.leaveGroupCallPresentation | +Stop screen sharing in a group call | +
phone.discardGroupCall | +Terminate a group call | +
phone.joinGroupCallPresentation | +Start screen sharing in a call | +
phone.startScheduledGroupCall | +Start a scheduled group call. | +
phone.saveDefaultGroupCallJoinAs | +Set the default peer that will be used to join a group call in a specific dialog. | +
Name | +Description | +
---|---|
messages.uploadImportedMedia | +Upload a media file associated with an imported chat, click here for more info ». | +
messages.startHistoryImport | +Complete the history import process, importing all messages into the chat. To be called only after initializing the import with messages.initHistoryImport and uploading all files using messages.uploadImportedMedia. |
+
messages.checkHistoryImportPeer | +Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». If the check succeeds, and no RPC errors are returned, a messages.CheckedHistoryImportPeer constructor will be returned, with a confirmation text to be shown to the user, before actually initializing the import. |
+
messages.checkHistoryImport | +Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». | +
messages.initHistoryImport | +Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ». | +
Name | +Description | +
---|---|
langpack.getDifference | +Get new strings in languagepack | +
langpack.getLangPack | +Get localization pack strings | +
langpack.getLanguage | +Get information about a language in a localization pack | +
langpack.getLanguages | +Get information about all languages in a localization pack | +
langpack.getStrings | +Get strings from a language pack | +
Name | +Description | +
---|---|
account.getAutoDownloadSettings | +Get media autodownload settings | +
account.saveAutoDownloadSettings | +Change media autodownload settings | +
Name | +Description | +
---|---|
messages.getReplies | +Get messages in a reply thread | +
contacts.blockFromReplies | +Stop getting notifications about thread replies of a certain user in @replies |
+
messages.getDiscussionMessage | +Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group | +
messages.readDiscussion | +Mark a thread as read | +
Name | +Description | +
---|---|
messages.getMessagesReactions | +Get message reactions | +
messages.sendReaction | +Send reaction to message | +
messages.getMessageReactionsList | +Get full message reaction list | +
Name | +Description | +
---|---|
messages.deleteHistory | +Deletes communication history. | +
messages.deleteMessages | +Deletes messages by their identifiers. | +
messages.editMessage | +Edit message | +
messages.forwardMessages | +Forwards messages by their IDs. | +
messages.getHistory | +Gets back the conversation history with one interlocutor / within a chat | +
messages.getMessageEditData | +Find out if a media message's caption can be edited | +
messages.getMessages | +Returns the list of messages by their IDs. | +
messages.getMessagesViews | +Get and increase the view counter of a message sent or forwarded from a channel | +
messages.getRecentLocations | +Get live location history of a certain user | +
messages.getSearchCounters | +Get the number of results that would be found by a messages.search call with the same parameters | +
messages.getUnreadMentions | +Get unread messages where we were mentioned | +
messages.readHistory | +Marks message history as read. | +
messages.readMentions | +Mark mentions as read | +
messages.readMessageContents | +Notifies the sender about the recipient having listened a voice message or watched a video. | +
messages.receivedMessages | +Confirms receipt of messages by a client, cancels PUSH-notification sending. | +
messages.search | +Gets back found messages | +
messages.searchGlobal | +Search for messages and peers globally | +
messages.sendMedia | +Send a media | +
messages.sendMessage | +Sends a message to a chat | +
messages.sendMultiMedia | +Send an album or grouped media | +
messages.updatePinnedMessage | +Pin a message | +
messages.unpinAllMessages | +Unpin all pinned messages | +
Name | +Description | +
---|---|
account.registerDevice | +Register device to receive PUSH notifications | +
account.unregisterDevice | +Deletes a device by its token, stops sending PUSH-notifications to it. | +
account.updateDeviceLocked | +When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. | +
account.getNotifyExceptions | +Returns list of chats with non-default notification settings | +
account.getNotifySettings | +Gets current notification settings for a given user/group, from all users/all groups. | +
account.updateNotifySettings | +Edits notification settings from a given user/group, from all users/all groups. | +
account.resetNotifySettings | +Resets all notification settings from users and groups. | +
Name | +Description | +
---|---|
users.getFullUser | +Returns extended user info by ID. | +
users.getUsers | +Returns basic user info according to their identifiers. | +
Name | +Description | +
---|---|
payments.getSavedInfo | +Get saved payment information | +
payments.clearSavedInfo | +Clear saved payment information | +
payments.getPaymentForm | +Get a payment form | +
payments.validateRequestedInfo | +Submit requested order information for validation | +
messages.setBotShippingResults | +If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an updateBotShippingQuery update. Use this method to reply to shipping queries. | +
account.getTmpPassword | +Get temporary payment password | +
payments.sendPaymentForm | +Send compiled payment form | +
messages.setBotPrecheckoutResults | +Once the user has confirmed their payment and shipping details, the bot receives an updateBotPrecheckoutQuery update. Use this method to respond to such pre-checkout queries. Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. |
+
payments.getPaymentReceipt | +Get payment receipt | +
Name | +Description | +
---|---|
messages.getPollResults | +Get poll results | +
messages.getPollVotes | +Get poll results for non-anonymous polls | +
messages.sendVote | +Vote in a poll | +
Name | +Description | +
---|---|
messages.sendScheduledMessages | +Send scheduled messages right away | +
messages.getScheduledHistory | +Get scheduled messages | +
messages.deleteScheduledMessages | +Delete scheduled messages | +
messages.getScheduledMessages | +Get scheduled messages | +
Name | +Description | +
---|---|
account.getContentSettings | +Get sensitive content settings | +
account.setContentSettings | +Set sensitive content settings (for viewing or hiding NSFW content) | +
Name | +Description | +
---|---|
channels.getSponsoredMessages | +Get a list of sponsored messages | +
channels.viewSponsoredMessage | +Mark a specific sponsored message as read | +
Name | +Description | +
---|---|
help.getProxyData | +Get promotion info of the currently-used MTProxy | +
Name | +Description | +
---|---|
stats.loadAsyncGraph | +Load channel statistics graph asynchronously | +
stats.getBroadcastStats | +Get channel statistics | +
stats.getMessagePublicForwards | +Obtains a list of messages, indicating to which other public channels was a channel message forwarded. Will return a list of messages with peer_id equal to the public channel to which this message was forwarded. |
+
stats.getMegagroupStats | +Get supergroup statistics | +
stats.getMessageStats | +Get message statistics | +
Name | +Description | +
---|---|
messages.getOldFeaturedStickers | +Method for fetching previously featured stickers | +
messages.toggleStickerSets | +Apply changes to multiple stickersets | +
stickers.suggestShortName | +Suggests a short name for a given stickerpack name | +
stickers.checkShortName | +Check whether the given short name is available | +
stickers.setStickerSetThumb | +Set stickerset thumbnail | +
stickers.addStickerToSet | +Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. | +
stickers.changeStickerPosition | +Changes the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot | +
stickers.createStickerSet | +Create a stickerset, bots only. | +
stickers.removeStickerFromSet | +Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. | +
messages.clearRecentStickers | +Clear recent stickers | +
messages.faveSticker | +Mark a sticker as favorite | +
messages.getAllStickers | +Get all installed stickers | +
messages.getArchivedStickers | +Get all archived stickers | +
messages.getAttachedStickers | +Get stickers attached to a photo or video | +
messages.getFavedStickers | +Get faved stickers | +
messages.getFeaturedStickers | +Get featured stickers | +
messages.getMaskStickers | +Get installed mask stickers | +
messages.getRecentStickers | +Get recent stickers | +
messages.getStickerSet | +Get info about a stickerset | +
messages.getStickers | +Get stickers by emoji | +
messages.saveRecentSticker | +Add/remove sticker from recent stickers list | +
messages.installStickerSet | +Install a stickerset | +
messages.readFeaturedStickers | +Mark new featured stickers as read | +
messages.reorderStickerSets | +Reorder installed stickersets | +
messages.searchStickerSets | +Search for stickersets | +
messages.uninstallStickerSet | +Uninstall a stickerset | +
Name | +Description | +
---|---|
account.changePhone | +Change the phone number of the current account | +
account.confirmPhone | +Confirm a phone number to cancel account deletion, for more info click here » | +
account.deleteAccount | +Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. | +
account.getAccountTTL | +Get days to live of account | +
account.getPrivacy | +Get privacy settings of current account | +
account.resetAuthorization | +Log out an active authorized session by its hash | +
account.sendChangePhoneCode | +Verify a new phone number to associate to the current account | +
account.sendConfirmPhoneCode | +Send confirmation code to cancel account deletion, for more info click here » | +
account.setAccountTTL | +Set account self-destruction period | +
account.setPrivacy | +Change privacy settings of current account | +
account.setGlobalPrivacySettings | +Set global privacy settings | +
account.getGlobalPrivacySettings | +Get global privacy settings | +
account.updateProfile | +Updates user profile. | +
account.updateStatus | +Updates online user status. | +
Name | +Description | +
---|---|
photos.deletePhotos | +Deletes profile photos. | +
photos.getUserPhotos | +Returns the list of user photos. | +
photos.updateProfilePhoto | +Installs a previously uploaded photo as a profile photo. | +
photos.uploadProfilePhoto | +Updates current user profile photo. | +
Name | +Description | +
---|---|
channels.checkUsername | +Check if a username is free and can be assigned to a channel/supergroup | +
channels.updateUsername | +Change the username of a supergroup/channel | +
account.updateUsername | +Changes username for the current user. | +
account.checkUsername | +Validates a username and checks availability. | +
contacts.resolveUsername | +Resolve a @username to get peer info | +
Name | +Description | +
---|---|
account.getMultiWallPapers | +Get info about multiple wallpapers | +
account.getWallPaper | +Get info about a certain wallpaper | +
account.getWallPapers | +Returns a list of available wallpapers. | +
account.installWallPaper | +Install wallpaper | +
account.resetWallPapers | +Delete installed wallpapers | +
account.saveWallPaper | +Install/uninstall wallpaper | +
account.uploadWallPaper | +Create and upload a new wallpaper | +
See also:
+While MTProto is designed to be a reasonably fast and secure protocol, its advantages can be easily negated by careless implementation. We collected some security guidelines for client software developers on this page. All Telegram clients are required to comply.
+++Note that as of version 4.6, major Telegram clients are using MTProto 2.0. +MTProto v.1.0 is deprecated and is currently being phased out.
+
We use DH key exchange in two cases:
+ +In both cases, there are some verifications to be done whenever DH is used:
+Client is expected to check whether p = dh_prime is a safe 2048-bit prime (meaning that both p and (p-1)/2 are prime, and that 2^2047 < p < 2^2048), and that g generates a cyclic subgroup of prime order (p-1)/2, i.e. is a quadratic residue mod p. Since g is always equal to 2, 3, 4, 5, 6 or 7, this is easily done using quadratic reciprocity law, yielding a simple condition on p mod 4g -- namely, p mod 8 = 7 for g = 2; p mod 3 = 2 for g = 3; no extra condition for g = 4; p mod 5 = 1 or 4 for g = 5; p mod 24 = 19 or 23 for g = 6; and p mod 7 = 3, 5 or 6 for g = 7. After g and p have been checked by the client, it makes sense to cache the result, so as not to repeat lengthy computations in future.
+If the verification takes too long (which is the case for older mobile devices), one might initially run only 15 Miller--Rabin iterations (use parameter 30 in Java) for verifying primeness of p and (p - 1)/2 with error probability not exceeding one billionth, and do more iterations in the background later.
+Another way to optimize this is to embed into the client application code a small table with some known "good" couples (g,p) (or just known safe primes p, since the condition on g is easily verified during execution), checked during code generation phase, so as to avoid doing such verification during runtime altogether. The server rarely changes these values, thus one usually needs to put the current value of server's dh_prime into such a table. For example, the current value of dh_prime equals (in big-endian byte order)
+C7 1C AE B9 C6 B1 C9 04 8E 6C 52 2F 70 F1 3F 73 98 0D 40 23 8E 3E 21 C1 49 34 D0 37 56 3D 93 0F 48 19 8A 0A A7 C1 40 58 22 94 93 D2 25 30 F4 DB FA 33 6F 6E 0A C9 25 13 95 43 AE D4 4C CE 7C 37 20 FD 51 F6 94 58 70 5A C6 8C D4 FE 6B 6B 13 AB DC 97 46 51 29 69 32 84 54 F1 8F AF 8C 59 5F 64 24 77 FE 96 BB 2A 94 1D 5B CD 1D 4A C8 CC 49 88 07 08 FA 9B 37 8E 3C 4F 3A 90 60 BE E6 7C F9 A4 A4 A6 95 81 10 51 90 7E 16 27 53 B5 6B 0F 6B 41 0D BA 74 D8 A8 4B 2A 14 B3 14 4E 0E F1 28 47 54 FD 17 ED 95 0D 59 65 B4 B9 DD 46 58 2D B1 17 8D 16 9C 6B C4 65 B0 D6 FF 9C A3 92 8F EF 5B 9A E4 E4 18 FC 15 E8 3E BE A0 F8 7F A9 FF 5E ED 70 05 0D ED 28 49 F4 7B F9 59 D9 56 85 0C E9 29 85 1F 0D 81 15 F6 35 B1 05 EE 2E 4E 15 D0 4B 24 54 BF 6F 4F AD F0 34 B1 04 03 11 9C D8 E3 B9 2F CC 5B
+Apart from the conditions on the Diffie-Hellman prime dh_prime and generator g, both sides are to check that g, g_a and g_b are greater than 1 and less than dh_prime - 1. We recommend checking that g_a and g_b are between 2^{2048-64} and dh_prime - 2^{2048-64} as well.
+Once the client receives a server_DH_params_ok
answer in step 5) of the Authorization Key generation protocol and decrypts it obtaining answer_with_hash
, it MUST check that
answer_with_hash := SHA1(answer) + answer + (0-15 random bytes)
+In other words, the first 20 bytes of answer_with_hash
must be equal to SHA1 of the remainder of the decrypted message without the padding random bytes.
When the client receives and/or decrypts server messages during creation of Authorization Key, and these messages contain some nonce fields already known to the client from messages previously obtained during the same run of the protocol, the client is to check that these fields indeed contain the values previosly known.
+a
and b
Client must use a cryptographically secure PRNG to generate secret exponents a
or b
for DH key exchange. For secret chats, the client might request some entropy (random bytes) from the server while invoking messages.getDhConfig and feed these random bytes into its PRNG (for example, by PRNG_seed
if OpenSSL library is used), but never using these "random" bytes by themselves or replacing by them the local PRNG seed. One should mix bytes received from server into local PRNG seed.
Some important checks are to be done while sending and especially receiving encrypted MTProto messages.
+msg_key
is used not only to compute the AES key and IV to decrypt the received message. After decryption, the client MUST check that msg_key
is indeed equal to SHA256 of the plaintext obtained as the result of decryption (including the final 12...1024 padding bytes), prepended with 32 bytes taken from the auth_key
, as explained in MTProto 2.0 Description.
If an error is encountered before this check could be performed, the client must perform the msg_key
check anyway before returning any result. Note that the response to any error encountered before the msg_key
check must be the same as the response to a failed msg_key
check.
The client must check that the length of the message or container obtained from the decrypted message (computed from its length
field) does not exceed the total size of the plaintext, and that the difference (i.e. the length of the random padding) lies in the range from 12 to 1024 bytes.
The length should be always divisible by 4 and non-negative. On no account the client is to access data past the end of the decryption buffer containing the plaintext message.
+The client is to check that the session_id
field in the decrypted message indeed equals to that of an active session created by the client.
The client must check that msg_id
has even parity for messages from client to server, and odd parity for messages from server to client.
In addition, the identifiers (msg_id) of the last N messages received from the other side must be stored, and if a message comes in with an msg_id lower than all or equal to any of the stored values, that message is to be ignored. Otherwise, the new message msg_id is added to the set, and, if the number of stored msg_id values is greater than N, the oldest (i. e. the lowest) is discarded.
+In addition, msg_id values that belong over 30 seconds in the future or over 300 seconds in the past are to be ignored (recall that msg_id
approximately equals unixtime * 2^32). This is especially important for the server. The client would also find this useful (to protect from a replay attack), but only if it is certain of its time (for example, if its time has been synchronized with that of the server).
Certain client-to-server service messages containing data sent by the client to the server (for example, msg_id
of a recent client query) may, nonetheless, be processed on the client even if the time appears to be “incorrect”. This is especially true of messages to change server_salt and notifications about invalid time on the client. See Mobile Protocol: Service Messages.
If one of the checks listed above fails, the client is to completely discard the message obtained from server. We also recommend closing and reestablishing the TCP connection to the server, then retrying the operation or the whole key generation protocol.
+No information from incorrect messages can be used. Even if the application throws an exception and dies, this is much better than continuing with invalid data.
+Notice that invalid messages will infrequently appear during normal work even if no malicious tampering is being done. This is due to network transmission errors. We recommend ignoring the invalid message and closing the TCP connection, then creating a new TCP connection to the server and retrying the original query.
++The previous version of security recommendations relevant for MTProto 1.0 clients is available here.
+
++This document describes security recommendations for clients using MTProto 1.0, its status is DEPRECATED. +For up-to-date security recommendations, kindly see this document.
+
See also:
+While MTProto is designed to be a reasonably fast and secure protocol, its advantages can be easily negated by careless implementation. We collected some security guidelines for client software developers on this page. All Telegram clients are required to comply with these.
+We use DH key exchange in two cases:
+ +In both cases, there are some verifications to be done whenever DH is used:
+Client is expected to check whether p = dh_prime is a safe 2048-bit prime (meaning that both p and (p-1)/2 are prime, and that 2^2047 < p < 2^2048), and that g generates a cyclic subgroup of prime order (p-1)/2, i.e. is a quadratic residue mod p. Since g is always equal to 2, 3, 4, 5, 6 or 7, this is easily done using quadratic reciprocity law, yielding a simple condition on p mod 4g -- namely, p mod 8 = 7 for g = 2; p mod 3 = 2 for g = 3; no extra condition for g = 4; p mod 5 = 1 or 4 for g = 5; p mod 24 = 19 or 23 for g = 6; and p mod 7 = 3, 5 or 6 for g = 7. After g and p have been checked by the client, it makes sense to cache the result, so as not to repeat lengthy computations in future.
+If the verification takes too long (which is the case for older mobile devices), one might initially run only 15 Miller--Rabin iterations (use parameter 30 in Java) for verifying primeness of p and (p - 1)/2 with error probability not exceeding one billionth, and do more iterations in the background later.
+Another way to optimize this is to embed into the client application code a small table with some known "good" couples (g,p) (or just known safe primes p, since the condition on g is easily verified during execution), checked during code generation phase, so as to avoid doing such verification during runtime altogether. The server rarely changes these values, thus one usually needs to put the current value of server's dh_prime into such a table. For example, the current value of dh_prime equals (in big-endian byte order)
+C7 1C AE B9 C6 B1 C9 04 8E 6C 52 2F 70 F1 3F 73 98 0D 40 23 8E 3E 21 C1 49 34 D0 37 56 3D 93 0F 48 19 8A 0A A7 C1 40 58 22 94 93 D2 25 30 F4 DB FA 33 6F 6E 0A C9 25 13 95 43 AE D4 4C CE 7C 37 20 FD 51 F6 94 58 70 5A C6 8C D4 FE 6B 6B 13 AB DC 97 46 51 29 69 32 84 54 F1 8F AF 8C 59 5F 64 24 77 FE 96 BB 2A 94 1D 5B CD 1D 4A C8 CC 49 88 07 08 FA 9B 37 8E 3C 4F 3A 90 60 BE E6 7C F9 A4 A4 A6 95 81 10 51 90 7E 16 27 53 B5 6B 0F 6B 41 0D BA 74 D8 A8 4B 2A 14 B3 14 4E 0E F1 28 47 54 FD 17 ED 95 0D 59 65 B4 B9 DD 46 58 2D B1 17 8D 16 9C 6B C4 65 B0 D6 FF 9C A3 92 8F EF 5B 9A E4 E4 18 FC 15 E8 3E BE A0 F8 7F A9 FF 5E ED 70 05 0D ED 28 49 F4 7B F9 59 D9 56 85 0C E9 29 85 1F 0D 81 15 F6 35 B1 05 EE 2E 4E 15 D0 4B 24 54 BF 6F 4F AD F0 34 B1 04 03 11 9C D8 E3 B9 2F CC 5B
+Apart from the conditions on the Diffie-Hellman prime dh_prime and generator g, both sides are to check that g, g_a and g_b are greater than 1 and less than dh_prime - 1. We recommend checking that g_a and g_b are between 2^{2048-64} and dh_prime - 2^{2048-64} as well.
+Once the client receives a server_DH_params_ok
answer in step 5) of the Authorization Key generation protocol and decrypts it obtaining answer_with_hash
, it MUST check that
answer_with_hash := SHA1(answer) + answer + (0-15 random bytes)
+In other words, the first 20 bytes of answer_with_hash
must be equal to SHA1 of the remainder of the decrypted message without the padding random bytes.
When the client receives and/or decrypts server messages during creation of Authorization Key, and these messages contain some nonce fields already known to the client from messages previously obtained during the same run of the protocol, the client is to check that these fields indeed contain the values previosly known.
+a
and b
Client must use a cryptographically secure PRNG to generate secret exponents a
or b
for DH key exchange. For secret chats, the client might request some entropy (random bytes) from the server while invoking messages.getDhConfig and feed these random bytes into its PRNG (for example, by PRNG_seed
if OpenSSL library is used), but never using these "random" bytes by themselves or replacing by them the local PRNG seed. One should mix bytes received from server into local PRNG seed.
Some important checks are to be done while sending and especially receiving encrypted MTProto messages.
+msg_key
is used not only to compute the AES key and IV to decrypt the received message. After decryption, the client MUST check that msg_key
is indeed equal to SHA1 of the plaintext obtained as the result of decryption (without the final padding bytes).
If an error is encountered before this check could be performed, the client must perform the msg-key
check anyway before returning any result. Note that the response to any error encountered before the msg_key
check must be the same as the response to a failed msg_key
check.
The client is to check that the length of the message or container obtained from the decrypted message (computed from its length
field) does not exceed the total size of the plaintext, and that the difference is not more than 15 bytes. Apart from this, knowing the total length is important for the previous verification.
The length should be always divisible by 4 and non-negative. On no account the client is to access data past the end of the decryption buffer containing the plaintext message.
+The client is to check that the session_id
field in the decrypted message indeed equals to that of an active session created by the client.
The client must check that msg_id
has even parity for messages from client to server, and odd parity for messages from server to client.
In addition, the identifiers (msg_id) of the last N messages received from the other side must be stored, and if a message comes in with an msg_id lower than all or equal to any of the stored values, that message is to be ignored. Otherwise, the new message msg_id is added to the set, and, if the number of stored msg_id values is greater than N, the oldest (i. e. the lowest) is discarded.
+In addition, msg_id values that belong over 30 seconds in the future or over 300 seconds in the past are to be ignored (recall that msg_id
approximately equals unixtime * 2^32). This is especially important for the server. The client would also find this useful (to protect from a replay attack), but only if it is certain of its time (for example, if its time has been synchronized with that of the server).
Certain client-to-server service messages containing data sent by the client to the server (for example, msg_id
of a recent client query) may, nonetheless, be processed on the client even if the time appears to be “incorrect”. This is especially true of messages to change server_salt and notifications about invalid time on the client. See Mobile Protocol: Service Messages.
If one of the checks listed above fails, the client is to completely discard the message obtained from server. We also recommend closing and reestablishing the TCP connection to the server, then retrying the operation or the whole key generation protocol.
+No information from incorrect messages can be used. Even if the application throws an exception and dies, this is much better than continuing with invalid data.
+Notice that invalid messages will infrequently appear during normal work even if no malicious tampering is being done. This is due to network transmission errors. We recommend ignoring the invalid message and closing the TCP connection, then creating a new TCP connection to the server and retrying the original query.