Delete conversation and messages
Delete a conversation entry and purge all messages stored locally for the current account.
Use deleteConversationAndDeleteAllMsg() when implementing "Delete chat" in your user interface. Prompt the user for explicit confirmation before proceeding:
Code example
import sdk, { DeleteConversationAndDeleteAllMsgReq } from '@openimsdk/imsdk';
const request: DeleteConversationAndDeleteAllMsgReq = {
conversationID: conversationID,
};
await sdk.deleteConversationAndDeleteAllMsg(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Target conversation identifier. |
Return value
Returns a Promise that resolves to void when the conversation and local message records are deleted.
State changes after the call
This method deletes the local conversation entry and message records stored for the signed-in user; it does not remove friends, leave groups, or delete history from other participants' devices. Once the Promise resolves, remove the item from the local conversation list using conversationID. Receive the conversation change notification via EventOnConversationChanged to reconcile persistent state, as detailed in Retrieve conversation list.
Was this page helpful?