diff --git a/data/web/corefork.telegram.org/api/bots/webapps.html b/data/web/corefork.telegram.org/api/bots/webapps.html index cf10d4bf4e..188acb0281 100644 --- a/data/web/corefork.telegram.org/api/bots/webapps.html +++ b/data/web/corefork.telegram.org/api/bots/webapps.html @@ -111,14 +111,15 @@ Note that eventual errors will not be sent as a failed event if the

Simple webapps can only send back data to the bot through the MTProto API via a web_app_data_send JS event ».

Simple webapps can be opened from a keyboardButtonSimpleWebView button contained in a reply keyboard identified by a replyKeyboardMarkup constructor, or by clicking on the inlineBotWebView button on top of the inline result list, contained in messages.botResults.switch_webview, returned by messages.getInlineBotResults.

To open them, users should call messages.requestSimpleWebView passing the original url, 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:

+

If and only if the webapp was opened from a keyboardButtonSimpleWebView reply keyboard button, upon receiving a web_app_data_send JS event » from the web app, clients should invoke messages.sendWebViewData, passing the following arguments:

-

Make sure to ignore all web_app_data_send events sent after the first one, messages.sendWebViewData must be called only once.
+

Always ignore all web_app_data_send events received from inlineBotWebView webapps, as only keyboardButtonSimpleWebView webapps can send this event.
+Make sure to ignore all web_app_data_send events sent after the first one, messages.sendWebViewData must be called only once.
The webview must be closed after invoking the messages.sendWebViewData method.

This will generate a messageActionWebViewDataSent update for the user, and a messageActionWebViewDataSentMe update for the bot, containing the event data.

Normal web apps

@@ -169,9 +170,7 @@ The webview must be closed after invoking the named bot web app links ».

These links are different from bot attachment menu deep links », because they don't require the user to install an attachment menu, and a single bot can offer multiple web apps, distinguished by their short_name.

These links should be handled as follows:

@@ -179,6 +178,8 @@ The webview must be closed after invoking the messages.getBotApp, passing an inputBotAppShortName with the short_name contained in the appname query string parameter. If the client has already encountered an app with this short name from the same bot before, pass the hash of the cached botApp constructor to messages.getBotApp. +
  • If a messages.botApp constructor is returned and its request_write_access flag is set, show a prompt to the user, indicating that the bot is asking permission to send messages to the user.
    +If the user agrees, set the write_allowed flag when invoking messages.requestAppWebView in the next step.
  • If a messages.botApp constructor is returned, open the web app by invoking messages.requestAppWebView, generating an inputBotAppID constructor from id and access_hash of the returned botApp, or from previously cached information if we already met the bot app and botAppNotModified was returned.