Skip to main content

Message menu

Users can open a context menu on messages in the channel message list (right-click or long-press). Visible items depend on message type and state.

tip

Reference artwork. Channel filters and header menus are app-owned.

Built-in menu IDs

IDs are defined by MessageMenuID:

IDDescription
MessageMenuID.REPLYReply / quote
MessageMenuID.MULIT_CHOICEMulti-select mode
MessageMenuID.COPYCopy text (typically text messages)
MessageMenuID.FORWARDForward
MessageMenuID.SPEECH_TO_TEXTSpeech to text for HD voice messages when speech-to-text is enabled
MessageMenuID.CANCEL_SPEECH_TO_TEXTCancel speech-to-text
MessageMenuID.DELETE_FOR_MEDelete the message from the current user's view
MessageMenuID.DELETE_FOR_ALLDelete a sent message for all participants within the configured recall window

Labels resolve from i18n tables keyed by the menu id strings. See Localization.

Example: clone the built-in en_US strings, tweak a label, and register them under en_UK so the snippet shows both locales side by side:

TypeScript
import { MessageMenuID } from '@nexconn/chatui';

const entries = app.cloneLanguageEntries('en_US');
entries[MessageMenuID.REPLY] = 'Quote';
app.registerLanguagePack('en_UK', entries);

Delete and confirmation

Sensitive actions such as delete may show a confirmation dialog. The exact delete flow depends on message direction, the recall time window, and backend policy.

Customize the message menu

cloneMessageMenu returns a shallow copy of the MessageMenuItem array; call setMessageMenu with the updated array.

The built-in items follow these visibility rules:

  • DELETE_FOR_ME: shown for received messages, failed outgoing messages, and sent outgoing messages after the configured recall time window; hidden for sending messages
  • DELETE_FOR_ALL: sender-side only, hidden for sending/failed messages, and shown only within the configured recall time window
  • REPLY: shown for text, image, file, and reference messages that are not sending/failed
  • COPY: shown for text or reference messages when navigator.clipboard is available
  • FORWARD: shown for text, image, file, HD voice, combine, GIF, short video, and reference messages that are not sending/failed
  • SPEECH_TO_TEXT / CANCEL_SPEECH_TO_TEXT: shown only for HD voice messages when speech-to-text is enabled
  • In system channels, REPLY, FORWARD, and MULIT_CHOICE are hidden. COPY and DELETE_FOR_ME can still appear when their own filters match the message.
TypeScript
import type { MessageMenuItem } from '@nexconn/chatui';

const menu: MessageMenuItem[] = app.cloneMessageMenu();
menu.push({
id: 'message.menu.item.demo',
icon: 'https://example.com/icon.svg',
filter: () => true,
});
app.setMessageMenu(menu);

MessageMenuItem has id, icon, and optional filter(message).

Add i18n keys for new ids. Clicks on custom items emit ChatUIEvents MESSAGE_MENU_ITEM_CLICK with MessageMenuItemClick.

TypeScript
import { ChatUIEvents } from '@nexconn/chatui';

app.addEventListener(ChatUIEvents.MESSAGE_MENU_ITEM_CLICK, (evt) => {
const { id, message } = evt.data;
if (id === 'message.menu.item.demo') {
// Custom handling
return;
}
// Built-ins: avoid evt.preventDefault() unless you intentionally override SDK behavior
});