default

Utility library for Telegram API, especially useful for testing But powerful enough to be used full featured telegram bot or integrations

I
f
tgtb

Creates a new TgtbClient instance

v
TOKEN_CHARS

Symbols allowed in bot token or secret token

v
WEB_APP_UINT8

"WebApp" as Uint8Array

types

Types for Telegram API, Login Widget, WebApp Also exported from @grammyjs/types

I
AcceptedGiftTypes

This object describes the types of gifts that can be gifted to a user or a chat.

I
AffiliateInfo

Contains information about the affiliate that received a commission via this transaction.

I
Animation

This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).

I
ApiError
No documentation available
T
ApiMethods

Wrapper type to bundle all methods of the Telegram Bot API

T
ApiResponse

The response contains an object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals true, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals false and the error is explained in the 'description'. An Integer 'error_code' field is also returned, but its contents are subject to change in the future. Some errors may also have an optional field 'parameters' of the type ResponseParameters, which can help to automatically handle the error.

I
ApiSuccess
No documentation available
I
Audio

This object represents an audio file to be treated as music by the Telegram clients.

T
BackgroundFill

This object describes the way a background is filled based on the selected colors. Currently, it can be one of

I
BackgroundFillFreeformGradient

The background is a freeform gradient that rotates after every message in the chat.

I
BackgroundFillSolid

The background is filled using the selected color.

T
BackgroundType

This object describes the type of a background. Currently, it can be one of

I
BackgroundTypeChatTheme

The background is taken directly from a built-in chat theme.

I
BackgroundTypeFill

The background is automatically filled based on the selected colors.

I
BackgroundTypePattern

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.

I
BackgroundTypeWallpaper

The background is a wallpaper in the JPEG format.

I
Birthdate

Describes the birthdate of a user.

I
BotCommand

This object represents a bot command.

T
BotCommandScope

This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:

I
BotCommandScopeAllChatAdministrators

Represents the scope of bot commands, covering all group and supergroup chat administrators.

I
BotCommandScopeAllGroupChats

Represents the scope of bot commands, covering all group and supergroup chats.

I
BotCommandScopeAllPrivateChats

Represents the scope of bot commands, covering all private chats.

I
BotCommandScopeChat

Represents the scope of bot commands, covering a specific chat.

I
BotCommandScopeChatAdministrators

Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.

I
BotCommandScopeChatMember

Represents the scope of bot commands, covering a specific member of a group or supergroup chat.

I
BotCommandScopeDefault

Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user.

I
BotDescription

This object represents the bot's description.

I
BotName

This object represents the bot's name.

I
BotShortDescription

This object represents the bot's short description.

I
BusinessConnection

Describes the connection of the bot with a business account.

I
BusinessIntro

Contains information about the start page settings of a Telegram Business account.

I
BusinessLocation

Contains information about the location of a Telegram Business account.

I
BusinessMessagesDeleted

This object is received when messages are deleted from a connected business account.

I
BusinessOpeningHours

Describes the opening hours of a business.

I
BusinessOpeningHoursInterval

Describes an interval of time during which a business is open.

I
CallbackGame

A placeholder, currently holds no information. Use BotFather to set up your game.

I
CallbackQuery

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.

N
T
Chat
No documentation available
I
ChatBackground

This object represents a chat background.

I
ChatBoost

This object contains information about a chat boost.

I
ChatBoostAdded

This object represents a service message about a user boosting a chat.

I
ChatBoostRemoved

This object represents a boost removed from a chat.

T
ChatBoostSource

This object describes the source of a chat boost. It can be one of

I
ChatBoostSourceGiftCode

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.

I
ChatBoostSourceGiveaway

The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways.

I
ChatBoostSourcePremium

The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user.

I
ChatBoostUpdated

This object represents a boost added to a chat or changed.

N
T
ChatFullInfo
No documentation available
I
ChatJoinRequest

Represents a join request sent to a chat.

I
ChatLocation

Represents a location to which a chat is connected.

T
ChatMember

This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:

I
ChatMemberBanned

Represents a chat member that was banned in the chat and can't return to the chat or view chat messages.

I
ChatMemberLeft

Represents a chat member that isn't currently a member of the chat, but may join it themselves.

I
ChatMemberMember

Represents a chat member that has no additional privileges or restrictions.

I
ChatMemberOwner

Represents a chat member that owns the chat and has all administrator privileges.

I
ChatShared

This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button.

I
ChecklistTasksAdded

Describes a service message about tasks added to a checklist.

I
ChecklistTasksDone

Describes a service message about checklist tasks marked as done or not done.

I
ChosenInlineResult

Represents a result of an inline query that was chosen by the user and sent to their chat partner.

I
Contact

This object represents a phone contact.

I
CopyTextButton

This object represents an inline keyboard button that copies specified text to the clipboard.

I
Dice

This object represents an animated emoji that displays a random value.

I
DirectMessagePriceChanged

Describes a service message about a change in the price of direct messages sent to a channel chat.

I
DirectMessagesTopic

Describes a topic of a direct messages chat.

I
Document

This object represents a general file (as opposed to photos, voice messages and audio files).

I
EncryptedCredentials

Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.

I
EncryptedPassportElement

Describes documents or other Telegram Passport elements shared with the bot by the user.

I
File

This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<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.

I
ForceReply

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.

I
ForumTopicClosed

This object represents a service message about a forum topic closed in the chat. Currently holds no information.

I
ForumTopicCreated

This object represents a service message about a new forum topic created in the chat.

I
ForumTopicEdited

This object represents a service message about an edited forum topic.

I
ForumTopicReopened

This object represents a service message about a forum topic reopened in the chat. Currently holds no information.

I
Game

This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.

I
GameHighScore

This object represents one row of the high scores table for a game.

I
GeneralForumTopicHidden

This object represents a service message about General forum topic hidden in the chat. Currently holds no information.

I
GeneralForumTopicUnhidden

This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.

I
GiftBackground

This object describes the background of a gift.

I
Gifts

This object represent a list of gifts.

I
GiveawayCompleted

This object represents a service message about the completion of a giveaway without public winners.

I
GiveawayCreated

This object represents a service message about the creation of a scheduled giveaway.

I
InaccessibleMessage

This object describes a message that was deleted or is otherwise inaccessible to the bot.

N
T
InlineKeyboardButton
No documentation available
I
I
InlineKeyboardButton.LoginButton
No documentation available
I
InlineKeyboardButton.PayButton
No documentation available
I
InlineKeyboardButton.UrlButton
No documentation available
I
InlineKeyboardButton.WebAppButton
No documentation available
I
InlineKeyboardMarkup

This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button.

I
InlineQuery

This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.

T
InlineQueryResult

This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:

I
InlineQueryResultAudio

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.

I
InlineQueryResultCachedAudio

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.

I
InlineQueryResultCachedDocument

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.

I
InlineQueryResultCachedGif

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.

I
InlineQueryResultCachedMpeg4Gif

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.

I
InlineQueryResultCachedPhoto

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.

I
InlineQueryResultCachedSticker

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.

I
InlineQueryResultCachedVideo

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.

I
InlineQueryResultCachedVoice

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.

I
InlineQueryResultContact

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.

I
InlineQueryResultDocument

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.

I
InlineQueryResultGif

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.

I
InlineQueryResultLocation

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.

I
InlineQueryResultMpeg4Gif

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.

I
InlineQueryResultPhoto

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.

I
InlineQueryResultsButton

This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.

I
InlineQueryResultVenue

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.

I
InlineQueryResultVideo

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.

I
InlineQueryResultVoice

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.

I
InputChecklistTask

Describes a task to add to a checklist.

I
InputContactMessageContent

Represents the content of a contact message to be sent as the result of an inline query.

I
InputLocationMessageContent

Represents the content of a location message to be sent as the result of an inline query.

T
InputMedia

This object represents the content of a media message to be sent. It should be one of

I
InputMediaAnimation

Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

I
InputMediaAudio

Represents an audio file to be treated as music to be sent.

T
InputMessageContent

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:

T
InputPaidMedia

This object describes the paid media to be sent. Currently, it can be one of

I
InputPaidMediaPhoto

The paid media to send is a photo.

I
InputPollOption

This object contains information about one answer option in a poll to send.

T
InputProfilePhoto

This object describes a profile photo to set. Currently, it can be one of

I
InputProfilePhotoAnimated

An animated profile photo in the MPEG4 format.

I
InputProfilePhotoStatic

A static profile photo in the .JPG format.

I
InputSticker

This object describes a sticker to be added to a sticker set.

T
InputStoryContent

This object describes the content of a story to post. Currently, it can be one of

I
InputStoryContentPhoto

Describes a photo to post as a story.

I
InputTextMessageContent

Represents the content of a text message to be sent as the result of an inline query.

I
InputVenueMessageContent

Represents the content of a venue message to be sent as the result of an inline query.

I
Invoice

This object contains basic information about an invoice.

N
T
KeyboardButton
No documentation available
I
KeyboardButton.CommonButton
No documentation available
I
I
I
KeyboardButton.WebAppButton
No documentation available
I
KeyboardButtonPollType

This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.

I
KeyboardButtonRequestChat

This object defines the criteria used to request a suitable chat. Information about the selected chat will be shared with the bot when the corresponding button is pressed. The bot will be granted requested rights in the chat if appropriate.

I
KeyboardButtonRequestUsers

This object defines the criteria used to request suitable users. Information about the selected users will be shared with the bot when the corresponding button is pressed.

I
LabeledPrice

This object represents a portion of the price for goods or services.

T
LanguageCode

A two-letter ISO 639-1 language code.

I
LinkPreviewOptions

Describes the options used for link preview generation.

I
LocationAddress

Describes the physical address of a location.

I
LoginUrl

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. Telegram apps support these buttons as of version 5.7.

I
MaskPosition

This object describes the position on faces where a mask should be placed by default.

T
MaybeInaccessibleMessage

This object describes a message that can be inaccessible to the bot. It can be one of

T
MenuButton

This object describes the bot's menu button in a private chat. It should be one of

I
MenuButtonCommands

Represents a menu button, which opens the bot's list of commands.

I
MenuButtonDefault

Describes that no specific value for the menu button was set.

I
MenuButtonWebApp

Represents a menu button, which launches a Web App.

T
Message.AnimationMessage
No documentation available
T
Message.AudioMessage
No documentation available
T
Message.BoostAddedMessage
No documentation available
T
Message.ChannelChatCreatedMessage
No documentation available
T
Message.ChatBackgroundSetMessage
No documentation available
T
Message.ChatSharedMessage
No documentation available
T
Message.ChecklistMessage
No documentation available
T
Message.ChecklistTasksAddedMessage
No documentation available
T
Message.ChecklistTasksDoneMessage
No documentation available
T
Message.ConnectedWebsiteMessage
No documentation available
T
Message.ContactMessage
No documentation available
T
Message.DeleteChatPhotoMessage
No documentation available
T
Message.DiceMessage
No documentation available
T
Message.DirectMessagePriceChangedMessage
No documentation available
T
Message.DocumentMessage
No documentation available
T
Message.ForumTopicClosedMessage
No documentation available
T
Message.ForumTopicCreatedMessage
No documentation available
T
Message.ForumTopicEditedMessage
No documentation available
T
Message.ForumTopicReopenedMessage
No documentation available
T
Message.GameMessage
No documentation available
T
Message.GeneralForumTopicHiddenMessage
No documentation available
T
Message.GeneralForumTopicUnhiddenMessage
No documentation available
T
Message.GiftMessage
No documentation available
T
Message.GiftUpgradeSentMessage
No documentation available
T
Message.GiveawayCompletedMessage
No documentation available
T
Message.GiveawayCreatedMessage
No documentation available
T
Message.GiveawayMessage
No documentation available
T
Message.GiveawayWinnersMessage
No documentation available
T
Message.GroupChatCreatedMessage
No documentation available
T
Message.InvoiceMessage
No documentation available
T
Message.LeftChatMemberMessage
No documentation available
T
Message.LocationMessage
No documentation available
T
T
Message.MigrateFromChatIdMessage
No documentation available
T
Message.MigrateToChatIdMessage
No documentation available
T
Message.NewChatMembersMessage
No documentation available
T
Message.NewChatPhotoMessage
No documentation available
T
Message.NewChatTitleMessage
No documentation available
T
Message.PaidMediaMessage
No documentation available
T
Message.PaidMessagePriceChangedMessage
No documentation available
T
Message.PassportDataMessage
No documentation available
T
Message.PhotoMessage
No documentation available
T
Message.PinnedMessageMessage
No documentation available
T
Message.PollMessage
No documentation available
T
Message.ProximityAlertTriggeredMessage
No documentation available
T
Message.RefundedPaymentMessage
No documentation available
T
Message.StickerMessage
No documentation available
T
Message.StoryMessage
No documentation available
T
Message.SuccessfulPaymentMessage
No documentation available
T
Message.SuggestedPostApprovalFailedMessage
No documentation available
T
Message.SuggestedPostApprovedMessage
No documentation available
T
Message.SuggestedPostDeclinedMessage
No documentation available
T
Message.SuggestedPostInfoMessage
No documentation available
T
Message.SuggestedPostPaidMessage
No documentation available
T
Message.SuggestedPostRefundedMessage
No documentation available
T
Message.SupergroupChatCreated
No documentation available
T
Message.TextMessage
No documentation available
T
Message.UniqueGiftMessage
No documentation available
T
Message.UsersSharedMessage
No documentation available
T
Message.VenueMessage
No documentation available
T
Message.VideoChatEndedMessage
No documentation available
T
T
Message.VideoChatScheduledMessage
No documentation available
T
Message.VideoChatStartedMessage
No documentation available
T
Message.VideoMessage
No documentation available
T
Message.VideoNoteMessage
No documentation available
T
Message.VoiceMessage
No documentation available
T
Message.WebAppDataMessage
No documentation available
T
Message.WriteAccessAllowedMessage
No documentation available
I
MessageAutoDeleteTimerChanged

This object represents a service message about a change in auto-delete timer settings.

N
T
MessageEntity
No documentation available
I
MessageEntity.CommonMessageEntity
No documentation available
I
MessageEntity.PreMessageEntity
No documentation available
I
MessageEntity.TextLinkMessageEntity
No documentation available
I
MessageId

This object represents a unique message identifier.

T
MessageOrigin

This object describes the origin of a message. It can be one of

I
MessageOriginChannel

The message was originally sent to a channel chat.

I
MessageOriginChat

The message was originally sent on behalf of a chat to a group chat.

I
MessageOriginHiddenUser

The message was originally sent by an unknown user.

I
MessageOriginUser

The message was originally sent by a known user.

I
MessageReactionCountUpdated

This object represents reaction changes on a message with anonymous reactions.

I
MessageReactionUpdated

This object represents a change of a reaction on a message performed by a user.

T
Opts

Utility type providing the argument type for the given method name or {} if the method does not take any parameters

I
OrderInfo

This object represents information about an order.

T
OwnedGift

This object describes a gift received and owned by a user or a chat. Currently, it can be one of

I
OwnedGifts

Contains the list of gifts received and owned by a user or a chat.

T
PaidMedia

This object describes paid media. Currently, it can be one of

I
PaidMediaInfo

Describes the paid media added to a message.

I
PaidMediaPhoto

The paid media is a photo.

I
PaidMediaPreview

The paid media isn't available before the payment.

I
PaidMediaPurchased

This object contains information about a paid media purchase.

I
PaidMediaVideo

The paid media is a video.

I
PaidMessagePriceChanged

Describes a service message about a change in the price of paid messages within a chat.

T
ParseMode

The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, spoiler text, block quotations as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can specify text entities directly, or use markdown-style or HTML-style formatting.

I
PassportData

Describes Telegram Passport data shared with the bot by the user.

T
PassportElementError

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:

I
PassportElementErrorDataField

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.

I
PassportElementErrorFile

Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.

I
PassportElementErrorFiles

Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.

I
PassportElementErrorFrontSide

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.

I
PassportElementErrorReverseSide

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.

I
PassportElementErrorSelfie

Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.

I
PassportElementErrorTranslationFile

Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.

I
PassportElementErrorTranslationFiles

Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.

I
PassportElementErrorUnspecified

Represents an issue in an unspecified place. The error is considered resolved when new data is added.

I
PassportFile

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.

I
PhotoSize

This object represents one size of a photo or a file / sticker thumbnail.

I
PollAnswer

This object represents an answer of a user in a non-anonymous poll.

I
PollOption

This object contains information about one answer option in a poll.

I
PreCheckoutQuery

This object contains information about an incoming pre-checkout query.

I
PreparedInlineMessage

Describes an inline message to be sent by a user of a Mini App.

I
ProximityAlertTriggered

This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.

I
ReactionCount

Represents a reaction added to a message along with the number of times it was added.

T
ReactionType

This object describes the type of a reaction. Currently, it can be one of

I
ReactionTypeCustomEmoji

The reaction is based on a custom emoji.

I
ReactionTypeEmoji

The reaction is based on an emoji.

I
ReactionTypePaid

The reaction is paid.

I
I
ReplyKeyboardMarkup

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.

I
ReplyKeyboardRemove

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.

I
ResponseParameters

Describes why a request was unsuccessful.

T
RevenueWithdrawalState

This object describes the state of a revenue withdrawal operation. Currently, it can be one of

I
RevenueWithdrawalStateFailed

The withdrawal failed and the transaction was refunded.

I
RevenueWithdrawalStatePending

The withdrawal is in progress.

I
RevenueWithdrawalStateSucceeded

The withdrawal succeeded.

I
SentWebAppMessage

Describes an inline message sent by a Web App on behalf of a user.

I
SharedUser

This object contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button.

I
I
ShippingOption

This object represents one shipping option.

I
ShippingQuery

This object contains information about an incoming shipping query.

I
StarAmount

Describes an amount of Telegram Stars.

I
StarTransaction

Describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control.

I
StarTransactions

Contains a list of Telegram Star transactions.

I
StickerSet

This object represents a sticker set.

I
Story

This object represents a story.

I
StoryArea

Describes a clickable area on a story media.

T
StoryAreaType

Describes the type of a clickable area on a story. Currently, it can be one of

I
StoryAreaTypeLocation

Describes a story area pointing to a location. Currently, a story can have up to 10 location areas.

I
StoryAreaTypeSuggestedReaction

Describes a story area pointing to a suggested reaction. Currently, a story can have up to 5 suggested reaction areas.

I
StoryAreaTypeUniqueGift

Describes a story area pointing to a unique gift. Currently, a story can have at most 1 unique gift area.

I
StoryAreaTypeWeather

Describes a story area containing weather information. Currently, a story can have up to 3 weather areas.

I
SuccessfulPayment

This object contains basic information about a successful payment. Note that if the buyer initiates a chargeback with the relevant payment provider following this transaction, the funds may be debited from your balance. This is outside of Telegram's control.

I
SuggestedPostApprovalFailed

Describes a service message about the failed approval of a suggested post. Currently, only caused by insufficient user funds at the time of approval.

I
SuggestedPostApproved

Describes a service message about the approval of a suggested post.

I
SuggestedPostDeclined

Describes a service message about the rejection of a suggested post.

I
SuggestedPostInfo

Contains information about a suggested post.

I
SuggestedPostPaid

Describes a service message about a successful payment for a suggested post.

I
SuggestedPostParameters

Contains parameters of a post that is being suggested by the bot.

I
SuggestedPostPrice

Describes the price of a suggested post.

I
SuggestedPostRefunded

Describes a service message about a payment refund for a suggested post.

I
SwitchInlineQueryChosenChat

This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.

I
TextQuote

This object contains information about the quoted part of a message that is replied to by the given message.

T
TransactionPartner

This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of

I
TransactionPartnerAffiliateProgram

Describes the affiliate program that issued the affiliate commission received via this transaction.

I
TransactionPartnerChat

Describes a transaction with a chat.

I
TransactionPartnerFragment

Describes a withdrawal transaction with Fragment.

I
TransactionPartnerOther

Describes a transaction with an unknown source or recipient.

I
TransactionPartnerTelegramAds

Describes a withdrawal transaction to the Telegram Ads platform.

I
TransactionPartnerTelegramApi

Describes a transaction with payment for paid broadcasting.

I
UniqueGift

This object describes a unique gift that was upgraded from a regular gift.

I
UniqueGiftBackdrop

This object describes the backdrop of a unique gift.

I
UniqueGiftBackdropColors

This object describes the colors of the backdrop of a unique gift.

I
UniqueGiftColors

This object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift.

I
UniqueGiftInfo

Describes a service message about a unique gift that was sent or received.

I
UniqueGiftModel

This object describes the model of a unique gift.

I
UniqueGiftSymbol

This object describes the symbol shown on the pattern of a unique gift.

I
Update.Channel

Internal type holding properties that message updates in channels share.

I
Update.Edited

Internal type holding properties that updates about edited messages share.

I
Update.NonChannel

Internal type holding properties that message updates outside of channels share.

I
Update.Private

Internal type holding properties that message updates in private chats share.

I
UserChatBoosts

This object represents a list of boosts added to a chat by a user.

I
UserProfilePhotos

This object represent a user's profile pictures.

I
UserRating

This object describes the rating of a user based on their Telegram Star spendings.

I
UsersShared

This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUsers button.

I
VideoChatEnded

This object represents a service message about a video chat ended in the chat.

I
VideoChatParticipantsInvited

This object represents a service message about new members invited to a video chat.

I
VideoChatScheduled

This object represents a service message about a video chat scheduled in the chat.

I
VideoChatStarted

This object represents a service message about a video chat started in the chat. Currently holds no information.

I
VideoNote

This object represents a video message (available in Telegram apps as of v.4.0).

I
Voice

This object represents a voice note.

I
WebAppData

Describes data sent from a Web App to the bot.

I
WebAppInfo

Describes a Web App.

I
WriteAccessAllowed

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.

T
ChatFromGetChat
No documentation available

types/interface.ts

Types and interfaces for tgtb

utils

Utilities functions

f
createSecret

Create a random secret string for X-Telegram-Bot-Api-Secret-Token header

f
randomBotId

Generates a random bot ID

f
randomBotToken

Generates a random bot token

f
randomBotUsername

Generates a random bot username

f
randomInitData

Generates a random init data

f
randomOAuthUser

Generates random OAuth user data

f
signInitData

Signs the init data

f
signOAuthUser

Signs the OAuth user data

utils/crypto.ts

Crypto utilities

f
createSecret

Create a random secret string for X-Telegram-Bot-Api-Secret-Token header

utils/test-utils.ts

Utility functions for testing

f
randomBotId

Generates a random bot ID

f
randomBotToken

Generates a random bot token

f
randomBotUsername

Generates a random bot username

f
randomInitData

Generates a random init data

f
randomOAuthUser

Generates random OAuth user data

f
signInitData

Signs the init data

f
signOAuthUser

Signs the OAuth user data