Set message destruct
Configure automated server-side message retention and deletion policies using the OpenIM React Native SDK.
Configure an automated server-side message deletion policy for a conversation:
await OpenIMSDK.setConversation({
conversationID,
isMsgDestruct: true,
msgDestructTime: 3600,
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Target conversation ID to configure. |
isMsgDestruct | boolean | No | Whether to enable automatic server-side message destruction. |
msgDestructTime | number | No | Automated destruction interval in seconds. |
To enable the policy, provide both isMsgDestruct: true and msgDestructTime; set isMsgDestruct: false to disable it. Note that this feature is distinct from one-to-one burn-after-reading, which is managed via isPrivateChat and burnDuration.
Automated destruction purges historical messages retained on the cloud server. Messages already stored in the local SQLite database remain intact until locally cleared; however, once wiped or on a new device, expired server messages cannot be synchronized again.
Return value
A resolved Promise confirms that the message destruction policy was updated on the server.
The update triggers the OnConversationChanged event. Use conversationID to identify the conversation in your state store and reconcile isMsgDestruct and msgDestructTime. For event listener details, see Retrieve conversation list.
Was this page helpful?