diff --git a/data/web/corefork.telegram.org/api/bots/attach.html b/data/web/corefork.telegram.org/api/bots/attach.html new file mode 100644 index 0000000000..28eb794f3a --- /dev/null +++ b/data/web/corefork.telegram.org/api/bots/attach.html @@ -0,0 +1,118 @@ + + +
+ +Bots can offer users interactive HTML5 web apps to completely replace any website.
They support seamless authorization, integrated payments via multiple payment providers (with Google Pay and Apple Pay out of the box), delivering tailored push notifications to users, and much more.
This article offers a technical overview of the implementation of bot web apps using the MTProto API: see here an overview using the simplified bot API ».
-Schema:
-messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction;
-messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction;
-
-updateWebViewResultSent#1592b79d query_id:long = Update;
-
-keyboardButtonWebView#13767230 text:string url:string = KeyboardButton;
-keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton;
-
-webViewResultUrl#c14557c query_id:long url:string = WebViewResult;
-
-simpleWebViewResultUrl#882f76bb url:string = SimpleWebViewResult;
-
-webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent;
-
----functions---
-
-messages.requestWebView#91b15831 flags:# from_bot_menu:flags.4?true silent:flags.5?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = WebViewResult;
-messages.prolongWebView#ea5fbcce flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = Bool;
-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;
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 ».
Simple webapps can only be opened from a keyboardButtonSimpleWebView button contained in a reply keyboard identified by a replyKeyboardMarkup constructor.
To open them, users should call messages.requestSimpleWebView, and then open a webview using the url
contained in the returned simpleWebViewResultUrl.
Upon receiving a web_app_data_send
JS event from the web app, clients should invoke messages.sendWebViewData, passing the following arguments:
bot
- Bot IDrandom_id
- Unique random ID to prevent duplicate sending of the same eventbutton_text
- Text of the keyboardButtonSimpleWebView that was pressed to open the simple web appdata
- Contents of the data
field of the JS event. This will generate a messageActionWebViewDataSent update for the user, and a messageActionWebViewDataSentMe update for the bot, containing the event data.
+Schema:
+keyboardButtonWebView#13767230 text:string url:string = KeyboardButton;
+botMenuButton#c7b57ce6 text:string url:string = BotMenuButton;
+
+webViewResultUrl#c14557c query_id:long url:string = WebViewResult;
+
+updateWebViewResultSent#1592b79d query_id:long = Update;
+webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent;
+
+---functions---
+
+messages.requestWebView#91b15831 flags:# from_bot_menu:flags.4?true silent:flags.5?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = WebViewResult;
+messages.prolongWebView#ea5fbcce flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = Bool;
+messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent;
+Normal webapps can be opened from:
+web_app_data_send
JS event.