Skip to content

Latest commit

 

History

History
1377 lines (698 loc) · 110 KB

telegram.md

File metadata and controls

1377 lines (698 loc) · 110 KB

Getting updates

Data Types

This object represents an incoming update.
At most one of the optional parameters can be present in any given update.

Update(update_id: Integer, message: Message, edited_message: Message, channel_post: Message, edited_channel_post: Message, business_connection: BusinessConnection, business_message: Message, edited_business_message: Message, deleted_business_messages: BusinessMessagesDeleted, message_reaction: MessageReactionUpdated, message_reaction_count: MessageReactionCountUpdated, inline_query: InlineQuery, chosen_inline_result: ChosenInlineResult, callback_query: CallbackQuery, shipping_query: ShippingQuery, pre_checkout_query: PreCheckoutQuery, poll: Poll, poll_answer: PollAnswer, my_chat_member: ChatMemberUpdated, chat_member: ChatMemberUpdated, chat_join_request: ChatJoinRequest, chat_boost: ChatBoostUpdated, removed_chat_boost: ChatBoostRemoved)

Describes the current status of a webhook.

WebhookInfo(url: String, has_custom_certificate: Boolean, pending_update_count: Integer, ip_address: String, last_error_date: Integer, last_error_message: String, last_synchronization_error_date: Integer, max_connections: Integer, allowed_updates: List<String>)

Methods

Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.

Notes
1. This method will not work if an outgoing webhook is set up.
2. In order to avoid getting duplicate updates, recalculate offset after each server response.

getUpdates(offset: Integer, limit: Integer, timeout: Integer, allowed_updates: List<String>)

Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.

If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.

Notes
1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.
3. Ports currently supported for webhooks: 443, 80, 88, 8443.

If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.

setWebhook(url: String, certificate: InputFile, ip_address: String, max_connections: Integer, allowed_updates: List<String>, drop_pending_updates: Boolean, secret_token: String)

Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.

deleteWebhook(drop_pending_updates: Boolean)

Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.

getWebhookInfo()

Available types

Data Types

This object represents a Telegram user or bot.

User(id: Integer, is_bot: Boolean, first_name: String, last_name: String, username: String, language_code: String, is_premium: Boolean, added_to_attachment_menu: Boolean, can_join_groups: Boolean, can_read_all_group_messages: Boolean, supports_inline_queries: Boolean, can_connect_to_business: Boolean, has_main_web_app: Boolean)

This object represents a chat.

Chat(id: Integer, type: String, title: String, username: String, first_name: String, last_name: String, is_forum: Boolean)

This object contains full information about a chat.

ChatFullInfo(id: Integer, type: String, title: String, username: String, first_name: String, last_name: String, is_forum: Boolean, accent_color_id: Integer, max_reaction_count: Integer, photo: ChatPhoto, active_usernames: List<String>, birthdate: Birthdate, business_intro: BusinessIntro, business_location: BusinessLocation, business_opening_hours: BusinessOpeningHours, personal_chat: Chat, available_reactions: List<ReactionType>, background_custom_emoji_id: String, profile_accent_color_id: Integer, profile_background_custom_emoji_id: String, emoji_status_custom_emoji_id: String, emoji_status_expiration_date: Integer, bio: String, has_private_forwards: Boolean, has_restricted_voice_and_video_messages: Boolean, join_to_send_messages: Boolean, join_by_request: Boolean, description: String, invite_link: String, pinned_message: Message, permissions: ChatPermissions, can_send_paid_media: Boolean, slow_mode_delay: Integer, unrestrict_boost_count: Integer, message_auto_delete_time: Integer, has_aggressive_anti_spam_enabled: Boolean, has_hidden_members: Boolean, has_protected_content: Boolean, has_visible_history: Boolean, sticker_set_name: String, can_set_sticker_set: Boolean, custom_emoji_sticker_set_name: String, linked_chat_id: Integer, location: ChatLocation)

This object represents a message.

Message(message_id: Integer, message_thread_id: Integer, from: User, sender_chat: Chat, sender_boost_count: Integer, sender_business_bot: User, date: Integer, business_connection_id: String, chat: Chat, forward_origin: MessageOrigin, is_topic_message: Boolean, is_automatic_forward: Boolean, reply_to_message: Message, external_reply: ExternalReplyInfo, quote: TextQuote, reply_to_story: Story, via_bot: User, edit_date: Integer, has_protected_content: Boolean, is_from_offline: Boolean, media_group_id: String, author_signature: String, text: String, entities: List<MessageEntity>, link_preview_options: LinkPreviewOptions, effect_id: String, animation: Animation, audio: Audio, document: Document, paid_media: PaidMediaInfo, photo: List<PhotoSize>, sticker: Sticker, story: Story, video: Video, video_note: VideoNote, voice: Voice, caption: String, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, has_media_spoiler: Boolean, contact: Contact, dice: Dice, game: Game, poll: Poll, venue: Venue, location: Location, new_chat_members: List<User>, left_chat_member: User, new_chat_title: String, new_chat_photo: List<PhotoSize>, delete_chat_photo: Boolean, group_chat_created: Boolean, supergroup_chat_created: Boolean, channel_chat_created: Boolean, message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged, migrate_to_chat_id: Integer, migrate_from_chat_id: Integer, pinned_message: MaybeInaccessibleMessage, invoice: Invoice, successful_payment: SuccessfulPayment, refunded_payment: RefundedPayment, users_shared: UsersShared, chat_shared: ChatShared, connected_website: String, write_access_allowed: WriteAccessAllowed, passport_data: PassportData, proximity_alert_triggered: ProximityAlertTriggered, boost_added: ChatBoostAdded, chat_background_set: ChatBackground, forum_topic_created: ForumTopicCreated, forum_topic_edited: ForumTopicEdited, forum_topic_closed: ForumTopicClosed, forum_topic_reopened: ForumTopicReopened, general_forum_topic_hidden: GeneralForumTopicHidden, general_forum_topic_unhidden: GeneralForumTopicUnhidden, giveaway_created: GiveawayCreated, giveaway: Giveaway, giveaway_winners: GiveawayWinners, giveaway_completed: GiveawayCompleted, video_chat_scheduled: VideoChatScheduled, video_chat_started: VideoChatStarted, video_chat_ended: VideoChatEnded, video_chat_participants_invited: VideoChatParticipantsInvited, web_app_data: WebAppData, reply_markup: InlineKeyboardMarkup)

This object represents a unique message identifier.

MessageId(message_id: Integer)

This object describes a message that was deleted or is otherwise inaccessible to the bot.

InaccessibleMessage(chat: Chat, message_id: Integer, date: Integer)

This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.

MessageEntity(type: String, offset: Integer, length: Integer, url: String, user: User, language: String, custom_emoji_id: String)

This object contains information about the quoted part of a message that is replied to by the given message.

TextQuote(text: String, entities: List<MessageEntity>, position: Integer, is_manual: Boolean)

This object contains information about a message that is being replied to, which may come from another chat or forum topic.

ExternalReplyInfo(origin: MessageOrigin, chat: Chat, message_id: Integer, link_preview_options: LinkPreviewOptions, animation: Animation, audio: Audio, document: Document, paid_media: PaidMediaInfo, photo: List<PhotoSize>, sticker: Sticker, story: Story, video: Video, video_note: VideoNote, voice: Voice, has_media_spoiler: Boolean, contact: Contact, dice: Dice, game: Game, giveaway: Giveaway, giveaway_winners: GiveawayWinners, invoice: Invoice, location: Location, poll: Poll, venue: Venue)

Describes reply parameters for the message that is being sent.

ReplyParameters(message_id: Integer, chat_id: IntegerOrString, allow_sending_without_reply: Boolean, quote: String, quote_parse_mode: String, quote_entities: List<MessageEntity>, quote_position: Integer)

The message was originally sent by a known user.

MessageOriginUser(type: String, date: Integer, sender_user: User)

The message was originally sent by an unknown user.

MessageOriginHiddenUser(type: String, date: Integer, sender_user_name: String)

The message was originally sent on behalf of a chat to a group chat.

MessageOriginChat(type: String, date: Integer, sender_chat: Chat, author_signature: String)

The message was originally sent to a channel chat.

MessageOriginChannel(type: String, date: Integer, chat: Chat, message_id: Integer, author_signature: String)

This object represents one size of a photo or a file / sticker thumbnail.

PhotoSize(file_id: String, file_unique_id: String, width: Integer, height: Integer, file_size: Integer)

This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).

Animation(file_id: String, file_unique_id: String, width: Integer, height: Integer, duration: Integer, thumbnail: PhotoSize, file_name: String, mime_type: String, file_size: Integer)

This object represents an audio file to be treated as music by the Telegram clients.

Audio(file_id: String, file_unique_id: String, duration: Integer, performer: String, title: String, file_name: String, mime_type: String, file_size: Integer, thumbnail: PhotoSize)

This object represents a general file (as opposed to photos, voice messages and audio files).

Document(file_id: String, file_unique_id: String, thumbnail: PhotoSize, file_name: String, mime_type: String, file_size: Integer)

This object represents a story.

Story(chat: Chat, id: Integer)

This object represents a video file.

Video(file_id: String, file_unique_id: String, width: Integer, height: Integer, duration: Integer, thumbnail: PhotoSize, file_name: String, mime_type: String, file_size: Integer)

This object represents a video message (available in Telegram apps as of v.4.0).

VideoNote(file_id: String, file_unique_id: String, length: Integer, duration: Integer, thumbnail: PhotoSize, file_size: Integer)

This object represents a voice note.

Voice(file_id: String, file_unique_id: String, duration: Integer, mime_type: String, file_size: Integer)

Describes the paid media added to a message.

PaidMediaInfo(star_count: Integer, paid_media: List<PaidMedia>)

The paid media isn't available before the payment.

PaidMediaPreview(type: String, width: Integer, height: Integer, duration: Integer)

The paid media is a photo.

PaidMediaPhoto(type: String, photo: List<PhotoSize>)

The paid media is a video.

PaidMediaVideo(type: String, video: Video)

This object represents a phone contact.

Contact(phone_number: String, first_name: String, last_name: String, user_id: Integer, vcard: String)

This object represents an animated emoji that displays a random value.

Dice(emoji: String, value: Integer)

This object contains information about one answer option in a poll.

PollOption(text: String, text_entities: List<MessageEntity>, voter_count: Integer)

This object contains information about one answer option in a poll to be sent.

InputPollOption(text: String, text_parse_mode: String, text_entities: List<MessageEntity>)

This object represents an answer of a user in a non-anonymous poll.

PollAnswer(poll_id: String, voter_chat: Chat, user: User, option_ids: List<Integer>)

This object contains information about a poll.

Poll(id: String, question: String, question_entities: List<MessageEntity>, options: List<PollOption>, total_voter_count: Integer, is_closed: Boolean, is_anonymous: Boolean, type: String, allows_multiple_answers: Boolean, correct_option_id: Integer, explanation: String, explanation_entities: List<MessageEntity>, open_period: Integer, close_date: Integer)

This object represents a point on the map.

Location(latitude: Float, longitude: Float, horizontal_accuracy: Float, live_period: Integer, heading: Integer, proximity_alert_radius: Integer)

This object represents a venue.

Venue(location: Location, title: String, address: String, foursquare_id: String, foursquare_type: String, google_place_id: String, google_place_type: String)

Describes data sent from a Web App to the bot.

WebAppData(data: String, button_text: String)

This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.

ProximityAlertTriggered(traveler: User, watcher: User, distance: Integer)

This object represents a service message about a change in auto-delete timer settings.

MessageAutoDeleteTimerChanged(message_auto_delete_time: Integer)

This object represents a service message about a user boosting a chat.

ChatBoostAdded(boost_count: Integer)

The background is filled using the selected color.

BackgroundFillSolid(type: String, color: Integer)

The background is a gradient fill.

BackgroundFillGradient(type: String, top_color: Integer, bottom_color: Integer, rotation_angle: Integer)

The background is a freeform gradient that rotates after every message in the chat.

BackgroundFillFreeformGradient(type: String, colors: List<Integer>)

The background is automatically filled based on the selected colors.

BackgroundTypeFill(type: String, fill: BackgroundFill, dark_theme_dimming: Integer)

The background is a wallpaper in the JPEG format.

BackgroundTypeWallpaper(type: String, document: Document, dark_theme_dimming: Integer, is_blurred: Boolean, is_moving: Boolean)

The background is a PNG or TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user.

BackgroundTypePattern(type: String, document: Document, fill: BackgroundFill, intensity: Integer, is_inverted: Boolean, is_moving: Boolean)

The background is taken directly from a built-in chat theme.

BackgroundTypeChatTheme(type: String, theme_name: String)

This object represents a chat background.

ChatBackground(type: BackgroundType)

This object represents a service message about a new forum topic created in the chat.

ForumTopicCreated(name: String, icon_color: Integer, icon_custom_emoji_id: String)

This object represents a service message about an edited forum topic.

ForumTopicEdited(name: String, icon_custom_emoji_id: String)

This object contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button.

SharedUser(user_id: Integer, first_name: String, last_name: String, username: String, photo: List<PhotoSize>)

This object contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button.

UsersShared(request_id: Integer, users: List<SharedUser>)

This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button.

ChatShared(request_id: Integer, chat_id: Integer, title: String, username: String, photo: List<PhotoSize>)

This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.

WriteAccessAllowed(from_request: Boolean, web_app_name: String, from_attachment_menu: Boolean)

This object represents a service message about a video chat scheduled in the chat.

VideoChatScheduled(start_date: Integer)

This object represents a service message about a video chat ended in the chat.

VideoChatEnded(duration: Integer)

This object represents a service message about new members invited to a video chat.

VideoChatParticipantsInvited(users: List<User>)

This object represents a message about a scheduled giveaway.

Giveaway(chats: List<Chat>, winners_selection_date: Integer, winner_count: Integer, only_new_members: Boolean, has_public_winners: Boolean, prize_description: String, country_codes: List<String>, premium_subscription_month_count: Integer)

This object represents a message about the completion of a giveaway with public winners.

GiveawayWinners(chat: Chat, giveaway_message_id: Integer, winners_selection_date: Integer, winner_count: Integer, winners: List<User>, additional_chat_count: Integer, premium_subscription_month_count: Integer, unclaimed_prize_count: Integer, only_new_members: Boolean, was_refunded: Boolean, prize_description: String)

This object represents a service message about the completion of a giveaway without public winners.

GiveawayCompleted(winner_count: Integer, unclaimed_prize_count: Integer, giveaway_message: Message)

Describes the options used for link preview generation.

LinkPreviewOptions(is_disabled: Boolean, url: String, prefer_small_media: Boolean, prefer_large_media: Boolean, show_above_text: Boolean)

This object represent a user's profile pictures.

UserProfilePhotos(total_count: Integer, photos: List<List<PhotoSize>>)

This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.

The maximum file size to download is 20 MB

File(file_id: String, file_unique_id: String, file_size: Integer, file_path: String)

Describes a Web App.

WebAppInfo(url: String)

This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). Not supported in channels and for messages sent on behalf of a Telegram Business account.

ReplyKeyboardMarkup(keyboard: List<List<KeyboardButton>>, is_persistent: Boolean, resize_keyboard: Boolean, one_time_keyboard: Boolean, input_field_placeholder: String, selective: Boolean)

This object represents one button of the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, String can be used instead of this object to specify the button text.

Note: request_users and request_chat options will only work in Telegram versions released after 3 February, 2023. Older clients will display unsupported message.

KeyboardButton(text: String, request_users: KeyboardButtonRequestUsers, request_chat: KeyboardButtonRequestChat, request_contact: Boolean, request_location: Boolean, request_poll: KeyboardButtonPollType, web_app: WebAppInfo)

This object defines the criteria used to request suitable users. Information about the selected users will be shared with the bot when the corresponding button is pressed. More about requesting users »

KeyboardButtonRequestUsers(request_id: Integer, user_is_bot: Boolean, user_is_premium: Boolean, max_quantity: Integer, request_name: Boolean, request_username: Boolean, request_photo: Boolean)

This object defines the criteria used to request a suitable chat. Information about the selected chat will be shared with the bot when the corresponding button is pressed. The bot will be granted requested rights in the chat if appropriate. More about requesting chats ».

KeyboardButtonRequestChat(request_id: Integer, chat_is_channel: Boolean, chat_is_forum: Boolean, chat_has_username: Boolean, chat_is_created: Boolean, user_administrator_rights: ChatAdministratorRights, bot_administrator_rights: ChatAdministratorRights, bot_is_member: Boolean, request_title: Boolean, request_username: Boolean, request_photo: Boolean)

This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.

KeyboardButtonPollType(type: String)

Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). Not supported in channels and for messages sent on behalf of a Telegram Business account.

ReplyKeyboardRemove(remove_keyboard: Boolean, selective: Boolean)

This object represents an inline keyboard that appears right next to the message it belongs to.

InlineKeyboardMarkup(inline_keyboard: List<List<InlineKeyboardButton>>)

This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button.

InlineKeyboardButton(text: String, url: String, callback_data: String, web_app: WebAppInfo, login_url: LoginUrl, switch_inline_query: String, switch_inline_query_current_chat: String, switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat, callback_game: CallbackGame, pay: Boolean)

This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:

Telegram apps support these buttons as of version 5.7.

Sample bot: @discussbot

LoginUrl(url: String, forward_text: String, bot_username: String, request_write_access: Boolean)

This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.

SwitchInlineQueryChosenChat(query: String, allow_user_chats: Boolean, allow_bot_chats: Boolean, allow_group_chats: Boolean, allow_channel_chats: Boolean)

This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.

NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters).

CallbackQuery(id: String, from: User, message: MaybeInaccessibleMessage, inline_message_id: String, chat_instance: String, data: String, game_short_name: String)

Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. Not supported in channels and for messages sent on behalf of a Telegram Business account.

Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:

  • Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
  • Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'.

The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions - without any extra work for the user.

ForceReply(force_reply: Boolean, input_field_placeholder: String, selective: Boolean)

This object represents a chat photo.

ChatPhoto(small_file_id: String, small_file_unique_id: String, big_file_id: String, big_file_unique_id: String)

Represents an invite link for a chat.

ChatInviteLink(invite_link: String, creator: User, creates_join_request: Boolean, is_primary: Boolean, is_revoked: Boolean, name: String, expire_date: Integer, member_limit: Integer, pending_join_request_count: Integer)

Represents the rights of an administrator in a chat.

ChatAdministratorRights(is_anonymous: Boolean, can_manage_chat: Boolean, can_delete_messages: Boolean, can_manage_video_chats: Boolean, can_restrict_members: Boolean, can_promote_members: Boolean, can_change_info: Boolean, can_invite_users: Boolean, can_post_stories: Boolean, can_edit_stories: Boolean, can_delete_stories: Boolean, can_post_messages: Boolean, can_edit_messages: Boolean, can_pin_messages: Boolean, can_manage_topics: Boolean)

This object represents changes in the status of a chat member.

ChatMemberUpdated(chat: Chat, from: User, date: Integer, old_chat_member: ChatMember, new_chat_member: ChatMember, invite_link: ChatInviteLink, via_join_request: Boolean, via_chat_folder_invite_link: Boolean)

Represents a chat member that owns the chat and has all administrator privileges.

ChatMemberOwner(status: String, user: User, is_anonymous: Boolean, custom_title: String)

Represents a chat member that has some additional privileges.

ChatMemberAdministrator(status: String, user: User, can_be_edited: Boolean, is_anonymous: Boolean, can_manage_chat: Boolean, can_delete_messages: Boolean, can_manage_video_chats: Boolean, can_restrict_members: Boolean, can_promote_members: Boolean, can_change_info: Boolean, can_invite_users: Boolean, can_post_stories: Boolean, can_edit_stories: Boolean, can_delete_stories: Boolean, can_post_messages: Boolean, can_edit_messages: Boolean, can_pin_messages: Boolean, can_manage_topics: Boolean, custom_title: String)

Represents a chat member that has no additional privileges or restrictions.

ChatMemberMember(status: String, user: User, until_date: Integer)

Represents a chat member that is under certain restrictions in the chat. Supergroups only.

ChatMemberRestricted(status: String, user: User, is_member: Boolean, can_send_messages: Boolean, can_send_audios: Boolean, can_send_documents: Boolean, can_send_photos: Boolean, can_send_videos: Boolean, can_send_video_notes: Boolean, can_send_voice_notes: Boolean, can_send_polls: Boolean, can_send_other_messages: Boolean, can_add_web_page_previews: Boolean, can_change_info: Boolean, can_invite_users: Boolean, can_pin_messages: Boolean, can_manage_topics: Boolean, until_date: Integer)

Represents a chat member that isn't currently a member of the chat, but may join it themselves.

ChatMemberLeft(status: String, user: User)

Represents a chat member that was banned in the chat and can't return to the chat or view chat messages.

ChatMemberBanned(status: String, user: User, until_date: Integer)

Represents a join request sent to a chat.

ChatJoinRequest(chat: Chat, from: User, user_chat_id: Integer, date: Integer, bio: String, invite_link: ChatInviteLink)

Describes actions that a non-administrator user is allowed to take in a chat.

ChatPermissions(can_send_messages: Boolean, can_send_audios: Boolean, can_send_documents: Boolean, can_send_photos: Boolean, can_send_videos: Boolean, can_send_video_notes: Boolean, can_send_voice_notes: Boolean, can_send_polls: Boolean, can_send_other_messages: Boolean, can_add_web_page_previews: Boolean, can_change_info: Boolean, can_invite_users: Boolean, can_pin_messages: Boolean, can_manage_topics: Boolean)

Describes the birthdate of a user.

Birthdate(day: Integer, month: Integer, year: Integer)

Contains information about the start page settings of a Telegram Business account.

BusinessIntro(title: String, message: String, sticker: Sticker)

Contains information about the location of a Telegram Business account.

BusinessLocation(address: String, location: Location)

Describes an interval of time during which a business is open.

BusinessOpeningHoursInterval(opening_minute: Integer, closing_minute: Integer)

Describes the opening hours of a business.

BusinessOpeningHours(time_zone_name: String, opening_hours: List<BusinessOpeningHoursInterval>)

Represents a location to which a chat is connected.

ChatLocation(location: Location, address: String)

The reaction is based on an emoji.

ReactionTypeEmoji(type: String, emoji: String)

The reaction is based on a custom emoji.

ReactionTypeCustomEmoji(type: String, custom_emoji_id: String)

The reaction is paid.

ReactionTypePaid(type: String)

Represents a reaction added to a message along with the number of times it was added.

ReactionCount(type: ReactionType, total_count: Integer)

This object represents a change of a reaction on a message performed by a user.

MessageReactionUpdated(chat: Chat, message_id: Integer, user: User, actor_chat: Chat, date: Integer, old_reaction: List<ReactionType>, new_reaction: List<ReactionType>)

This object represents reaction changes on a message with anonymous reactions.

MessageReactionCountUpdated(chat: Chat, message_id: Integer, date: Integer, reactions: List<ReactionCount>)

This object represents a forum topic.

ForumTopic(message_thread_id: Integer, name: String, icon_color: Integer, icon_custom_emoji_id: String)

This object represents a bot command.

BotCommand(command: String, description: String)

Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user.

BotCommandScopeDefault(type: String)

Represents the scope of bot commands, covering all private chats.

BotCommandScopeAllPrivateChats(type: String)

Represents the scope of bot commands, covering all group and supergroup chats.

BotCommandScopeAllGroupChats(type: String)

Represents the scope of bot commands, covering all group and supergroup chat administrators.

BotCommandScopeAllChatAdministrators(type: String)

Represents the scope of bot commands, covering a specific chat.

BotCommandScopeChat(type: String, chat_id: IntegerOrString)

Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.

BotCommandScopeChatAdministrators(type: String, chat_id: IntegerOrString)

Represents the scope of bot commands, covering a specific member of a group or supergroup chat.

BotCommandScopeChatMember(type: String, chat_id: IntegerOrString, user_id: Integer)

This object represents the bot's name.

BotName(name: String)

This object represents the bot's description.

BotDescription(description: String)

This object represents the bot's short description.

BotShortDescription(short_description: String)

Represents a menu button, which opens the bot's list of commands.

MenuButtonCommands(type: String)

Represents a menu button, which launches a Web App.

MenuButtonWebApp(type: String, text: String, web_app: WebAppInfo)

Describes that no specific value for the menu button was set.

MenuButtonDefault(type: String)

The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user.

ChatBoostSourcePremium(source: String, user: User)

The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.

ChatBoostSourceGiftCode(source: String, user: User)

The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.

ChatBoostSourceGiveaway(source: String, giveaway_message_id: Integer, user: User, is_unclaimed: Boolean)

This object contains information about a chat boost.

ChatBoost(boost_id: String, add_date: Integer, expiration_date: Integer, source: ChatBoostSource)

This object represents a boost added to a chat or changed.

ChatBoostUpdated(chat: Chat, boost: ChatBoost)

This object represents a boost removed from a chat.

ChatBoostRemoved(chat: Chat, boost_id: String, remove_date: Integer, source: ChatBoostSource)

This object represents a list of boosts added to a chat by a user.

UserChatBoosts(boosts: List<ChatBoost>)

Describes the connection of the bot with a business account.

BusinessConnection(id: String, user: User, user_chat_id: Integer, date: Integer, can_reply: Boolean, is_enabled: Boolean)

This object is received when messages are deleted from a connected business account.

BusinessMessagesDeleted(business_connection_id: String, chat: Chat, message_ids: List<Integer>)

Describes why a request was unsuccessful.

ResponseParameters(migrate_to_chat_id: Integer, retry_after: Integer)

Represents a photo to be sent.

InputMediaPhoto(type: String, media: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, has_spoiler: Boolean)

Represents a video to be sent.

InputMediaVideo(type: String, media: String, thumbnail: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, width: Integer, height: Integer, duration: Integer, supports_streaming: Boolean, has_spoiler: Boolean)

Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

InputMediaAnimation(type: String, media: String, thumbnail: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, width: Integer, height: Integer, duration: Integer, has_spoiler: Boolean)

Represents an audio file to be treated as music to be sent.

InputMediaAudio(type: String, media: String, thumbnail: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, duration: Integer, performer: String, title: String)

Represents a general file to be sent.

InputMediaDocument(type: String, media: String, thumbnail: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, disable_content_type_detection: Boolean)

The paid media to send is a photo.

InputPaidMediaPhoto(type: String, media: String)

The paid media to send is a video.

InputPaidMediaVideo(type: String, media: String, thumbnail: InputFileOrString, width: Integer, height: Integer, duration: Integer, supports_streaming: Boolean)

Available methods

Methods

Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters.

logOut()

Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters.

close()

Use this method to send text messages. On success, the sent Message is returned.

sendMessage(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, text: String, parse_mode: ParseMode, entities: List<MessageEntity>, link_preview_options: LinkPreviewOptions, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned.

forwardMessage(chat_id: IntegerOrString, message_thread_id: Integer, from_chat_id: IntegerOrString, disable_notification: Boolean, protect_content: Boolean, message_id: Integer)

Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned.

forwardMessages(chat_id: IntegerOrString, message_thread_id: Integer, from_chat_id: IntegerOrString, message_ids: List<Integer>, disable_notification: Boolean, protect_content: Boolean)

Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

copyMessage(chat_id: IntegerOrString, message_thread_id: Integer, from_chat_id: IntegerOrString, message_id: Integer, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, disable_notification: Boolean, protect_content: Boolean, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned.

copyMessages(chat_id: IntegerOrString, message_thread_id: Integer, from_chat_id: IntegerOrString, message_ids: List<Integer>, disable_notification: Boolean, protect_content: Boolean, remove_caption: Boolean)

Use this method to send photos. On success, the sent Message is returned.

sendPhoto(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, photo: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, has_spoiler: Boolean, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.

For sending voice messages, use the sendVoice method instead.

sendAudio(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, audio: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, duration: Integer, performer: String, title: String, thumbnail: InputFileOrString, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

sendDocument(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, document: InputFileOrString, thumbnail: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, disable_content_type_detection: Boolean, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

sendVideo(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, video: InputFileOrString, duration: Integer, width: Integer, height: Integer, thumbnail: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, has_spoiler: Boolean, supports_streaming: Boolean, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.

sendAnimation(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, animation: InputFileOrString, duration: Integer, width: Integer, height: Integer, thumbnail: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, has_spoiler: Boolean, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

sendVoice(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, voice: InputFileOrString, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, duration: Integer, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.

sendVideoNote(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, video_note: InputFileOrString, duration: Integer, length: Integer, thumbnail: InputFileOrString, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send paid media. On success, the sent Message is returned.

sendPaidMedia(business_connection_id: String, chat_id: IntegerOrString, star_count: Integer, media: List<InputPaidMedia>, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, disable_notification: Boolean, protect_content: Boolean, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned.

sendMediaGroup(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, media: List<InputMedia>, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters)

Use this method to send point on the map. On success, the sent Message is returned.

sendLocation(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, latitude: Float, longitude: Float, horizontal_accuracy: Float, live_period: Integer, heading: Integer, proximity_alert_radius: Integer, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send information about a venue. On success, the sent Message is returned.

sendVenue(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, latitude: Float, longitude: Float, title: String, address: String, foursquare_id: String, foursquare_type: String, google_place_id: String, google_place_type: String, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send phone contacts. On success, the sent Message is returned.

sendContact(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, phone_number: String, first_name: String, last_name: String, vcard: String, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send a native poll. On success, the sent Message is returned.

sendPoll(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, question: String, question_parse_mode: String, question_entities: List<MessageEntity>, options: List<InputPollOption>, is_anonymous: Boolean, type: String, allows_multiple_answers: Boolean, correct_option_id: Integer, explanation: String, explanation_parse_mode: String, explanation_entities: List<MessageEntity>, open_period: Integer, close_date: Integer, is_closed: Boolean, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.

sendDice(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, emoji: String, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.

Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot.

We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

sendChatAction(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, action: String)

Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.

setMessageReaction(chat_id: IntegerOrString, message_id: Integer, reaction: List<ReactionType>, is_big: Boolean)

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

getUserProfilePhotos(user_id: Integer, offset: Integer, limit: Integer)

Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.

Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.

getFile(file_id: String)

Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

banChatMember(chat_id: IntegerOrString, user_id: Integer, until_date: Integer, revoke_messages: Boolean)

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.

unbanChatMember(chat_id: IntegerOrString, user_id: Integer, only_if_banned: Boolean)

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.

restrictChatMember(chat_id: IntegerOrString, user_id: Integer, permissions: ChatPermissions, use_independent_chat_permissions: Boolean, until_date: Integer)

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.

promoteChatMember(chat_id: IntegerOrString, user_id: Integer, is_anonymous: Boolean, can_manage_chat: Boolean, can_delete_messages: Boolean, can_manage_video_chats: Boolean, can_restrict_members: Boolean, can_promote_members: Boolean, can_change_info: Boolean, can_invite_users: Boolean, can_post_stories: Boolean, can_edit_stories: Boolean, can_delete_stories: Boolean, can_post_messages: Boolean, can_edit_messages: Boolean, can_pin_messages: Boolean, can_manage_topics: Boolean)

Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.

setChatAdministratorCustomTitle(chat_id: IntegerOrString, user_id: Integer, custom_title: String)

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.

banChatSenderChat(chat_id: IntegerOrString, sender_chat_id: Integer)

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.

unbanChatSenderChat(chat_id: IntegerOrString, sender_chat_id: Integer)

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.

setChatPermissions(chat_id: IntegerOrString, permissions: ChatPermissions, use_independent_chat_permissions: Boolean)

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.

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.

exportChatInviteLink(chat_id: IntegerOrString)

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.

createChatInviteLink(chat_id: IntegerOrString, name: String, expire_date: Integer, member_limit: Integer, creates_join_request: Boolean)

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.

editChatInviteLink(chat_id: IntegerOrString, invite_link: String, name: String, expire_date: Integer, member_limit: Integer, creates_join_request: Boolean)

Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.

createChatSubscriptionInviteLink(chat_id: IntegerOrString, name: String, subscription_period: Integer, subscription_price: Integer)

Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.

editChatSubscriptionInviteLink(chat_id: IntegerOrString, invite_link: String, name: String)

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.

revokeChatInviteLink(chat_id: IntegerOrString, invite_link: String)

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.

approveChatJoinRequest(chat_id: IntegerOrString, user_id: Integer)

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.

declineChatJoinRequest(chat_id: IntegerOrString, user_id: Integer)

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.

setChatPhoto(chat_id: IntegerOrString, photo: InputFile)

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.

deleteChatPhoto(chat_id: IntegerOrString)

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.

setChatTitle(chat_id: IntegerOrString, title: String)

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.

setChatDescription(chat_id: IntegerOrString, description: String)

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.

pinChatMessage(business_connection_id: String, chat_id: IntegerOrString, message_id: Integer, disable_notification: Boolean)

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.

unpinChatMessage(business_connection_id: String, chat_id: IntegerOrString, message_id: Integer)

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.

unpinAllChatMessages(chat_id: IntegerOrString)

Use this method for your bot to leave a group, supergroup or channel. Returns True on success.

leaveChat(chat_id: IntegerOrString)

Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success.

getChat(chat_id: IntegerOrString)

Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects.

getChatAdministrators(chat_id: IntegerOrString)

Use this method to get the number of members in a chat. Returns Int on success.

getChatMemberCount(chat_id: IntegerOrString)

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.

getChatMember(chat_id: IntegerOrString, user_id: Integer)

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.

setChatStickerSet(chat_id: IntegerOrString, sticker_set_name: String)

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.

deleteChatStickerSet(chat_id: IntegerOrString)

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.

getForumTopicIconStickers()

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.

createForumTopic(chat_id: IntegerOrString, name: String, icon_color: Integer, icon_custom_emoji_id: String)

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 the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

editForumTopic(chat_id: IntegerOrString, message_thread_id: Integer, name: String, icon_custom_emoji_id: String)

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.

closeForumTopic(chat_id: IntegerOrString, message_thread_id: Integer)

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.

reopenForumTopic(chat_id: IntegerOrString, message_thread_id: Integer)

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.

deleteForumTopic(chat_id: IntegerOrString, message_thread_id: Integer)

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.

unpinAllForumTopicMessages(chat_id: IntegerOrString, message_thread_id: Integer)

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 the can_manage_topics administrator rights. Returns True on success.

editGeneralForumTopic(chat_id: IntegerOrString, name: String)

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.

closeGeneralForumTopic(chat_id: IntegerOrString)

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.

reopenGeneralForumTopic(chat_id: IntegerOrString)

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.

hideGeneralForumTopic(chat_id: IntegerOrString)

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.

unhideGeneralForumTopic(chat_id: IntegerOrString)

Use this method to clear the list of pinned messages in a General 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.

unpinAllGeneralForumTopicMessages(chat_id: IntegerOrString)

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.

answerCallbackQuery(callback_query_id: String, text: String, show_alert: Boolean, url: String, cache_time: Integer)

Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.

getUserChatBoosts(chat_id: IntegerOrString, user_id: Integer)

Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success.

getBusinessConnection(business_connection_id: String)

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.

setMyCommands(commands: List<BotCommand>, scope: BotCommandScope, language_code: String)

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.

deleteMyCommands(scope: BotCommandScope, language_code: String)

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.

getMyCommands(scope: BotCommandScope, language_code: String)

Use this method to change the bot's name. Returns True on success.

setMyName(name: String, language_code: String)

Use this method to get the current bot name for the given user language. Returns BotName on success.

getMyName(language_code: 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.

setMyDescription(description: String, language_code: String)

Use this method to get the current bot description for the given user language. Returns BotDescription on success.

getMyDescription(language_code: 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.

setMyShortDescription(short_description: String, language_code: String)

Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success.

getMyShortDescription(language_code: String)

Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.

setChatMenuButton(chat_id: Integer, menu_button: MenuButton)

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.

getChatMenuButton(chat_id: Integer)

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.

setMyDefaultAdministratorRights(rights: ChatAdministratorRights, for_channels: Boolean)

Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.

getMyDefaultAdministratorRights(for_channels: Boolean)

Updating messages

Methods

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. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

editMessageText(business_connection_id: String, chat_id: IntegerOrString, message_id: Integer, inline_message_id: String, text: String, parse_mode: ParseMode, entities: List<MessageEntity>, link_preview_options: LinkPreviewOptions, reply_markup: InlineKeyboardMarkup)

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. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

editMessageCaption(business_connection_id: String, chat_id: IntegerOrString, message_id: Integer, inline_message_id: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, reply_markup: InlineKeyboardMarkup)

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. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

editMessageMedia(business_connection_id: String, chat_id: IntegerOrString, message_id: Integer, inline_message_id: String, media: InputMedia, reply_markup: InlineKeyboardMarkup)

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.

editMessageLiveLocation(business_connection_id: String, chat_id: IntegerOrString, message_id: Integer, inline_message_id: String, latitude: Float, longitude: Float, live_period: Integer, horizontal_accuracy: Float, heading: Integer, proximity_alert_radius: Integer, reply_markup: InlineKeyboardMarkup)

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.

stopMessageLiveLocation(business_connection_id: String, chat_id: IntegerOrString, message_id: Integer, inline_message_id: String, reply_markup: InlineKeyboardMarkup)

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. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

editMessageReplyMarkup(business_connection_id: String, chat_id: IntegerOrString, message_id: Integer, inline_message_id: String, reply_markup: InlineKeyboardMarkup)

Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned.

stopPoll(business_connection_id: String, chat_id: IntegerOrString, message_id: Integer, reply_markup: InlineKeyboardMarkup)

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.

deleteMessage(chat_id: IntegerOrString, message_id: Integer)

Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns True on success.

deleteMessages(chat_id: IntegerOrString, message_ids: List<Integer>)

Stickers

Data Types

This object represents a sticker.

Sticker(file_id: String, file_unique_id: String, type: String, width: Integer, height: Integer, is_animated: Boolean, is_video: Boolean, thumbnail: PhotoSize, emoji: String, set_name: String, premium_animation: File, mask_position: MaskPosition, custom_emoji_id: String, needs_repainting: Boolean, file_size: Integer)

This object represents a sticker set.

StickerSet(name: String, title: String, sticker_type: String, stickers: List<Sticker>, thumbnail: PhotoSize)

This object describes the position on faces where a mask should be placed by default.

MaskPosition(point: String, x_shift: Float, y_shift: Float, scale: Float)

This object describes a sticker to be added to a sticker set.

InputSticker(sticker: InputFileOrString, format: String, emoji_list: List<String>, mask_position: MaskPosition, keywords: List<String>)

Methods

Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned.

sendSticker(business_connection_id: String, chat_id: IntegerOrString, message_thread_id: Integer, sticker: InputFileOrString, emoji: String, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: KeyboardOption)

Use this method to get a sticker set. On success, a StickerSet object is returned.

getStickerSet(name: String)

Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.

getCustomEmojiStickers(custom_emoji_ids: List<String>)

Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success.

uploadStickerFile(user_id: Integer, sticker: InputFile, sticker_format: String)

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.

createNewStickerSet(user_id: Integer, name: String, title: String, stickers: List<InputSticker>, sticker_type: String, needs_repainting: Boolean)

Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success.

addStickerToSet(user_id: Integer, name: String, sticker: InputSticker)

Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.

setStickerPositionInSet(sticker: String, position: Integer)

Use this method to delete a sticker from a set created by the bot. Returns True on success.

deleteStickerFromSet(sticker: String)

Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success.

replaceStickerInSet(user_id: Integer, name: String, old_sticker: String, sticker: InputSticker)

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.

setStickerEmojiList(sticker: String, emoji_list: List<String>)

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.

setStickerKeywords(sticker: String, keywords: List<String>)

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.

setStickerMaskPosition(sticker: String, mask_position: MaskPosition)

Use this method to set the title of a created sticker set. Returns True on success.

setStickerSetTitle(name: String, title: String)

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.

setStickerSetThumbnail(name: String, user_id: Integer, thumbnail: InputFileOrString, format: String)

Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.

setCustomEmojiStickerSetThumbnail(name: String, custom_emoji_id: String)

Use this method to delete a sticker set that was created by the bot. Returns True on success.

deleteStickerSet(name: String)

Inline mode

Data Types

This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.

InlineQuery(id: String, from: User, query: String, offset: String, chat_type: String, location: Location)

This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.

InlineQueryResultsButton(text: String, web_app: WebAppInfo, start_parameter: String)

Represents a link to an article or web page.

InlineQueryResultArticle(type: String, id: String, title: String, input_message_content: InputMessageContent, reply_markup: InlineKeyboardMarkup, url: String, hide_url: Boolean, description: String, thumbnail_url: String, thumbnail_width: Integer, thumbnail_height: Integer)

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.

InlineQueryResultPhoto(type: String, id: String, photo_url: String, thumbnail_url: String, photo_width: Integer, photo_height: Integer, title: String, description: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultGif(type: String, id: String, gif_url: String, gif_width: Integer, gif_height: Integer, gif_duration: Integer, thumbnail_url: String, thumbnail_mime_type: String, title: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultMpeg4Gif(type: String, id: String, mpeg4_url: String, mpeg4_width: Integer, mpeg4_height: Integer, mpeg4_duration: Integer, thumbnail_url: String, thumbnail_mime_type: String, title: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultVideo(type: String, id: String, video_url: String, mime_type: String, thumbnail_url: String, title: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, video_width: Integer, video_height: Integer, video_duration: Integer, description: String, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultAudio(type: String, id: String, audio_url: String, title: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, performer: String, audio_duration: Integer, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultVoice(type: String, id: String, voice_url: String, title: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, voice_duration: Integer, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultDocument(type: String, id: String, title: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, document_url: String, mime_type: String, description: String, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent, thumbnail_url: String, thumbnail_width: Integer, thumbnail_height: Integer)

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.

InlineQueryResultLocation(type: String, id: String, latitude: Float, longitude: Float, title: String, horizontal_accuracy: Float, live_period: Integer, heading: Integer, proximity_alert_radius: Integer, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent, thumbnail_url: String, thumbnail_width: Integer, thumbnail_height: Integer)

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.

InlineQueryResultVenue(type: String, id: String, latitude: Float, longitude: Float, title: String, address: String, foursquare_id: String, foursquare_type: String, google_place_id: String, google_place_type: String, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent, thumbnail_url: String, thumbnail_width: Integer, thumbnail_height: Integer)

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.

InlineQueryResultContact(type: String, id: String, phone_number: String, first_name: String, last_name: String, vcard: String, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent, thumbnail_url: String, thumbnail_width: Integer, thumbnail_height: Integer)

Represents a Game.

InlineQueryResultGame(type: String, id: String, game_short_name: String, reply_markup: InlineKeyboardMarkup)

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.

InlineQueryResultCachedPhoto(type: String, id: String, photo_file_id: String, title: String, description: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultCachedGif(type: String, id: String, gif_file_id: String, title: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultCachedMpeg4Gif(type: String, id: String, mpeg4_file_id: String, title: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultCachedSticker(type: String, id: String, sticker_file_id: String, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultCachedDocument(type: String, id: String, title: String, document_file_id: String, description: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultCachedVideo(type: String, id: String, video_file_id: String, title: String, description: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, show_caption_above_media: Boolean, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultCachedVoice(type: String, id: String, voice_file_id: String, title: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

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.

InlineQueryResultCachedAudio(type: String, id: String, audio_file_id: String, caption: String, parse_mode: ParseMode, caption_entities: List<MessageEntity>, reply_markup: InlineKeyboardMarkup, input_message_content: InputMessageContent)

Represents the content of a text message to be sent as the result of an inline query.

InputTextMessageContent(message_text: String, parse_mode: ParseMode, entities: List<MessageEntity>, link_preview_options: LinkPreviewOptions)

Represents the content of a location message to be sent as the result of an inline query.

InputLocationMessageContent(latitude: Float, longitude: Float, horizontal_accuracy: Float, live_period: Integer, heading: Integer, proximity_alert_radius: Integer)

Represents the content of a venue message to be sent as the result of an inline query.

InputVenueMessageContent(latitude: Float, longitude: Float, title: String, address: String, foursquare_id: String, foursquare_type: String, google_place_id: String, google_place_type: String)

Represents the content of a contact message to be sent as the result of an inline query.

InputContactMessageContent(phone_number: String, first_name: String, last_name: String, vcard: String)

Represents the content of an invoice message to be sent as the result of an inline query.

InputInvoiceMessageContent(title: String, description: String, payload: String, provider_token: String, currency: String, prices: List<LabeledPrice>, max_tip_amount: Integer, suggested_tip_amounts: List<Integer>, provider_data: String, photo_url: String, photo_size: Integer, photo_width: Integer, photo_height: Integer, need_name: Boolean, need_phone_number: Boolean, need_email: Boolean, need_shipping_address: Boolean, send_phone_number_to_provider: Boolean, send_email_to_provider: Boolean, is_flexible: Boolean)

Represents a result of an inline query that was chosen by the user and sent to their chat partner.

Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates.

ChosenInlineResult(result_id: String, from: User, location: Location, inline_message_id: String, query: String)

Describes an inline message sent by a Web App on behalf of a user.

SentWebAppMessage(inline_message_id: String)

Methods

Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results per query are allowed.

answerInlineQuery(inline_query_id: String, results: List<InlineQueryResult>, cache_time: Integer, is_personal: Boolean, next_offset: String, button: InlineQueryResultsButton)

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.

answerWebAppQuery(web_app_query_id: String, result: InlineQueryResult)

Payments

Data Types

This object represents a portion of the price for goods or services.

LabeledPrice(label: String, amount: Integer)

This object contains basic information about an invoice.

Invoice(title: String, description: String, start_parameter: String, currency: String, total_amount: Integer)

This object represents a shipping address.

ShippingAddress(country_code: String, state: String, city: String, street_line1: String, street_line2: String, post_code: String)

This object represents information about an order.

OrderInfo(name: String, phone_number: String, email: String, shipping_address: ShippingAddress)

This object represents one shipping option.

ShippingOption(id: String, title: String, prices: List<LabeledPrice>)

This object contains basic information about a successful payment.

SuccessfulPayment(currency: String, total_amount: Integer, invoice_payload: String, shipping_option_id: String, order_info: OrderInfo, telegram_payment_charge_id: String, provider_payment_charge_id: String)

This object contains basic information about a refunded payment.

RefundedPayment(currency: String, total_amount: Integer, invoice_payload: String, telegram_payment_charge_id: String, provider_payment_charge_id: String)

This object contains information about an incoming shipping query.

ShippingQuery(id: String, from: User, invoice_payload: String, shipping_address: ShippingAddress)

This object contains information about an incoming pre-checkout query.

PreCheckoutQuery(id: String, from: User, currency: String, total_amount: Integer, invoice_payload: String, shipping_option_id: String, order_info: OrderInfo)

The withdrawal is in progress.

RevenueWithdrawalStatePending(type: String)

The withdrawal succeeded.

RevenueWithdrawalStateSucceeded(type: String, date: Integer, url: String)

The withdrawal failed and the transaction was refunded.

RevenueWithdrawalStateFailed(type: String)

Describes a transaction with a user.

TransactionPartnerUser(type: String, user: User, invoice_payload: String, paid_media: List<PaidMedia>)

Describes a withdrawal transaction with Fragment.

TransactionPartnerFragment(type: String, withdrawal_state: RevenueWithdrawalState)

Describes a withdrawal transaction to the Telegram Ads platform.

TransactionPartnerTelegramAds(type: String)

Describes a transaction with an unknown source or recipient.

TransactionPartnerOther(type: String)

Describes a Telegram Star transaction.

StarTransaction(id: String, amount: Integer, date: Integer, source: TransactionPartner, receiver: TransactionPartner)

Contains a list of Telegram Star transactions.

StarTransactions(transactions: List<StarTransaction>)

Methods

Use this method to send invoices. On success, the sent Message is returned.

sendInvoice(chat_id: IntegerOrString, message_thread_id: Integer, title: String, description: String, payload: String, provider_token: String, currency: String, prices: List<LabeledPrice>, max_tip_amount: Integer, suggested_tip_amounts: List<Integer>, start_parameter: String, provider_data: String, photo_url: String, photo_size: Integer, photo_width: Integer, photo_height: Integer, need_name: Boolean, need_phone_number: Boolean, need_email: Boolean, need_shipping_address: Boolean, send_phone_number_to_provider: Boolean, send_email_to_provider: Boolean, is_flexible: Boolean, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: InlineKeyboardMarkup)

Use this method to create a link for an invoice. Returns the created invoice link as String on success.

createInvoiceLink(title: String, description: String, payload: String, provider_token: String, currency: String, prices: List<LabeledPrice>, max_tip_amount: Integer, suggested_tip_amounts: List<Integer>, provider_data: String, photo_url: String, photo_size: Integer, photo_width: Integer, photo_height: Integer, need_name: Boolean, need_phone_number: Boolean, need_email: Boolean, need_shipping_address: Boolean, send_phone_number_to_provider: Boolean, send_email_to_provider: Boolean, is_flexible: Boolean)

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.

answerShippingQuery(shipping_query_id: String, ok: Boolean, shipping_options: List<ShippingOption>, error_message: String)

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.

answerPreCheckoutQuery(pre_checkout_query_id: String, ok: Boolean, error_message: String)

Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.

getStarTransactions(offset: Integer, limit: Integer)

Refunds a successful payment in Telegram Stars. Returns True on success.

refundStarPayment(user_id: Integer, telegram_payment_charge_id: String)

Telegram Passport

Data Types

Describes Telegram Passport data shared with the bot by the user.

PassportData(data: List<EncryptedPassportElement>, credentials: EncryptedCredentials)

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.

PassportFile(file_id: String, file_unique_id: String, file_size: Integer, file_date: Integer)

Describes documents or other Telegram Passport elements shared with the bot by the user.

EncryptedPassportElement(type: String, data: String, phone_number: String, email: String, files: List<PassportFile>, front_side: PassportFile, reverse_side: PassportFile, selfie: PassportFile, translation: List<PassportFile>, hash: String)

Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.

EncryptedCredentials(data: String, hash: String, secret: String)

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.

PassportElementErrorDataField(source: String, type: String, field_name: String, data_hash: String, message: String)

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.

PassportElementErrorFrontSide(source: String, type: String, file_hash: String, message: String)

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.

PassportElementErrorReverseSide(source: String, type: String, file_hash: String, message: String)

Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.

PassportElementErrorSelfie(source: String, type: String, file_hash: String, message: String)

Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.

PassportElementErrorFile(source: String, type: String, file_hash: String, message: String)

Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.

PassportElementErrorFiles(source: String, type: String, file_hashes: List<String>, message: String)

Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.

PassportElementErrorTranslationFile(source: String, type: String, file_hash: String, message: String)

Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.

PassportElementErrorTranslationFiles(source: String, type: String, file_hashes: List<String>, message: String)

Represents an issue in an unspecified place. The error is considered resolved when new data is added.

PassportElementErrorUnspecified(source: String, type: String, element_hash: String, message: String)

Methods

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.

setPassportDataErrors(user_id: Integer, errors: List<PassportElementError>)

Games

Data Types

This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.

Game(title: String, description: String, photo: List<PhotoSize>, text: String, text_entities: List<MessageEntity>, animation: Animation)

This object represents one row of the high scores table for a game.

And that's about all we've got for now.
If you've got any questions, please check out our Bot FAQ »

GameHighScore(position: Integer, user: User, score: Integer)

Methods

Use this method to send a game. On success, the sent Message is returned.

sendGame(business_connection_id: String, chat_id: Integer, message_thread_id: Integer, game_short_name: String, disable_notification: Boolean, protect_content: Boolean, message_effect_id: String, reply_parameters: ReplyParameters, reply_markup: InlineKeyboardMarkup)

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.

setGameScore(user_id: Integer, score: Integer, force: Boolean, disable_edit_message: Boolean, chat_id: Integer, message_id: Integer, inline_message_id: String)

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.

getGameHighScores(user_id: Integer, chat_id: Integer, message_id: Integer, inline_message_id: String)