logo
The setNavigationButton method is used to configure a Chat Navigation Button within a specific chat. This button appears in the chat input bar and, when pressed, opens a designated Keypad Menu in the keyboard area of the chat.
This method allows developers to define the starting point of a guided, in-chat user experience, enabling quick access to interactive menus without requiring the user to send a message first.

Field
Type
Required
Description
method
String
Yes
"setNavigationButton"
app_id
String
Yes
Unique identifier for App.
navigationButton
menu_id
Yes
Unique identifier of the starting menu to open when the Chat Navigation Button is pressed. This menu will be rendered in the keyboard area as a Keypad Menu.
chat
Yes
Unique identifier for the target Chat object.
to_user_id
String
Optional
Unique identifier of the target user. Will be displayed if you reply or send a message to the target user within a Group or Channel.

Preconditions for API Functionality

The following table outlines the preconditions that must be met for the API to function correctly. Failure to meet these conditions may result in errors or unexpected behavior.
Condition
Description
API must have "Manage Chats" permission
The API needs "Manage Chats" permission to manage chats within the app.
API must be a moderator or an admin in the chat
The API requires admin privileges in the chat to execute view or creation actions.

Response

setChatMenu_ack
✅ "On success, the setNavigationButton_ack method is returned to acknowledge the receipt of the setNavigationButton."
Let me know if you need further refinements! 🚀
Field
Type
Returned
Description
method
String
Yes
"setNavigationButton_ack "
app_id
String
Yes
Unique identifier for App.
chat
Yes
Chat Object.
reference
String
Optional
Unique identifier echoed from the request.

SDK Mapping — setNavigationButton

SDK
Request Method
Response Callback
Java
SetNavigationButtonOutMessage navMsg = new SetNavigationButtonOutMessage(); navMsg.setChatId(chatId); navMsg.setNavigation_button("Menu ID"); navMsg.setApp_id(appId); api.send(navMsg);
onRecieving(JsonObject obj)
JavaScript
let navMsg = new SetNavigationButtonOutMessage(); navMsg.chat_id= chat_id; navMsg.appId =appId navMsg.navigation_button="Menu ID" api.send(JSON.stringify(navMsg));
onReceiveObj(obj)
Python
nav_msg = SetNavigationButtonOutMessage() nav_msg.navigation_button = "Menu ID" nav_msg .chat_id = chat_id nav_msg .app_id = app_id napi.send(nav_msg)
on_receive_obj(self, obj)

Example:

Requests

json
{ "method": "setNavigationButton", "chat_id": "90090684270838031", "navigation_button": "WPM1Z6584mRlA42", "app_id": "90090684293000559", "reference": "132456789" }
java
{ Button navigationButton = new Button(); navigationButton.setNextMenu(nextMenu); SetNavigationButtonOutMessage navMsg = new SetNavigationButtonOutMessage(); navMsg.setChatId(chatId); navMsg.setNavigationButtons(new Button[] { navigationButton }); navMsg.setApp_id(appId); api.send(navMsg); }
javascript
{let fb = new Button(); fb.next_menu = nextMenu; let navMsg = new SetNavigationButtonOutMessage(); navMsg.chat_id = chatId; navMsg.navigation_buttons = [] navMsg.navigation_buttons.push(fb); navMsg.appId = appId api.send(JSON.stringify(navMsg)); }
python
{ btn = Button({}) btn.next_menu = next_menu nav_msg = SetNavigationButtonOutMessage() nav_msg.chat_id = chat_id nav_msg.navigation_buttons = [] _, btn_dict = btn.to_json_obj() nav_msg.navigation_buttons.append(btn_dict) msg, _ = nav_msg.to_json_obj() msg.app_id = app_id api.send(msg) }

Responses

json
{ "method": "setNavigationButton_ack", "chat": { "id": "90090684270838031" }, "app_id": "90090684293000559", "reference": "132456789" }

Powered by Notaku