Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Set message local extension

Update the device-local extension field of a message on the current client.

Copy

localEx is stored exclusively on the current device, making it ideal for UI folding, selection flags, local source tags, or application-specific audio transcription text.

Code example

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

const request: SetMessageLocalExReq = {
  conversationID: conversationID,
  clientMsgID: message.clientMsgID,
  localEx: JSON.stringify({ selected: true, transcript: 'Transcribed speech text' }),
};
await sdk.setMessageLocalEx(request);

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesTarget conversation identifier.
clientMsgIDstringYesClient message identifier of the target message.
localExstringYesDevice-local extension string.

Return value

Returns a Promise that resolves to void when the local database write completes.

State changes after the call

This method does not automatically merge previous JSON fields. When multiple application modules share this property, read and validate existing values first, merge attributes in your business layer, and write back the entire string. Clients locate the record using clientMsgID (qualified by conversationID as needed). Resolving the Promise confirms the local database update without triggering shared message events.