Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Tiny (smol) Telegram Bot API client library with TypeScript types
default
Main Telegram Bot API client module.
Calls a Telegram Bot API method.
Fetches the contents of a file that you get from TgApi.getFile.
Returns an iterator over updates from the Telegram Bot API.
Telegram API URL.
Parameters of TgApi.addStickerToSet method.
This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
Parameters of TgApi.answerCallbackQuery method.
Parameters of TgApi.answerInlineQuery method.
Parameters of TgApi.answerPreCheckoutQuery method.
Parameters of TgApi.answerShippingQuery method.
Parameters of TgApi.answerWebAppQuery method.
Options for callTgApi.
Parameters of TgApi.approveChatJoinRequest method.
This object represents an audio file to be treated as music by the Telegram clients.
This object describes the way a background is filled based on the selected colors. Currently, it can be one of
The background is a freeform gradient that rotates after every message in the chat.
The background is a gradient fill.
The background is filled using the selected color.
This object describes the type of a background. Currently, it can be one of
The background is taken directly from a built-in chat theme.
The background is automatically filled based on the selected colors.
The background is a PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the background fill chosen by the user.
The background is a wallpaper in the JPEG format.
Parameters of TgApi.banChatMember method.
Parameters of TgApi.banChatSenderChat method.
Describes the birthdate of a user.
Wraps callTgApi and other functions into a single easy-to-use class.
This object represents a bot command.
This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:
Represents the scope of bot commands, covering all group and supergroup chat administrators.
Represents the scope of bot commands, covering all group and supergroup chats.
Represents the scope of bot commands, covering all private chats.
Represents the scope of bot commands, covering a specific chat.
Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.
Represents the scope of bot commands, covering a specific member of a group or supergroup chat.
Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user.
TgBot config.
This object represents the bot's description.
This object represents the bot's name.
This object represents the bot's short description.
Describes the connection of the bot with a business account.
Contains information about the start page settings of a Telegram Business account.
Contains information about the location of a Telegram Business account.
This object is received when messages are deleted from a connected business account.
Describes the opening hours of a business.
Describes an interval of time during which a business is open.
A placeholder, currently holds no information. Use BotFather to set up your game.
This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
This object represents a chat.
Represents the rights of an administrator in a chat.
This object represents a chat background.
This object contains information about a chat boost.
This object represents a service message about a user boosting a chat.
This object represents a boost removed from a chat.
This object describes the source of a chat boost. It can be one of
The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
This object represents a boost added to a chat or changed.
This object contains full information about a chat.
Represents an invite link for a chat.
Represents a join request sent to a chat.
Represents a location to which a chat is connected.
This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
Represents a chat member that has some additional privileges.
Represents a chat member that was banned in the chat and can't return to the chat or view chat messages.
Represents a chat member that isn't currently a member of the chat, but may join it themselves.
Represents a chat member that has no additional privileges or restrictions.
Represents a chat member that owns the chat and has all administrator privileges.
Represents a chat member that is under certain restrictions in the chat. Supergroups only.
This object represents changes in the status of a chat member.
Describes actions that a non-administrator user is allowed to take in a chat.
This object represents a chat photo.
Represents a result of an inline query that was chosen by the user and sent to their chat partner.
Parameters of TgApi.closeForumTopic method.
Parameters of TgApi.closeGeneralForumTopic method.
This object represents a phone contact.
Parameters of TgApi.copyMessage method.
Parameters of TgApi.copyMessages method.
Parameters of TgApi.createChatInviteLink method.
Parameters of TgApi.createForumTopic method.
Parameters of TgApi.createInvoiceLink method.
Parameters of TgApi.createNewStickerSet method.
Parameters of TgApi.declineChatJoinRequest method.
Parameters of TgApi.deleteChatPhoto method.
Parameters of TgApi.deleteChatStickerSet method.
Parameters of TgApi.deleteForumTopic method.
Parameters of TgApi.deleteMessage method.
Parameters of TgApi.deleteMessages method.
Parameters of TgApi.deleteMyCommands method.
Parameters of TgApi.deleteStickerFromSet method.
Parameters of TgApi.deleteStickerSet method.
Parameters of TgApi.deleteWebhook method.
This object represents an animated emoji that displays a random value.
This object represents a general file (as opposed to photos, voice messages and audio files).
Parameters of TgApi.editChatInviteLink method.
Parameters of TgApi.editForumTopic method.
Parameters of TgApi.editGeneralForumTopic method.
Parameters of TgApi.editMessageLiveLocation method.
Parameters of TgApi.editMessageMedia method.
Parameters of TgApi.editMessageReplyMarkup method.
Parameters of TgApi.editMessageText method.
Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
Describes documents or other Telegram Passport elements shared with the bot by the user.
Error returned from the Telegram Bot API.
Parameters of TgApi.exportChatInviteLink method.
This object contains information about a message that is being replied to, which may come from another chat or forum topic.
This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot/<file_path>. 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.
Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. Not supported in channels and for messages sent on behalf of a Telegram Business account.
This object represents a forum topic.
This object represents a service message about a forum topic closed in the chat. Currently holds no information.
This object represents a service message about a new forum topic created in the chat.
This object represents a service message about an edited forum topic.
This object represents a service message about a forum topic reopened in the chat. Currently holds no information.
Parameters of TgApi.forwardMessage method.
Parameters of TgApi.forwardMessages method.
This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
This object represents one row of the high scores table for a game.
Parameters of TgApi.getBusinessConnection method.
Parameters of TgApi.getChatAdministrators method.
Parameters of TgApi.getChatMemberCount method.
Parameters of TgApi.getChatMember method.
Parameters of TgApi.getChat method.
Parameters of TgApi.getCustomEmojiStickers method.
Parameters of TgApi.getFile method.
Parameters of TgApi.getGameHighScores method.
Parameters of TgApi.getMyCommands method.
Parameters of TgApi.getMyDefaultAdministratorRights method.
Parameters of TgApi.getMyDescription method.
Parameters of TgApi.getMyName method.
Parameters of TgApi.getMyShortDescription method.
Parameters of TgApi.getStarTransactions method.
Parameters of TgApi.getStickerSet method.
Parameters of TgApi.getUpdates method.
Parameters of TgApi.getUserChatBoosts method.
Parameters of TgApi.getUserProfilePhotos method.
This object represents a message about a scheduled giveaway.
This object represents a service message about the completion of a giveaway without public winners.
This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.
This object represents a message about the completion of a giveaway with public winners.
Parameters of TgApi.hideGeneralForumTopic method.
This object describes a message that was deleted or is otherwise inaccessible to the bot.
This object represents an inline keyboard that appears right next to the message it belongs to.
This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
Represents a link to an article or web page.
Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
Represents a Game.
Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
Represents the content of a contact message to be sent as the result of an inline query.
This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.
Represents the content of an invoice message to be sent as the result of an inline query.
Represents the content of a location message to be sent as the result of an inline query.
This object represents the content of a media message to be sent. It should be one of
Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
Represents an audio file to be treated as music to be sent.
Represents a general file to be sent.
Represents a photo to be sent.
Represents a video to be sent.
This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:
This object describes the paid media to be sent. Currently, it can be one of
The paid media to send is a photo.
The paid media to send is a video.
This object contains information about one answer option in a poll to be sent.
This object describes a sticker to be added to a sticker set.
Represents the content of a text message to be sent as the result of an inline query.
Represents the content of a venue message to be sent as the result of an inline query.
This object contains basic information about an invoice.
This object represents a portion of the price for goods or services.
Parameters of TgApi.leaveChat method.
Describes the options used for link preview generation.
This object represents a point on the map.
This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:
This object describes the position on faces where a mask should be placed by default.
This object describes a message that can be inaccessible to the bot. It can be one of
This object represents a message.
This object represents a service message about a change in auto-delete timer settings.
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
This object represents a unique message identifier.
This object describes the origin of a message. It can be one of
The message was originally sent to a channel chat.
The message was originally sent on behalf of a chat to a group chat.
The message was originally sent by a known user.
This object represents reaction changes on a message with anonymous reactions.
This object represents a change of a reaction on a message performed by a user.
This object represents information about an order.
This object describes paid media. Currently, it can be one of
Describes the paid media added to a message.
The paid media is a photo.
The paid media isn't available before the payment.
The paid media is a video.
Describes Telegram Passport data shared with the bot by the user.
This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.
Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.
Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.
Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.
Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.
Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.
Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.
Represents an issue in an unspecified place. The error is considered resolved when new data is added.
This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
This object represents one size of a photo or a file / sticker thumbnail.
Parameters of TgApi.pinChatMessage method.
This object contains information about a poll.
This object represents an answer of a user in a non-anonymous poll.
This object contains information about one answer option in a poll.
This object contains information about an incoming pre-checkout query.
Parameters of TgApi.promoteChatMember method.
This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
Represents a reaction added to a message along with the number of times it was added.
This object describes the type of a reaction. Currently, it can be one of
The reaction is based on a custom emoji.
The reaction is based on an emoji.
This object contains basic information about a refunded payment.
Parameters of TgApi.refundStarPayment method.
Parameters of TgApi.reopenForumTopic method.
Parameters of TgApi.reopenGeneralForumTopic method.
Parameters of TgApi.replaceStickerInSet method.
This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). Not supported in channels and for messages sent on behalf of a Telegram Business account.
Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). Not supported in channels and for messages sent on behalf of a Telegram Business account.
Describes reply parameters for the message that is being sent.
Describes why a request was unsuccessful.
Parameters of TgApi.restrictChatMember method.
This object describes the state of a revenue withdrawal operation. Currently, it can be one of
The withdrawal failed and the transaction was refunded.
The withdrawal is in progress.
The withdrawal succeeded.
Parameters of TgApi.revokeChatInviteLink method.
Parameters of TgApi.sendAnimation method.
Parameters of TgApi.sendAudio method.
Parameters of TgApi.sendChatAction method.
Parameters of TgApi.sendContact method.
Parameters of TgApi.sendDice method.
Parameters of TgApi.sendDocument method.
Parameters of TgApi.sendGame method.
Parameters of TgApi.sendInvoice method.
Parameters of TgApi.sendLocation method.
Parameters of TgApi.sendMediaGroup method.
Parameters of TgApi.sendMessage method.
Parameters of TgApi.sendPaidMedia method.
Parameters of TgApi.sendPhoto method.
Parameters of TgApi.sendPoll method.
Parameters of TgApi.sendSticker method.
Parameters of TgApi.sendVenue method.
Parameters of TgApi.sendVideoNote method.
Parameters of TgApi.sendVideo method.
Parameters of TgApi.sendVoice method.
Describes an inline message sent by a Web App on behalf of a user.
Parameters of TgApi.setChatAdministratorCustomTitle method.
Parameters of TgApi.setChatDescription method.
Parameters of TgApi.setChatPermissions method.
Parameters of TgApi.setChatPhoto method.
Parameters of TgApi.setChatStickerSet method.
Parameters of TgApi.setChatTitle method.
Parameters of TgApi.setCustomEmojiStickerSetThumbnail method.
Parameters of TgApi.setGameScore method.
Parameters of TgApi.setMessageReaction method.
Parameters of TgApi.setMyCommands method.
Parameters of TgApi.setMyDefaultAdministratorRights method.
Parameters of TgApi.setMyDescription method.
Parameters of TgApi.setMyName method.
Parameters of TgApi.setMyShortDescription method.
Parameters of TgApi.setPassportDataErrors method.
Parameters of TgApi.setStickerEmojiList method.
Parameters of TgApi.setStickerKeywords method.
Parameters of TgApi.setStickerMaskPosition method.
Parameters of TgApi.setStickerPositionInSet method.
Parameters of TgApi.setStickerSetThumbnail method.
Parameters of TgApi.setStickerSetTitle method.
Parameters of TgApi.setWebhook method.
This object represents a shipping address.
This object represents one shipping option.
This object contains information about an incoming shipping query.
Describes a Telegram Star transaction.
Contains a list of Telegram Star transactions.
This object represents a sticker.
This object represents a sticker set.
Parameters of TgApi.stopMessageLiveLocation method.
Parameters of TgApi.stopPoll method.
This object represents a story.
This object contains basic information about a successful payment.
This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.
This object contains information about the quoted part of a message that is replied to by the given message.
This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of
Describes a withdrawal transaction with Fragment.
Describes a transaction with an unknown source or recipient.
Describes a withdrawal transaction to the Telegram Ads platform.
Describes a transaction with a user.
Parameters of TgApi.unbanChatMember method.
Parameters of TgApi.unbanChatSenderChat method.
Parameters of TgApi.unhideGeneralForumTopic method.
Parameters of TgApi.unpinAllChatMessages method.
Parameters of TgApi.unpinAllForumTopicMessages method.
Parameters of TgApi.unpinAllGeneralForumTopicMessages method.
Parameters of TgApi.unpinChatMessage method.
This object represents an incoming update.
Parameters of TgApi.uploadStickerFile method.
This object represents a Telegram user or bot.
This object represents a list of boosts added to a chat by a user.
This object represent a user's profile pictures.
This object represents a venue.
This object represents a video file.
This object represents a service message about a video chat ended in the chat.
This object represents a service message about new members invited to a video chat.
This object represents a service message about a video chat scheduled in the chat.
This object represents a service message about a video chat started in the chat. Currently holds no information.
This object represents a video message (available in Telegram apps as of v.4.0).
This object represents a voice note.
Describes data sent from a Web App to the bot.
Describes a Web App.
Describes the current status of a webhook.
This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.