Browse SDKs · Android
Platform
SDKsAndroid

Set conversation extension data

Store custom application metadata on a conversation using setConversationEx().

Copy

Attach custom business metadata to a conversation. The extension string is typically a serialized JSON string used to store domain tags, category identifiers, or custom presentation attributes.

Code example

OpenIMClient.getInstance().conversationManager.setConversationEx(
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // Extension update succeeded.
        }

        @Override
        public void onError(int code, String error) {
            // code and error describe the failure.
        }
    },
    conversationID,
    extensionJSON
);

Parameters

ParameterTypeRequiredDescription
baseOnBase<String>YesCallback delivering the asynchronous operation result.
conversationIDStringYesTarget conversation identifier.
exStringYesCustom extension string, typically formatted as JSON text.

Return value

The successful callback indicates that the server persisted the extension string. The update synchronizes across all devices logged into the authenticated account.

State changes after the call

Once the extension string takes effect, the SDK triggers the OnConversationListener.onConversationChanged event. When your listener receives this event, locate the conversation matching conversationID and update its ex field. For complete listener registration details, see Get the conversation list.