Skip to main content

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.

func (c *Client) MessagesRequestWebView(ctx context.Context, request *MessagesRequestWebViewRequest) (*WebViewResultURL, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesRequestWebView(ctx, &tg.MessagesRequestWebViewRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // *WebViewResultURL
return nil
})

Parameters

NameTypeRequiredDescription
FromBotMenuboolWhether the webview was opened by clicking on the bot's menu button ».
SilentboolWhether 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).
CompactboolIf 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.
FullscreenboolIf 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.
PeerInputPeerClassyesDialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »).
BotInputUserClassyesBot that owns the web app
URLstringWeb app URL
StartParamstringIf 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.
ThemeParamsDataJSONTheme parameters »
PlatformstringyesShort name of the application; 0-64 English letters, digits, and underscores
ReplyToInputReplyToClassIf 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.
SendAsInputPeerClassOpen the web app as the specified peer, sending the resulting the message as the specified peer.

Returns

*WebViewResultURL

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.

References