diff --git a/data/web/corefork.telegram.org/api/bots/webapps.html b/data/web/corefork.telegram.org/api/bots/webapps.html index fe927bf45e..09e214413f 100644 --- a/data/web/corefork.telegram.org/api/bots/webapps.html +++ b/data/web/corefork.telegram.org/api/bots/webapps.html @@ -73,46 +73,48 @@
Both simple and normal can send web events starting with web_app_
; see the web event documentation for the full list of events that can be sent by the web app to the client ».
Web apps can also receive events, by exposing a window.Telegram.WebView.receiveEvent("event_name", params)
method.
Here's the full list of events that can be received by a web app from the client.
+Here's the full list of events that can be received by a web app from the client, by calling the receiveEvent
method.
phone_requested
Params: a JSON object containing an optional string phone_number
field.
Sent in response to a web_app_request_phone outgoing event, see the docs for more info ».
+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.
settings_button_pressed
Params: null
Sent by the client when the user presses the settings button, if it was previously enabled in BotFather.
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 back button, if it was previously enabled by a web_app_setup_back_button
event.
invoice_closed
Params: JSON object with the following fields:
slug
- Invoice slugstatus
- settings_button_pressed
Params: null
Sent by the client when the user presses the settings button, if it was previously enabled in BotFather.
-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
viewport_changed
Params: a JSON object with the following fields:
height
-is_state_stable
-is_expanded
- height
- The current height of the visible area of the Web Appis_state_stable
- The height of the visible area of the Web App in its last stable stateis_expanded
- Whether the Web App is expanded to its maximum heightEmitted when the viewport is changed.
theme_changed
Params: a JSON object with the following fields:
theme_params
: a JSON object with the following fields:bg_color
-secondary_bg_color
-text_color
- hint_color
- link_color
- button_color
- button_text_color
- bg_color
- Background color in hex RGB format (string)secondary_bg_color
- Secondary background color in hex RGB format (string)text_color
- Text color in hex RGB format (string)hint_color
- Hint color in hex RGB format (string)link_color
- Link color in hex RGB format (string)button_color
- Button color in hex RGB format (string)button_text_color
- Button text color in hex RGB format (string)Emitted when requested by the web app using a web_app_request_theme
event, or when the app theme changes.
popup_closed
Params: a JSON object with an optional button_id
string field.
Emitted when the user presses a button or cancels a popup brought up by a previous web_app_open_popup
event.
'*'<
web_app_open_tg_link
Event data: a JSON object with a string path_full
field, containing the path+query component of a t.me deep link.
Used to open a t.me deep link. The Web App will be closed.
-web_app_setup_back_button
-Event data: a JSON object with an is_visible
boolean field.
-Determines whether to show or hide the back button.
web_app_open_invoice
+Event data: a JSON object with a string slug
field
web_app_expand
No event payload.
Expands the web app to the maximum available height.
web_app_request_viewport
No event payload.
-Used by web apps to request information about the viewport, clients should call window.Telegram.WebView.receiveEvent("viewport_changed", {})
+Used by web apps to request information about the viewport, clients should emit a viewport_changed event
web_app_request_theme
+No event payload.
+Used by web apps to request information about the current theme, clients should emit a theme_changed event.
web_app_ready
+No event payload.
+Emitted by web apps when they are fully loaded.
web_app_setup_main_button
+Event payload: JSON object with the following fields:
+
+is_visible
- Whether the main button is visible (boolean)
+is_active
- Whether the main button is active (boolean)
+text
- Button text (string)
+color
- Button color in hex RGB format (string)
+text_color
- Button text color in hex RGB format (string)
+is_progress_visible
- Indicates whether the button should display a loading indicator (boolean)
+
+Configures the main button: when the user presses it a main_button_pressed
event should be emitted by the client.
+web_app_setup_back_button
+Event data: a JSON object with an is_visible
boolean field.
+Determines whether to show or hide the back button: when the user presses it a back_button_pressed
event should be emitted by the client.
payment_form_submit
Event payload: JSON object with credentials
and title
fields.
-title
is the censored credit card title.
-credentials
is a service-specific JSON object with information about the payment credentials provided by the user to the payment system.
-Neither Telegram, nor bots will have access to your credit card information.
-Credit card details will be handled only by the payment system.
+
+title
is the censored credit card title.
+credentials
is a service-specific JSON object with information about the payment credentials provided by the user to the payment system.
+
+Neither Telegram, nor bots will have access to your credit card information.
+Credit card details will be handled only by the payment system, see the payment documentation for more info ».
share_score
No event payload.
Will be called by games when the user explicitly clicks on the share score button to share the game, along with his score.