Skip to main content
Quick Reference for AI Agents & Developers
// Delete user conversation
CometChat.deleteConversation("UID", CometChatConstants.RECEIVER_TYPE_USER,
    object : CallbackListener<String>() {
        override fun onSuccess(message: String) { }
        override fun onError(e: CometChatException) { }
    })

// Delete group conversation
CometChat.deleteConversation("GUID", CometChatConstants.RECEIVER_TYPE_GROUP, callback)
Note: This deletes the conversation only for the logged-in user. To delete for all users, use the REST API.
Available via: SDK | REST API | UI Kits
To delete a conversation, 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.
CometChat.deleteConversation(UID, CometChatConstants.RECEIVER_TYPE_USER, new CometChat.CallbackListener<String>() {
  @Override
  public void onSuccess(String s) {
    Log.d(TAG, s);
  }

  @Override
  public void onError(CometChatException e) {
    Log.d(TAG, e.getMessage());
  }
});
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

Best Practices

Prompt users to confirm before deleting conversations, especially for important chats, as this action removes the conversation from their list.
SDK deletion only removes the conversation for the logged-in user. Use REST API if you need to delete conversations for all participants.
Consider offering an “archive” feature using conversation tags instead of deletion, allowing users to hide conversations without losing them permanently.
Remove the conversation from your UI immediately after successful deletion to provide instant feedback to users.

Troubleshooting

Symptom: deleteConversation() fails with “Conversation not found” error.Cause: The conversation doesn’t exist or has already been deleted.Solution: Verify the UID/GUID is correct and the conversation exists by fetching it first using retrieve-conversations.
Symptom: Delete fails with “Invalid receiver type” error.Cause: Receiver type doesn’t match the conversation type.Solution: Use RECEIVER_TYPE_USER for user conversations and RECEIVER_TYPE_GROUP for group conversations. Check the conversation type before deleting.
Symptom: Deleted conversation reappears when new messages arrive.Cause: Deleting a conversation only removes it from the list. New messages create a new conversation entry.Solution: This is expected behavior. If you want to prevent messages, consider blocking the user or leaving the group instead.

Next Steps