telegram_web_app library

Classes

BackButton
BackButtonClickedEvent
Bot API 6.1+ Occurrs when the back button is pressed. eventHandler receives no parameters.
BiometricAuthenticateParams
This object describes the native popup for authenticating the user using biometrics.
BiometricAuthRequestedEvent
Bot API 7.2+ Occurs whenever biometric authentication was requested. eventHandler receives an object with the field isAuthenticated containing a boolean indicating whether the user was authenticated successfully. If isAuthenticated is true, the field biometricToken will contain the biometric token stored in secure storage on the device.
BiometricAuthRequestedPayload
BiometricManager
This object controls biometrics on the device. Before the first use of this object, it needs to be initialized using the init method.
BiometricManagerUpdatedEvent
Bot API 7.2+ Occurs whenever BiometricManager object is changed. eventHandler receives no parameters.
BiometricRequestAccessParams
This object describes the native popup for authenticating the user using biometrics.
BiometricTokenUpdatedEvent
Bot API 7.2+ Occurs whenever the biometric token was updated. eventHandler receives an object with the single field isUpdated, containing a boolean indicating whether the token was updated.
BiometricTokenUpdatedPayload
BottomButton
BottomButtonParams
ClipboardTextReceivedEvent
Bot API 6.4+ Occurrs when the readTextFromClipboard method is called. eventHandler receives an object with the single field data containing text data from the clipboard. If the clipboard contains non-text data, the field data will be an empty string. If the Mini App has no access to the clipboard, the field data will be null.
ClipboardTextReceivedPayload
CloudStorage
https://core.telegram.org/bots/webapps#cloudstorage
ContactRequestedEvent
Bot API 6.9+ Occurrs when the user's phone number was requested. eventHandler receives an object with the single field status containing one of the statuses:
ContactRequestedPayload
HapticFeedback
https://core.telegram.org/bots/webapps#hapticfeedback
InvoiceClosedEvent
Bot API 6.1+ Occurrs when the opened invoice is closed. eventHandler receives an object with the two fields: url – invoice link provided and status – one of the invoice statuses:
InvoiceClosedPayload
MainButtonClickedEvent
Occurs when the main button is pressed. eventHandler receives no parameters.
MockThemeParams
PopupButton
PopupClosedEvent
Bot API 6.2+ Occurrs when the opened popup is closed. eventHandler receives an object with the single field button_id – the value of the field id of the pressed button. If no buttons were pressed, the field button_id will be null.
PopupClosedPayload
QrTextReceivedEvent
Bot API 6.4+ Occurs when the QR code scanner catches a code with text data. eventHandler receives an object with the single field data containing text data from the QR code.
QrTextReceivedPayload
ScanQrPopupClosedEvent
Bot API 7.7+ Occurs when the QR code scanner popup is closed by the user. eventHandler receives no parameters.
SecondaryButtonClickedEvent
Bot API 7.10+ Occurs when the secondary button is pressed. eventHandler receives no parameters
SettingsButton
SettingsButtonClickedEvent
Bot API 6.1+ Occurrs when the Settings item in context menu is pressed. eventHandler receives no parameters.
StoryShareParams
This object describes additional sharing settings for the native story editor.
This object describes a widget link to be included in the story.
TelegramEvent
https://core.telegram.org/bots/webapps#events-available-for-mini-apps
TelegramInitData
TelegramThemeUtil
TelegramUser
TelegramWebApp
All the apis provided at https://core.telegram.org/bots/webapps#initializing-mini-apps
TelegramWebAppFake
TelegramWebAppImpl
ThemeChangedEvent
Occurs whenever theme settings are changed in the user's Telegram app (including switching to night mode). eventHandler receives no parameters, new theme settings and color scheme can be received via this.themeParams and this.colorScheme respectively.
ThemeParams
ViewportChangedEvent
Occurs when the visible section of the Mini App is changed. eventHandler receives an object with the single field isStateStable. If isStateStable is true, the resizing of the Mini App is finished. If it is false, the resizing is ongoing (the user is expanding or collapsing the Mini App or an animated object is playing). The current value of the visible section’s height is available in this.viewportHeight.
ViewportChangedPayload
WebAppChat
This object represents a chat.
WebAppInitData
This object contains data that is transferred to the Mini App when it is opened. It is empty if the Mini App was launched from a keyboard button or from inline mode.
WebAppUser
This object contains the data of the Mini App user.
WriteAccessRequestedEvent
Bot API 6.9+ Occurs when the write permission was requested. eventHandler receives an object with the single field status containing one of the statuses:
WriteAccessRequestedPayload

Extensions

ColorExtensions on Color
Extensions to convert Color to hex #rrggbb format
StringExtensions on String
Extension to convert a String to a Color