answerWebAppQuery

Returns: SentWebAppMessage

class aiogram.methods.answer_web_app_query.AnswerWebAppQuery(*, web_app_query_id: str, result: InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice, **extra_data: Any)[source]

Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a aiogram.types.sent_web_app_message.SentWebAppMessage object is returned.

Source: https://core.telegram.org/bots/api#answerwebappquery

web_app_query_id: str

Unique identifier for the query to be answered

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

result: InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice

A JSON-serialized object describing the message to be sent

Usage

As bot method

result: SentWebAppMessage = await bot.answer_web_app_query(...)

Method as object

Imports:

  • from aiogram.methods.answer_web_app_query import AnswerWebAppQuery

  • alias: from aiogram.methods import AnswerWebAppQuery

With specific bot

result: SentWebAppMessage = await bot(AnswerWebAppQuery(...))

As reply into Webhook in handler

return AnswerWebAppQuery(...)