Attaches a menu to one specific message. It renders beneath the message bubble and belongs to that message alone.
💡 If you send both
inline_menuandmenu_ref,inline_menuwins.
Add one of these to any outgoing message:
| Field | Type | What it does |
|---|---|---|
inline_menu |
Array of Menu | Defines the menu right there in the message. Not reusable. |
menu_ref |
String | References an existing menu by its menu_id, provisioned earlier with setChatMenu. |
Unlike a keypad menu, a message-bound menu does not persist across the chat.
The normal message acknowledgement. Presses on the menu arrive later as menuCallback with "source": "inline".
All three SDKs take the menu as raw JSON, so build it as a JSON array rather than with DTO classes.
| SDK | Field | Callback |
|---|---|---|
| Java | outmsg.setInlineMenu(JSONArray) / outmsg.setMenuRef(String) |
onMessagAckCallback(MessageAck msgAck) |
| JavaScript | outmsg.inline_menu / outmsg.menu_ref |
onMessagAckCallback(msgAck) |
| Python | out_msg.inline_menus / out_msg.menu_ref — note the plural property; it serialises to inline_menu |
on_message_ack_callback(self, msg_ack) |
{
"method": "sendMessage",
"chat_id": "90090684438172188",
"app_id": "90090684293000559",
"reference": 987654321,
"text": "Hello world!",
"inline_menu": [
{
"menu_id": "PBw7HmDu5FAWjFm",
"cat": "menu",
"menu_name": "First Menu",
"menu_group": "TgKB8yDHKv4ZBOc",
"menu_version": "04oTrLih73KeqCke",
"menu_order": 0,
"api_id": "90091783822039252",
"rows": [
{
"row_id": "r_bMCvsAZ5ZVkMx2C",
"row_order": 0,
"menu_id": "PBw7HmDu5FAWjFm",
"row_version": "FoLSTFJYg48eXrDp",
"cells": [
{
"cell_id": "b_BKwMwhIVbBFw634",
"form": "button",
"style": "filled",
"cell_order": 0,
"version": "7fOkiEWlDadvyOIE",
"callback": "b_BKwMwhIVbBFw634",
"label": "Save"
},
{
"cell_id": "b_b2ZRG1YmHStEPo5",
"form": "button",
"style": "tonal",
"cell_order": 1,
"version": "Gk4E9kpy4KG1yDij",
"callback": "b_b2ZRG1YmHStEPo5",
"label": "Delete"
}
]
},
{
"row_id": "r_DAetbJyRzpFUwSI",
"row_order": 1,
"menu_id": "PBw7HmDu5FAWjFm",
"row_version": "QU6FfL9gyHSAiw8m",
"cells": [
{
"cell_id": "b_oScCagIGQmaHjNQ",
"form": "button",
"style": "outlined",
"cell_order": 0,
"version": "dl609ppkJkkfRdUL",
"callback": "b_oScCagIGQmaHjNQ",
"label": "Cancel"
}
]
}
]
}
]
}
String menuJson = "[ ... the inline_menu array shown above ... ]";
JSONArray inlineMenu = (JSONArray) new JSONParser(-1).parse(menuJson);
TextOutMessage outmsg = new TextOutMessage();
outmsg.setChatId("90090684438172188");
outmsg.setApp_id("90090684293000559");
outmsg.setReference("987654321");
outmsg.setText("Hello world!");
outmsg.setEcho(1);
outmsg.setInlineMenu(inlineMenu);
api.send(outmsg);
const inlineMenu = JSON.parse("[ ... the inline_menu array shown above ... ]");
let outmsg = new TextOutMessage();
outmsg.chat_id = "90090684438172188";
outmsg.appId = "90090684293000559";
outmsg.reference = "987654321";
outmsg.text = "Hello world!";
outmsg.echo = 1;
outmsg.inline_menu = inlineMenu;
api.send(JSON.stringify(outmsg.toJsonObject()));
import json
inline_menu = json.loads("[ ... the inline_menu array shown above ... ]")
out_msg = TextOutMessage()
out_msg.chat_id = "90090684438172188"
out_msg.app_id = "90090684293000559"
out_msg.reference = "987654321"
out_msg.text = "Hello world!"
out_msg.echo = 1
out_msg.inline_menus = inline_menu
obj, _ = out_msg.to_json_obj()
napi.send(obj)
To reference a menu you already provisioned, drop inline_menu and send "menu_ref": "PBw7HmDu5FAWjFm" instead.