Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Set conversation extension

Store application-defined custom metadata strings on a specific conversation.

Copy

The ex field stores an opaque string; the SDK does not parse or merge nested JSON keys automatically. If multiple features share the extension field, merge JSON namespaces at the application layer before calling this method:

Code example

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

const request: SetConversationReq = {
  conversationID: conversationID,
  ex: JSON.stringify(conversationExtra),
};
await sdk.setConversation(request);

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesTarget conversation identifier.
exstringYesThe complete custom metadata string to assign.

Return value

Returns a Promise that resolves to void when the extension is committed.

State changes after the call

Resolving the Promise triggers EventOnConversationChanged. Match the item by conversationID and update its ex string property, as detailed in Retrieve conversation list. Maintain backwards-compatible parsing logic in client code to handle unknown JSON schemas gracefully.