save_prepared_inline_message()

async Client.save_prepared_inline_message()

Store a message that can be sent by a user of a Mini App.

Use this method to prepare an inline result that a Mini App user can send to a chat via the web_app_send_prepared_message Web App event.

Usable by Users Bots
Parameters:
  • user_id (int | str) – Unique identifier (int) or username (str) of the user who will send the message.

  • result (InputBotInlineResult) – The prepared inline result object to store.

  • allow_user_chats (bool, optional) – Pass True if the message can be sent to private chats with users.

  • allow_bot_chats (bool, optional) – Pass True if the message can be sent to private chats with bots.

  • allow_group_chats (bool, optional) – Pass True if the message can be sent to group and supergroup chats.

  • allow_channel_chats (bool, optional) – Pass True if the message can be sent to channel chats.

Returns:

BotPreparedInlineMessage – The prepared inline message object containing the id and expiration date.

Example

from pyrogram.raw.types import InputBotInlineResultArticle, InputBotInlineMessageText

result = InputBotInlineResultArticle(
    id="unique_id",
    title="Article Title",
    input_message_content=InputBotInlineMessageText(message="Hello!"),
)
prepared = await app.save_prepared_inline_message(
    user_id=user_id,
    result=result,
    allow_user_chats=True,
)