Skip to main content

messages.sendWebViewData

Used by the user to relay data from an opened reply keyboard bot mini app to the bot that owns it.

func (c *Client) MessagesSendWebViewData(ctx context.Context, request *MessagesSendWebViewDataRequest) (UpdatesClass, error)

Calling this method​

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

res, err := api.MessagesSendWebViewData(ctx, &tg.MessagesSendWebViewDataRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters​

NameTypeRequiredDescription
BotInputUserClassyesBot that owns the web app
RandomIDint64yesUnique client message ID to prevent duplicate sending of the same event
ButtonTextstringyesText of the keyboardButtonSimpleWebView that was pressed to open the web app.
DatastringyesData to relay to the bot, obtained from a web_app_data_send JS event.

Returns​

UpdatesClass

Possible errors​

CodeTypeDescription
400BOT_INVALIDThis is not a valid bot.

References​