Use this method to set the navigation button to the menu reference. When the navigation button is pressed, the referenced menu will be displayed as a normal keypad menu, Chat Menu.
Field
Type
Required
Description
method
String
Yes
"setNavigationButton"
navigation_buttonsmenu_ref
String Array of Button
Yes
Array of Button: Menu unique identifier that references the next menu to navigate to it when the navigation button is pressed.
chat_id
String
Yes
Unique identifier for the target Chat or User_id.
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.

Requests

json
{ "method": "setNavigationButton", "chat_id": "47586214123658955", "navigation_buttons": [ { "next_menu": "MainMenu" } ] }
java
String chatId = incomingMsg.getChat().getId(); Utils.setNavigationButton(chatId, "mainMenu", api); public static void setNavigationButton(String chatId, String nextMenu, Api api) { Button navigationButton = new Button(); navigationButton.setNextMenu(nextMenu); SetNavigationButtonOutMessage navMsg = new SetNavigationButtonOutMessage(); navMsg.setChatId(chatId); navMsg.setNavigationButtons(new Button[] { navigationButton }); api.send(navMsg); }
javascript
static setNavigationButton(chatId, nextMenu, api){ let fb = new Button(); fb.next_menu = nextMenu; let navMsg = new SetNavigationButtonOutMessage(); navMsg.chat_id = chatId; navMsg.navigation_buttons = [] navMsg.navigation_buttons.push(fb); api.send(JSON.stringify(navMsg)); }
python
def set_nav_button(nextMenu,napi,chatId) : fb = Button() fb.next_menu = nextMenu navMsg = Utils.SetNavigationButtonOutMessage() navMsg.chat_id = chatId navMsg.navigation_buttons=[] navMsg.navigation_buttons.append(fb) napi.send(navMsg)

Responses

ChatMenuCallback
json
{ "method": "chatMenuCallback", "chatMenuCallback": { "date": 7456984123741, "button_callback": "VCB0", "next_menu": null, "button_query_result": null, "chat": { "id": "874125364412589741", "type": "Mobile" }, "from": { "id": "741254123980325800", "type": "Mobile" }, "menu_ref": "FourthMenu", "button_label": "Food" } }
SetChatMenu Ack
json
{ "method": "setChatMenu_ack", "chat": { "id": "4522291356145774" } }