Class Telegram

Hierarchy

  • ApiClient
    • Telegram

Constructors

Properties

Accessors

Methods

addStickerToSet answerCbQuery answerGameQuery answerInlineQuery answerPreCheckoutQuery answerShippingQuery answerWebAppQuery approveChatJoinRequest banChatMember banChatSenderChat callApi close closeForumTopic closeGeneralForumTopic copyMessage copyMessages createChatInviteLink createForumTopic createInvoiceLink createNewStickerSet declineChatJoinRequest deleteChatPhoto deleteChatStickerSet deleteForumTopic deleteMessage deleteMessages deleteMyCommands deleteStickerFromSet deleteStickerSet deleteWebhook editChatInviteLink editForumTopic editGeneralForumTopic editMessageCaption editMessageLiveLocation editMessageMedia editMessageReplyMarkup editMessageText exportChatInviteLink forwardMessage forwardMessages getChat getChatAdministrators getChatMember getChatMembersCount getChatMenuButton getCustomEmojiStickers getFile getFileLink getForumTopicIconStickers getGameHighScores getMe getMyCommands getMyDefaultAdministratorRights getMyDescription getMyName getMyShortDescription getStickerSet getUpdates getUserChatBoosts getUserProfilePhotos getWebhookInfo hideGeneralForumTopic leaveChat logOut pinChatMessage promoteChatMember reopenForumTopic reopenGeneralForumTopic restrictChatMember revokeChatInviteLink sendAnimation sendAudio sendChatAction sendContact sendCopy sendDice sendDocument sendGame sendInvoice sendLocation sendMediaGroup sendMessage sendPhoto sendPoll sendQuiz sendSticker sendVenue sendVideo sendVideoNote sendVoice setChatAdministratorCustomTitle setChatDescription setChatMenuButton setChatPermissions setChatPhoto setChatStickerSet setChatTitle setCustomEmojiStickerSetThumbnail setGameScore setMessageReaction setMyCommands setMyDefaultAdministratorRights setMyDescription setMyName setMyShortDescription setPassportDataErrors setStickerEmojiList setStickerKeywords setStickerMaskPosition setStickerPositionInSet setStickerSetThumbnail setStickerSetTitle setWebhook stopMessageLiveLocation stopPoll unbanChatMember unbanChatSenderChat unhideGeneralForumTopic unpinAllChatMessages unpinAllForumTopicMessages unpinAllGeneralForumTopicMessages unpinChatMessage uploadStickerFile

Constructors

  • Parameters

    • token: string
    • Optional options: Partial<Options>
      Optional
    • Optional response: Response
      Optional

    Returns Telegram

Properties

options: Options
token: string

Accessors

  • get kickChatMember(): ((chatId, userId, untilDate?, extra?) => Promise<true>)
  • Kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group 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 admin rights.

    Returns ((chatId, userId, untilDate?, extra?) => Promise<true>)

      • (chatId, userId, untilDate?, extra?): Promise<true>
      • Kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group 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 admin rights.

        Parameters

        • chatId: string | number

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

        • userId: number
        • Optional untilDate: number

          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

          Optional
        • Optional extra: Omit<{}, "chat_id" | "user_id" | "until_date">
          Optional

        Returns Promise<true>

    Deprecated

    since API 5.3. Use Telegram.banChatMember

  • get setStickerSetThumb(): ((name, userId, thumbnail?) => Promise<true>)
  • Returns ((name, userId, thumbnail?) => Promise<true>)

      • (name, userId, thumbnail?): Promise<true>
      • Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set.

        Parameters

        • name: string

          Sticker set name

        • userId: number

          User identifier of the sticker set owner

        • Optional thumbnail: string | InputFile

          A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass a HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using Input helpers. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.

          Optional

        Returns Promise<true>

    Deprecated

    since API 6.8. Use Telegram.setStickerSetThumbnail

Methods

  • Add a new sticker to a set created by the bot.

    Parameters

    • ownerId: number

      User identifier of sticker set owner

    • name: string

      Sticker set name

    • stickerData: Omit<{}, "chat_id" | "name" | "user_id">

    Returns Promise<true>

  • Parameters

    • callbackQueryId: string
    • Optional text: string
      Optional
    • Optional extra: Omit<{}, "text" | "chat_id" | "callback_query_id">
      Optional

    Returns Promise<true>

  • Parameters

    • callbackQueryId: string
    • url: string

    Returns Promise<true>

  • Send answers to an inline query. No more than 50 results per query are allowed.

    Parameters

    • inlineQueryId: string
    • results: readonly InlineQueryResult[]
    • Optional extra: Omit<{}, "chat_id" | "inline_query_id" | "results">
      Optional

    Returns Promise<true>

  • 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. Respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.

    Parameters

    • preCheckoutQueryId: string
    • 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.

    • Optional errorMessage: string

      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.

      Optional

    Returns Promise<true>

  • 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. Reply to shipping queries.

    Parameters

    • shippingQueryId: string
    • 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: undefined | readonly ShippingOption[]

      Required if ok is True. A JSON-serialized array of available shipping options.

    • errorMessage: undefined | string

      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.

    Returns Promise<true>

  • Parameters

    • webAppQueryId: string
    • result: InlineQueryResult

    Returns Promise<SentWebAppMessage>

  • 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.

    Parameters

    • chatId: string | number

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

    • userId: number

      Unique identifier of the target user

    Returns Promise<true>

  • Kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group 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 admin rights.

    Parameters

    • chatId: string | number

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

    • userId: number
    • Optional untilDate: number

      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

      Optional
    • Optional extra: Omit<{}, "chat_id" | "user_id" | "until_date">
      Optional

    Returns Promise<true>

  • Ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is unbanned first. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.

    Parameters

    • chatId: string | number

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

    • senderChatId: number

      Unique identifier of the target sender chat

    • Optional extra: {
          caption?: string | FmtString<string>;
      }
      Optional
      • Optional caption?: string | FmtString<string>

    Returns Promise<true>

  • Type Parameters

    • M extends keyof Telegram

    Parameters

    • method: M
    • payload: Opts<M>
    • __namedParameters: CallApiOptions = {}

    Returns Promise<ReturnType<Telegram[M]>>

  • Close the bot instance before moving it from one local server to another.

    Returns Promise<true>

  • 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.

    Parameters

    • chat_id: string | number
    • message_thread_id: number

      Unique identifier for the target message thread of the forum topic

    Returns Promise<true>

  • 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.

    Parameters

    • chat_id: string | number

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

    Returns Promise<true>

  • Send copy of existing message.

    Parameters

    • chatId: string | number

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

    • fromChatId: string | number

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

    • messageId: number

      Message identifier in the chat specified in from_chat_id

    • Optional extra: {
          caption?: string | FmtString<string>;
      }
      Optional
      • Optional caption?: string | FmtString<string>

    Returns Promise<MessageId>

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

    Parameters

    • chatId: string | number

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

    • fromChatId: string | number

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

    • messageIds: number[]

      Identifiers of 1-100 messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.

    • Optional extra: Omit<{}, "chat_id" | "from_chat_id" | "message_ids">
      Optional

    Returns Promise<MessageId[]>

  • Parameters

    • chatId: string | number
    • Optional extra: Omit<{}, "chat_id">
      Optional

    Returns Promise<ChatInviteLink>

  • Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object.

    Parameters

    • chat_id: string | number
    • name: string

      Topic name, 1-128 characters

    • Optional extra: Omit<{}, "chat_id" | "name">
      Optional

    Returns Promise<ForumTopic>

  • Parameters

    • invoice: Omit<{}, "chat_id">

    Returns Promise<string>

  • Create new sticker set owned by a user. The bot will be able to edit the created sticker set.

    Parameters

    • ownerId: number

      User identifier of created sticker set owner

    • name: string

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

    • title: string

      Sticker set title, 1-64 characters

    • stickerData: Omit<{}, "chat_id" | "name" | "user_id" | "title">

    Returns Promise<true>

  • 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.

    Parameters

    • chatId: string | number

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

    • userId: number

      Unique identifier of the target user

    Returns Promise<true>

  • Parameters

    • chatId: string | number

    Returns Promise<true>

  • Parameters

    • chatId: string | number

    Returns Promise<true>

  • 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.

    Parameters

    • chat_id: string | number
    • message_thread_id: number

      Unique identifier for the target message thread of the forum topic

    Returns Promise<true>

  • 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.
    • Bots can delete outgoing messages in groups and supergroups.
    • 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.

    Parameters

    • chatId: string | number

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

    • messageId: number

      Identifier of the message to delete

    Returns Promise<true>

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

    Parameters

    • chatId: string | number

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

    • messageIds: number[]

      Identifiers of 1-100 messages to delete. See deleteMessage for limitations on which messages can be deleted

    Returns Promise<true>

  • Parameters

    • extra: {} = {}

      Returns Promise<true>

    • Delete a sticker from a set created by the bot.

      Parameters

      • sticker: string

        File identifier of the sticker

      Returns Promise<true>

    • Parameters

      • name: string

      Returns Promise<true>

    • Remove webhook integration.

      Parameters

      • Optional extra: {
            drop_pending_updates?: boolean;
        }
        Optional
        • Optional drop_pending_updates?: boolean

      Returns Promise<true>

    • Parameters

      • chatId: string | number
      • inviteLink: string
      • Optional extra: Omit<{}, "chat_id" | "invite_link">
        Optional

      Returns Promise<ChatInviteLink>

    • 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.

      Parameters

      • chat_id: string | number
      • message_thread_id: number

        Unique identifier for the target message thread of the forum topic

      • extra: Omit<{}, "chat_id" | "message_thread_id">

      Returns Promise<true>

    • 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.

      Parameters

      • chat_id: string | number

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

      • name: string

        New topic name, 1-128 characters

      Returns Promise<true>

    • Edit captions of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

      Parameters

      • chatId: undefined | string | number

        Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)

      • messageId: undefined | number

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

      • inlineMessageId: undefined | string

        Required if chatId and messageId are not specified. Identifier of the inline message

      • caption: undefined | string | FmtString<string>

        New caption of the message

      • Optional extra: Omit<{}, "caption" | "chat_id" | "message_id" | "inline_message_id">
        Optional

      Returns Promise<true | Edited & CaptionableMessage>

    • Parameters

      • chatId: undefined | string | number
      • messageId: undefined | number
      • inlineMessageId: undefined | string
      • latitude: number
      • longitude: number
      • Optional extra: Omit<{}, "chat_id" | "message_id" | "inline_message_id" | "latitude" | "longitude">
        Optional

      Returns Promise<true | Edited & LocationMessage>

    • Edit animation, audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL.

      Parameters

      • chatId: undefined | string | number

        Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)

      • messageId: undefined | number

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

      • inlineMessageId: undefined | string

        Required if chatId and messageId are not specified. Identifier of the inline message

      • media: {
            caption?: string | FmtString<string>;
        } | {
            caption?: string | FmtString<string>;
        } | {
            caption?: string | FmtString<string>;
        } | {
            caption?: string | FmtString<string>;
        } | {
            caption?: string | FmtString<string>;
        }

        New media of message

      • Optional extra: Omit<{}, "chat_id" | "message_id" | "inline_message_id" | "media">

        Additional parameters, such as reply_markup

        Optional

      Returns Promise<true | Object>

    • Edit only the reply markup of messages sent by the bot or via the bot (for inline bots).

      Parameters

      • chatId: undefined | string | number

        Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)

      • messageId: undefined | number

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

      • inlineMessageId: undefined | string

        Required if chatId and messageId are not specified. Identifier of the inline message

      • markup: undefined | InlineKeyboardMarkup

        A JSON-serialized object for an inline keyboard.

      Returns Promise<true | Object>

      If edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

    • Edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

      Parameters

      • chatId: undefined | string | number

        Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)

      • messageId: undefined | number

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

      • inlineMessageId: undefined | string

        Required if chatId and messageId are not specified. Identifier of the inline message

      • text: string | FmtString<string>

        New text of the message

      • Optional extra: Omit<{}, "text" | "chat_id" | "message_id" | "inline_message_id">
        Optional

      Returns Promise<true | Edited & TextMessage>

    • Export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

      Parameters

      • chatId: string | number

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

      Returns Promise<string>

    • Forward existing message.

      Parameters

      • chatId: string | number

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

      • fromChatId: string | number

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

      • messageId: number

        Message identifier in the chat specified in from_chat_id

      • Optional extra: Omit<{}, "chat_id" | "from_chat_id" | "message_id">
        Optional

      Returns Promise<Message>

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

      Parameters

      • chatId: string | number

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

      • fromChatId: string | number

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

      • messageIds: number[]

        Identifiers of 1-100 messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.

      • Optional extra: Omit<{}, "chat_id" | "from_chat_id" | "message_ids">
        Optional

      Returns Promise<MessageId[]>

    • 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.).

      Parameters

      • chatId: string | number

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

      Returns Promise<ChatFromGetChat>

    • Parameters

      • chatId: string | number

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

      Returns Promise<(ChatMemberOwner | ChatMemberAdministrator)[]>

    • Get information about a member of a chat.

      Parameters

      • chatId: string | number

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

      • userId: number

        Unique identifier of the target user

      Returns Promise<ChatMember>

    • Get the number of members in a chat.

      Parameters

      • chatId: string | number

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

      Returns Promise<number>

    • 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

      • chatId: {
            chatId?: number;
        } = {}

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

        • Optional chatId?: number

      Returns Promise<MenuButton>

    • Parameters

      • custom_emoji_ids: string[]

      Returns Promise<Sticker[]>

    • Get basic info about a file and prepare it for downloading.

      Parameters

      • fileId: string

        Id of file to get link to

      Returns Promise<File>

    • Get download link to a file.

      Parameters

      • fileId: string | File

      Returns Promise<URL>

    • Parameters

      • userId: number
      • inlineMessageId: undefined | string
      • chatId: undefined | number
      • messageId: undefined | number

      Returns Promise<GameHighScore[]>

    • Get basic information about the bot

      Returns Promise<UserFromGetMe>

    • Get the current list of the bot's commands.

      Parameters

      • extra: {} = {}

        Returns Promise<BotCommand[]>

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

        Parameters

        • forChannels: {
              forChannels?: boolean;
          } = {}

          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.

          • Optional forChannels?: boolean

        Returns Promise<ChatAdministratorRights>

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

        Parameters

        • Optional language_code: string

          A two-letter ISO 639-1 language code.

          Optional

        Returns Promise<BotDescription>

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

        Parameters

        • Optional language_code: string

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

          Optional

        Returns Promise<BotName>

      • Use this method to get the current bot short description for the given user language.

        Parameters

        • Optional language_code: string

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

          Optional

        Returns Promise<BotShortDescription>

      • Parameters

        • name: string

        Returns Promise<StickerSet>

      • Directly request incoming updates. You should probably use Telegraf::launch instead.

        Parameters

        • timeout: number
        • limit: number
        • offset: number
        • allowedUpdates: undefined | readonly UpdateType[]

        Returns Promise<Update[]>

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

        Parameters

        • chat_id: string | number

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

        • user_id: number

          Unique identifier of the target user

        Returns Promise<UserChatBoosts[]>

      • Parameters

        • userId: number
        • Optional offset: number
          Optional
        • Optional limit: number
          Optional

        Returns Promise<UserProfilePhotos>

      • Returns Promise<WebhookInfo>

      • 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.

        Parameters

        • chat_id: string | number

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

        Returns Promise<true>

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

        Parameters

        • chatId: string | number

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

        Returns Promise<true>

      • Log out from the cloud Bot API server before launching the bot locally.

        Returns Promise<true>

      • Pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in the supergroup or 'can_edit_messages' admin right in the channel.

        Parameters

        • chatId: string | number

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

        • messageId: number
        • Optional extra: {
              disable_notification?: boolean;
          }
          Optional
          • Optional disable_notification?: boolean

        Returns Promise<true>

      • 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 admin rights. Pass False for all boolean parameters to demote a user.

        Parameters

        • chatId: string | number

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

        • userId: number
        • extra: Omit<{}, "chat_id" | "user_id">

        Returns Promise<true>

      • 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.

        Parameters

        • chat_id: string | number
        • message_thread_id: number

          Unique identifier for the target message thread of the forum topic

        Returns Promise<true>

      • 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.

        Parameters

        • chat_id: string | number

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

        Returns Promise<true>

      • Restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user.

        Parameters

        • chatId: string | number

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

        • userId: number
        • extra: Omit<{}, "chat_id" | "user_id">

        Returns Promise<true>

      • Parameters

        • chatId: string | number
        • inviteLink: string

        Returns Promise<ChatInviteLink>

      • Send .gif animations.

        Parameters

        • chatId: string | number

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

        • animation: string | InputFile
        • Optional extra: {
              caption?: string | FmtString<string>;
          }
          Optional
          • Optional caption?: string | FmtString<string>

        Returns Promise<AnimationMessage>

      • Send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.

        Parameters

        • chatId: string | number

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

        • audio: string | InputFile
        • Optional extra: {
              caption?: string | FmtString<string>;
          }
          Optional
          • Optional caption?: string | FmtString<string>

        Returns Promise<AudioMessage>

      • 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).

        Parameters

        • chat_id: string | number
        • action: "typing" | "upload_photo" | "record_video" | "upload_video" | "record_voice" | "upload_voice" | "upload_document" | "choose_sticker" | "find_location" | "record_video_note" | "upload_video_note"
        • Optional extra: Omit<{}, "action" | "chat_id">
          Optional

        Returns Promise<true>

      • Parameters

        • chatId: string | number
        • phoneNumber: string
        • firstName: string
        • Optional extra: Omit<{}, "phone_number" | "chat_id" | "first_name">
          Optional

        Returns Promise<ContactMessage>

      • Send copy of existing message.

        Parameters

        • chatId: string | number

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

        • message: Message

          Received message object

        • Optional extra: {
              caption?: string | FmtString<string>;
          }
          Optional
          • Optional caption?: string | FmtString<string>

        Returns Promise<MessageId>

        Deprecated

        use copyMessage instead

      • Send a dice, which will have a random value from 1 to 6.

        Parameters

        • chatId: string | number

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

        • Optional extra: Omit<{}, "chat_id">
          Optional

        Returns Promise<DiceMessage>

      • Send general files. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

        Parameters

        • chatId: string | number

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

        • document: string | InputFile
        • Optional extra: {
              caption?: string | FmtString<string>;
          }
          Optional
          • Optional caption?: string | FmtString<string>

        Returns Promise<DocumentMessage>

      • Parameters

        • chatId: number

          Unique identifier for the target chat

        • gameName: string
        • Optional extra: Omit<{}, "chat_id" | "game_short_name">
          Optional

        Returns Promise<GameMessage>

      • Parameters

        • chatId: string | number

          Unique identifier for the target private chat

        • invoice: Omit<{}, "chat_id" | "message_thread_id" | "disable_notification" | "reply_parameters" | "reply_markup">
        • Optional extra: Omit<{}, "chat_id" | "protect_content" | "title" | "description" | "payload" | "provider_token" | "currency" | "prices" | "max_tip_amount" | "suggested_tip_amounts" | "provider_data" | "photo_url" | "photo_size" | "photo_width" | "photo_height" | "need_name" | "need_phone_number" | "need_email" | "need_shipping_address" | "send_phone_number_to_provider" | "send_email_to_provider" | "is_flexible" | "start_parameter">
          Optional

        Returns Promise<InvoiceMessage>

      • Send point on the map.

        Parameters

        • chatId: string | number

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

        • latitude: number
        • longitude: number
        • Optional extra: Omit<{}, "chat_id" | "latitude" | "longitude">
          Optional

        Returns Promise<LocationMessage>

      • Send a group of photos or videos as an album.

        Parameters

        • chatId: string | number

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

        • media: MediaGroup

          A JSON-serialized array describing photos and videos to be sent, must include 2–10 items

        • Optional extra: Omit<{}, "chat_id" | "media">
          Optional

        Returns Promise<(DocumentMessage | AudioMessage | PhotoMessage | VideoMessage)[]>

      • Send a text message.

        Parameters

        • chatId: string | number

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

        • text: string | FmtString<string>

          Text of the message to be sent

        • Optional extra: Omit<{}, "text" | "chat_id">
          Optional

        Returns Promise<TextMessage>

      • Parameters

        • chatId: string | number

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

        • photo: string | InputFile
        • Optional extra: {
              caption?: string | FmtString<string>;
          }
          Optional
          • Optional caption?: string | FmtString<string>

        Returns Promise<PhotoMessage>

      • Send a native poll.

        Parameters

        • chatId: string | number

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

        • question: string

          Poll question, 1-255 characters

        • options: readonly string[]

          A JSON-serialized list of answer options, 2-10 strings 1-100 characters each

        • Optional extra: Omit<{}, "type" | "chat_id" | "question" | "options">
          Optional

        Returns Promise<PollMessage>

      • Send a native quiz.

        Parameters

        • chatId: string | number

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

        • question: string

          Poll question, 1-255 characters

        • options: readonly string[]

          A JSON-serialized list of answer options, 2-10 strings 1-100 characters each

        • Optional extra: Omit<{}, "type" | "chat_id" | "question" | "options">
          Optional

        Returns Promise<PollMessage>

      • Send .webp, animated .tgs, or video .webm stickers

        Parameters

        • chatId: string | number

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

        • sticker: string | InputFile
        • Optional extra: Omit<{}, "chat_id" | "sticker">
          Optional

        Returns Promise<StickerMessage>

      • Parameters

        • chatId: string | number
        • latitude: number
        • longitude: number
        • title: string
        • address: string
        • Optional extra: Omit<{}, "chat_id" | "title" | "latitude" | "longitude" | "address">
          Optional

        Returns Promise<VenueMessage>

      • Send video files, Telegram clients support mp4 videos (other formats may be sent as Document). Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

        Parameters

        • chatId: string | number

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

        • video: string | InputFile
        • Optional extra: {
              caption?: string | FmtString<string>;
          }
          Optional
          • Optional caption?: string | FmtString<string>

        Returns Promise<VideoMessage>

      • Send video messages.

        Parameters

        • chatId: string | number

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

        • videoNote: string | InputFileVideoNote
        • Optional extra: Omit<{}, "chat_id" | "video_note">
          Optional

        Returns Promise<VideoNoteMessage>

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

        Parameters

        • chatId: string | number

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

        • voice: string | InputFile
        • Optional extra: {
              caption?: string | FmtString<string>;
          }
          Optional
          • Optional caption?: string | FmtString<string>

        Returns Promise<VoiceMessage>

      • Parameters

        • chatId: string | number
        • userId: number
        • title: string

        Returns Promise<true>

      • Parameters

        • chatId: string | number
        • Optional description: string
          Optional

        Returns Promise<true>

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

        Parameters

        • __namedParameters: {
              chatId?: number;
              menuButton?: MenuButton;
          } = {}
          • Optional chatId?: number
          • Optional menuButton?: MenuButton

        Returns Promise<true>

      • Parameters

        • chatId: string | number
        • permissions: ChatPermissions
        • Optional extra: Omit<{}, "chat_id" | "permissions">
          Optional

        Returns Promise<true>

      • Parameters

        • chatId: string | number
        • photo: InputFile

        Returns Promise<true>

      • Parameters

        • chatId: string | number
        • setName: string

        Returns Promise<true>

      • 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 admin rights.

        Parameters

        • chatId: string | number

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

        • title: string

          New chat title, 1-255 characters

        Returns Promise<true>

      • Parameters

        • name: string
        • custom_emoji_id: string

        Returns Promise<true>

      • Parameters

        • userId: number
        • score: number
        • inlineMessageId: undefined | string
        • chatId: undefined | number
        • messageId: undefined | number
        • editMessage: boolean = true
        • force: boolean = false

        Returns Promise<true | Edited & GameMessage>

      • Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. In albums, bots must react to the first message.

        Parameters

        • chat_id: string | number

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

        • message_id: number

          Identifier of the target message

        • Optional reaction: ReactionType[]

          New list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.

          Optional
        • Optional is_big: boolean

          Pass True to set the reaction with a big animation

          Optional

        Returns Promise<true>

      • Change the list of the bot's commands.

        Parameters

        • commands: readonly BotCommand[]

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

        • Optional extra: Omit<{}, "chat_id" | "commands">
          Optional

        Returns Promise<true>

      • 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 are free to modify the list before adding the bot.

        Parameters

        • __namedParameters: {
              forChannels?: boolean;
              rights?: ChatAdministratorRights;
          } = {}
          • Optional forChannels?: boolean
          • Optional rights?: ChatAdministratorRights

        Returns Promise<true>

      • Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.

        Parameters

        • description: string

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

        • Optional language_code: string

          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.

          Optional

        Returns Promise<true>

      • Use this method to change the bot's name.

        Parameters

        • name: string

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

        • Optional language_code: string

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

          Optional

        Returns Promise<true>

      • 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.

        Parameters

        • short_description: string
        • Optional language_code: string

          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.

          Optional

        Returns Promise<true>

      • Parameters

        • userId: number
        • errors: readonly PassportElementError[]

        Returns Promise<true>

      • Parameters

        • sticker: string
        • emoji_list: string[]

        Returns Promise<true>

      • Parameters

        • sticker: string
        • Optional keywords: string[]
          Optional

        Returns Promise<true>

      • Parameters

        • sticker: string
        • Optional mask_position: MaskPosition
          Optional

        Returns Promise<true>

      • Move a sticker in a set created by the bot to a specific position.

        Parameters

        • sticker: string

          File identifier of the sticker

        • position: number

          New sticker position in the set, zero-based

        Returns Promise<true>

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

        Parameters

        • name: string

          Sticker set name

        • userId: number

          User identifier of the sticker set owner

        • Optional thumbnail: string | InputFile

          A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass a HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using Input helpers. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.

          Optional

        Returns Promise<true>

      • Parameters

        • name: string
        • title: string

        Returns Promise<true>

      • Specify a url to receive incoming updates via an outgoing webhook.

        Parameters

        • url: string

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

        • Optional extra: Omit<{}, "url" | "chat_id">
          Optional

        Returns Promise<true>

      • Parameters

        • chatId: undefined | string | number
        • messageId: undefined | number
        • inlineMessageId: undefined | string
        • Optional markup: InlineKeyboardMarkup
          Optional

        Returns Promise<true | Edited & LocationMessage>

      • Parameters

        • chatId: string | number

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

        • messageId: number

          Identifier of the original message with the poll

        • Optional extra: Omit<{}, "chat_id" | "message_id">
          Optional

        Returns Promise<Poll>

      • Unban a user from a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

        Parameters

        • chatId: string | number

          Unique identifier for the target group or username of the target supergroup or channel (in the format @username)

        • userId: number

          Unique identifier of the target user

        • Optional extra: {
              only_if_banned?: boolean;
          }
          Optional
          • Optional only_if_banned?: boolean

        Returns Promise<true>

      • 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.

        Parameters

        • chatId: string | number

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

        • senderChatId: number

          Unique identifier of the target sender chat

        Returns Promise<true>

      • 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.

        Parameters

        • chat_id: string | number

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

        Returns Promise<true>

      • Clear the list of pinned messages in a chat.

        Parameters

        • chatId: string | number

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

        Returns Promise<true>

      • 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.

        Parameters

        • chat_id: string | number
        • message_thread_id: number

          Unique identifier for the target message thread of the forum topic

        Returns Promise<true>

      • 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.

        Parameters

        • chat_id: string | number

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

        Returns Promise<true>

      • Unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in the supergroup or 'can_edit_messages' admin right in the channel.

        Parameters

        • chatId: string | number

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

        • Optional messageId: number
          Optional

        Returns Promise<true>

      • Upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). https://core.telegram.org/bots/api#sending-files

        Parameters

        • ownerId: number

          User identifier of sticker file owner

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

        Returns Promise<File>

      Generated using TypeDoc