logo
Use this message to set normal keypad menus to Chat Menus. Chat Menus, it must send the entire menus again to the target chat.
Field
Type
Required
Description
method
String
Yes
"setChatMenu"
app_id
String
Yes
Unique identifier for App.
chat_id
String
Yes
Unique identifier for the target Chat or User_id.
to_user_id
String
Optional
Unique identifier of the target user within a chat. Used to respond to user replies or send a message to a specific user within a chat Group or Channel. The message will be displayed to them only.
menus
Yes
New or updated Menus.
reference
String
Optional
Unique identifier for the request. This reference will be echoed in the response.

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 setChatMenu_ack method is returned to acknowledge the receipt of the chatMenu."
Let me know if you need further refinements! 🚀
Field
Type
Returned
Description
method
String
Yes
"setChatMenu_ack"
app_id
String
Yes
Unique identifier for App.
chat_id
String
Yes
Chat Object.
reference
String
Optional
Unique identifier echoed from the request.

Example:

Requests

json
{ "method": "setChatMenu", "chat_id": "90090684438172188", "menus": [ { "menu_id": "EtaL3TQJZm2uWQB", "menu_ref": "EtaL3TQJZm2uWQB", "menu_version": "gd9eUjGbY8p1jkJw", "cat": "menu", "menu_group": "LWEdAhAkdyIU5xh", "menu_order": 0, "menu_name": "First Menu", "update": 1, "rows": [ { "row_id": "r_X1nubcrpSTdRNOw", "row_order": 0, "menu_id": "EtaL3TQJZm2uWQB", "buttons": [ { "button_code": "button_01", "button_form": "button", "button_style": "01", "button_style_ios": "01", "button_type": "submit-all", "button_label": "OK", "button_keyboard": "text", "button_db": 1, "button_newpage": false, "button_id": "b_cdO3Lzof8lCibRN", "button_version": "6NCSKniZwi6tfPsO", "row_id": "r_X1nubcrpSTdRNOw", "button_callback": "b_cdO3Lzof8lCibRN", "button_order": 0, "menu_id": "EtaL3TQJZm2uWQB", "update": 1 }, { "button_form": "button", "button_style": "03", "button_style_ios": "03", "button_type": "submit-all", "button_id": "b_DlVXvkurn9dQALS", "button_version": "tjfAMxWhXTdKEXo9", "row_id": "r_X1nubcrpSTdRNOw", "button_callback": "b_DlVXvkurn9dQALS", "button_order": 1, "menu_id": "EtaL3TQJZm2uWQB", "button_code": "button_03", "button_label": "CANCEL", "button_keyboard": "text", "button_db": 1, "button_newpage": false, "update": 1 } ], "row_version": "r_X1nubcrpSTdRNOw" } ] } ], "app_id": "90090684293000559", "reference": "123456789" }
java
// SEND CHAT MENU else if (incomingMsg.getText().toLowerCase().equals("chatmenu")) { String chatId = incomingMsg.getChat().getId(); new Utils().setNavigationButton(chatId, "mainMenu", api); Button menuBtn1 = createButton("Ų…ØĩØąØ§ŲˆŲŠ", "mainCB", 1, "Gray", "Red", null, null); menuBtn1.setButtonIcon("ic_smoke_free_24dp"); menuBtn1.setButtonIconBgColor("#00FFFF"); Button menuBtn2 = createButton("Funny", "funnyCB", 1, "Gray", "Red", null, null); menuBtn2.setButtonIcon("ic_timeline_24dp"); Button menuBtn3 = createButton("Option", "optionCB", 1, "Gray", "Red", null, null); menuBtn3.setButtonIcon("ic_pregnant_woman_24dp"); menuBtn3.setButtonIconBgColor("orange"); SetChatMenuOutMessage outmsg = new SetChatMenuOutMessage(); Row firstRow = new Row(); firstRow.setRowOrder(1); firstRow.setButtons(new Button[] { menuBtn1, menuBtn2, menuBtn3 }); Menu chatMenu = new Menu(); String menuRef = "mainMenu"; chatMenu.setMenuRef(menuRef); chatMenu.setRows(new Row[] { firstRow }); outmsg.setChatId(incomingMsg.getChat().getId()); outmsg.setMenus(new Menu[] { chatMenu }); api.send(outmsg); }
javascript
let outmsg = new SetChatMenuOutMessage(); let chat_id = incomingMsg.chat.id; Utility.setNavigationButton(chat_id, "mainMenu", api); let menuBtn1 = createButton( "No Smoking", "mainCB", 1, "Gray", "Red", null, null ); menuBtn1.button_icon = "ic_smoke_free_24dp"; menuBtn1.button_icon_bgcolor = "#00FFFF"; let buttons = []; buttons.push(menuBtn1); let rowOrder = 1; let firstRow = new Row(buttons, rowOrder); let rows = []; rows.push(firstRow); let menuRef = "mainMenu"; let chatMenu = new Menu(rows, menuRef); let menus = []; menus.push(chatMenu); outmsg.chat_id = incomingMsg.chat.id; outmsg.menus = menus; api.send(JSON.stringify(outmsg));
python
Utils.set_navigation_button(chatId, "mainMenu", napi) menuBtn1 = create_button(label="Ų…ØĩØąØ§ŲˆŲŠ", callback="mainCB", order=1, bg_color="Gray", txt_color="Red") menuBtn1.button_icon = "ic_smoke_free_24dp" menuBtn1.button_icon_bgcolor = "#00FFFF" menuBtn2 = create_button(label="Funny", callback="funnyCB", order=1, bg_color="Gray", txt_color="Red") menuBtn2.button_icon = "ic_timeline_24dp" menuBtn3 = create_button(label="Option", callback="optionCB", order=1, bg_color="Gray", txt_color="Red") menuBtn3.button_icon = "ic_pregnant_woman_24dp" menuBtn3.button_icon_bgcolor = "orange" outMsg = SetChatMenuOutMessage() firstRow = Row() firstRow.row_order = 1 firstRow.buttons = [menuBtn1, menuBtn2, menuBtn3] menuRef = "mainMenu" chatMenu = Menu() chatMenu.menu_ref = menuRef chatMenu.rows = [firstRow] outMsg.chat_id = chatId outMsg.menus = [chatMenu] napi.send(outMsg)

Responses

SetChatMenu Ack
json
{ "method": "setChatMenu_ack", "app_id": "90090684293000559", "chat_id": { "id": "90090684438172188", }, "reference": "123456789" }