SDKsHarmonyOSEnterprise
Set conversation extension
Store application-defined custom metadata strings on a specific conversation.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Target conversation identifier. |
ex | string | Yes | The 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.
Was this page helpful?