Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Create merge forward message

Combine multiple existing messages into a single merged forward message.

Copy

Consolidates multiple chat messages into a single forwardable chat record card.

Code example

import sdk, { CreateMergerMessageReq, CreateMergerMessageResp } from '@openimsdk/imsdk';

const request: CreateMergerMessageReq = {
  messages: selectedMessages,
  title: 'Project Discussion History',
  summaries: ['Alex: Please confirm deployment time', 'Morgan: Scheduled for Friday release'],
};
const response: CreateMergerMessageResp = await sdk.createMergerMessage(request);
const message = response.message;

Parameters

ParameterTypeRequiredDescription
messagesIMMessage[]YesArray of messages to include in the merged record.
titlestringYesTitle displayed at the top of the merged record card.
summariesstring[]YesArray of summary preview strings shown on the message bubble.

Return value

Returns a Promise resolving to CreateMergerMessageResp:

PropertyTypeDescription
messageIMMessageLocally instantiated merged message object.

State changes after the call

The sequence of messages defines the order presented in the expanded chat history viewer. summaries must be formatted by the application layer; the SDK does not automatically generate summaries. This operation instantiates the IMMessage locally; call Send message to dispatch it.