save_prepared_keyboard_button()¶
- async Client.save_prepared_keyboard_button()¶
Store a keyboard button that can be used by a user within a Mini App.
Stores a keyboard button with type
requestPeerorrequestWebViewthat a Mini App user can use. The stored result can be retrieved by the user using theweb_app_send_prepared_messageWeb App event.Note
This is a Bot API concept that maps to the same MTProto endpoint as
save_prepared_inline_message(). Thebuttonmust be anInputBotInlineResultobject that wraps the keyboard button content.Usable by Users Bots- Parameters:
user_id (
int|str) – Unique identifier (int) or username (str) of the Mini App user to whom theweb_app_send_prepared_messageevent will be sent.button (
KeyboardButton) – A keyboard button object of typekeyboardButtonRequestPeerorkeyboardButtonSimpleWebViewto prepare.
- Returns:
BotPreparedInlineMessage– The prepared message object containing anidandexpiration date.
Example
from pyrogram.raw.types import KeyboardButtonRequestPeer, RequestPeerTypeUser button = KeyboardButtonRequestPeer( text="Pick a user", button_id=1, peer_type=RequestPeerTypeUser(), max_quantity=1, ) prepared = await app.save_prepared_keyboard_button(user_id=user_id, button=button)