diff --git a/data/web/corefork.telegram.org/api/bots/webapps.html b/data/web/corefork.telegram.org/api/bots/webapps.html index 5a99cca095..ec933ab1a3 100644 --- a/data/web/corefork.telegram.org/api/bots/webapps.html +++ b/data/web/corefork.telegram.org/api/bots/webapps.html @@ -69,6 +69,8 @@ messages.requestSimpleWebView#6abb2f73 flags:# bot:InputUser url:string theme_params:flags.0?DataJSON = SimpleWebViewResult; messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent; messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates; +

Web events

+

Both simple and normal should handle web events starting with web_app_; see the web event documentation for more info ยป.

Simple web apps

Schema:

replyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup;
diff --git a/data/web/corefork.telegram.org/api/web-events.html b/data/web/corefork.telegram.org/api/web-events.html
index 2754c28b03..4ac6fd9afe 100644
--- a/data/web/corefork.telegram.org/api/web-events.html
+++ b/data/web/corefork.telegram.org/api/web-events.html
@@ -59,105 +59,65 @@ The postEvent function will try sending the event to the Telegram a
 

Finally, web MTProto clients that need to open a game or process a payment in an iframe can use the postMessage API to receive events from iframes. The GamingCommunication and bot web app libraries by default will use '*' as targetOrigin, sending messages to parent pages regardless of the origin of the embedder.

window.parent.postMessage(JSON.stringify({eventType: eventType, eventData: eventData}), targetOrigin);
-

Event types

+

Event types

eventType is a simple string indicating the event type, and eventData is a payload with an object that will be parsed by the Telegram app.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
eventTypeeventDataDescription
web_app_closenullEmitted by bot web apps when the web app webview should be closed.
web_app_request_phonenullEmitted by bot web apps when they request the user's phone number: Telegram clients should show a prompt to the user, which should call window.Telegram.WebView.receiveEvent({}) upon completion
web_app_open_popupJSON object with title (optional string), message (string),
web_app_setup_closing_behavior
web_app_set_background_color
web_app_set_header_color
web_app_data_send
web_app_trigger_haptic_feedback
web_app_open_link
web_app_open_tg_link
web_app_setup_back_button
web_app_open_invoice
web_app_expand
web_app_request_viewport
web_app_request_theme
web_app_ready
web_app_setup_main_button
payment_form_submitJSON object with credentials and title fieldstitle 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.
share_scorenullWill be called by games when the user explicitly clicks on the share score button to share the game, along with his score.
Typically done by using messages.forwardMessages on the game message with the with_my_score flag.
share_gamenullWill be called by games when the user explicitly clicks on the share game button to share the game, without sharing his score.
Typically done by using messages.forwardMessages on the game message without the with_my_score flag, or by sharing the game's deep link.
game_overnullCan be called by games when the user loses a game
game_loadednullCan be called by games once the game fully loads
resize_frameJSON object with height fieldCalled by supported pages inside of IV iframe embeds, indicates the new size of the embed frame.
+

web_app_close

+

No event payload.

+

Emitted by bot web apps when the web app webview should be closed.

+

web_app_request_phone

+

No event payload.

+

Emitted by bot web apps when they request the user's phone number: Telegram clients should show a prompt to the user, asking to share the phone number.

+ +

web_app_open_popup

+

Event data: JSON object with the following fields:

+ +

web_app_setup_closing_behavior

+

web_app_set_background_color

+

web_app_set_header_color

+

web_app_data_send

+

web_app_trigger_haptic_feedback

+

web_app_open_link

+

web_app_open_tg_link

+

web_app_setup_back_button

+

web_app_open_invoice

+

web_app_expand

+

web_app_request_viewport

+

web_app_request_theme

+

web_app_ready

+

web_app_setup_main_button

+

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.

+

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.
+Typically done by using messages.forwardMessages on the game message with the with_my_score flag.

+

share_game

+

No event payload.

+

Will be called by games when the user explicitly clicks on the share game button to share the game, without sharing his score.
+Typically done by using messages.forwardMessages on the game message without the with_my_score flag, or by sharing the game's deep link.

+

game_over

+

No event payload.

+

Can be called by games when the user loses a game

+

game_loaded

+

Can be called by games once the game fully loads.

+

resize_frame

+

Event payload: JSON object with height field

+

Called by supported pages inside of IV iframe embeds, indicates the new size of the embed frame.

diff --git a/data/web/corefork.telegram.org/constructor/upload.file b/data/web/corefork.telegram.org/constructor/upload.file index f4fa1ea09f..d1207edd95 100644 --- a/data/web/corefork.telegram.org/constructor/upload.file +++ b/data/web/corefork.telegram.org/constructor/upload.file @@ -74,7 +74,7 @@ mtime int -Modification type +Modification time bytes