Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Set burn duration

Configure the burn-after-reading countdown duration in seconds for a conversation.

Copy

Specify the lifespan in seconds that messages remain accessible after being read under burn-after-reading mode:

Code example

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

const request: SetConversationReq = {
  conversationID: conversationID,
  burnDuration: 30,
};
await sdk.setConversation(request);

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesTarget conversation identifier.
burnDurationnumberYesCountdown duration in seconds after which viewed messages are destroyed.

Return value

Returns a Promise that resolves to void when the duration is updated.

State changes after the call

Activating burn-after-reading mode also requires enabling isPrivateChat via Enable or disable burn-after-reading. Do not confuse burn duration with server-side periodic retention configured in Set periodic server message destruction. After the Promise resolves, the SDK emits EventOnConversationChanged. Match the item by conversationID and update its burnDuration attribute in the local store, as shown in Retrieve conversation list.