Extends
Members
webhookReply
Setter for webhookReply
Use this property to control reply via webhook feature.
- Overrides
- Source
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.
Name | Type | Attributes | Description |
---|---|---|---|
ownerId | number | User identifier of sticker set owner | |
name | string | Sticker set name | |
extra | ExtraAddStickerToSet | Other parameters | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
callbackQueryId | string | <optional> | Unique identifier for the query to be answered |
text | string | <optional> | Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters |
showAlert | boolean | <optional> | If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. |
extra | ExtraAnswerCbQuery | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
answerGameQuery(callbackQueryId, urlopt, signalopt) → {Promise}
Alias to answerCbQuery for game query
Name | Type | Attributes | Description |
---|---|---|---|
callbackQueryId | string | Unique identifier for the query to be answered | |
url | string | <optional> | URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
inlineQueryId | string | Unique identifier for the answered query | |
results | Array.<InlineQueryResult> | A array of results for the inline query | |
extra | ExtraAnswerInlineQuery | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
preCheckoutQueryId | string | Unique identifier for the query to be answered | |
ok | boolean | 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. | |
errorMessage | string | <optional> | Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
shippingQueryId | string | Unique identifier for the query to be answered | |
ok | boolean | 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) | |
shippingOptions | Array.<ShippingOption> | <optional> | Required if ok is True. Array of available shipping options. |
errorMessage | string | <optional> | Required if ok is False. Error message in human-readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
webAppQueryId | string | Unique identifier for the query to be answered | |
result | InlineQueryResult | A JSON-serialized object describing the message to be sent | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
userId | number | Unique identifier of the target user | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
userId | number | Unique identifier of the target user | |
extra | ExtraBanChatMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
senderChatId | number | Unique identifier of the target sender chat | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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
Name | Type | Attributes | Description |
---|---|---|---|
method | string | Telegram API method name | |
data | object | <optional> | Object with method parameters |
extra | CallApiExtra | <optional> | Extra parameters |
- Inherited From
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | |
messageThreadId | number | Unique identifier for the target message thread of the forum topic | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target supergroup (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
fromChatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
messageId | number | Message identifier in the chat specified in | |
extra | ExtraCopyMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<MessageId>
createChatInviteLink(chatId, extraopt, signalopt) → {Promise.<ChatInviteLink>}
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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
extra | ExtraCreateChatInviteLink | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
name | string | Topic name, 1-128 characters | |
extra | ExtraCreateForumTopic | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<ForumTopic>
createInvoiceLink(invoice, signalopt) → {Promise.<string>}
Use this method to create a link for an invoice.
Returns the created invoice link as String
on success.
Name | Type | Attributes | Description |
---|---|---|---|
invoice | InvoiceLinkParams | Object with invoice properties | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
ownerId | number | User identifier of created sticker set owner | |
name | string | Short name of sticker set, to be used in | |
title | string | Sticker set title, 1-64 characters | |
extra | ExtraCreateNewStickerSet | Other parameters | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
userId | number | Unique identifier of the target user | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target supergroup (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | |
messageThreadId | number | Unique identifier for the target message thread of the forum topic | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
messageId | number | Identifier of the message to delete | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
extra | ExtraDeleteMyCommands | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
sticker | string | File identifier of the sticker | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Sticker set name | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
extra | ExtraDeleteWebhook | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
editChatInviteLink(chatId, inviteLink, extraopt, signalopt) → {Promise.<ChatInviteLink>}
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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
inviteLink | string | The invite link to edit | |
extra | ExtraEditChatInviteLink | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
messageThreadId | number | Unique identifier for the target message thread of the forum topic | |
extra | ExtraEditForumTopic | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target supergroup (in the format | |
name | string | New topic name, 1-128 characters | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | <optional> | Unique identifier for the target chat or username of the target channel (in the format |
messageId | number | <optional> | Required if |
inlineMessageId | string | <optional> | Required if |
caption | string | <optional> | New caption of the message, 0-1024 characters after entities parsing |
extra | ExtraEditMessageCaption | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | <optional> | Unique identifier for the target chat or username of the target channel (in the format |
messageId | number | <optional> | Required if |
inlineMessageId | string | <optional> | Required if |
latitude | number | Latitude of new location | |
longitude | number | Longitude of new location | |
extra | ExtraEditMessageLiveLocation | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | <optional> | Unique identifier for the target chat or username of the target channel (in the format |
messageId | number | <optional> | Required if |
inlineMessageId | string | <optional> | Required if |
media | InputMedia | Object for a new media content of the message | |
extra | ExtraEditMessageMedia | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | <optional> | Unique identifier for the target chat or username of the target channel (in the format |
messageId | number | <optional> | Required if |
inlineMessageId | string | <optional> | Required if |
extra | ExtraEditMessageReplyMarkup | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | <optional> | Unique identifier for the target chat or username of the target channel (in the format |
messageId | number | <optional> | Required if |
inlineMessageId | string | <optional> | Required if |
text | string | New text of the message, 1-4096 characters after entities parsing | |
extra | ExtraEditMessageText | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|Message)>
exportChatInviteLink(chatId, signalopt) → {Promise}
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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
fromChatId | string | | Unique identifier for the chat where the original message was sent (or channel username in the format | |
messageId | number | Message identifier in the chat specified in | |
extra | ExtraForwardMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
userId | number | Unique identifier of the target user | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<ChatMember>
getChatMemberCount(chatId, signalopt) → {Promise.<number>}
Use this method to get the number of members in a chat.
Returns Int
on success.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<number>
getChatMembersCount(chatId, signalopt) → {Promise.<number>}
Use this method to get the number of members in a chat.
Returns Int
on success.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Deprecated
- Use getChatMemberCount
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | <optional> | Unique identifier for the target chat or username of the target channel (in the format |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
customEmojiIds | Array.<string> | List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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
Name | Type | Attributes | Description |
---|---|---|---|
fileId | string | File identifier to get information about. For example | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<File>
(async) getFileLink(fileId, signalopt) → {Promise.<URL>}
Calls getFile method with fileId
or file object and return result
Name | Type | Attributes | Description |
---|---|---|---|
fileId | string | | File identifier to get information about. For example | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Target user id | |
inlineMessageId | number | <optional> | Required if |
chatId | number | <optional> | Required if |
messageId | number | <optional> | Required if |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
extra | ExtraGetMyCommands | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
forChannels | boolean | <optional> | Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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
Name | Type | Attributes | Description |
---|---|---|---|
languageCode | string | <optional> | A two-letter ISO 639-1 language code or an empty string |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
languageCode | string | <optional> | A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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
Name | Type | Attributes | Description |
---|---|---|---|
languageCode | string | <optional> | A two-letter ISO 639-1 language code or an empty string |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<BotShortDescription>
getStickerSet(name, signalopt) → {Promise.<StickerSet>}
Use this method to get a sticker set.
On success, a StickerSet object is returned.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Name of the sticker set | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
timeout | number | <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. |
limit | number | <optional> | 100 | Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100. |
offset | number | <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 | |
allowedUpdates | Array.<string> | <optional> | Array of allowed updates or update name For example, specify
| |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | Unique identifier of the target user | |
offset | number | <optional> | Sequential number of the first photo to be returned. By default, all photos are returned. |
limit | number | <optional> | Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target supergroup (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
userId | number | Unique identifier of the target user | |
untilDate | number | <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. |
extra | ExtraKickChatMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Deprecated
- Use #banChatMember instead
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
messageId | number | Identifier of a message to pin | |
extra | ExtraPinChatMessage | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
userId | number | Unique identifier of the target user | |
extra | ExtraPromoteChatMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | |
messageThreadId | number | Unique identifier for the target message thread of the forum topic | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target supergroup (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target supergroup (in the format | |
userId | number | Unique identifier of the target user | |
extra | ExtraRestrictChatMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<(boolean|WebhookResponse)>
revokeChatInviteLink(chatId, inviteLink, signalopt) → {Promise.<ChatInviteLink>}
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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
inviteLink | string | The invite link to revoke | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
animation | InputFile | | Animation to send. Pass a | |
extra | ExtraAnimation | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
audio | InputFile | | Audio file to send. Pass a | |
extra | ExtraAudio | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
action | Action | Type of action to broadcast. Choose one, depending on what the user is about to receive: | |
extra | ExtraSendChatAction | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
phoneNumber | string | Contact's phone number | |
firstName | string | Contact's first name | |
extra | ExtraContact | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
sendCopy(chatId, message, extraopt, signalopt) → {Promise}
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
message | Message | Message object | |
extra | object | | <optional> | Extra parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
extra | ExtraDice | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
document | InputFile | | Document to send. Pass a | |
extra | ExtraDocument | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
sendGame(chatId, gameName, extraopt, signalopt) → {Promise.<Message>}
Use this method to send a game.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
gameName | string | Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather. | |
extra | ExtraGame | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
sendInvoice(chatId, invoice, extraopt, signalopt) → {Promise.<Message>}
Use this method to send invoices.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
invoice | InvoiceParams | Other invoice parameters | |
extra | ExtraInvoice | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
latitude | number | Latitude of the location | |
longitude | number | Longitude of the location | |
extra | ExtraLocation | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
media | Array.<(InputMediaPhoto|InputMediaAudio|InputMediaVideo|InputMediaDocument)> | A array describing messages to be sent, must include 2-10 items | |
extra | ExtraMediaGroup | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
text | string | Text of the message to be sent, 1-4096 characters after entities parsing | |
extra | ExtraSendMessage | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<Message>
sendPhoto(chatId, photo, extraopt, signalopt) → {Promise.<Message>}
Use this method to send photos.
On success, the sent Message is returned.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target channel (in the format | |
photo | InputFile | | Photo to send. Pass a | |
extra | ExtraPhoto | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
question | string | Poll question, 1-300 characters | |
options | Array.<string> | List of answer options, 2-10 strings 1-100 characters each | |
extra | ExtraPoll | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
question | string | Poll question, 1-300 characters | |
options | Array.<string> | List of answer options, 2-10 strings 1-100 characters each | |
extra | ExtraQuiz | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
sticker | InputFile | | Sticker to send. Pass a | |
extra | ExtraSticker | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
latitude | number | Latitude of the venue | |
longitude | number | Longitude of the venue | |
title | string | Name of the venue | |
address | string | Address of the venue | |
extra | ExtraVenue | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
video | InputFile | | Video to send. Pass a | |
extra | ExtraVideo | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
videoNote | InputFile | | Video note to send. Pass a | |
extra | ExtraVideoNote | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
voice | InputFile | | 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. | |
extra | ExtraVoice | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target supergroup (in the format | |
userId | number | Unique identifier of the target user | |
title | string | New custom title for the administrator; 0-16 characters, emoji are not allowed | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
description | string | <optional> | New chat description, 0-255 characters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
menuButton | MenuButton | <optional> | Unique identifier for the target private chat. If not specified, default bot's menu button will be changed |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target supergroup (in the format | |
permissions | ChatPermissions | A object for new default chat permissions | |
extra | ExtraSetChatPermissions | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
photo | InputFile | New chat photo, uploaded using multipart/form-data | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | string | | Unique identifier for the target chat or username of the target supergroup (in the format | |
setName | string | Name of the sticker set to be set as the group sticker set | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
title | string | New chat title, 1-255 characters | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Sticker set name | |
customEmojiId | string | <optional> | Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
userId | number | User identifier | ||
score | number | New score, must be non-negative | ||
inlineMessageId | number | <optional> | Required if | |
chatId | number | <optional> | Required if inline_message_id is not specified. Unique identifier for the target chat | |
messageId | number | <optional> | Required if | |
editMessage | boolean | <optional> | true | Pass True, if the game message should not be automatically edited to include the current scoreboard |
force | boolean | <optional> | Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
commands | Array.<BotCommand> | List of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified. | |
extra | ExtraSetMyCommands | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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
Name | Type | Attributes | Description |
---|---|---|---|
rights | ChatAdministratorRights | <optional> | Object describing new default administrator rights. If not specified, the default administrator rights will be cleared. |
forChannels | boolean | <optional> | Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
description | string | <optional> | New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language. |
languageCode | string | <optional> | A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | <optional> | New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language. |
languageCode | string | <optional> | A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
shortDescription | string | <optional> | New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language. |
languageCode | string | <optional> | A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
userId | number | User identifier | |
errors | Array.<PassportElementError> | Array describing the errors | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
sticker | FileId | File identifier of the sticker | |
emojiList | Array.<string> | A JSON-serialized list of 1-20 emoji associated with the sticker | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
sticker | FileId | File identifier of the sticker | |
keywords | Array.<string> | <optional> | A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
sticker | FileId | File identifier of the sticker | |
maskPosition | MaskPosition | <optional> | A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
sticker | string | File identifier of the sticker | |
position | number | New sticker position in the set, zero-based | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Sticker set name | |
userId | number | User identifier of the sticker set owner | |
thumbnail | InputFile | | <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. |
signal | AbortSignal | <optional> | Optional |
- Deprecated
- Use Telegram#setStickerSetThumbnail. Renamed after Bots API 6.6
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Sticker set name | |
userId | number | User identifier of the sticker set owner | |
thumbnail | InputFile | | <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. |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | Sticker set name | |
title | string | Sticker set title, 1-64 characters | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
url | string | HTTPS URL to send updates to. Use an empty string to remove webhook integration | |
extra | ExtraSetWebhook | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
messageId | number | <optional> | Required if |
inlineMessageId | string | <optional> | Required if |
extra | ExtraStopMessageLiveLocation | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
messageId | number | Identifier of the original message with the poll | |
extra | ExtraStopPoll | | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
userId | number | Unique identifier of the target user | |
extra | ExtraUnbanMember | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
senderChatId | number | Unique identifier of the target sender chat | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target supergroup (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | |
messageThreadId | number | Unique identifier for the target message thread of the forum topic | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
chatId | number | | Unique identifier for the target chat or username of the target channel (in the format | |
extra | ExtraUnPinChatMessage | <optional> | Other parameters |
signal | AbortSignal | <optional> | Optional |
- Source
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
ownerId | number | User identifier of sticker file owner | |
sticker | InputSticker | 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 ยป. | |
extra | ExtraUploadStickerFile | Other parameters | |
signal | AbortSignal | <optional> | Optional |
- Source
- Type:
- Promise.<File>