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
| Name | Type | Required | Description |
|---|---|---|---|
FromBotMenu | bool | — | Whether the webview was opened by clicking on the bot's menu button ». |
Silent | bool | — | Whether 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). |
Compact | bool | — | If 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. |
Fullscreen | bool | — | If 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. |
Peer | InputPeerClass | yes | Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »). |
Bot | InputUserClass | yes | Bot that owns the web app |
URL | string | — | Web app URL |
StartParam | string | — | If 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. |
ThemeParams | DataJSON | — | Theme parameters » |
Platform | string | yes | Short name of the application; 0-64 English letters, digits, and underscores |
ReplyTo | InputReplyToClass | — | If 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. |
SendAs | InputPeerClass | — | Open the web app as the specified peer, sending the resulting the message as the specified peer. |
Returns
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | BOT_INVALID | This is not a valid bot. |
| 400 | BOT_WEBVIEW_DISABLED | A 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. |
| 403 | CHAT_WRITE_FORBIDDEN | You can't write in this chat. |
| 400 | INPUT_USER_DEACTIVATED | The specified user was deleted. |
| 400 | MSG_ID_INVALID | Invalid message ID provided. |
| 400 | PEER_ID_INVALID | The provided peer id is invalid. |
| 403 | PRIVACY_PREMIUM_REQUIRED | You need a Telegram Premium subscription to send a message to this user. |
| 400 | SEND_AS_PEER_INVALID | You can't send messages as the specified peer. |
| 400 | THEME_PARAMS_INVALID | The specified theme_params field is invalid. |
| 400 | URL_INVALID | Invalid URL provided. |
| 400 | YOU_BLOCKED_USER | You blocked this user. |
References
- Official documentation
- Generated Go reference
- TL definition:
messages.requestWebView#269dc2c1