@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
@channelusername )
|
| 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 |
| use_independent_chat_permissions | Boolean | Optional | Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. |
| 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_video_chats | Boolean | Optional | Pass True if the administrator can manage video 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 they have 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 |
| can_manage_topics | Boolean | Optional | Pass True if the user is allowed to create, rename, close, and reopen forum topics, 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_independent_chat_permissions | Boolean | Optional | Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. |
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 | The 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 | The 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-128 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, which aren't bots. Returns an Array of ChatMember objects.
| 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. The method is only guaranteed to work for other users if the bot is an administrator in the 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 get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects.
Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object.
| 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 ) |
| name | String | Yes | Topic name, 1-128 characters |
| icon_color | Integer | Optional | Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F) |
| icon_custom_emoji_id | String | Optional | Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. |
Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. 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 ) |
| message_thread_id | Integer | Yes | Unique identifier for the target message thread of the forum topic |
| name | String | Optional | New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept |
| icon_custom_emoji_id | String | Optional | New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept |
Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. 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 ) |
| message_thread_id | Integer | Yes | Unique identifier for the target message thread of the forum topic |
Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. 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 ) |
| message_thread_id | Integer | Yes | Unique identifier for the target message thread of the forum topic |
Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages 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 ) |
| message_thread_id | Integer | Yes | Unique identifier for the target message thread of the forum topic |
Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. 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 ) |
| message_thread_id | Integer | Yes | Unique identifier for the target message thread of the forum topic |
Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics 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 ) |
| name | String | Yes | New topic name, 1-128 characters |
Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics 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 ) |
Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. 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 hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. 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 unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics 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 ) |
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 this manual 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 an Array of BotCommand objects. 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 |
Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| description | String | Optional | New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language. |
| language_code | String | Optional | A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description. |
Use this method to get the current bot description for the given user language. Returns BotDescription on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| language_code | String | Optional | A two-letter ISO 639-1 language code or an empty string |
Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| short_description | String | Optional | New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language. |
| language_code | String | Optional | A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description. |
Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| language_code | String | Optional | A two-letter ISO 639-1 language code or an empty string |
Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| chat_id | Integer | Optional | Unique identifier for the target private chat. If not specified, default bot's menu button will be changed |
| menu_button | MenuButton | Optional | A JSON-serialized object for the bot's new menu button. Defaults to MenuButtonDefault |
Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| chat_id | Integer | Optional | Unique identifier for the target private chat. If not specified, default bot's menu button will be returned |
Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| rights | ChatAdministratorRights | Optional | A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared. |
| for_channels | Boolean | Optional | Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed. |
Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| for_channels | Boolean | Optional | Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned. |
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 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 | The 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 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.
- Service messages about a supergroup, channel, or forum topic
creation can't be deleted.
- 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. |
| type | String | Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video. |
| width | Integer | Sticker width |
| height | Integer | Sticker height |
| is_animated | Boolean | True, if the sticker is animated |
| is_video | Boolean | True, if the sticker is a video sticker |
| thumbnail | 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 |
| premium_animation | File | Optional. For premium regular stickers, premium animation for the sticker |
| mask_position | MaskPosition | Optional. For mask stickers, the position where the mask should be placed |
| custom_emoji_id | String | Optional. For custom emoji stickers, unique identifier of the custom emoji |
| needs_repainting | True | Optional. True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places |
| 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 |
| sticker_type | String | Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji” |
| is_animated | Boolean | True, if the sticker set contains animated stickers |
| is_video | Boolean | True, if the sticker set contains video stickers |
| stickers | Array of Sticker | List of all set stickers |
| thumbnail | PhotoSize | Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM 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. |
This object describes a sticker to be added to a sticker set.
| Field | Type | Description |
|---|---|---|
| sticker | InputFile or String | The added sticker. 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, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. More information on Sending Files » |
| emoji_list | Array of String | List of 1-20 emoji associated with the sticker |
| mask_position | MaskPosition | Optional. Position where the mask should be placed on faces. For “mask” stickers only. |
| keywords | Array of String | Optional. List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only. |
Use this method to send static .WEBP, animated .TGS, or video .WEBM 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 ) |
| message_thread_id | Integer | Optional | Unique identifier for the target message thread (topic) of the forum; for forum supergroups only |
| 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 sticker from the Internet, or upload a new .WEBP or .TGS sticker using multipart/form-data. More information on Sending Files ». Video stickers can only be sent by a file_id. Animated stickers can't be sent via an HTTP URL. |
| emoji | String | Optional | Emoji associated with the sticker; only for just uploaded stickers |
| disable_notification | Boolean | Optional | Sends the message silently. Users will receive a notification with no sound. |
| protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
| 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 get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.
| Parameter | Type | Required | Description |
|---|---|---|---|
| custom_emoji_ids | Array of String | Yes | List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. |
Use this method to upload a file with a sticker for later use in the createNewStickerSet and addStickerToSet methods (the file 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 |
| sticker | InputFile | Yes | A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. More information on Sending Files » |
| sticker_format | String | Yes | Format of the sticker, must be one of “static”, “animated”, “video” |
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. 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 |
| stickers | Array of InputSticker | Yes | A JSON-serialized list of 1-50 initial stickers to be added to the sticker set |
| sticker_format | String | Yes | Format of stickers in the set, must be one of “static”, “animated”, “video” |
| sticker_type | String | Optional | Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created. |
| needs_repainting | Boolean | Optional | Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only |
Use this method to add a new sticker to a set created by the bot. The format of the added sticker must match the format of the other stickers in the set. Emoji sticker sets can have up to 200 stickers. Animated and video 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 |
| sticker | InputSticker | Yes | A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed. |
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 change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| sticker | String | Yes | File identifier of the sticker |
| emoji_list | Array of String | Yes | A JSON-serialized list of 1-20 emoji associated with the sticker |
Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| sticker | String | Yes | File identifier of the sticker |
| keywords | Array of String | Optional | A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters |
Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| sticker | String | Yes | File identifier of the sticker |
| mask_position | MaskPosition | Optional | A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position. |
Use this method to set the title of a created sticker set. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Sticker set name |
| title | String | Yes | Sticker set title, 1-64 characters |
Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. 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 |
| thumbnail | InputFile or String | Optional | A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video 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 information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. |
Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Sticker set name |
| custom_emoji_id | String | Optional | Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail. |
Use this method to delete a sticker set that was created by the bot. Returns True on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Sticker set name |
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 |
| thumbnail_url | String | Optional. Url of the thumbnail for the result |
| thumbnail_width | Integer | Optional. Thumbnail width |
| thumbnail_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 |
| thumbnail_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 |
| thumbnail_url | String | URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result |
| thumbnail_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 MPEG4 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 |
| thumbnail_url | String | URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result |
| thumbnail_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 the video URL, “text/html” or “video/mp4” |
| thumbnail_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 |
| thumbnail_url | String | Optional. URL of the thumbnail (JPEG only) for the file |
| thumbnail_width | Integer | Optional. Thumbnail width |
| thumbnail_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 |
| thumbnail_url | String | Optional. Url of the thumbnail for the result |
| thumbnail_width | Integer | Optional. Thumbnail width |
| thumbnail_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 |
| thumbnail_url | String | Optional. Url of the thumbnail for the result |
| thumbnail_width | Integer | Optional. Thumbnail width |
| thumbnail_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 |
| thumbnail_url | String | Optional. Url of the thumbnail for the result |
| thumbnail_width | Integer | Optional. Thumbnail width |
| thumbnail_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 MPEG4 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. |
| photo_size | Integer | Optional. Photo size in bytes |
| 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 the user's phone number should be sent to provider |
| send_email_to_provider | Boolean | Optional. Pass True if the 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.
Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.
| Parameter | Type | Required | Description |
|---|---|---|---|
| web_app_query_id | String | Yes | Unique identifier for the query to be answered |
| result | InlineQueryResult | Yes | A JSON-serialized object describing the message to be sent |
Describes an inline message sent by a Web App on behalf of a user.
| Field | Type | Description |
|---|---|---|
| inline_message_id | String | Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. |
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 ) |
| message_thread_id | Integer | Optional | Unique identifier for the target message thread (topic) of the forum; for forum supergroups only |
| 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 | Payment 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 | 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 in bytes |
| 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 the user's phone number should be sent to provider |
| send_email_to_provider | Boolean | Optional | Pass True if the 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. |
| protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
| 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. |
Use this method to create a link for an invoice. Returns the created invoice link as String on success.
| Parameter | Type | Required | Description |
|---|---|---|---|
| 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 | Payment 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. |
| provider_data | String | Optional | 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. |
| photo_size | Integer | Optional | Photo size in bytes |
| 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 the user's phone number should be sent to the provider |
| send_email_to_provider | Boolean | Optional | Pass True if the user's email address should be sent to the provider |
| is_flexible | Boolean | Optional | Pass True if the final price depends on the shipping method |
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 | Pass 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 | Two-letter 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 information 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 information 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.
Describes 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 |
Describes 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 |
Describes 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 |
| message_thread_id | Integer | Optional | Unique identifier for the target message thread (topic) of the forum; for forum supergroups only |
| 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. |
| protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
| 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. 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 their 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
»