Browse SDKs · Android
Platform
SDKsAndroid

Create a merged message

Use createMergerMessage to combine multiple messages into one summary message.

Copy

Combine multiple historical messages into a single merged forward card message. The resulting message displays as a preview card with a title and summary lines in the chat stream, which recipients can tap to expand and view the full conversation history.

Code example

List<Message> messages = Arrays.asList(msg1, msg2, msg3);
String title = "Chat history from Project Team";
List<String> summaries = Arrays.asList("Alex: We deployed the latest release", "Bob: Understood, running verification tests");

Message message = OpenIMClient.getInstance().messageManager.createMergerMessage(
    messages,
    title,
    summaries
);

Parameters

ParameterTypeRequiredDescription
messagesList<Message>YesThe list of original messages to bundle, ordered chronologically.
titleStringYesTitle displayed on the merged message card (such as "Chat history from Project Team").
summariesList<String>YesSummary preview lines displayed on the card (typically formatted as "Sender: Message snippet").

Return value

Returns the created Message object with contentType set to MessageType.MERGER.

State changes after the call

  1. Local initialization: Initializes the local Message structure without sending data to the server.
  2. Transmission: Call Send a message to deliver the merged message to a single user or group.