telegram_web_app library

Classes

Accelerometer
Bot API 8.0+
AccelerometerChangedEvent
Bot API 8.0+
AccelerometerFailedEvent
Bot API 8.0+
AccelerometerStartedEvent
Bot API 8.0+
AccelerometerStartParams
Bot API 8.0+
AccelerometerStoppedEvent
Occurs when accelerometer tracking has stopped. eventHandler receives no parameters.
ActivatedEvent
Bot API 8.0+
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
ContentSafeAreaChangedEvent
Bot API 8.0+
ContentSafeAreaInset
Bot API 8.0+
DeactivatedEvent
Bot API 8.0+
DeviceOrientation
This object provides access to orientation data on the device.
DeviceOrientationChangedEvent
Occurs with the specified frequency after calling the start method, sending the current orientation data.eventHandler receives no parameters, the current device orientation values can be received via this.alpha, this.beta and this.gamma respectively.
DeviceOrientationFailedEvent
Occurs if a request to start device orientation tracking fails. eventHandler receives an object with the single field error, describing the reason for the failure. Possible values for error are:
DeviceOrientationStartedEvent
Occurs with the specified frequency after calling the start method, sending the current orientation data.eventHandler receives no parameters, the current device orientation values can be received via this.alpha, this.beta and this.gamma respectively.
DeviceOrientationStartParams
This object defines the parameters for starting device orientation tracking.
DeviceOrientationStoppedEvent
Occurs when device orientation tracking has stopped. eventHandler receives no parameters.
EmojiStatusAccessRequestedEvent
Bot API 8.0+
EmojiStatusFailedEvent
Bot API 8.0+
EmojiStatusParams
This object describes additional settings for setting an emoji status.
EmojiStatusSetEvent
Bot API 8.0+
FileDownloadRequestedEvent
Bot API 8.0+
FullscreenChangedEvent
Bot API 8.0+
FullscreenFailedEvent
Bot API 8.0+
Gyroscope
Bot API 8.0+
GyroscopeChangedEvent
Bot API 8.0+
GyroscopeFailedEvent
Bot API 8.0+
GyroscopeStartedEvent
Bot API 8.0+
GyroscopeStartParams
Bot API 8.0+
GyroscopeStoppedEvent
Occurs when gyroscope tracking has stopped. eventHandler receives no parameters.
HapticFeedback
https://core.telegram.org/bots/webapps#hapticfeedback
HomeScreenAddedEvent
Bot API 8.0+
HomeScreenCheckedEvent
Bot API 8.0+
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
LocationData
Bot API 8.0+
LocationManager
Bot API 8.0+
LocationManagerUpdatedEvent
Bot API 8.0+
LocationRequestedEvent
Bot API 8.0+
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
SafeAreaChangedEvent
Bot API 8.0+
SafeAreaInset
Bot API 8.0+
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.
ShareMessageFailedEvent
Bot API 8.0+
ShareMessageSentEvent
Bot API 8.0+
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