diff --git a/data/web/corefork.telegram.org/api/bots/webapps.html b/data/web/corefork.telegram.org/api/bots/webapps.html index 782325cab7..768f975496 100644 --- a/data/web/corefork.telegram.org/api/bots/webapps.html +++ b/data/web/corefork.telegram.org/api/bots/webapps.html @@ -54,13 +54,13 @@
Here's the full list of events that can be received by a web app from the client, by calling the receiveEvent
method.
main_button_pressed
Params: null
Sent by the client when the user presses the main button, if it was previously configured by a web_app_setup_main_button
event ».
Sent by the client when the user presses the main button located at the bottom of the webview, handle this event only if the main button was previously configured by a web_app_setup_main_button
event ».
settings_button_pressed
Params: null
Sent by the client when the user presses the settings button, if it was previously enabled in @BotFather, as specified by the has_settings
flag of attachMenuBot ».
back_button_pressed
Params: null
Sent by the client when the user presses the back button, if it was previously enabled by a web_app_setup_back_button
event ».
Sent by the client when the user presses the (OS or UI) back button, if it was previously enabled by a web_app_setup_back_button
event ».
invoice_closed
Params: JSON object with the following fields:
viewport_changed
Params: a JSON object with the following fields:
height
- The current height of the visible area of the Web App (integer)is_state_stable
- The height of the visible area of the Web App in its last stable state (integer)is_expanded
- Whether the Web App is expanded to its maximum height (boolean)height
- The current height of the visible area of the Web App (excluding the bottom main button, if visible) (integer)is_state_stable
- If true, the viewport is currently being resized (animation in progress), more events of this type may be emitted. (boolean)is_expanded
- Whether the Web App is expanded to its maximum height after the user swiped up or after the web app emitted a web_app_expand event (boolean)Emitted when the viewport is changed.
theme_changed
The opened URL's fragment parameters already contain basic information about the user and a query_id
parameter, that is exposed by the bot web apps JS library: this query_id
can then be used by the bot to invoke messages.sendWebViewResultMessage, passing an InputBotInlineResult constructor that will automatically send a message with optionally attached media, and even inline buttons on behalf of the user.
Bot web apps can be themed according to the following theme parameters, passed as a JSON object to the theme_params
parameter of the messages.requestSimpleWebView and messages.requestWebView methods.
This JSON object has the the following keys, containing color theme information (hex string, RGB24) to pass to the web app:
+This JSON object has the the following keys, containing color theme information (hex string, RGB, no alpha) to pass to the web app:
bg_color
- Background color secondary_bg_color
- Secondary background color text_color
- Text color hint_color
- Hint text color link_color
- Link color button_color
- Button color button_text_color
- Button text colorwindow.Telegram.WebView.receiveEvent("popup_closed", {"button_id": "<button id>"})
window.Telegram.WebView.receiveEvent("popup_closed", {})
Ignore instances of this event if a popup is already being displayed (handling can only resume after the popup_closed
response event is emitted).
-Maximum 3 consecutive events of this type can be handled in a timespan of 3 seconds, ignore excess events.
Disable handling of this event if a popup is already being displayed, re-enable handling only after the popup_closed
response event is emitted.
+While handling is enabled, maximum 3 consecutive valid events of this type can be handled in a timespan of 3 seconds, ignore excess events.
web_app_setup_closing_behavior
Event data: a JSON object with a boolean need_confirmation
.
If equal to true
, the client should require user confirmation before closing the webview, to avoid accidentally aborting a sensitive operation; otherwise no confirmation should be requested.
If equal to true
, the client should require user confirmation with a "Changes that you made may not be saved." popup with "Cancel"/"Close anyway" buttons before closing the webview, to avoid accidentally aborting a sensitive operation; otherwise no confirmation should be requested.
web_app_set_background_color
Event data: a JSON object with a string color
with a hex RGB color.
Used to set the web app background and lower overscroll color.