Skip to main content
Quick Reference
// Delete a user conversation
CometChat.deleteConversation("UID", "user");

// Delete a group conversation
CometChat.deleteConversation("GUID", "group");
Available via: SDK | REST API | UI Kits
In case you want to delete a conversation, you can use the deleteConversation() method. This method takes two parameters: the unique ID (UID/GUID) of the conversation to be deleted, and the type (user/group) of conversation to be deleted.
Deleting a conversation is an irreversible operation for the logged-in user. Once deleted, the conversation and its associated data cannot be recovered for that user.
let UID = "UID";
let type = "user";
CometChat.deleteConversation(UID, type).then(
  deletedConversation => {
      console.log(deletedConversation);
  }, error => {
      console.log('error while deleting a conversation', error);
  }
);
This method deletes the conversation only for the logged-in user. To delete a conversation for all the users of the conversation, please refer to our REST API documentation here. The deleteConversation() method takes the following parameters:
ParameterDescriptionRequired
conversationWithUID of the user or GUID of the group whose conversation you want to delete.YES
conversationTypeThe type of conversation you want to delete. It can be either user or group.YES
  • Always confirm with the user before deleting a conversation, as this action is irreversible for the logged-in user.
  • Handle the error callback gracefully to inform users if the deletion fails (e.g., due to network issues or invalid IDs).
  • After a successful deletion, update your local conversation list by refreshing it using ConversationsRequest.
  • Conversation not found: Ensure the UID or GUID you are passing is correct and that a conversation with that user or group exists.
  • Permission denied: Verify that the logged-in user has the appropriate permissions and that the SDK is initialized and the user is logged in.
  • Type mismatch: Make sure the conversationType parameter matches the ID you are passing — use "user" with a UID and "group" with a GUID.

Next Steps