messages.requestWebView #

Open a bot mini app, sending over user information after user confirmation.

After calling this method, until the user closes the webview, messages.prolongWebView must be called every 60 seconds.

Layer 223

webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true fullscreen:flags.2?true query_id:flags.0?long url:string = WebViewResult;
---functions---
messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult;

Parameters #

NameTypeDescription
flags#Flags, see TL conditional fields
from_bot_menuflags.4?trueWhether the webview was opened by clicking on the bot's menu button ».
silentflags.5?trueWhether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent silently (no notifications for the receivers).
compactflags.7?trueIf set, requests to open the mini app in compact mode (as opposed to normal or fullscreen mode). Must be set if the mode parameter of the attachment menu deep link is equal to compact.
fullscreenflags.8?trueIf set, requests to open the mini app in fullscreen mode (as opposed to normal or compact mode). Must be set if the mode parameter of the attachment menu deep link is equal to fullscreen.
peerInputPeerDialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »).
botInputUserBot that owns the web app
urlflags.1?stringWeb app URL
start_paramflags.3?stringIf the web app was opened from the attachment menu using a attachment menu deep link, start_param should contain the data from the startattach parameter.
theme_paramsflags.2?DataJSONTheme parameters »
platformstringShort name of the application; 0-64 English letters, digits, and underscores
reply_toflags.0?InputReplyToIf set, indicates that the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to the specified message or story.
send_asflags.13?InputPeerOpen the web app as the specified peer, sending the resulting the message as the specified peer.

Result #

WebViewResult

Only users can use this method #

Possible errors #

CodeTypeDescription
400BOT_INVALIDThis is not a valid bot.
400BOT_WEBVIEW_DISABLEDA webview cannot be opened in the specified conditions: emitted for example if from_bot_menu or url are set and peer is not the chat with the bot.
403CHAT_WRITE_FORBIDDENYou can't write in this chat.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MSG_ID_INVALIDInvalid message ID provided.
400PEER_ID_INVALIDThe provided peer id is invalid.
403PRIVACY_PREMIUM_REQUIREDYou need a Telegram Premium subscription to send a message to this user.
400SEND_AS_PEER_INVALIDYou can't send messages as the specified peer.
400THEME_PARAMS_INVALIDThe specified theme_params field is invalid.
400URL_INVALIDInvalid URL provided.
400YOU_BLOCKED_USERYou blocked this user.

Bot menu button #

Bots can choose the behavior of the menu button shown next to the text input field.

messages.sendWebViewResultMessage #

Terminate webview interaction started with messages.requestWebView, sending the specified message to the chat on behalf of the user.

Telegram clients must handle special tg:// and t.me deep links encountered in messages, link entities and in other apps by registering OS handlers.

Mini Apps on Telegram #

Bots can offer users interactive HTML5 web apps to completely replace any website.

Telegram Mini Apps #

messages.prolongWebView #

Indicate to the server (from the user side) that the user is still using a web app.

If the method returns a QUERY_ID_INVALID error, the webview must be closed.

Telegram Premium #

Telegram Premium is an optional subscription service that unlocks additional exclusive client-side and API-side features, while helping support the development of the app.