GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Follow on X
  • Home
  • FAQ
  • Apps
  • API
  • Protocol
  • Schema
  • Bot menu button
  • inputUserEmpty
  • botMenuButton
  • bot mini app
  • botMenuButtonCommands
  • inputUser

This view

  • Original page
  • New address

GeezerVison is showing core.telegram.org — Bot menu button

  • Follow on X
  • Home
  • FAQ
  • Apps
  • API
  • Protocol
  • Schema

Machine-readable version of this page: /api/bots/menu.md.

  • API
  • Bot menu button

Bot menu button

Bots can choose the behavior of the menu button shown next to the text input field.

For a simplified description using the HTTP bot API, see here ».

Setting the menu button

Schema:

botMenuButtonDefault#7533a588 = BotMenuButton;
botMenuButtonCommands#4258c205 = BotMenuButton;
botMenuButton#c7b57ce6 text:string url:string = BotMenuButton;

inputUserEmpty#b98886cf = InputUser;
inputUser#f21158c6 user_id:long access_hash:long = InputUser;

---functions---

bots.setBotMenuButton#4504d54f user_id:InputUser button:BotMenuButton = Bool;

Bots can use bots.setBotMenuButton to change the menu button for a certain user, or for all users.

Set scope: all users

To change the menu button for all users use the following parameters:

  • user_id - inputUserEmpty
  • button - one of the following constructors:
    • botMenuButton - Opens a bot mini app when clicked.
    • botMenuButtonCommands - Opens the bot's command list when clicked.

botMenuButtonDefault shouldn't be used as it has no effect, keeping the previously set menu button (either botMenuButton or botMenuButtonCommands).

Set scope: specific users

To change the menu button for a specific user use the following parameters:

  • user_id - inputUser with the user ID/access hash
  • button - one of the following constructors:
    • botMenuButton - Opens a bot mini app when clicked.
    • botMenuButtonCommands - Opens the bot's command list when clicked.
    • botMenuButtonDefault - Resets the behavior of the button to the default scope (all users).

Getting the menu button

Bots

botMenuButtonDefault#7533a588 = BotMenuButton;
botMenuButtonCommands#4258c205 = BotMenuButton;
botMenuButton#c7b57ce6 text:string url:string = BotMenuButton;

inputUserEmpty#b98886cf = InputUser;
inputUser#f21158c6 user_id:long access_hash:long = InputUser;

---functions---

bots.getBotMenuButton#9c60eb28 user_id:InputUser = BotMenuButton;

Bots might need to know the button type currently used in a given chat or in all chats: bots.getBotMenuButton can be used for this.

Users can't use this method, and should use the user method instead.

Get scope: all users

To get the menu button used for all users use the following parameter:

  • user_id - inputUserEmpty

One of the following constructors will be returned:

  • botMenuButton - Opens a bot mini app when clicked.
  • botMenuButtonCommands - Opens the bot's command list when clicked.

botMenuButtonDefault will never be returned in this case.

Get scope: specific users

To get the menu button used for a specific user use the following parameter:

  • user_id - inputUser with the user ID access/hash

One of the following constructors will be returned:

  • botMenuButton - Opens a bot mini app when clicked.
  • botMenuButtonCommands - Opens the bot's command list when clicked.
  • botMenuButtonDefault - The default scope (all users) button behavior is in use.

Users

updateBotMenuButton#14b85813 bot_id:long button:BotMenuButton = Update;

botMenuButtonCommands#4258c205 = BotMenuButton;
botMenuButton#c7b57ce6 text:string url:string = BotMenuButton;

botInfo#4d8a0299 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector<BotCommand> menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string app_settings:flags.8?BotAppSettings verifier_settings:flags.9?BotVerifierSettings = BotInfo;

userFull#06cbe645 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true display_gifts_button:flags2.16?true noforwards_my_enabled:flags2.23?true noforwards_peer_enabled:flags2.24?true unofficial_security_risk:flags2.26?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities bot_manager_id:flags2.25?long = UserFull;

---functions---

users.getFullUser#b60f5918 id:InputUser = users.UserFull;

Users will receive an updateBotMenuButton update when a bot changes the behavior of the menu button globally or in the private chat with the user.

For new bots, users.getFullUser can be used to fetch the userFull related to the bot, containing the botInfo constructor with various info about the bot, including the menu button behavior.

botMenuButtonDefault will never be returned in an updateBotMenuButton or in a botInfo (but if it does happen, treat it like a botMenuButtonCommands).

Bots should use the bot method instead.

Telegram
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
About
  • FAQ
  • Privacy
  • Press
Mobile Apps
  • iPhone/iPad
  • Android
  • Mobile Web
Desktop Apps
  • PC/Mac/Linux
  • macOS
  • Web-browser
Platform
  • API
  • Translations
  • Instant View
About
Blog
Press
Safety
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.