Registers a handler for inline button clicks (callback_query).
String or regular expression to check callback_data
Functions that will be executed on a match
Use this method to add a new sticker to a sticker set.
Returns True on success.
User identifier creating the sticker set.
Sticker set name.
Sticker to add. Must be an InputSticker object.
True on success.
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.
Returns True on success.
Alternatively, the user can be redirected to a 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 can use links like t.me/your_bot?start=XXXX which open your bot with a parameter.
Unique query identifier
Optionaloptions: Omit<AnswerCallbackQueryParams, "callback_query_id">Additional response parameters (text, show_alert, url, etc.)
True on success
Use this method to reply to a received guest query.
On success, a SentGuestMessage object is returned.
Unique query identifier
Serialized JSON object describing the message to be sent.
SentGuestMessage
Use this method to send answers to an inline query.
Returns True on success.
No more than 50 results per query are allowed.
Inline query identifier.
Array of results.
Optionaloptions: Omit<AnswerInlineQueryParams, "inline_query_id" | "results">Additional parameters.
True on success.
After a user has confirmed their payment and shipping data, the Bot API sends a final confirmation as an update with the pre_checkout_query field.
Use this method to answer such pre-checkout queries.
Returns True on success.
Note: The Bot API must receive a response within 10 seconds after sending a pre-checkout query.
Pre-checkout query identifier.
Whether the response is successful.
Optionaloptions: Omit<AnswerPreCheckoutQueryParams, "ok" | "pre_checkout_query_id">Additional parameters (error_message)
True on success.
If you sent an invoice with a shipping address request and the is_flexible parameter was specified, the Bot API will send the bot an update with the shipping_query field.
Use this method to answer shipping queries.
Returns True on success.
Shipping query identifier.
Whether the response is successful.
Optionalshipping_options: ShippingOption[]Array of shipping options.
True on success.
Use this method to set the result of an interaction with a web application 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.
Web App query identifier.
Web application interaction result.
SentWebAppMessage.
Use this method to approve a chat join request.
For this to work, the bot must be a chat administrator and have the can_invite_users administrator right.
Returns True on success.
Unique identifier for the target chat
Unique user identifier
boolean on success
Use this method to approve a suggested post in a direct message chat.
The bot must have the can_post_messages administrator right in the corresponding channel chat.
Returns True on success.
Chat identifier or username.
Suggested post identifier.
Optionaloptions: Omit<ApproveSuggestedPostParams, "chat_id" | "message_id">True on success.
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.
For this to work, the bot must be an administrator in the chat and have the appropriate administrator rights.
Returns True on success.
Unique identifier for the target chat
Unique identifier for the target user
Optionaloptions: Omit<BanChatMemberParams, "chat_id" | "user_id">Additional ban parameters
true on success
Use this method to ban a channel chat in a supergroup or channel.
Until the chat is unbanned, the owner of the banned chat will not be able to send messages on behalf of any of their channels.
For this to work, the bot must be a supergroup or channel administrator and have appropriate administrator rights.
Returns True on success.
Unique identifier for the target chat
Unique identifier of the sender
True on success
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 so that the bot doesn't start again after a server restart.
The method will return a 429 error during the first 10 minutes after the bot starts.
Returns True on success.
True on success
Use this method to close an open topic in a forum supergroup chat.
For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right, unless it is the topic author.
Returns True on success.
Unique identifier for the target chat
Forum topic identifier
True on success
Use this method to close an open "General" topic in a forum supergroup chat.
For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right.
Returns True on success.
Unique identifier for the target chat
True on success
Registers a handler for a specific command (or an array of commands).
Command name without the slash (e.g., 'start' or ['start', 'help'])
Functions that will be executed if the command matches
Converts a regular gift into Telegram Stars.
Requires the business bot right can_convert_gifts_to_stars.
On success, returns True.
Business account identifier
Gift identifier
True on success
Use this method to copy messages of any type.
Service messages and messages with protected content cannot be forwarded.
On success, the MessageId of the sent message is returned.
Unique identifier for the target chat
Unique identifier for the chat from which messages are forwarded
Identifier of the message in the chat_id chat
Optionaloptions: Omit<CopyMessageParams, "chat_id" | "message_id" | "from_chat_id">Additional copying parameters
MessageId on success
Use this method to copy multiple messages of any type.
If some of the specified messages cannot be found or copied, they are skipped.
Service messages and messages with protected content cannot be copied.
Grouping by albums is preserved for copied messages.
On success, an array of MessageId of the copied messages is returned.
Unique identifier for the target chat
Unique identifier for the chat from which messages are forwarded
Message identifiers in the chat_id chat
Optionaloptions: Omit<CopyMessagesParams, "chat_id" | "from_chat_id" | "message_ids">Additional copying parameters
MessageId[] on success
Use this method to create an additional invite link for a chat.
For this to work, the bot must be a chat administrator and have appropriate administrator rights.
The link can be revoked using the revokeChatInviteLink method.
On success, returns the new invite link as a ChatInviteLink object.
Unique identifier for the target chat
Optionaloptions: Omit<CreateChatInviteLinkParams, "chat_id">ChatInviteLink on success
Use this method to create a subscription invite link for a channel chat.
The bot must have the can_invite_users administrator right.
The link can be edited using the editChatSubscriptionInviteLink method or revoked using the revokeChatInviteLink method.
Returns the new invite link as a ChatInviteLink object.
Unique identifier for the target chat
Optionaloptions: Omit<Parameters for creating the invite link
ChatInviteLink on success
Use this method to create a topic in a forum supergroup chat or in a private chat with a user.
In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the can_manage_topics administrator right.
Returns information about the created topic as a ForumTopic object.
Unique identifier for the target chat
Forum topic name
Optionaloptions: Omit<CreateForumTopicParams, "chat_id" | "name">Additional parameters (icon_custom_emoji_id, etc.)
ForumTopic on success
Use this method to create an invoice link. On success, returns the created invoice link as a string.
Invoice title.
Invoice description.
Internal invoice information.
Invoice currency.
Invoice prices.
Optionaloptions: Omit<Additional parameters.
Created invoice link.
Use this method to create a new sticker set belonging to a user.
The bot will be able to edit a sticker set created this way.
Returns True on success.
User identifier.
Sticker set name. Must start with a-z, A-Z, or 0-9, and can contain _ and consist of no more than 64 characters.
Sticker set title. Must consist of no more than 64 characters.
Array of stickers to add. At least one sticker must be passed.
Optionaloptions: Omit<CreateNewStickerSetParams, "title" | "name" | "stickers">Additional parameters.
True on success.
Use this method to decline a chat join request.
For this to work, the bot must be a chat administrator and have the can_invite_users administrator right.
Returns True on success.
Unique identifier for the target chat
Unique user identifier
boolean on success
Use this method to decline a suggested post in a direct message chat.
The bot must have the can_manage_direct_messages administrator right in the corresponding channel chat.
Returns True on success.
Chat identifier.
Suggested post identifier.
Optionaloptions: Omit<DeclineSuggestedPostParams, "chat_id" | "message_id">True on success.
Use this method to delete up to 10000 recent reactions in a group or supergroup chat added by a specific user or chat.
The bot must have the can_delete_messages administrator right in the chat.
Returns True on success.
Unique identifier for the target chat
Optionaloptions: Omit<DeleteAllMessageReactionsParams, "chat_id">Additional parameters
True on success
Deletes messages on behalf of a business account.
Requires the business bot right can_delete_sent_messages to delete messages sent by the bot itself, or can_delete_all_messages to delete any message.
Returns True on success.
Business account identifier
Message identifiers
True on success
Use this method to delete a chat profile photo.
For this to work, the bot must be a chat administrator.
Returns true on success.
Unique identifier for the target chat
boolean on success
Use this method to delete a set of group stickers from a supergroup.
For this to work, the bot must be a chat administrator and have appropriate administrator rights.
Use the can_set_sticker_set field, which is optionally returned in getChat requests, to check if the bot can use this method.
Returns True on success.
Unique identifier for the target chat
True on success
Use this method to delete a forum topic along with all its messages in a forum supergroup chat or in a private chat with a user.
In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the can_delete_messages administrator right.
Returns True on success.
Unique identifier for the target chat
Forum topic identifier
True on success
Use this method to delete a message, including service messages, with the following restrictions:
dice message in a private chat can only be deleted if it was sent more than 24 hours ago.can_post_messages permission can delete outgoing messages in channels.can_delete_messages administrator right in a supergroup or channel, it can delete any message there.can_manage_direct_messages administrator right in a channel, it can delete any message in the corresponding direct message chat.
Returns True on success.Chat identifier or username.
Message identifier.
True on success.
Use this method to delete a reaction from a message in a group or supergroup chat.
The bot must have the can_delete_messages administrator right in the chat.
Returns True on success.
Unique identifier for the target chat
Message identifier
Optionaloptions: Omit<DeleteMessageReactionParams, "chat_id" | "message_id">Additional parameters
True on success
Use this method to delete multiple messages at once.
If some of the specified messages cannot be found, they are skipped.
Returns True on success.
Chat identifier or username.
Message identifiers.
True on success.
Use this method to delete the list of bot commands for a given scope and user language.
After deletion, higher-level commands will be shown to affected users.
Returns True on success.
Optionaloptions: DeleteMyCommandsParamsAdditional parameters (scope, language_code)
True on success
Use this method to delete a sticker from a sticker set.
Returns True on success.
Sticker identifier.
True on success.
Use this method to delete a sticker set created by the bot.
Returns True on success.
Sticker set name.
True on success.
Deletes a story previously published by the bot on behalf of a managed business account.
Requires the business bot right can_manage_stories.
On success, returns True.
Unique business connection identifier
Story identifier
True on success
Use this method to stop using the webhook and start working in long polling mode.
Returns True on success.
Optionaloptions: DeleteWebhookParamsAdditional parameters for deleting the webhook
boolean on success
Use this method to edit a non-primary invite link created by the bot.
For this to work, the bot must be a chat administrator and have appropriate administrator rights.
On success, returns the edited invite link as a ChatInviteLink object.
Unique identifier for the target chat
Chat invite link
Optionaloptions: Omit<EditChatInviteLinkParams, "chat_id" | "invite_link">Parameters for changing the invite link
ChatInviteLink on success
Use this method to edit a subscription invite link created by the bot.
The bot must have the can_invite_users administrator right.
On success, returns the edited invite link as a ChatInviteLink object.
Unique identifier for the target chat
Chat invite link
Optionaloptions: Omit<EditChatSubscriptionInviteLinkParams, "chat_id" | "invite_link">Parameters for editing the invite link
ChatInviteLink on success
Use this method to edit the name and icon of a topic in a forum supergroup chat or in a private chat with a user.
In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the can_manage_topics administrator right, unless it is the topic author.
Returns True on success.
Unique identifier for the target chat
Forum topic identifier
Optionaloptions: Omit<EditForumTopicParams, "chat_id" | "message_thread_id">Additional parameters (name, icon_custom_emoji_id)
true on success
Use this method to edit the name of the "General" topic in a forum supergroup chat.
For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right.
Returns True on success.
Unique identifier for the target chat
New forum topic name
True on success
Use this method to edit message captions.
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 of being sent.
Message identifier (either chat_id and message_id, or inline_message_id)
Optionaloptions: Omit<EditMessageCaptionParams, "chat_id" | "message_id" | "inline_message_id">Additional parameters (caption, parse_mode, etc.)
Edited message or True if editing was successful
Use this method to edit a checklist on behalf of a connected business account. On success, the edited message is returned.
Business connection identifier.
Chat identifier.
Message identifier.
New checklist.
Optionaloptions: Omit<Additional parameters
Edited message on success.
Use this method to edit live location messages.
A location can be edited until its live_period expires or editing is explicitly prohibited by calling stopMessageLiveLocation.
On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
Message identifier. Can be an object with chat_id and message_id or an inline_message_id string.
New location latitude
New location longitude
Optionaloptions: Omit<Additional parameters
Edited message or True on success.
Use this method to edit animation, audio, document, photo, or video messages, or to add media files to text messages.
If a message is part of a message album, it can only be edited as audio for audio albums, only as a document for document albums, and as a photo or video in other cases.
When editing an inline message, a new file cannot 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 of being sent.
Message identifier. Can be an object with chat_id and message_id or an inline_message_id string.
Optionaloptions: Omit<Media message editing parameters. Must include media (InputMediaVideo/InputMediaAnimation/InputMediaAudio/InputMediaPhoto).
Edited message or True on success.
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 of being sent.
Message identifier. Can be an object with chat_id and message_id or an inline_message_id string.
Optionaloptions: Omit<Additional parameters.
Edited message or True on success.
Edits a text message or inline message text.
Message identifier (either chat_id and message_id, or inline_message_id)
New message text
Optionaloptions: Omit<Additional parameters
Edited message
Edits a story previously published by the bot on behalf of a managed business account.
Requires the business bot right can_manage_stories.
Returns Story on success.
Unique business connection identifier
Story identifier
Story content
Optionaloptions: Omit<EditStoryParams, "business_connection_id" | "content" | "story_id">Additional parameters
Story on success
Allows the bot to cancel or re-enable the renewal of a subscription paid in Telegram Stars.
Returns True on success.
User identifier.
Telegram payment identifier for the subscription.
Whether the subscription is canceled.
True on success.
Use this method to create a new primary invite link for a chat; any previously created primary link will be revoked. For this to work, the bot must be a chat administrator and have appropriate administrator rights. On success, returns the new invite link as a string.
Unique identifier for the target chat
string on success
Use this method to forward messages of any type. Service messages and messages with protected content cannot be forwarded. On success, the sent message is returned.
Unique identifier for the target chat
Unique identifier for the chat from which the message is forwarded
Identifier of the message in the from_chat_id chat
Optionaloptions: Omit<ForwardMessageParams, "chat_id" | "message_id" | "from_chat_id">Additional forwarding parameters
Message on success
Use this method to forward multiple messages of any type.
If some of the specified messages cannot be found or forwarded, they are skipped.
Service messages and messages with protected content cannot be forwarded.
Grouping by albums is preserved for forwarded messages.
On success, an array of MessageId of the sent messages is returned.
Unique identifier for the target chat
Unique identifier for the chat from which messages are forwarded
Array of message identifiers in the chat_id chat
Optionaloptions: Omit<ForwardMessagesParams, "chat_id" | "from_chat_id" | "message_ids">Additional forwarding parameters
MessageId[] on success
Returns a list of gifts that the bot can send to users and channel chats.
No parameters required.
Returns a Gifts object on success.
Gifts object on success
Returns received gifts belonging to a managed business account.
Requires the business bot right can_view_gifts_and_stars.
Returns OwnedGifts on success.
Business account identifier
Optionaloptions: Omit<GetBusinessAccountGiftsParams, "business_connection_id">Additional parameters
Received gifts
Returns the number of Telegram Stars belonging to a managed business account.
Requires the business bot right can_view_gifts_and_stars.
Returns StarAmount on success.
Business account identifier
Number of stars
Use this method to get information about the bot's connection to a business account.
Returns a BusinessConnection object on success.
Unique business connection identifier
BusinessConnection with connection information
Use this method to get up-to-date information about the chat.
On success, returns a ChatFullInfo object.
Unique identifier for the target chat
ChatFullInfo on success
Use this method to get a list of administrators in a chat who are not bots.
On success, returns an array of ChatMember objects.
Unique identifier for the target chat
Optionaloptions: Omit<GetChatAdministratorsParams, "chat_id">Additional parameters
ChatMember[] on success
Returns gifts belonging to a chat.
Returns OwnedGifts on success.
Chat identifier with the user
Optionaloptions: Omit<GetChatGiftsParams, "chat_id">Additional parameters
Received gifts
Use this method to get information about a chat member.
The method is guaranteed to work for other users only if the bot is a chat administrator.
On success, returns a ChatMember object.
Unique identifier for the target chat
User identifier
ChatMember on success
Use this method to get the number of members in a chat.
Returns int on success.
Unique identifier for the target chat
number on success
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.
Optionalchat_id: numberChat identifier
MenuButton object on success
Use this method to get information about custom emoji stickers by their identifiers.
Returns an array of Sticker objects.
Sticker identifiers.
Array of Sticker objects.
Use this method to get basic information about a file and prepare it for downloading.
Currently, bots can download files of up to 20 MB in size.
On success, a TelegramFile object is returned.
The file can 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.
Unique file identifier
TelegramFile with file information
Use this method to get custom emoji stickers that any user can use as a forum topic icon.
Requires no parameters. Returns an array of Sticker objects.
Sticker[] on success
Use this method to get data for high score tables.
Returns the score of the specified user and several of their neighbors in the game.
Returns an array of GameHighScore objects.
This method will currently return scores for the target user, as well as two of their closest neighbors on each side. It will also return the top three users if the user and their neighbors are not among them. Note that this behavior is subject to change.
User identifier.
Optionaloptions: Omit<GetGameHighScoresParams, "user_id">Additional parameters.
Array of GameHighScore objects with user score information.
Use this method to get managed bot access settings.
Returns a BotAccessSettings object on success.
Unique user identifier (managed bot)
BotAccessSettings with access settings
Use this method to get a managed bot token. Returns the token as a string on success.
Unique user identifier (managed bot)
string token as a string
Use this method to get information about the bot.
Returns User.
User on success
Use this method to get the current list of bot commands for a given scope and user language. Returns an array of BotCommand objects. If commands are not set, an empty list is returned.
Optionaloptions: GetMyCommandsParamsAdditional parameters (scope, language_code)
Array of BotCommand objects
Use this method to get the bot's current default administrator rights.
Returns ChatAdministratorRights on success.
Optionaloptions: GetMyDefaultAdministratorRightsParamsAdditional parameters (for_channels)
ChatAdministratorRights object on success
Use this method to get the current bot description for a given user language.
Returns BotDescription on success.
Optionaloptions: GetMyDescriptionParamsAdditional parameters (language_code)
BotDescription object on success
Use this method to get the current bot name for a given user language. Returns BotName on success.
Optionaloptions: GetMyNameParamsAdditional parameters (language_code)
BotName object on success
Use this method to get the current bot short description for a given user language.
Returns BotShortDescription on success.
Optionaloptions: GetMyShortDescriptionParamsAdditional parameters (language_code)
BotShortDescription object on success
Method to get the current Telegram Stars balance of the bot.
Requires no parameters.
On success, returns a StarAmount object.
StarAmount object.
Returns the bot's Telegram Star transactions in chronological order.
On success, returns a StarTransactions object.
Optionaloptions: GetStarTransactionsParamsParameters for filtering transactions.
StarTransactions object with transaction information.
Use this method to get a sticker set.
On success, a StickerSet object is returned.
Sticker set name.
StickerSet.
Use this method to receive incoming updates using long polling.
Returns an array of Update objects.
Additional parameters for receiving updates
Update[] on success
Use this method to get information about boosts provided by a chat user.
Returns UserChatBoosts on success.
Unique identifier for the target chat
Unique user identifier
UserChatBoosts
Returns gifts owned and displayed by a user.
Returns OwnedGifts on success.
User identifier
Optionaloptions: Omit<GetUserGiftsParams, "user_id">Additional parameters
Received gifts
Use this method to get recent messages from a given user's personal chat.
Returns an array of Message objects on success.
Unique user identifier
Maximum number of messages to return; 1-20
Array of Message objects
Use this method to get a list of user profile audio.
Returns a UserProfileAudios object.
Unique identifier for the target user
Optionaloptions: Omit<GetUserProfileAudiosParams, "user_id">Additional profile audio parameters
UserProfileAudios on success
Use this method to get a list of user profile photos.
Returns a UserProfilePhotos object with user photos, starting from the newest.
Unique identifier for the target user
Optionaloptions: Omit<GetUserProfilePhotosParams, "user_id">Additional profile photo parameters
UserProfilePhotos on success
Use this method to get current information about the webhook set for your bot. Returns WebhookInfo.
WebhookInfo on success
Gifts a Telegram Premium subscription to a specified user.
Returns True on success.
User identifier
Number of subscription months
Number of stars
Optionaloptions: Omit<GiftPremiumSubscriptionParams, "user_id" | "star_count" | "month_count">True on success
Main method for processing incoming Updates from Telegram.
It automatically creates a base Context object and starts the middleware chain.
Context is always created, which is forcibly cast to your type C.Incoming update from Telegram
Promise<void>
Use this method to hide the "General" topic in a forum supergroup chat.
For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right.
The topic will be automatically closed if it was open.
Returns True on success.
Unique identifier for the target chat
True on success
Use this method for your bot to leave a group, supergroup, or channel.
Returns True on success.
Unique identifier for the target chat
True on success
Use this method to log out the bot.
Returns boolean.
boolean on success
Returns all handlers registered in this class as one large function. Wrapped in try...catch to intercept errors.
Registers a handler that will trigger under certain conditions (update type, presence of a field or entity).
Field name or array of names (e.g., 'photo', 'document', 'callback_query')
Handler functions that will be executed on a match
Use this method to add a message to the list of pinned messages in a chat.
In private chats and channel direct message chats, all non-service messages can be pinned.
Conversely, the bot must be an administrator with the can_pin_messages or can_edit_messages right to pin messages in groups and channels respectively.
Returns True on success.
Unique identifier for the target chat
Identifier of the message to pin
Optionaloptions: Omit<PinChatMessageParams, "chat_id" | "message_id">True on success
Posts a story on behalf of a managed business account.
Requires the business bot right can_manage_stories.
Returns Story on success.
Unique business connection identifier
Story content
Story duration (from 1 to 72 hours)
Optionaloptions: Omit<PostStoryParams, "business_connection_id" | "content" | "active_period">Additional parameters
Story on success
Use this method to promote or demote a user in a supergroup or a channel.
For this to work, the bot must be a chat administrator and have the appropriate administrator rights.
Pass False for all boolean parameters to demote a user.
Returns True on success.
Unique identifier for the chat or username of the target bot
Unique user identifier
Optionaloptions: Omit<PromoteChatMemberParams, "chat_id" | "user_id">Additional parameters
True on success
Marks an incoming message as read on behalf of a business account.
Requires the business bot right can_read_messages.
Returns True on success.
Business account identifier
Chat identifier
Message identifier
True on success
Refunds a successful payment in Telegram Stars.
Returns True on success.
User identifier.
Telegram payment transaction identifier.
True on success.
Deletes the current profile photo of a managed business account.
Requires the business bot right can_edit_profile_photo.
Returns True on success.
Business account identifier
Optionaloptions: Omit<RemoveBusinessAccountProfilePhotoParams, "business_connection_id">True on success
Revokes a chat verification established by the bot on behalf of an organization.
Returns True on success.
Chat identifier
True on success
Use this method to delete the bot's profile photo.
Returns True on success.
True on success
Revokes a user verification established by the bot on behalf of an organization.
Returns True on success.
User identifier
true on success
Use this method to reopen a closed topic in a forum supergroup chat.
For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right, unless it is the topic author.
Returns True on success.
Unique identifier for the target chat
Forum topic identifier
True on success
Use this method to reopen a closed "General" topic in a forum supergroup chat.
For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right.
The topic will be automatically shown if it was hidden.
Returns True on success.
Unique identifier for the target chat
True on success
Use this method to revoke the current managed bot token and generate a new one. Returns the new token as a string on success.
Unique user identifier (managed bot)
New token as a string
Use this method to replace a sticker in a sticker set.
Returns True on success.
User identifier creating the sticker set.
Sticker set name.
Identifier of the sticker to be replaced.
New sticker. Must be an InputSticker object.
True on success.
Reposts a story on behalf of a business account from another business account.
Both business accounts must be managed by the same bot, and the story in the source account must be published (or reposted) by the bot.
Requires the business bot right can_manage_stories for both business accounts.
Returns Story on success.
Business account identifier.
Source chat identifier.
Source story identifier.
Story duration.
Optionaloptions: Omit<Additional parameters.
Story on success.
Use this method to restrict a user in a supergroup.
For this to work, the bot must be a supergroup administrator and have the appropriate administrator rights.
Pass True for all permissions to lift restrictions from a user.
Unique identifier for the chat or username of the target bot
Unique user identifier
New status of user rights
Optionaloptions: Omit<RestrictChatMemberParams, "chat_id" | "user_id" | "permissions">Additional parameters
True on success
Use this method to revoke an invite link created by the bot.
If the primary link is revoked, a new link is automatically generated.
For this to work, the bot must be a chat administrator and have appropriate administrator rights.
On success, returns the revoked invite link as a ChatInviteLink object.
Unique identifier for the target chat
Chat invite link
ChatInviteLink on success
Saves a message that can be sent by a mini-app user.
Returns a PreparedInlineMessage object.
User identifier
Inline query result
Optionaloptions: Omit<SavePreparedInlineMessageParams, "user_id" | "result">PreparedInlineMessage with the prepared message ID
Saves a keyboard button that can be used by a mini-app user.
Returns a PreparedKeyboardButton object.
User identifier
Keyboard button
PreparedKeyboardButton with the prepared button ID
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 up to 50 MB, this limit may be changed in the future.
Unique identifier for the target chat
Animation to send (File ID, URL or file object)
Optionaloptions: Omit<SendAnimationParams, "chat_id" | "animation">Additional animation parameters
Message on success
Use this method to send audio files, if you want Telegram clients to display them in the music player.
Your audio file must be in the .MP3 or .M4A format.
On success, the sent message is returned.
Bots can currently send audio files up to 50 MB, this limit may be changed in the future.
For sending voice messages, use the sendVoice method.
Unique identifier for the target chat
Audio to send (File ID, URL or file object)
Optionaloptions: Omit<SendAudioParams, "chat_id" | "audio">Additional audio parameters
Message on success
Use this method when you need to inform 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: ImageBot needs some time to process the request and upload the image.
Instead of sending a text message like "Getting image, please wait...", the bot can use sendChatAction with action = 'upload_photo'.
The user will see the bot status "uploading photo".
Unique identifier for the target chat
Type of action to broadcast
Optionaloptions: Omit<SendChatActionParams, "chat_id" | "action">Additional action parameters
True on success
Use this method to send a checklist on behalf of a connected business account.
On success, the sent Message is returned.
Business account identifier
Unique identifier for the target chat
Checklist to send
Optionaloptions: Omit<SendChecklistParams, "chat_id" | "business_connection_id" | "checklist">Additional checklist parameters
Message on success
Use this method to send user contact information.
On success, the sent Message is returned.
Unique identifier for the target chat
Phone number
Contact first name
Optionaloptions: Omit<SendContactParams, "chat_id" | "phone_number" | "first_name">Additional contact parameters
Message on success
Use this method to send an animated emoji that will display a random value.
Returns Message on success.
Unique identifier for the target chat
Optionaloptions: Omit<SendDiceParams, "chat_id">Additional animated emoji parameters (emoji, etc.)
Message on success
Use this method to send general files.
On success, the sent Message is returned.
Bots can currently send files of any type up to 50 MB, this limit may be changed in the future.
Unique identifier for the target chat
File to send (File ID, URL or file object)
Optionaloptions: Omit<SendDocumentParams, "chat_id" | "document">Additional file parameters
Message on success
Use this method to send a game. On success, the sent message is returned.
Chat identifier.
Game short name.
Optionaloptions: Omit<SendGameParams, "chat_id" | "game_short_name">Additional parameters.
Message object.
Sends a gift to a specified user or channel chat.
The recipient cannot convert the gift into Telegram Stars.
Returns True on success.
Unique gift identifier
Additional parameters (chat_id, gift_item_name, user_id)
True on success
Use this method to send invoices. On success, the sent message is returned.
Chat identifier.
Invoice title.
Invoice description.
Internal invoice information.
Invoice currency.
Invoice prices.
Optionaloptions: Omit<Additional parameters.
Sent message.
Use this method to send photos in real time.
On success, the sent Message is returned.
Unique identifier for the target chat
Video part of a live photo (URL or InputFile)
Photo (URL or InputFile)
Optionaloptions: Omit<SendLivePhotoParams, "chat_id" | "photo" | "live_photo">Additional sending parameters
Promise<Message>
Use this method to send a point on the map.
On success, the sent Message is returned.
Unique identifier for the target chat
Latitude
Longitude
Optionaloptions: Omit<SendLocationParams, "chat_id" | "latitude" | "longitude">Additional geolocation parameters
Message on success
Use this method to send a group of photos, videos, documents, or audio as an album.
Documents and audio files can only be grouped in an album with messages of the same type.
On success, an array of the sent Message objects is returned.
Unique identifier for the target chat
Array of media files to send
Optionaloptions: Omit<SendMediaGroupParams, "chat_id" | "media">Additional media file parameters
Message[] on success
Use this method to send a text message.
Returns Message.
Unique identifier for the target chat or channel username (in the format @channelusername)
Message text to send (1-4096 characters after entity parsing)
Optionaloptions: Omit<SendMessageParams, "text" | "chat_id">Additional message parameters
Message on success
Use this method to stream a part of a message to the user during its generation.
Returns boolean on success.
Unique identifier for the target chat
Unique draft identifier
Message text
Optionaloptions: Omit<SendMessageDraftParams, "text" | "chat_id" | "draft_id">Additional draft parameters
boolean on success
Use this method to send paid media files.
On success, the sent Message is returned.
Unique identifier for the target chat
Number of stars to send
Array of paid media files
Optionaloptions: Omit<SendPaidMediaParams, "chat_id" | "media" | "star_count">Additional paid media parameters
Message on success
Use this method to send photos.
On success, the sent Message is returned.
Unique identifier for the target chat
Photo to send (File ID, URL or file object)
Optionaloptions: Omit<SendPhotoParams, "chat_id" | "photo">Additional photo parameters
Message on success
Use this method to send a poll.
On success, the sent Message is returned.
Unique identifier for the target chat
Poll text
Array of answer options
Optionaloptions: Omit<SendPollParams, "chat_id" | "question" | "options">Additional poll parameters
Message on success
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
On success, the sent message is returned.
Chat identifier or username.
Sticker to send. Can be file_id, url, or InputFile.
Optionaloptions: Omit<SendStickerParams, "chat_id" | "sticker">Additional parameters.
Sent message.
Use this method to send venue information.
On success, the sent Message is returned.
Unique identifier for the target chat
Latitude
Longitude
Venue name
Address
Optionaloptions: Omit<Additional venue parameters
Message on success
Use this method to send video files.
Telegram clients support MPEG4 video (other formats can be sent as a document).
On success, the sent Message is returned.
Bots can currently send video files up to 50 MB, this limit may be changed in the future.
Unique identifier for the target chat
Video to send (File ID, URL or file object)
Optionaloptions: Omit<SendVideoParams, "chat_id" | "video">Additional video parameters
Message on success
Use this method to send video messages (videos up to 60 seconds long).
Currently, video message duration is limited to 60 seconds, but this limit may be changed in the future.
Bots can currently send video messages up to 50 MB, this limit may be changed in the future.
On success, the sent Message is returned.
Unique identifier for the target chat
Video message to send (File ID, URL or file object)
Optionaloptions: Omit<SendVideoNoteParams, "chat_id" | "video_note">Additional video message parameters
Message on success
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 or .M4A format (other formats may be sent as audio or document). On success, the sent message is returned. Bots can currently send voice messages up to 50 MB, this limit may be changed in the future.
Unique identifier for the target chat
Audio to send (File ID, URL or file object)
Optionaloptions: Omit<SendVoiceParams, "chat_id" | "voice">Additional audio parameters
Message on success
Changes the bio of a managed business account.
Requires the business bot right can_change_bio.
Returns True on success.
Business account identifier
Optionaloptions: Omit<SetBusinessAccountBioParams, "business_connection_id">Additional parameters (bio)
True on success
Changes the privacy settings regarding incoming gifts in a managed business account.
Requires the business bot right can_change_gift_settings.
Returns True on success.
Business account identifier
Show gift button
Accepted gift types
True on success
Changes the first and last name of a managed business account.
Requires the business bot right can_change_name.
Returns True on success.
Business account identifier
New first name of the managed business account
Optionaloptions: Omit<SetBusinessAccountNameParams, "business_connection_id" | "first_name">Additional parameters (last_name)
True on success
Changes the profile photo of a managed business account.
Requires the business bot right can_edit_profile_photo.
Returns True on success.
Business account identifier
Managed business account photo
Optionaloptions: Omit<SetBusinessAccountProfilePhotoParams, "business_connection_id" | "photo">Additional parameters (photo)
True on success
Changes the username of a managed business account.
Requires the business bot right can_change_username.
On success, returns True.
Business account identifier
Optionaloptions: Omit<SetBusinessAccountUsernameParams, "business_connection_id">Additional parameters (username)
True on success
Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
For this to work, the bot must be a chat administrator and have appropriate administrator rights.
Returns True on success.
Unique identifier for the target chat
Unique identifier for the target user
Custom title for the chat administrator
True on success
Use this method to change the description of a group, supergroup, or channel.
For this to work, the bot must be a chat administrator and have appropriate administrator rights.
Returns true on success.
Unique identifier for the target chat
Optionaldescription: stringNew chat description
True on success
Use this method to set a tag for a regular group or supergroup member.
For this to work, the bot must be a chat administrator and have the can_manage_tags administrator right.
Returns True on success.
Unique identifier for the target chat
Unique identifier for the target user
Optionaloptions: Omit<SetChatMemberTagParams, "chat_id" | "user_id">Additional parameters
True on success
Use this method to change the bot's menu button in a private chat or the default menu button.
Returns True on success.
Optionaloptions: SetChatMenuButtonParamsAdditional parameters (chat_id, menu_button)
True on success
Use this method to set default chat permissions for all participants.
For this to work, the bot must be a group or supergroup administrator and have the can_restrict_members administrator right.
Returns True on success.
Unique identifier for the target chat
New status of user rights
Optionaloptions: Omit<SetChatPermissionsParams, "chat_id" | "permissions">True on success
Use this method to upload a new profile photo for a chat. For this to work, the bot must be a chat administrator.
Unique identifier for the target chat
Photo to upload.
true on success
Use this method to set a new set of group stickers for a supergroup.
For this to work, the bot must be a chat administrator and have appropriate administrator rights.
Use the can_set_sticker_set field, which is optionally returned in getChat requests, to check if the bot can use this method.
Returns True on success.
Unique identifier for the target chat
Sticker set name
True on success
Use this method to change the chat title. Titles cannot be changed for private chats.
For this to work, the bot must be a chat administrator and have appropriate administrator rights.
Returns True on success.
Unique identifier for the target chat
New chat title
True on success
Use this method to set the thumbnail of a custom emoji sticker set.
Returns True on success.
Sticker set name.
Emoji identifier.
True on success.
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.
User identifier.
Player's score.
Optionaloptions: Omit<SetGameScoreParams, "user_id" | "score">Additional parameters.
Message object or True.
Use this method to change managed bot access settings.
Returns True on success.
Unique user identifier (managed bot)
True if only selected users have access to the bot. The bot owner always has access.
Optionaloptions: Omit<SetManagedBotAccessSettingsParams, "user_id" | "is_access_restricted">Additional parameters (see SetManagedBotAccessSettingsParams)
True on success
Use this method to change chosen reactions on a message.
Service messages of some types cannot be reacted to.
Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel.
Bots cannot use paid reactions.
Returns True on success.
Unique identifier for the target chat
Unique identifier for the message
Array of reactions to set
True on success
Use this method to change the list of bot commands.
See this guide for more information about bot commands.
Returns True on success.
List of commands for the bot (max 100)
Optionaloptions: Omit<SetMyCommandsParams, "commands">Additional parameters (scope, language_code)
True on success
Use this method to change the default administrator rights requested by the bot when it is added as an administrator to groups or channels.
These rights will be proposed to users, but they can change the list before adding the bot.
Returns True on success.
Optionaloptions: SetMyDefaultAdministratorRightsParamsAdditional parameters (rights, for_channels)
True on success
Use this method to change the bot's description, which is displayed in the chat with the bot if the chat is empty.
Returns True on success.
Optionaloptions: SetMyDescriptionParamsAdditional parameters (description, language_code)
True on success
Use this method to change the bot's name.
Returns True on success.
Optionaloptions: SetMyNameParamsAdditional parameters (name, language_code)
True on success
Use this method to change the bot's profile photo.
Returns True on success.
Bot profile photo
True on success
Use this method to change the bot's short description, which is displayed on the bot's profile page and sent with a link when users share the bot.
Returns True on success.
Optionaloptions: SetMyShortDescriptionParamsAdditional parameters (short_description, language_code)
True on success
Use this method to change the list of emojis assigned to a regular or custom emoji sticker.
The sticker must belong to a sticker set created by the bot.
Returns True on success.
Sticker identifier.
List of emojis.
True on success.
Use this method to change the list of 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.
Sticker identifier.
List of keywords.
True on success.
Use this method to change the mask position of a sticker.
The sticker must belong to a set created by the bot.
Returns True on success.
Sticker identifier.
Optionaloptions: Omit<SetStickerMaskPositionParams, "sticker">Additional parameters.
True on success.
Use this method to move a sticker from a set created by the bot to a specific position.
Returns True on success.
Sticker identifier.
New sticker position.
True on success.
Use this method to set the thumbnail of a regular sticker set or a mask set.
The thumbnail file format must match the format of the stickers in the set.
Returns True on success.
Sticker set name.
User identifier creating the sticker set.
Thumbnail file format.
Optionaloptions: Omit<SetStickerSetThumbnailParams, "user_id" | "name" | "format">Additional parameters.
True on success.
Use this method to set the title of a created sticker set.
Returns True on success.
Sticker set name.
New sticker set title.
True on success.
Use this method to set a user's emoji status.
Returns True on success.
Unique identifier for the target user
Optionaloptions: Omit<SetUserEmojiStatusParams, "user_id">Additional emoji status parameters
True on success
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 serialized JSON update.
In case of a failed request (a request with an HTTP response status code other than 2XY), we will retry the request and stop its execution after a sufficient number of attempts.
Returns True on success.
If you want to ensure that the webhook was set by you, you can specify secret data in the parameter secret_token.
If specified, the request will contain an "X-Telegram-Bot-Api-Secret-Token" header with the secret token as its content.
Important: Ensure that your URL uses a valid SSL certificate. Requests with invalid certificates will be ignored. For testing in a local environment, you can use ngrok or similar services.
Webhook URL
Optionaloptions: Omit<SetWebhookParams, "url">Additional webhook parameters
boolean on success
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.
Message identifier. Can be an object with chat_id and message_id or an inline_message_id string.
Optionaloptions: Omit<Additional parameters
Edited message or True on success.
Use this method to stop a poll. On success, the updated poll is returned.
Chat identifier or username.
Message identifier with the poll.
Optionaloptions: Omit<StopPollParams, "chat_id" | "message_id">Additional parameters.
Updated poll.
Transfers Telegram Stars from a business account balance to the bot balance.
Requires the business bot right can_transfer_stars.
Returns True on success.
Business account identifier
Number of stars to transfer
True on success
Transfers an owned unique gift to another user.
Requires the business bot right can_transfer_and_upgrade_gifts.
Requires the business bot right can_transfer_stars if the transfer is paid.
Returns True on success.
Business account identifier
Gift identifier
New owner's chat identifier
Optionaloptions: Omit<Additional parameters
True on success
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 an invite link, etc.
The bot must be an administrator for this to work.
By default, this method guarantees that after the call the user will not be 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 only_if_banned parameter.
Returns True on success.
Unique identifier for the target chat
Unique identifier for the target user
Optionaloptions: Omit<UnbanChatMemberParams, "chat_id" | "user_id">Additional unban parameters
True on success
Use this method to unban a previously blocked channel chat in a supergroup or channel.
For this to work, the bot must be an administrator and have appropriate administrator rights.
Returns True on success.
Unique identifier for the target chat
Unique identifier of the sender
True on success
Use this method to unhide the "General" topic in a forum supergroup chat.
For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right.
Returns True on success.
Unique identifier for the target chat
True on success
Use this method to clear the list of pinned messages in a chat.
In private chats and channel direct message chats, no additional rights are required to unpin all pinned messages.
Conversely, the bot must be an administrator with the can_pin_messages or can_edit_messages right to unpin all pinned messages in groups and channels respectively.
Returns True on success.
Unique identifier for the target chat
True on success
Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or in a private chat with a user.
In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the can_pin_messages administrator right in the supergroup.
Returns True on success.
Unique identifier for the target chat
Forum topic identifier
True on success
Use this method to clear the list of pinned messages in a General forum topic.
For this to work, the bot must be a chat administrator and have the can_pin_messages administrator right in the supergroup.
Returns True on success.
Unique identifier for the target chat
True on success
Use this method to remove a message from the list of pinned messages in a chat.
In private chats and channel direct message chats, all messages can be unpinned.
Conversely, the bot must be an administrator with the can_pin_messages or can_edit_messages right to unpin messages in groups and channels respectively.
Returns True on success.
Unique identifier for the target chat
Optionaloptions: Omit<UnpinChatMessageParams, "chat_id">Additional parameters (message_id, etc.)
True on success
Upgrades a regular gift to a unique one.
Requires the business bot right can_transfer_and_upgrade_gifts.
Additionally requires the business bot right can_transfer_stars if the upgrade is paid.
Returns True on success.
Business account identifier
Gift identifier
Optionaloptions: Omit<UpgradeGiftParams, "business_connection_id" | "owned_gift_id">True on success
Use this method to upload a sticker file for subsequent use in createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times).
Returns the uploaded file on success.
User identifier.
Sticker to upload. Can be a string (file_id) or InputFile.
Sticker format. Can be 'static', 'animated', or 'video'.
File object.
Adds a general handler or an ENTIRE MODULE (another Composer).
Verifies a chat on behalf of an organization represented by the bot.
Returns True on success.
Chat identifier
Optionaloptions: Omit<VerifyChatParams, "chat_id">Additional parameters (custom_description)
True on success
Verifies a user on behalf of an organization represented by the bot.
Returns True on success.
User identifier
Optionaloptions: Omit<VerifyUserParams, "user_id">Additional parameters (status, comment)
True on success
StaticcomposeMagic engine: collects an array of middlewares into a single execution chain. When one middleware calls next(), this function triggers the next one.
Internal method used by the utf-build CLI to dynamically inject the GAS API client at runtime. Do not use manually.