Places a navigation button in a chat's input bar. Pressing it opens a keypad menu in the keyboard area — the entry point to a guided in-chat flow, with no message from the user required.
💡navigation_buttonis a plainmenu_idstring, not an object. The menu it points to must already be provisioned with setChatMenu.
Request
method is "setNavigationButton".Field | Type | Required | Description |
navigation_button | String | Yes | The menu_id of the menu to open when the button is pressed. |
chat_id | String | Yes | The target chat. |
app_id | String | Yes | The app the chat belongs to. |
nav_type | String | Optional | Where the button appears. Omit for the main chat screen; "reply_admin" for the reply screen; "admin" for the Admin Chat screen in Settings. |
menu_open | Integer | Optional | 1 opens the menu automatically on entering the chat. 0 or omitted leaves it closed. |
to_user_id | String | Optional | Show the button to one member only, inside a group or channel. |
reference | String | Optional | Your id for this request. Echoed back in the response. |
Preconditions
Requirement | Why |
"Manage Chats" permission | Needed to modify chats in the app. |
Bot is admin or moderator in the chat | Navigation buttons are an admin action. |
Response
setNavigationButton_ack
Field | Type | Returned | Description |
method | String | Yes | "setNavigationButton_ack" |
chat | Yes | The chat the button was applied to. | |
app_id | String | Yes | Echoed from the request. |
reference | String | Optional | Echoed from the request. |
SDKs
SDK | Call | Callback |
Java | api.send(navMsg); after navMsg.setNavigation_button(menuId) | onRecieving(JSONObject obj) |
JavaScript | api.send(JSON.stringify(navMsg.toJsonObject())); | onReceiveObj(obj) |
Python | napi.send(obj) after obj, _ = nav_msg.to_json_obj() | on_receive_obj(self, obj) |
Example
Request
json{ "method": "setNavigationButton", "chat_id": "90090684270838031", "navigation_button": "WPM1Z6584mRlA42", "app_id": "90090684293000559", "reference": "132456789" }
javaSetNavigationButtonOutMessage navMsg = new SetNavigationButtonOutMessage(); navMsg.setChatId("90090684270838031"); navMsg.setNavigation_button("WPM1Z6584mRlA42"); navMsg.setApp_id("90090684293000559"); navMsg.setReference("132456789"); // optional: navMsg.setType("admin"); navMsg.setIsOpen(1); api.send(navMsg);
javascriptlet navMsg = new SetNavigationButtonOutMessage(); navMsg.chat_id = "90090684270838031"; navMsg.navigation_button = "WPM1Z6584mRlA42"; navMsg.appId = "90090684293000559"; navMsg.reference = "132456789"; // optional: navMsg.nav_type = "admin"; navMsg.menu_open = 1; api.send(JSON.stringify(navMsg.toJsonObject()));
pythonnav_msg = SetNavigationButtonOutMessage() nav_msg.chat_id = "90090684270838031" nav_msg.navigation_button = "WPM1Z6584mRlA42" nav_msg.app_id = "90090684293000559" nav_msg.reference = "132456789" # optional: nav_msg.nav_type = "admin"; nav_msg.menu_open = 1 obj, _ = nav_msg.to_json_obj() napi.send(obj)
Response
json{ "method": "setNavigationButton_ack", "app_id": "90090684293000559", "reference": "132456789", "chat": { "id": "90090684270838031" } }