Telegram

Class which implements sugar for direct Telegram Bots API calls

Constructor

new Telegram()

Extends

Members

webhookReply

Setter for webhookReply

Use this property to control reply via webhook feature.

Methods

addStickerToSet(ownerId, name, extra, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to add a new sticker to a set created by the bot. You must use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
ownerIdnumber

User identifier of sticker set owner

namestring

Sticker set name

extraExtraAddStickerToSet

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

answerCbQuery(callbackQueryIdopt, textopt, showAlertopt, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

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.

Parameters:
NameTypeAttributesDescription
callbackQueryIdstring<optional>

Unique identifier for the query to be answered

textstring<optional>

Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters

showAlertboolean<optional>

If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.

extraExtraAnswerCbQuery<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

answerGameQuery(callbackQueryId, urlopt, signalopt) → {Promise}

Alias to answerCbQuery for game query

Parameters:
NameTypeAttributesDescription
callbackQueryIdstring

Unique identifier for the query to be answered

urlstring<optional>

URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise

answerInlineQuery(inlineQueryId, results, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to send answers to an inline query.

Returns True on success or WebhookResponse when webhook response enabled. No more than 50 results per query are allowed.

Parameters:
NameTypeAttributesDescription
inlineQueryIdstring

Unique identifier for the answered query

resultsArray.<InlineQueryResult>

A array of results for the inline query

extraExtraAnswerInlineQuery<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

answerPreCheckoutQuery(preCheckoutQueryId, ok, errorMessageopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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.

Returns True on success or WebhookResponse when webhook response enabled.

Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.

Parameters:
NameTypeAttributesDescription
preCheckoutQueryIdstring

Unique identifier for the query to be answered

okboolean

Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.

errorMessagestring<optional>

Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

answerShippingQuery(shippingQueryId, ok, shippingOptionsopt, errorMessageopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
shippingQueryIdstring

Unique identifier for the query to be answered

okboolean

Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)

shippingOptionsArray.<ShippingOption><optional>

Required if ok is True. Array of available shipping options.

errorMessagestring<optional>

Required if ok is False. Error message in human-readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

answerWebAppQuery(webAppQueryId, result, signalopt) → {Promise.<SentWebAppMessage>}

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.

Parameters:
NameTypeAttributesDescription
webAppQueryIdstring

Unique identifier for the query to be answered

resultInlineQueryResult

A JSON-serialized object describing the message to be sent

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<SentWebAppMessage>

approveChatJoinRequest(chatId, userId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

userIdnumber

Unique identifier of the target user

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

banChatMember(chatId, userId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

userIdnumber

Unique identifier of the target user

extraExtraBanChatMember<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

banChatSenderChat(chatId, senderChatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

senderChatIdnumber

Unique identifier of the target sender chat

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

(async) callApi(method, dataopt, extraopt) → {Promise.<(object|boolean|number)>}

Method for direct call telegram bots api methods

Takes an optional AbortSignal object that allows to cancel the API call if desired.

For example:

const controller = new AbortController();
const signal = controller.signal;
ctx.telegram.callApi ('getMe', {}, { signal })
  .then(console.log)
  .catch(err => {
    if (err instanceof AbortError) {
      console.log('API call aborted')
    } else throw err
  })

controller.abort(); // Abort request

Read more about request aborts

Parameters:
NameTypeAttributesDescription
methodstring

Telegram API method name

dataobject<optional>

Object with method parameters

extraCallApiExtra<optional>

Extra parameters

Inherited From
Returns:
Type: 
Promise.<(object|boolean|number)>

closeForumTopic(chatId, messageThreadId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageThreadIdnumber

Unique identifier for the target message thread of the forum topic

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

closeGeneralForumTopic(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

copyMessage(chatId, fromChatId, messageId, extraopt, signalopt) → {Promise.<MessageId>}

Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message.

Returns the MessageId of the sent message on success.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

fromChatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber

Message identifier in the chat specified in from_chat_id

extraExtraCopyMessage | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<MessageId>

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

extraExtraCreateChatInviteLink<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<ChatInviteLink>

createForumTopic(chatId, name, extraopt, signalopt) → {Promise.<ForumTopic>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

namestring

Topic name, 1-128 characters

extraExtraCreateForumTopic<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<ForumTopic>

Use this method to create a link for an invoice.

Returns the created invoice link as String on success.

Parameters:
NameTypeAttributesDescription
invoiceInvoiceLinkParams

Object with invoice properties

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<string>

createNewStickerSet(ownerId, name, title, extra, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You must use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
ownerIdnumber

User identifier of created sticker set owner

namestring

Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters.

titlestring

Sticker set title, 1-64 characters

extraExtraCreateNewStickerSet

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

declineChatJoinRequest(chatId, userId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

userIdnumber

Unique identifier of the target user

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

deleteChatPhoto(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

deleteChatStickerSet(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

deleteForumTopic(chatId, messageThreadId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageThreadIdnumber

Unique identifier for the target message thread of the forum topic

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

deleteMessage(chatId, messageId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to delete a message, including service messages, with the following limitations:

  • A message can only be deleted if it was sent less than 48 hours ago.
  • A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
  • Bots can delete outgoing messages in private chats, groups, and supergroups.
  • Bots can delete incoming messages in private chats.
  • Bots granted can_post_messages permissions can delete outgoing messages in channels.
  • If the bot is an administrator of a group, it can delete any message there.
  • If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber

Identifier of the message to delete

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

deleteMyCommands(extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
extraExtraDeleteMyCommands<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

deleteStickerFromSet(sticker, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to delete a sticker from a set created by the bot.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
stickerstring

File identifier of the sticker

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

deleteStickerSet(name, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to delete a sticker set that was created by the bot.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
namestring

Sticker set name

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

deleteWebhook(extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to remove webhook integration if you decide to switch back to Telegram#getUpdates.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
extraExtraDeleteWebhook<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

inviteLinkstring

The invite link to edit

extraExtraEditChatInviteLink<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<ChatInviteLink>

editForumTopic(chatId, messageThreadId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageThreadIdnumber

Unique identifier for the target message thread of the forum topic

extraExtraEditForumTopic<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

editGeneralForumTopic(chatId, name, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

namestring

New topic name, 1-128 characters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

editMessageCaption(chatIdopt, messageIdopt, inlineMessageIdopt, captionopt, extraopt, signalopt) → {Promise.<(boolean|Message)>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string<optional>

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber<optional>

Required if inline_message_id is not specified. Identifier of the message to edit

inlineMessageIdstring<optional>

Required if chat_id and message_id are not specified. Identifier of the inline message

captionstring<optional>

New caption of the message, 0-1024 characters after entities parsing

extraExtraEditMessageCaption | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|Message)>

editMessageLiveLocation(chatIdopt, messageIdopt, inlineMessageIdopt, latitude, longitude, extraopt, signalopt) → {Promise.<(boolean|Message)>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string<optional>

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber<optional>

Required if inline_message_id is not specified. Identifier of the message to edit

inlineMessageIdstring<optional>

Required if chat_id and message_id are not specified. Identifier of the inline message

latitudenumber

Latitude of new location

longitudenumber

Longitude of new location

extraExtraEditMessageLiveLocation | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|Message)>

editMessageMedia(chatIdopt, messageIdopt, inlineMessageIdopt, media, extraopt, signalopt) → {Promise.<(boolean|Message)>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string<optional>

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber<optional>

Required if inline_message_id is not specified. Identifier of the message to edit

inlineMessageIdstring<optional>

Required if chat_id and message_id are not specified. Identifier of the inline message

mediaInputMedia

Object for a new media content of the message

extraExtraEditMessageMedia | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|Message)>

editMessageReplyMarkup(chatIdopt, messageIdopt, inlineMessageIdopt, extraopt, signalopt) → {Promise.<(boolean|Message)>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string<optional>

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber<optional>

Required if inline_message_id is not specified. Identifier of the message to edit

inlineMessageIdstring<optional>

Required if chat_id and message_id are not specified. Identifier of the inline message

extraExtraEditMessageReplyMarkup | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|Message)>

editMessageText(chatIdopt, messageIdopt, inlineMessageIdopt, text, extraopt, signalopt) → {Promise.<(boolean|Message)>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string<optional>

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber<optional>

Required if inline_message_id is not specified. Identifier of the message to edit

inlineMessageIdstring<optional>

Required if chat_id and message_id are not specified. Identifier of the inline message

textstring

New text of the message, 1-4096 characters after entities parsing

extraExtraEditMessageText | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|Message)>

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise

forwardMessage(chatId, fromChatId, messageId, extraopt, signalopt) → {Promise.<Message>}

Use this method to forward messages of any kind. Service messages can't be forwarded.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

fromChatIdstring | number

Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)

messageIdnumber

Message identifier in the chat specified in from_chat_id

extraExtraForwardMessage | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

getChat(chatId, signalopt) → {Promise.<Chat>}

Use this method to get up-to-date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).

Returns a Chat object on success.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Chat>

getChatAdministrators(chatId, signalopt) → {Promise.<Array.<ChatMember>>}

Use this method to get a list of administrators in a chat.

On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Array.<ChatMember>>

getChatMember(chatId, userId, signalopt) → {Promise.<ChatMember>}

Use this method to get information about a member of a chat.

Note that the method getChatMember is only guaranteed to work if the bot is an administrator in the chat. (for hidden members after Bots API 6.4)

Returns a ChatMember object on success.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

userIdnumber

Unique identifier of the target user

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<ChatMember>

getChatMemberCount(chatId, signalopt) → {Promise.<number>}

Use this method to get the number of members in a chat.

Returns Int on success.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<number>

getChatMembersCount(chatId, signalopt) → {Promise.<number>}

Use this method to get the number of members in a chat.

Returns Int on success.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Deprecated
  • Use getChatMemberCount
Returns:
Type: 
Promise.<number>

getChatMenuButton(chatIdopt, signalopt) → {Promise.<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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string<optional>

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<MenuButton>

getCustomEmojiStickers(customEmojiIds, signalopt) → {Promise.<Array.<Sticker>>}

Use this method to get information about custom emoji stickers by their identifiers.

Returns an Array of Sticker objects.

Parameters:
NameTypeAttributesDescription
customEmojiIdsArray.<string>

List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Array.<Sticker>>

getFile(fileId, signalopt) → {Promise.<File>}

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

Parameters:
NameTypeAttributesDescription
fileIdstring

File identifier to get information about. For example AgACAgIAAx0CQjQWAgABBL1TYuJg8dI5tgABhPn_grF1nRzR-aMtAAJRvDEbb9cQSzO9zjdgGjp1AQADAgADcwADKQQ

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<File>

Calls getFile method with fileId or file object and return result

Parameters:
NameTypeAttributesDescription
fileIdstring | File

File identifier to get information about. For example AgACAgIAAx0CQjQWAgABBL1TYuJg8dI5tgABhPn_grF1nRzR-aMtAAJRvDEbb9cQSzO9zjdgGjp1AQADAgADcwADKQQ

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<URL>

getForumTopicIconStickers(signalopt) → {Promise.<Array.<Sticker>>}

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.

Parameters:
NameTypeAttributesDescription
signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Array.<Sticker>>

getGameHighScores(userId, inlineMessageIdopt, chatIdopt, messageIdopt, signalopt) → {Promise.<Array.<GameHighScore>>}

Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game.

On success, returns an Array of GameHighScore objects.

Parameters:
NameTypeAttributesDescription
userIdnumber

Target user id

inlineMessageIdnumber<optional>

Required if inline_message_id is not specified. Unique identifier for the target chat

chatIdnumber<optional>

Required if inline_message_id is not specified. Identifier of the sent message

messageIdnumber<optional>

Required if chat_id and message_id are not specified. Identifier of the inline message

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Array.<GameHighScore>>

getMe(signalopt) → {Promise.<User>}

A simple method for testing your bot's authentication token. Requires no parameters.

Returns basic information about the bot in form of a User object.

Parameters:
NameTypeAttributesDescription
signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<User>

getMyCommands(extraopt, signalopt) → {Promise.<Array.<BotCommand>>}

Use this method to get the current list of the bot's commands for the given scope and user language.

Returns Array of BotCommand on success. If commands aren't set, an empty list is returned.

Parameters:
NameTypeAttributesDescription
extraExtraGetMyCommands<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Array.<BotCommand>>

getMyDefaultAdministratorRights(forChannelsopt, signalopt) → {Promise.<ChatAdministratorRights>}

Use this method to get the current default administrator rights of the bot.

Returns ChatAdministratorRights on success.

Parameters:
NameTypeAttributesDescription
forChannelsboolean<optional>

Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<ChatAdministratorRights>

getMyDescription(languageCodeopt, signalopt) → {Promise.<BotDescription>}

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

Parameters:
NameTypeAttributesDescription
languageCodestring<optional>

A two-letter ISO 639-1 language code or an empty string

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<BotDescription>

getMyName(languageCodeopt, signalopt) → {Promise.<BotName>}

Use this method to get the current bot name for the given user language.

Returns BotName on success.

Parameters:
NameTypeAttributesDescription
languageCodestring<optional>

A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<BotName>

getMyShortDescription(languageCodeopt, signalopt) → {Promise.<BotShortDescription>}

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

Parameters:
NameTypeAttributesDescription
languageCodestring<optional>

A two-letter ISO 639-1 language code or an empty string

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<BotShortDescription>

getStickerSet(name, signalopt) → {Promise.<StickerSet>}

Use this method to get a sticker set.

On success, a StickerSet object is returned.

Parameters:
NameTypeAttributesDescription
namestring

Name of the sticker set

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<StickerSet>

getUpdates(timeoutopt, limitopt, offsetopt, allowedUpdatesopt, signalopt) → {Promise.<Array.<Update>>}

Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.

Parameters:
NameTypeAttributesDefaultDescription
timeoutnumber<optional>
0

Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.

limitnumber<optional>
100

Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.

offsetnumber<optional>

Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten.

allowedUpdatesArray.<string><optional>

Array of allowed updates or update name For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used.

Please note that this parameter doesn't affect updates created before
signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Array.<Update>>

getUserProfilePhotos(userId, offsetopt, limitopt, signalopt) → {Promise.<UserProfilePhotos>}

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

Returns a UserProfilePhotos object.

Parameters:
NameTypeAttributesDescription
userIdnumber

Unique identifier of the target user

offsetnumber<optional>

Sequential number of the first photo to be returned. By default, all photos are returned.

limitnumber<optional>

Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<UserProfilePhotos>

getWebhookInfo(signalopt) → {Promise.<WebhookInfo>}

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.

Parameters:
NameTypeAttributesDescription
signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<WebhookInfo>

hideGeneralForumTopic(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

kickChatMember(chatId, userId, untilDateopt, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Alias to banChatMember, but have different arguments

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

userIdnumber

Unique identifier of the target user

untilDatenumber<optional>

Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.

extraExtraKickChatMember<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Deprecated
  • Use #banChatMember instead
Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

leaveChat(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method for your bot to leave a group, supergroup or channel.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

pinChatMessage(chatId, messageId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber

Identifier of a message to pin

extraExtraPinChatMessage<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

promoteChatMember(chatId, userId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

userIdnumber

Unique identifier of the target user

extraExtraPromoteChatMember<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

reopenForumTopic(chatId, messageThreadId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageThreadIdnumber

Unique identifier for the target message thread of the forum topic

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

reopenGeneralForumTopic(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

restrictChatMember(chatId, userId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

userIdnumber

Unique identifier of the target user

extraExtraRestrictChatMember<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

inviteLinkstring

The invite link to revoke

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<ChatInviteLink>

sendAnimation(chatId, animation, extraopt, signalopt) → {Promise.<Message>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

animationInputFile | FileId

Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More information on Sending Files ยป

extraExtraAnimation | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendAudio(chatId, audio, extraopt, signalopt) → {Promise.<Message>}

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 Telegram#sendVoice method instead.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

audioInputFile | FileId

Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ยป

extraExtraAudio | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendChatAction(chatId, action, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

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.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

actionAction

Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.

extraExtraSendChatAction<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

sendContact(chatId, phoneNumber, firstName, extraopt, signalopt) → {Promise.<Message>}

Use this method to send phone contacts.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

phoneNumberstring

Contact's phone number

firstNamestring

Contact's first name

extraExtraContact | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendCopy(chatId, message, extraopt, signalopt) → {Promise}

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageMessage

Message object

extraobject | Extra<optional>

Extra parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise

sendDice(chatId, extraopt, signalopt) → {Promise.<Message>}

Use this method to send an animated emoji that will display a random value.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

extraExtraDice | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendDocument(chatId, document, extraopt, signalopt) → {Promise.<Message>}

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.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

documentInputFile | FileId

Document to send. Pass a file_id as String to send a document that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. More information on Sending Files ยป

extraExtraDocument | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendGame(chatId, gameName, extraopt, signalopt) → {Promise.<Message>}

Use this method to send a game.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

gameNamestring

Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather.

extraExtraGame | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendInvoice(chatId, invoice, extraopt, signalopt) → {Promise.<Message>}

Use this method to send invoices.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

invoiceInvoiceParams

Other invoice parameters

extraExtraInvoice | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendLocation(chatId, latitude, longitude, extraopt, signalopt) → {Promise}

Use this method to send point on the map.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)Unique identifier for the target chat or username of the target channel (in the format @channelusername)

latitudenumber

Latitude of the location

longitudenumber

Longitude of the location

extraExtraLocation | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise

sendMediaGroup(chatId, media, extraopt, signalopt) → {Promise.<Array.<Message>>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

mediaArray.<(InputMediaPhoto|InputMediaAudio|InputMediaVideo|InputMediaDocument)>

A array describing messages to be sent, must include 2-10 items

extraExtraMediaGroup | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Array.<Message>>

sendMessage(chatId, text, extraopt, signalopt) → {Promise.<Message>}

Use this method to send text messages.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

textstring

Text of the message to be sent, 1-4096 characters after entities parsing

extraExtraSendMessage | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendPhoto(chatId, photo, extraopt, signalopt) → {Promise.<Message>}

Use this method to send photos.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

photoInputFile | FileId

Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files ยป

extraExtraPhoto | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendPoll(chatId, question, options, extraopt, signalopt) → {Promise.<Message>}

Use this method to send a native poll with type regular.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

questionstring

Poll question, 1-300 characters

optionsArray.<string>

List of answer options, 2-10 strings 1-100 characters each

extraExtraPoll | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendQuiz(chatId, question, options, extraopt, signalopt) → {Promise.<Message>}

Use this method to send a native poll with type quiz.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

questionstring

Poll question, 1-300 characters

optionsArray.<string>

List of answer options, 2-10 strings 1-100 characters each

extraExtraQuiz | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendSticker(chatId, sticker, extraopt, signalopt) → {Promise.<Message>}

Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

stickerInputFile | FileId

Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ยป

extraExtraSticker | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendVenue(chatId, latitude, longitude, title, address, extraopt, signalopt) → {Promise.<Message>}

Use this method to send information about a venue.

On success, the sent Message is returned.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)Unique identifier for the target chat or username of the target channel (in the format @channelusername)

latitudenumber

Latitude of the venue

longitudenumber

Longitude of the venue

titlestring

Name of the venue

addressstring

Address of the venue

extraExtraVenue | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendVideo(chatId, video, extraopt, signalopt) → {Promise.<Message>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

videoInputFile | FileId

Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files ยป

extraExtraVideo | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendVideoNote(chatId, videoNote, extraopt, signalopt) → {Promise.<Message>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

videoNoteInputFile | FileId

Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files ยป. Sending video notes by a URL is currently unsupported

extraExtraVideoNote | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

sendVoice(chatId, voice, extraopt, signalopt) → {Promise.<Message>}

Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document).

On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

voiceInputFile | FileId

Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.

extraExtraVoice | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Message>

setChatAdministratorCustomTitle(chatId, userId, title, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

userIdnumber

Unique identifier of the target user

titlestring

New custom title for the administrator; 0-16 characters, emoji are not allowed

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setChatDescription(chatId, descriptionopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled. https://core.telegram.org/bots/api#setchatdescription

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

descriptionstring<optional>

New chat description, 0-255 characters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setChatMenuButton(chatId, menuButtonopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

menuButtonMenuButton<optional>

Unique identifier for the target private chat. If not specified, default bot's menu button will be changed

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setChatPermissions(chatId, permissions, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

permissionsChatPermissions

A object for new default chat permissions

extraExtraSetChatPermissions<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setChatPhoto(chatId, photo, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

photoInputFile

New chat photo, uploaded using multipart/form-data

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setChatStickerSet(chatId, setName, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdstring | number

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

setNamestring

Name of the sticker set to be set as the group sticker set

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setChatTitle(chatId, title, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

titlestring

New chat title, 1-255 characters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setCustomEmojiStickerSetThumbnail(name, customEmojiIdopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to set the thumbnail of a custom emoji sticker set.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
namestring

Sticker set name

customEmojiIdstring<optional>

Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setGameScore(userId, score, inlineMessageIdopt, chatIdopt, messageIdopt, editMessageopt, forceopt, signalopt) → {Promise.<(boolean|Message)>}

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.

Parameters:
NameTypeAttributesDefaultDescription
userIdnumber

User identifier

scorenumber

New score, must be non-negative

inlineMessageIdnumber<optional>

Required if chat_id and message_id are not specified. Identifier of the inline message

chatIdnumber<optional>

Required if inline_message_id is not specified. Unique identifier for the target chat

messageIdnumber<optional>

Required if inline_message_id is not specified. Identifier of the sent message

editMessageboolean<optional>
true

Pass True, if the game message should not be automatically edited to include the current scoreboard

forceboolean<optional>

Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|Message)>

setMyCommands(commands, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
commandsArray.<BotCommand>

List of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.

extraExtraSetMyCommands<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setMyDefaultAdministratorRights(rightsopt, forChannelsopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled. https://core.telegram.org/bots/api#setmydefaultadministratorrights

Parameters:
NameTypeAttributesDescription
rightsChatAdministratorRights<optional>

Object describing new default administrator rights. If not specified, the default administrator rights will be cleared.

forChannelsboolean<optional>

Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setMyDescription(descriptionopt, languageCodeopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
descriptionstring<optional>

New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.

languageCodestring<optional>

A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setMyName(nameopt, languageCodeopt, signalopt) → {Promise.<boolean>}

Use this method to get the current bot name for the given user language.

Returns BotName on success.

Parameters:
NameTypeAttributesDescription
namestring<optional>

New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.

languageCodestring<optional>

A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<boolean>

setMyShortDescription(shortDescriptionopt, languageCodeopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
shortDescriptionstring<optional>

New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.

languageCodestring<optional>

A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setPassportDataErrors(userId, errors, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

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.

Parameters:
NameTypeAttributesDescription
userIdnumber

User identifier

errorsArray.<PassportElementError>

Array describing the errors

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setStickerEmojiList(sticker, emojiList, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
stickerFileId

File identifier of the sticker

emojiListArray.<string>

A JSON-serialized list of 1-20 emoji associated with the sticker

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setStickerKeywords(sticker, keywordsopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
stickerFileId

File identifier of the sticker

keywordsArray.<string><optional>

A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setStickerMaskPosition(sticker, maskPositionopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
stickerFileId

File identifier of the sticker

maskPositionMaskPosition<optional>

A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setStickerPositionInSet(sticker, position, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
stickerstring

File identifier of the sticker

positionnumber

New sticker position in the set, zero-based

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setStickerSetThumb(name, userId, thumbnailopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Video thumbnails can be set only for video sticker sets only.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
namestring

Sticker set name

userIdnumber

User identifier of the sticker set owner

thumbnailInputFile | FileId<optional>

A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements, or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ยป. Animated sticker set thumbnails can't be uploaded via HTTP URL.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Deprecated
Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setStickerSetThumbnail(name, userId, thumbnailopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Video thumbnails can be set only for video sticker sets only.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
namestring

Sticker set name

userIdnumber

User identifier of the sticker set owner

thumbnailInputFile | FileId<optional>

A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements, or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ยป. Animated sticker set thumbnails can't be uploaded via HTTP URL.

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setStickerSetTitle(name, title, signalopt) → {Promise.<(boolean|WebhookResponse)>}

Use this method to set the title of a created sticker set.

Returns True on success or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
namestring

Sticker set name

titlestring

Sticker set title, 1-64 characters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

setWebhook(url, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

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.

Parameters:
NameTypeAttributesDescription
urlstring

HTTPS URL to send updates to. Use an empty string to remove webhook integration

extraExtraSetWebhook<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

stopMessageLiveLocation(chatId, messageIdopt, inlineMessageIdopt, extraopt, signalopt) → {Promise.<(boolean|Message)>}

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.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber<optional>

Required if inline_message_id is not specified. Identifier of the message with live location to stop

inlineMessageIdstring<optional>

Required if chat_id and message_id are not specified. Identifier of the inline message

extraExtraStopMessageLiveLocation | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|Message)>

stopPoll(chatId, messageId, extraopt, signalopt) → {Promise.<Poll>}

Use this method to stop a poll which was sent by the bot.

On success, the stopped Poll is returned.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageIdnumber

Identifier of the original message with the poll

extraExtraStopPoll | Extra<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<Poll>

unbanChatMember(chatId, userId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

userIdnumber

Unique identifier of the target user

extraExtraUnbanMember<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

unbanChatSenderChat(chatId, senderChatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

senderChatIdnumber

Unique identifier of the target sender chat

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

unhideGeneralForumTopic(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

unpinAllChatMessages(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

unpinAllForumTopicMessages(chatId, messageThreadId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

messageThreadIdnumber

Unique identifier for the target message thread of the forum topic

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

unpinAllGeneralForumTopicMessages(chatId, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

unpinChatMessage(chatId, extraopt, signalopt) → {Promise.<(boolean|WebhookResponse)>}

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 or WebhookResponse when webhook response enabled.

Parameters:
NameTypeAttributesDescription
chatIdnumber | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

extraExtraUnPinChatMessage<optional>

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<(boolean|WebhookResponse)>

uploadStickerFile(ownerId, sticker, extra, signalopt) → {Promise.<File>}

Use this method to upload a .PNG file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times).

Returns the uploaded File on success.

Parameters:
NameTypeAttributesDescription
ownerIdnumber

User identifier of sticker file owner

stickerInputSticker

PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. More information on Sending Files ยป.

extraExtraUploadStickerFile

Other parameters

signalAbortSignal<optional>

Optional AbortSignal to cancel the request

Returns:
Type: 
Promise.<File>