ultra-telegram-framework
    Preparing search index...

    Class TelegramBot<C>

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    _setClient action addStickerToSet answerCallbackQuery answerGuestQuery answerInlineQuery answerPreCheckoutQuery answerShippingQuery answerWebAppQuery approveChatJoinRequest approveSuggestedPost banChatMember banChatSenderChat catch close closeForumTopic closeGeneralForumTopic command convertGiftToStars copyMessage copyMessages createChatInviteLink createChatSubscriptionInviteLink createForumTopic createInvoiceLink createNewStickerSet declineChatJoinRequest declineSuggestedPost deleteAllMessageReactions deleteBusinessMessages deleteChatPhoto deleteChatStickerSet deleteForumTopic deleteMessage deleteMessageReaction deleteMessages deleteMyCommands deleteStickerFromSet deleteStickerSet deleteStory deleteWebhook editChatInviteLink editChatSubscriptionInviteLink editForumTopic editGeneralForumTopic editMessageCaption editMessageChecklist editMessageLiveLocation editMessageMedia editMessageReplyMarkup editMessageText editStory editUserStarSubscription exportChatInviteLink forwardMessage forwardMessages getAvailableGifts getBusinessAccountGifts getBusinessAccountStarBalance getBusinessConnection getChat getChatAdministrators getChatGifts getChatMember getChatMemberCount getChatMenuButton getCustomEmojiStickers getFile getForumTopicIconStickers getGameHighScores getManagedBotAccessSettings getManagedBotToken getMe getMyCommands getMyDefaultAdministratorRights getMyDescription getMyName getMyShortDescription getMyStarBalance getStarTransactions getStickerSet getUpdates getUserChatBoosts getUserGifts getUserPersonalChatMessages getUserProfileAudios getUserProfilePhotos getWebhookInfo giftPremiumSubscription handleUpdate hideGeneralForumTopic launch leaveChat logOut middleware on pinChatMessage postStory promoteChatMember readBusinessMessage refundStarPayment removeBusinessAccountProfilePhoto removeChatVerification removeMyProfilePhoto removeUserVerification reopenForumTopic reopenGeneralForumTopic replaceManagedBotToken replaceStickerInSet repostStory restrictChatMember revokeChatInviteLink savePreparedInlineMessage savePreparedKeyboardButton sendAnimation sendAudio sendChatAction sendChecklist sendContact sendDice sendDocument sendGame sendGift sendInvoice sendLivePhoto sendLocation sendMediaGroup sendMessage sendMessageDraft sendPaidMedia sendPhoto sendPoll sendSticker sendVenue sendVideo sendVideoNote sendVoice setBusinessAccountBio setBusinessAccountGiftSettings setBusinessAccountName setBusinessAccountProfilePhoto setBusinessAccountUsername setChatAdministratorCustomTitle setChatDescription setChatMemberTag setChatMenuButton setChatPermissions setChatPhoto setChatStickerSet setChatTitle setCustomEmojiStickerSetThumbnail setGameScore setManagedBotAccessSettings setMessageReaction setMyCommands setMyDefaultAdministratorRights setMyDescription setMyName setMyProfilePhoto setMyShortDescription setStickerEmojiList setStickerKeywords setStickerMaskPosition setStickerPositionInSet setStickerSetThumbnail setStickerSetTitle setUserEmojiStatus setWebhook stopMessageLiveLocation stopPoll transferBusinessAccountStars transferGift unbanChatMember unbanChatSenderChat unhideGeneralForumTopic unpinAllChatMessages unpinAllForumTopicMessages unpinAllGeneralForumTopicMessages unpinChatMessage upgradeGift uploadStickerFile use verifyChat verifyUser compose

    Constructors

    Methods

    • Registers a handler for inline button clicks (callback_query).

      Parameters

      • actionName: string | RegExp

        String or regular expression to check callback_data

      • ...middlewares: Middleware<C>[]

        Functions that will be executed on a match

      Returns this

    • Use this method to add a new sticker to a sticker set. Returns True on success.

      Parameters

      • user_id: number

        User identifier creating the sticker set.

      • name: string

        Sticker set name.

      • sticker: InputSticker

        Sticker to add. Must be an InputSticker object.

      Returns Promise<boolean>

      True on success.

    • Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. Returns True on success.

      Alternatively, the user can be redirected to a specified game URL. For this option to work, you must first create a game for your bot via @BotFather and accept the terms. Otherwise, you can use links like t.me/your_bot?start=XXXX which open your bot with a parameter.

      Parameters

      • callback_query_id: string

        Unique query identifier

      • Optionaloptions: Omit<AnswerCallbackQueryParams, "callback_query_id">

        Additional response parameters (text, show_alert, url, etc.)

      Returns Promise<boolean>

      True on success

    • Use this method to reply to a received guest query. On success, a SentGuestMessage object is returned.

      Parameters

      • guest_query_id: string

        Unique query identifier

      • result: InlineQueryResult

        Serialized JSON object describing the message to be sent.

      Returns Promise<SentGuestMessage>

      SentGuestMessage

    • Use this method to send answers to an inline query. Returns True on success. No more than 50 results per query are allowed.

      Parameters

      Returns Promise<boolean>

      True on success.

    • After a user has confirmed their payment and shipping data, the Bot API sends a final confirmation as an update with the pre_checkout_query field. Use this method to answer such pre-checkout queries. Returns True on success.

      Note: The Bot API must receive a response within 10 seconds after sending a pre-checkout query.

      Parameters

      • pre_checkout_query_id: string

        Pre-checkout query identifier.

      • ok: boolean

        Whether the response is successful.

      • Optionaloptions: Omit<AnswerPreCheckoutQueryParams, "ok" | "pre_checkout_query_id">

        Additional parameters (error_message)

      Returns Promise<boolean>

      True on success.

    • If you sent an invoice with a shipping address request and the is_flexible parameter was specified, the Bot API will send the bot an update with the shipping_query field. Use this method to answer shipping queries. Returns True on success.

      Parameters

      • shipping_query_id: string

        Shipping query identifier.

      • ok: boolean

        Whether the response is successful.

      • Optionalshipping_options: ShippingOption[]

        Array of shipping options.

      Returns Promise<boolean>

      True on success.

    • Use this method to set the result of an interaction with a web application and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.

      Parameters

      • web_app_query_id: string

        Web App query identifier.

      • result: InlineQueryResult

        Web application interaction result.

      Returns Promise<SentWebAppMessage>

      SentWebAppMessage.

    • Use this method to approve a chat join request. For this to work, the bot must be a chat administrator and have the can_invite_users administrator right. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • user_id: number

        Unique user identifier

      Returns Promise<boolean>

      boolean on success

    • Use this method to approve a suggested post in a direct message chat. The bot must have the can_post_messages administrator right in the corresponding channel chat. Returns True on success.

      Parameters

      • chat_id: number

        Chat identifier or username.

      • message_id: number

        Suggested post identifier.

      • Optionaloptions: Omit<ApproveSuggestedPostParams, "chat_id" | "message_id">

      Returns Promise<boolean>

      True on success.

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • user_id: number

        Unique identifier for the target user

      • Optionaloptions: Omit<BanChatMemberParams, "chat_id" | "user_id">

        Additional ban parameters

      Returns Promise<boolean>

      true on success

    • Use this method to ban a channel chat in a supergroup or channel. Until the chat is unbanned, the owner of the banned chat will not be able to send messages on behalf of any of their channels. For this to work, the bot must be a supergroup or channel administrator and have appropriate administrator rights. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • sender_chat_id: number

        Unique identifier of the sender

      Returns Promise<boolean>

      True on success

    • Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method so that the bot doesn't start again after a server restart. The method will return a 429 error during the first 10 minutes after the bot starts. Returns True on success.

      Returns Promise<boolean>

      True on success

    • Use this method to close an open topic in a forum supergroup chat. For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right, unless it is the topic author. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • message_thread_id: number

        Forum topic identifier

      Returns Promise<boolean>

      True on success

    • Use this method to close an open "General" topic in a forum supergroup chat. For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<boolean>

      True on success

    • Registers a handler for a specific command (or an array of commands).

      Parameters

      • command: string | string[]

        Command name without the slash (e.g., 'start' or ['start', 'help'])

      • ...middlewares: Middleware<C>[]

        Functions that will be executed if the command matches

      Returns this

    • Converts a regular gift into Telegram Stars. Requires the business bot right can_convert_gifts_to_stars. On success, returns True.

      Parameters

      • business_connection_id: string

        Business account identifier

      • owned_gift_id: string

        Gift identifier

      Returns Promise<boolean>

      True on success

    • Use this method to copy messages of any type. Service messages and messages with protected content cannot be forwarded. On success, the MessageId of the sent message is returned.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • from_chat_id: string | number

        Unique identifier for the chat from which messages are forwarded

      • message_id: number

        Identifier of the message in the chat_id chat

      • Optionaloptions: Omit<CopyMessageParams, "chat_id" | "message_id" | "from_chat_id">

        Additional copying parameters

      Returns Promise<MessageId>

      MessageId on success

    • Use this method to copy multiple messages of any type. If some of the specified messages cannot be found or copied, they are skipped. Service messages and messages with protected content cannot be copied. Grouping by albums is preserved for copied messages. On success, an array of MessageId of the copied messages is returned.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • from_chat_id: string | number

        Unique identifier for the chat from which messages are forwarded

      • message_ids: number[]

        Message identifiers in the chat_id chat

      • Optionaloptions: Omit<CopyMessagesParams, "chat_id" | "from_chat_id" | "message_ids">

        Additional copying parameters

      Returns Promise<MessageId[]>

      MessageId[] on success

    • Use this method to create an additional invite link for a chat. For this to work, the bot must be a chat administrator and have appropriate administrator rights. The link can be revoked using the revokeChatInviteLink method. On success, returns the new invite link as a ChatInviteLink object.

      Parameters

      Returns Promise<ChatInviteLink>

      ChatInviteLink on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • subscription_period: number
      • subscription_price: number
      • Optionaloptions: Omit<
            CreateChatSubscriptionInviteLinkParams,
            "chat_id"
            | "subscription_period"
            | "subscription_price",
        >

        Parameters for creating the invite link

      Returns Promise<ChatInviteLink>

      ChatInviteLink on success

    • Use this method to create a topic in a forum supergroup chat or in a private chat with a user. In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • name: string

        Forum topic name

      • Optionaloptions: Omit<CreateForumTopicParams, "chat_id" | "name">

        Additional parameters (icon_custom_emoji_id, etc.)

      Returns Promise<ForumTopic>

      ForumTopic on success

    • Use this method to create an invoice link. On success, returns the created invoice link as a string.

      Parameters

      • title: string

        Invoice title.

      • description: string

        Invoice description.

      • payload: string

        Internal invoice information.

      • currency: string

        Invoice currency.

      • prices: LabeledPrice[]

        Invoice prices.

      • Optionaloptions: Omit<
            CreateInvoiceLinkParams,
            "title"
            | "description"
            | "payload"
            | "currency"
            | "prices",
        >

        Additional parameters.

      Returns Promise<string>

      Created invoice link.

    • Use this method to create a new sticker set belonging to a user. The bot will be able to edit a sticker set created this way. Returns True on success.

      Parameters

      • user_id: number

        User identifier.

      • name: string

        Sticker set name. Must start with a-z, A-Z, or 0-9, and can contain _ and consist of no more than 64 characters.

      • title: string

        Sticker set title. Must consist of no more than 64 characters.

      • stickers: InputSticker[]

        Array of stickers to add. At least one sticker must be passed.

      • Optionaloptions: Omit<CreateNewStickerSetParams, "title" | "name" | "stickers">

        Additional parameters.

      Returns Promise<boolean>

      True on success.

    • Use this method to decline a chat join request. For this to work, the bot must be a chat administrator and have the can_invite_users administrator right. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • user_id: number

        Unique user identifier

      Returns Promise<boolean>

      boolean on success

    • Use this method to decline a suggested post in a direct message chat. The bot must have the can_manage_direct_messages administrator right in the corresponding channel chat. Returns True on success.

      Parameters

      • chat_id: number

        Chat identifier.

      • message_id: number

        Suggested post identifier.

      • Optionaloptions: Omit<DeclineSuggestedPostParams, "chat_id" | "message_id">

      Returns Promise<boolean>

      True on success.

    • Use this method to delete up to 10000 recent reactions in a group or supergroup chat added by a specific user or chat. The bot must have the can_delete_messages administrator right in the chat. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success

    • Deletes messages on behalf of a business account. Requires the business bot right can_delete_sent_messages to delete messages sent by the bot itself, or can_delete_all_messages to delete any message. Returns True on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      • message_ids: number[]

        Message identifiers

      Returns Promise<boolean>

      True on success

    • Use this method to delete a chat profile photo. For this to work, the bot must be a chat administrator. Returns true on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<boolean>

      boolean on success

    • Use this method to delete a set of group stickers from a supergroup. For this to work, the bot must be a chat administrator and have appropriate administrator rights. Use the can_set_sticker_set field, which is optionally returned in getChat requests, to check if the bot can use this method. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<boolean>

      True on success

    • Use this method to delete a forum topic along with all its messages in a forum supergroup chat or in a private chat with a user. In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the can_delete_messages administrator right. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • message_thread_id: number

        Forum topic identifier

      Returns Promise<boolean>

      True on success

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

      • A message can only be deleted if it was sent less than 48 hours ago.
      • Service messages about creating a supergroup, channel, or forum topic cannot be deleted.
      • A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
      • Bots can delete outgoing messages in private chats, groups, and supergroups.
      • Bots can delete incoming messages in private chats.
      • Bots granted the can_post_messages permission can delete outgoing messages in channels.
      • If the bot is a group administrator, it can delete any message there.
      • If the bot has the can_delete_messages administrator right in a supergroup or channel, it can delete any message there.
      • If the bot has the can_manage_direct_messages administrator right in a channel, it can delete any message in the corresponding direct message chat. Returns True on success.

      Parameters

      • chat_id: string | number

        Chat identifier or username.

      • message_id: number

        Message identifier.

      Returns Promise<boolean>

      True on success.

    • Use this method to delete a reaction from a message in a group or supergroup chat. The bot must have the can_delete_messages administrator right in the chat. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • message_id: number

        Message identifier

      • Optionaloptions: Omit<DeleteMessageReactionParams, "chat_id" | "message_id">

        Additional parameters

      Returns Promise<boolean>

      True on success

    • Use this method to delete multiple messages at once. If some of the specified messages cannot be found, they are skipped. Returns True on success.

      Parameters

      • chat_id: string | number

        Chat identifier or username.

      • message_ids: number[]

        Message identifiers.

      Returns Promise<boolean>

      True on success.

    • Use this method to delete the list of bot commands for a given scope and user language. After deletion, higher-level commands will be shown to affected users. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success

    • Use this method to delete a sticker from a sticker set. Returns True on success.

      Parameters

      • sticker: string

        Sticker identifier.

      Returns Promise<boolean>

      True on success.

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

      Parameters

      • name: string

        Sticker set name.

      Returns Promise<boolean>

      True on success.

    • Deletes a story previously published by the bot on behalf of a managed business account. Requires the business bot right can_manage_stories. On success, returns True.

      Parameters

      • business_connection_id: string

        Unique business connection identifier

      • story_id: number

        Story identifier

      Returns Promise<boolean>

      True on success

    • Use this method to stop using the webhook and start working in long polling mode. Returns True on success.

      Parameters

      Returns Promise<boolean>

      boolean on success

    • Use this method to edit a non-primary invite link created by the bot. For this to work, the bot must be a chat administrator and have appropriate administrator rights. On success, returns the edited invite link as a ChatInviteLink object.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • invite_link: string

        Chat invite link

      • Optionaloptions: Omit<EditChatInviteLinkParams, "chat_id" | "invite_link">

        Parameters for changing the invite link

      Returns Promise<ChatInviteLink>

      ChatInviteLink on success

    • Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator right. On success, returns the edited invite link as a ChatInviteLink object.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • invite_link: string

        Chat invite link

      • Optionaloptions: Omit<EditChatSubscriptionInviteLinkParams, "chat_id" | "invite_link">

        Parameters for editing the invite link

      Returns Promise<ChatInviteLink>

      ChatInviteLink on success

    • Use this method to edit the name and icon of a topic in a forum supergroup chat or in a private chat with a user. In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the can_manage_topics administrator right, unless it is the topic author. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • message_thread_id: number

        Forum topic identifier

      • Optionaloptions: Omit<EditForumTopicParams, "chat_id" | "message_thread_id">

        Additional parameters (name, icon_custom_emoji_id)

      Returns Promise<boolean>

      true on success

    • Use this method to edit the name of the "General" topic in a forum supergroup chat. For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • name: string

        New forum topic name

      Returns Promise<boolean>

      True on success

    • Use this method to edit message captions. On success, if the edited message is not an inline message, the edited message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours of being sent.

      Parameters

      • id: EditMessageIds

        Message identifier (either chat_id and message_id, or inline_message_id)

      • Optionaloptions: Omit<EditMessageCaptionParams, "chat_id" | "message_id" | "inline_message_id">

        Additional parameters (caption, parse_mode, etc.)

      Returns Promise<boolean | Message>

      Edited message or True if editing was successful

    • Use this method to edit a checklist on behalf of a connected business account. On success, the edited message is returned.

      Parameters

      • business_connection_id: string

        Business connection identifier.

      • chat_id: number

        Chat identifier.

      • message_id: number

        Message identifier.

      • checklist: InputChecklist

        New checklist.

      • Optionaloptions: Omit<
            EditMessageChecklistParams,
            "chat_id"
            | "business_connection_id"
            | "message_id"
            | "checklist",
        >

        Additional parameters

      Returns Promise<Message>

      Edited message on success.

    • Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly prohibited by calling stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

      Parameters

      • id: EditMessageIds

        Message identifier. Can be an object with chat_id and message_id or an inline_message_id string.

      • latitude: number

        New location latitude

      • longitude: number

        New location longitude

      • Optionaloptions: Omit<
            EditMessageLiveLocationParams,
            "chat_id"
            | "message_id"
            | "inline_message_id"
            | "latitude"
            | "longitude",
        >

        Additional parameters

      Returns Promise<boolean | Message>

      Edited message or True on success.

    • Use this method to edit animation, audio, document, photo, or video messages, or to add media files to text messages. If a message is part of a message album, it can only be edited as audio for audio albums, only as a document for document albums, and as a photo or video in other cases. When editing an inline message, a new file cannot be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours of being sent.

      Parameters

      • id: EditMessageIds

        Message identifier. Can be an object with chat_id and message_id or an inline_message_id string.

      • media: InputMedia
      • Optionaloptions: Omit<
            EditMessageMediaParams,
            "chat_id"
            | "message_id"
            | "inline_message_id"
            | "media",
        >

        Media message editing parameters. Must include media (InputMediaVideo/InputMediaAnimation/InputMediaAudio/InputMediaPhoto).

      Returns Promise<boolean | Message>

      Edited message or True on success.

    • Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours of being sent.

      Parameters

      • id: EditMessageIds

        Message identifier. Can be an object with chat_id and message_id or an inline_message_id string.

      • Optionaloptions: Omit<
            EditMessageReplyMarkupParams,
            "chat_id"
            | "message_id"
            | "inline_message_id",
        >

        Additional parameters.

      Returns Promise<boolean | Message>

      Edited message or True on success.

    • Edits a text message or inline message text.

      Parameters

      • id: EditMessageIds

        Message identifier (either chat_id and message_id, or inline_message_id)

      • text: string

        New message text

      • Optionaloptions: Omit<
            EditMessageTextParams,
            "text"
            | "chat_id"
            | "message_id"
            | "inline_message_id",
        >

        Additional parameters

      Returns Promise<boolean | Message>

      Edited message

    • Edits a story previously published by the bot on behalf of a managed business account. Requires the business bot right can_manage_stories. Returns Story on success.

      Parameters

      • business_connection_id: string

        Unique business connection identifier

      • story_id: number

        Story identifier

      • content: InputStoryContent

        Story content

      • Optionaloptions: Omit<EditStoryParams, "business_connection_id" | "content" | "story_id">

        Additional parameters

      Returns Promise<Story>

      Story on success

    • Allows the bot to cancel or re-enable the renewal of a subscription paid in Telegram Stars. Returns True on success.

      Parameters

      • user_id: number

        User identifier.

      • telegram_payment_charge_id: string

        Telegram payment identifier for the subscription.

      • is_canceled: boolean

        Whether the subscription is canceled.

      Returns Promise<boolean>

      True on success.

    • Use this method to create a new primary invite link for a chat; any previously created primary link will be revoked. For this to work, the bot must be a chat administrator and have appropriate administrator rights. On success, returns the new invite link as a string.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<string>

      string on success

    • Use this method to forward messages of any type. Service messages and messages with protected content cannot be forwarded. On success, the sent message is returned.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • from_chat_id: string | number

        Unique identifier for the chat from which the message is forwarded

      • message_id: number

        Identifier of the message in the from_chat_id chat

      • Optionaloptions: Omit<ForwardMessageParams, "chat_id" | "message_id" | "from_chat_id">

        Additional forwarding parameters

      Returns Promise<Message>

      Message on success

    • Use this method to forward multiple messages of any type. If some of the specified messages cannot be found or forwarded, they are skipped. Service messages and messages with protected content cannot be forwarded. Grouping by albums is preserved for forwarded messages. On success, an array of MessageId of the sent messages is returned.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • from_chat_id: string | number

        Unique identifier for the chat from which messages are forwarded

      • message_ids: number[]

        Array of message identifiers in the chat_id chat

      • Optionaloptions: Omit<ForwardMessagesParams, "chat_id" | "from_chat_id" | "message_ids">

        Additional forwarding parameters

      Returns Promise<MessageId[]>

      MessageId[] on success

    • Returns a list of gifts that the bot can send to users and channel chats. No parameters required. Returns a Gifts object on success.

      Returns Promise<Gifts>

      Gifts object on success

    • Returns received gifts belonging to a managed business account. Requires the business bot right can_view_gifts_and_stars. Returns OwnedGifts on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      • Optionaloptions: Omit<GetBusinessAccountGiftsParams, "business_connection_id">

        Additional parameters

      Returns Promise<OwnedGifts>

      Received gifts

    • Returns the number of Telegram Stars belonging to a managed business account. Requires the business bot right can_view_gifts_and_stars. Returns StarAmount on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      Returns Promise<StarAmount>

      Number of stars

    • Use this method to get information about the bot's connection to a business account. Returns a BusinessConnection object on success.

      Parameters

      • business_connection_id: string

        Unique business connection identifier

      Returns Promise<BusinessConnection>

      BusinessConnection with connection information

    • Use this method to get up-to-date information about the chat. On success, returns a ChatFullInfo object.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<ChatFullInfo>

      ChatFullInfo on success

    • Use this method to get a list of administrators in a chat who are not bots. On success, returns an array of ChatMember objects.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • Optionaloptions: Omit<GetChatAdministratorsParams, "chat_id">

        Additional parameters

      Returns Promise<ChatMember[]>

      ChatMember[] on success

    • Returns gifts belonging to a chat. Returns OwnedGifts on success.

      Parameters

      • chat_id: string | number

        Chat identifier with the user

      • Optionaloptions: Omit<GetChatGiftsParams, "chat_id">

        Additional parameters

      Returns Promise<OwnedGifts>

      Received gifts

    • Use this method to get information about a chat member. The method is guaranteed to work for other users only if the bot is a chat administrator. On success, returns a ChatMember object.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • user_id: number

        User identifier

      Returns Promise<ChatMember>

      ChatMember on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<number>

      number on success

    • Use this method to get the current value of the bot's menu button in a private chat or the default menu button. Returns MenuButton on success.

      Parameters

      • Optionalchat_id: number

        Chat identifier

      Returns Promise<MenuButton>

      MenuButton object on success

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

      Parameters

      • custom_emoji_ids: string[]

        Sticker identifiers.

      Returns Promise<Sticker[]>

      Array of Sticker objects.

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

      Parameters

      • file_id: string

        Unique file identifier

      Returns Promise<File>

      TelegramFile with file information

    • Use this method to get custom emoji stickers that any user can use as a forum topic icon. Requires no parameters. Returns an array of Sticker objects.

      Returns Promise<Sticker[]>

      Sticker[] on success

    • Use this method to get data for high score tables. Returns the score of the specified user and several of their neighbors in the game. Returns an array of GameHighScore objects.

      This method will currently return scores for the target user, as well as two of their closest neighbors on each side. It will also return the top three users if the user and their neighbors are not among them. Note that this behavior is subject to change.

      Parameters

      Returns Promise<GameHighScore[]>

      Array of GameHighScore objects with user score information.

    • Use this method to get managed bot access settings. Returns a BotAccessSettings object on success.

      Parameters

      • user_id: number

        Unique user identifier (managed bot)

      Returns Promise<BotAccessSettings>

      BotAccessSettings with access settings

    • Use this method to get a managed bot token. Returns the token as a string on success.

      Parameters

      • user_id: number

        Unique user identifier (managed bot)

      Returns Promise<string>

      string token as a string

    • Use this method to get information about the bot. Returns User.

      Returns Promise<User>

      User on success

    • Method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a StarAmount object.

      Returns Promise<StarAmount>

      StarAmount object.

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

      Parameters

      • name: string

        Sticker set name.

      Returns Promise<StickerSet>

      StickerSet.

    • Use this method to receive incoming updates using long polling. Returns an array of Update objects.

      Parameters

      Returns Promise<Update[]>

      Update[] on success

    • Use this method to get information about boosts provided by a chat user. Returns UserChatBoosts on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • user_id: number

        Unique user identifier

      Returns Promise<UserChatBoosts>

      UserChatBoosts

    • Returns gifts owned and displayed by a user. Returns OwnedGifts on success.

      Parameters

      • user_id: number

        User identifier

      • Optionaloptions: Omit<GetUserGiftsParams, "user_id">

        Additional parameters

      Returns Promise<OwnedGifts>

      Received gifts

    • Use this method to get recent messages from a given user's personal chat. Returns an array of Message objects on success.

      Parameters

      • user_id: number

        Unique user identifier

      • limit: number

        Maximum number of messages to return; 1-20

      Returns Promise<Message[]>

      Array of Message objects

    • Use this method to get a list of user profile photos. Returns a UserProfilePhotos object with user photos, starting from the newest.

      Parameters

      • user_id: number

        Unique identifier for the target user

      • Optionaloptions: Omit<GetUserProfilePhotosParams, "user_id">

        Additional profile photo parameters

      Returns Promise<UserProfilePhotos>

      UserProfilePhotos on success

    • Use this method to get current information about the webhook set for your bot. Returns WebhookInfo.

      Returns Promise<WebhookInfo>

      WebhookInfo on success

    • Gifts a Telegram Premium subscription to a specified user. Returns True on success.

      Parameters

      • user_id: number

        User identifier

      • month_count: number

        Number of subscription months

      • star_count: number

        Number of stars

      • Optionaloptions: Omit<GiftPremiumSubscriptionParams, "user_id" | "star_count" | "month_count">

      Returns Promise<boolean>

      True on success

    • Main method for processing incoming Updates from Telegram. It automatically creates a base Context object and starts the middleware chain.

      • ⚠️ Architectural note regarding custom context (Generic C): This library uses the approach of extending context through interfaces and middlewares (so-called hydration), rather than through class inheritance. Under the hood, a base instance of Context is always created, which is forcibly cast to your type C.
      • To add your own fields (e.g., sessions, DB connections, etc.), describe them in an interface and initialize them in your first middleware:

      Parameters

      • update: Update

        Incoming update from Telegram

      Returns Promise<void>

      Promise<void>

      interface MyContext extends Context {
      db: CustomDatabase;
      session: { step: number };
      }
      const bot = new TelegramBot<MyContext>(client);
      * // Context hydration
      bot.use(async (ctx, next) => {
      ctx.db = new CustomDatabase();
      ctx.session = { step: 0 };
      await next();
      });
    • Use this method to hide the "General" topic in a forum supergroup chat. For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right. The topic will be automatically closed if it was open. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<boolean>

      True on success

    • Parameters

      • options: { allowed_updates?: string[]; drop_pending_updates?: boolean; timeout?: number } = {}

      Returns Promise<void>

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<boolean>

      True on success

    • Use this method to log out the bot. Returns boolean.

      Returns Promise<boolean>

      boolean on success

    • Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct message chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the can_pin_messages or can_edit_messages right to pin messages in groups and channels respectively. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • message_id: number

        Identifier of the message to pin

      • Optionaloptions: Omit<PinChatMessageParams, "chat_id" | "message_id">

      Returns Promise<boolean>

      True on success

    • Posts a story on behalf of a managed business account. Requires the business bot right can_manage_stories. Returns Story on success.

      Parameters

      • business_connection_id: string

        Unique business connection identifier

      • content: InputStoryContent

        Story content

      • active_period: number

        Story duration (from 1 to 72 hours)

      • Optionaloptions: Omit<PostStoryParams, "business_connection_id" | "content" | "active_period">

        Additional parameters

      Returns Promise<Story>

      Story on success

    • Use this method to promote or demote a user in a supergroup or a channel. For this to work, the bot must be a chat administrator and have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the chat or username of the target bot

      • user_id: number

        Unique user identifier

      • Optionaloptions: Omit<PromoteChatMemberParams, "chat_id" | "user_id">

        Additional parameters

      Returns Promise<boolean>

      True on success

    • Marks an incoming message as read on behalf of a business account. Requires the business bot right can_read_messages. Returns True on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      • chat_id: number

        Chat identifier

      • message_id: number

        Message identifier

      Returns Promise<boolean>

      True on success

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

      Parameters

      • user_id: number

        User identifier.

      • telegram_payment_charge_id: string

        Telegram payment transaction identifier.

      Returns Promise<boolean>

      True on success.

    • Deletes the current profile photo of a managed business account. Requires the business bot right can_edit_profile_photo. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success

    • Revokes a chat verification established by the bot on behalf of an organization. Returns True on success.

      Parameters

      • chat_id: string | number

        Chat identifier

      Returns Promise<boolean>

      True on success

    • Use this method to delete the bot's profile photo. Returns True on success.

      Returns Promise<boolean>

      True on success

    • Revokes a user verification established by the bot on behalf of an organization. Returns True on success.

      Parameters

      • user_id: number

        User identifier

      Returns Promise<boolean>

      true on success

    • Use this method to reopen a closed topic in a forum supergroup chat. For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right, unless it is the topic author. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • message_thread_id: number

        Forum topic identifier

      Returns Promise<boolean>

      True on success

    • Use this method to reopen a closed "General" topic in a forum supergroup chat. For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right. The topic will be automatically shown if it was hidden. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<boolean>

      True on success

    • Use this method to revoke the current managed bot token and generate a new one. Returns the new token as a string on success.

      Parameters

      • user_id: number

        Unique user identifier (managed bot)

      Returns Promise<string>

      New token as a string

    • Use this method to replace a sticker in a sticker set. Returns True on success.

      Parameters

      • user_id: number

        User identifier creating the sticker set.

      • name: string

        Sticker set name.

      • old_sticker: string

        Identifier of the sticker to be replaced.

      • sticker: InputSticker

        New sticker. Must be an InputSticker object.

      Returns Promise<boolean>

      True on success.

    • Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story in the source account must be published (or reposted) by the bot. Requires the business bot right can_manage_stories for both business accounts. Returns Story on success.

      Parameters

      • business_connection_id: string

        Business account identifier.

      • from_chat_id: number

        Source chat identifier.

      • from_story_id: number

        Source story identifier.

      • active_period: number

        Story duration.

      • Optionaloptions: Omit<
            RepostStoryParams,
            | "business_connection_id"
            | "from_chat_id"
            | "active_period"
            | "from_story_id",
        >

        Additional parameters.

      Returns Promise<Story>

      Story on success.

    • Use this method to restrict a user in a supergroup. For this to work, the bot must be a supergroup administrator and have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user.

      Parameters

      • chat_id: string | number

        Unique identifier for the chat or username of the target bot

      • user_id: number

        Unique user identifier

      • permissions: ChatPermissions

        New status of user rights

      • Optionaloptions: Omit<RestrictChatMemberParams, "chat_id" | "user_id" | "permissions">

        Additional parameters

      Returns Promise<boolean>

      True on success

    • Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. For this to work, the bot must be a chat administrator and have appropriate administrator rights. On success, returns the revoked invite link as a ChatInviteLink object.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • invite_link: string

        Chat invite link

      Returns Promise<ChatInviteLink>

      ChatInviteLink on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • animation: string | InputFile

        Animation to send (File ID, URL or file object)

      • Optionaloptions: Omit<SendAnimationParams, "chat_id" | "animation">

        Additional animation parameters

      Returns Promise<Message>

      Message on success

    • Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio file must be in the .MP3 or .M4A format. On success, the sent message is returned. Bots can currently send audio files up to 50 MB, this limit may be changed in the future. For sending voice messages, use the sendVoice method.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • audio: string | InputFile

        Audio to send (File ID, URL or file object)

      • Optionaloptions: Omit<SendAudioParams, "chat_id" | "audio">

        Additional audio parameters

      Returns Promise<Message>

      Message on success

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

      Example: ImageBot needs some time to process the request and upload the image. Instead of sending a text message like "Getting image, please wait...", the bot can use sendChatAction with action = 'upload_photo'. The user will see the bot status "uploading photo".

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • action: ChatAction

        Type of action to broadcast

      • Optionaloptions: Omit<SendChatActionParams, "chat_id" | "action">

        Additional action parameters

      Returns Promise<boolean>

      True on success

    • Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned.

      Parameters

      • business_connection_id: string

        Business account identifier

      • chat_id: number

        Unique identifier for the target chat

      • checklist: InputChecklist

        Checklist to send

      • Optionaloptions: Omit<SendChecklistParams, "chat_id" | "business_connection_id" | "checklist">

        Additional checklist parameters

      Returns Promise<Message>

      Message on success

    • Use this method to send user contact information. On success, the sent Message is returned.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • phone_number: string

        Phone number

      • first_name: string

        Contact first name

      • Optionaloptions: Omit<SendContactParams, "chat_id" | "phone_number" | "first_name">

        Additional contact parameters

      Returns Promise<Message>

      Message on success

    • Use this method to send an animated emoji that will display a random value. Returns Message on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • Optionaloptions: Omit<SendDiceParams, "chat_id">

        Additional animated emoji parameters (emoji, etc.)

      Returns Promise<Message>

      Message on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • document: string | InputFile

        File to send (File ID, URL or file object)

      • Optionaloptions: Omit<SendDocumentParams, "chat_id" | "document">

        Additional file parameters

      Returns Promise<Message>

      Message on success

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

      Parameters

      • chat_id: number

        Chat identifier.

      • game_short_name: string

        Game short name.

      • Optionaloptions: Omit<SendGameParams, "chat_id" | "game_short_name">

        Additional parameters.

      Returns Promise<Message>

      Message object.

    • Sends a gift to a specified user or channel chat. The recipient cannot convert the gift into Telegram Stars. Returns True on success.

      Parameters

      • gift_id: string

        Unique gift identifier

      • options: Omit<SendGiftParams, "gift_id">

        Additional parameters (chat_id, gift_item_name, user_id)

      Returns Promise<boolean>

      True on success

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

      Parameters

      • chat_id: string | number

        Chat identifier.

      • title: string

        Invoice title.

      • description: string

        Invoice description.

      • payload: string

        Internal invoice information.

      • currency: string

        Invoice currency.

      • prices: LabeledPrice[]

        Invoice prices.

      • Optionaloptions: Omit<
            SendInvoiceParams,
            "chat_id"
            | "title"
            | "description"
            | "payload"
            | "currency"
            | "prices",
        >

        Additional parameters.

      Returns Promise<Message>

      Sent message.

    • Use this method to send photos in real time. On success, the sent Message is returned.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • live_photo: string | InputFile

        Video part of a live photo (URL or InputFile)

      • photo: string | InputFile

        Photo (URL or InputFile)

      • Optionaloptions: Omit<SendLivePhotoParams, "chat_id" | "photo" | "live_photo">

        Additional sending parameters

      Returns Promise<Message>

      Promise<Message>

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • latitude: number

        Latitude

      • longitude: number

        Longitude

      • Optionaloptions: Omit<SendLocationParams, "chat_id" | "latitude" | "longitude">

        Additional geolocation parameters

      Returns Promise<Message>

      Message on success

    • Use this method to send a text message. Returns Message.

      Parameters

      • chat_id: string | number

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

      • text: string

        Message text to send (1-4096 characters after entity parsing)

      • Optionaloptions: Omit<SendMessageParams, "text" | "chat_id">

        Additional message parameters

      Returns Promise<Message>

      Message on success

    • Use this method to stream a part of a message to the user during its generation. Returns boolean on success.

      Parameters

      • chat_id: number

        Unique identifier for the target chat

      • draft_id: number

        Unique draft identifier

      • text: string

        Message text

      • Optionaloptions: Omit<SendMessageDraftParams, "text" | "chat_id" | "draft_id">

        Additional draft parameters

      Returns Promise<boolean>

      boolean on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • star_count: number

        Number of stars to send

      • media: InputPaidMedia[]

        Array of paid media files

      • Optionaloptions: Omit<SendPaidMediaParams, "chat_id" | "media" | "star_count">

        Additional paid media parameters

      Returns Promise<Message>

      Message on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • photo: string | InputFile

        Photo to send (File ID, URL or file object)

      • Optionaloptions: Omit<SendPhotoParams, "chat_id" | "photo">

        Additional photo parameters

      Returns Promise<Message>

      Message on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • question: string

        Poll text

      • poll_options: InputPollOption[]

        Array of answer options

      • Optionaloptions: Omit<SendPollParams, "chat_id" | "question" | "options">

        Additional poll parameters

      Returns Promise<Message>

      Message on success

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

      Parameters

      • chat_id: string | number

        Chat identifier or username.

      • sticker: string | InputFile

        Sticker to send. Can be file_id, url, or InputFile.

      • Optionaloptions: Omit<SendStickerParams, "chat_id" | "sticker">

        Additional parameters.

      Returns Promise<Message>

      Sent message.

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • latitude: number

        Latitude

      • longitude: number

        Longitude

      • title: string

        Venue name

      • address: string

        Address

      • Optionaloptions: Omit<
            SendVenueParams,
            "chat_id"
            | "title"
            | "latitude"
            | "longitude"
            | "address",
        >

        Additional venue parameters

      Returns Promise<Message>

      Message on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • video: string | InputFile

        Video to send (File ID, URL or file object)

      • Optionaloptions: Omit<SendVideoParams, "chat_id" | "video">

        Additional video parameters

      Returns Promise<Message>

      Message on success

    • Use this method to send video messages (videos up to 60 seconds long). Currently, video message duration is limited to 60 seconds, but this limit may be changed in the future. Bots can currently send video messages up to 50 MB, this limit may be changed in the future. On success, the sent Message is returned.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • video_note: string | InputFile

        Video message to send (File ID, URL or file object)

      • Optionaloptions: Omit<SendVideoNoteParams, "chat_id" | "video_note">

        Additional video message parameters

      Returns Promise<Message>

      Message on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • voice: string | InputFile

        Audio to send (File ID, URL or file object)

      • Optionaloptions: Omit<SendVoiceParams, "chat_id" | "voice">

        Additional audio parameters

      Returns Promise<Message>

      Message on success

    • Changes the bio of a managed business account. Requires the business bot right can_change_bio. Returns True on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      • Optionaloptions: Omit<SetBusinessAccountBioParams, "business_connection_id">

        Additional parameters (bio)

      Returns Promise<boolean>

      True on success

    • Changes the privacy settings regarding incoming gifts in a managed business account. Requires the business bot right can_change_gift_settings. Returns True on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      • show_gift_button: boolean

        Show gift button

      • accepted_gift_types: AcceptedGiftTypes

        Accepted gift types

      Returns Promise<boolean>

      True on success

    • Changes the first and last name of a managed business account. Requires the business bot right can_change_name. Returns True on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      • first_name: string

        New first name of the managed business account

      • Optionaloptions: Omit<SetBusinessAccountNameParams, "business_connection_id" | "first_name">

        Additional parameters (last_name)

      Returns Promise<boolean>

      True on success

    • Changes the profile photo of a managed business account. Requires the business bot right can_edit_profile_photo. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success

    • Changes the username of a managed business account. Requires the business bot right can_change_username. On success, returns True.

      Parameters

      • business_connection_id: string

        Business account identifier

      • Optionaloptions: Omit<SetBusinessAccountUsernameParams, "business_connection_id">

        Additional parameters (username)

      Returns Promise<boolean>

      True on success

    • Use this method to set a custom title for an administrator in a supergroup promoted by the bot. For this to work, the bot must be a chat administrator and have appropriate administrator rights. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • user_id: number

        Unique identifier for the target user

      • custom_title: string

        Custom title for the chat administrator

      Returns Promise<boolean>

      True on success

    • Use this method to change the description of a group, supergroup, or channel. For this to work, the bot must be a chat administrator and have appropriate administrator rights. Returns true on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • Optionaldescription: string

        New chat description

      Returns Promise<boolean>

      True on success

    • Use this method to set a tag for a regular group or supergroup member. For this to work, the bot must be a chat administrator and have the can_manage_tags administrator right. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • user_id: number

        Unique identifier for the target user

      • Optionaloptions: Omit<SetChatMemberTagParams, "chat_id" | "user_id">

        Additional parameters

      Returns Promise<boolean>

      True on success

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

      Parameters

      Returns Promise<boolean>

      True on success

    • Use this method to set default chat permissions for all participants. For this to work, the bot must be a group or supergroup administrator and have the can_restrict_members administrator right. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success

    • Use this method to upload a new profile photo for a chat. For this to work, the bot must be a chat administrator.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • photo: InputFile

        Photo to upload.

      Returns Promise<boolean>

      true on success

    • Use this method to set a new set of group stickers for a supergroup. For this to work, the bot must be a chat administrator and have appropriate administrator rights. Use the can_set_sticker_set field, which is optionally returned in getChat requests, to check if the bot can use this method. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • sticker_set_name: string

        Sticker set name

      Returns Promise<boolean>

      True on success

    • Use this method to change the chat title. Titles cannot be changed for private chats. For this to work, the bot must be a chat administrator and have appropriate administrator rights. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • title: string

        New chat title

      Returns Promise<boolean>

      True on success

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

      Parameters

      • name: string

        Sticker set name.

      • custom_emoji_id: string

        Emoji identifier.

      Returns Promise<boolean>

      True on success.

    • Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error if the new score is not greater than the user's current score in the chat and force is False.

      Parameters

      • user_id: number

        User identifier.

      • score: number

        Player's score.

      • Optionaloptions: Omit<SetGameScoreParams, "user_id" | "score">

        Additional parameters.

      Returns Promise<boolean | Message>

      Message object or True.

    • Use this method to change managed bot access settings. Returns True on success.

      Parameters

      • user_id: number

        Unique user identifier (managed bot)

      • is_access_restricted: boolean

        True if only selected users have access to the bot. The bot owner always has access.

      • Optionaloptions: Omit<SetManagedBotAccessSettingsParams, "user_id" | "is_access_restricted">

        Additional parameters (see SetManagedBotAccessSettingsParams)

      Returns Promise<boolean>

      True on success

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

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • message_id: number

        Unique identifier for the message

      • reaction: ReactionType[]

        Array of reactions to set

      Returns Promise<boolean>

      True on success

    • Use this method to change the list of bot commands. See this guide for more information about bot commands. Returns True on success.

      Parameters

      • commands: BotCommand[]

        List of commands for the bot (max 100)

      • Optionaloptions: Omit<SetMyCommandsParams, "commands">

        Additional parameters (scope, language_code)

      Returns Promise<boolean>

      True on success

    • Use this method to change the default administrator rights requested by the bot when it is added as an administrator to groups or channels. These rights will be proposed to users, but they can change the list before adding the bot. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success

    • Use this method to change the bot's description, which is displayed in the chat with the bot if the chat is empty. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success

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

      Parameters

      • Optionaloptions: SetMyNameParams

        Additional parameters (name, language_code)

      Returns Promise<boolean>

      True on success

    • Use this method to change the bot's profile photo. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success

    • Use this method to change the bot's short description, which is displayed on the bot's profile page and sent with a link when users share the bot. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success

    • Use this method to change the list of emojis assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

      Parameters

      • sticker: string

        Sticker identifier.

      • emoji_list: string[]

        List of emojis.

      Returns Promise<boolean>

      True on success.

    • Use this method to change the list of keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

      Parameters

      • sticker: string

        Sticker identifier.

      • keywords: string[]

        List of keywords.

      Returns Promise<boolean>

      True on success.

    • Use this method to change the mask position of a sticker. The sticker must belong to a set created by the bot. Returns True on success.

      Parameters

      Returns Promise<boolean>

      True on success.

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

      Parameters

      • sticker: string

        Sticker identifier.

      • position: number

        New sticker position.

      Returns Promise<boolean>

      True on success.

    • Use this method to set the thumbnail of a regular sticker set or a mask set. The thumbnail file format must match the format of the stickers in the set. Returns True on success.

      Parameters

      • name: string

        Sticker set name.

      • user_id: number

        User identifier creating the sticker set.

      • format: string

        Thumbnail file format.

      • Optionaloptions: Omit<SetStickerSetThumbnailParams, "user_id" | "name" | "format">

        Additional parameters.

      Returns Promise<boolean>

      True on success.

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

      Parameters

      • name: string

        Sticker set name.

      • title: string

        New sticker set title.

      Returns Promise<boolean>

      True on success.

    • Use this method to set a user's emoji status. Returns True on success.

      Parameters

      • user_id: number

        Unique identifier for the target user

      • Optionaloptions: Omit<SetUserEmojiStatusParams, "user_id">

        Additional emoji status parameters

      Returns Promise<boolean>

      True on success

    • Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL containing a serialized JSON update. In case of a failed request (a request with an HTTP response status code other than 2XY), we will retry the request and stop its execution after a sufficient number of attempts. Returns True on success.

      If you want to ensure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain an "X-Telegram-Bot-Api-Secret-Token" header with the secret token as its content.

      Important: Ensure that your URL uses a valid SSL certificate. Requests with invalid certificates will be ignored. For testing in a local environment, you can use ngrok or similar services.

      Parameters

      • url: string

        Webhook URL

      • Optionaloptions: Omit<SetWebhookParams, "url">

        Additional webhook parameters

      Returns Promise<boolean>

      boolean on success

    • Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited message is returned, otherwise True is returned.

      Parameters

      • id: EditMessageIds

        Message identifier. Can be an object with chat_id and message_id or an inline_message_id string.

      • Optionaloptions: Omit<
            StopMessageLiveLocationParams,
            "chat_id"
            | "message_id"
            | "inline_message_id",
        >

        Additional parameters

      Returns Promise<boolean | Message>

      Edited message or True on success.

    • Use this method to stop a poll. On success, the updated poll is returned.

      Parameters

      • chat_id: string | number

        Chat identifier or username.

      • message_id: number

        Message identifier with the poll.

      • Optionaloptions: Omit<StopPollParams, "chat_id" | "message_id">

        Additional parameters.

      Returns Promise<Poll>

      Updated poll.

    • Transfers Telegram Stars from a business account balance to the bot balance. Requires the business bot right can_transfer_stars. Returns True on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      • star_count: number

        Number of stars to transfer

      Returns Promise<boolean>

      True on success

    • Transfers an owned unique gift to another user. Requires the business bot right can_transfer_and_upgrade_gifts. Requires the business bot right can_transfer_stars if the transfer is paid. Returns True on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      • owned_gift_id: string

        Gift identifier

      • new_owner_chat_id: number

        New owner's chat identifier

      • Optionaloptions: Omit<
            TransferGiftParams,
            "business_connection_id"
            | "owned_gift_id"
            | "new_owner_chat_id",
        >

        Additional parameters

      Returns Promise<boolean>

      True on success

    • Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via an invite link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user will not be a member of the chat, but will be able to join it. So, if the user is a member of the chat, they will also be removed from the chat. If you don't want this, use the only_if_banned parameter. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • user_id: number

        Unique identifier for the target user

      • Optionaloptions: Omit<UnbanChatMemberParams, "chat_id" | "user_id">

        Additional unban parameters

      Returns Promise<boolean>

      True on success

    • Use this method to unban a previously blocked channel chat in a supergroup or channel. For this to work, the bot must be an administrator and have appropriate administrator rights. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • sender_chat_id: number

        Unique identifier of the sender

      Returns Promise<boolean>

      True on success

    • Use this method to unhide the "General" topic in a forum supergroup chat. For this to work, the bot must be a chat administrator and have the can_manage_topics administrator right. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<boolean>

      True on success

    • Use this method to clear the list of pinned messages in a chat. In private chats and channel direct message chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the can_pin_messages or can_edit_messages right to unpin all pinned messages in groups and channels respectively. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<boolean>

      True on success

    • Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or in a private chat with a user. In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • message_thread_id: number

        Forum topic identifier

      Returns Promise<boolean>

      True on success

    • Use this method to clear the list of pinned messages in a General forum topic. For this to work, the bot must be a chat administrator and have the can_pin_messages administrator right in the supergroup. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      Returns Promise<boolean>

      True on success

    • Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct message chats, all messages can be unpinned. Conversely, the bot must be an administrator with the can_pin_messages or can_edit_messages right to unpin messages in groups and channels respectively. Returns True on success.

      Parameters

      • chat_id: string | number

        Unique identifier for the target chat

      • Optionaloptions: Omit<UnpinChatMessageParams, "chat_id">

        Additional parameters (message_id, etc.)

      Returns Promise<boolean>

      True on success

    • Upgrades a regular gift to a unique one. Requires the business bot right can_transfer_and_upgrade_gifts. Additionally requires the business bot right can_transfer_stars if the upgrade is paid. Returns True on success.

      Parameters

      • business_connection_id: string

        Business account identifier

      • owned_gift_id: string

        Gift identifier

      • Optionaloptions: Omit<UpgradeGiftParams, "business_connection_id" | "owned_gift_id">

      Returns Promise<boolean>

      True on success

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

      Parameters

      • user_id: number

        User identifier.

      • sticker: string | InputFile

        Sticker to upload. Can be a string (file_id) or InputFile.

      • sticker_format: "video" | "static" | "animated"

        Sticker format. Can be 'static', 'animated', or 'video'.

      Returns Promise<File>

      File object.

    • Verifies a chat on behalf of an organization represented by the bot. Returns True on success.

      Parameters

      • chat_id: number

        Chat identifier

      • Optionaloptions: Omit<VerifyChatParams, "chat_id">

        Additional parameters (custom_description)

      Returns Promise<boolean>

      True on success

    • Verifies a user on behalf of an organization represented by the bot. Returns True on success.

      Parameters

      • user_id: number

        User identifier

      • Optionaloptions: Omit<VerifyUserParams, "user_id">

        Additional parameters (status, comment)

      Returns Promise<boolean>

      True on success