Quick Reference for AI Agents & DevelopersNote: This deletes the conversation only for the logged-in user. To delete for all users, use the REST API.
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.
- Java (User)
- Java (Group)
- Kotlin (User)
- Kotlin (Group)
deleteConversation() method takes the following parameters:
| Parameter | Description | Required |
|---|---|---|
| conversationWith | UID of the user or GUID of the group whose conversation you want to delete. | YES |
| conversationType | The type of conversation you want to delete . It can be either user or group. | YES |
Best Practices
Confirm Before Deleting
Confirm Before Deleting
Prompt users to confirm before deleting conversations, especially for important chats, as this action removes the conversation from their list.
Understand Local vs Global Delete
Understand Local vs Global Delete
SDK deletion only removes the conversation for the logged-in user. Use REST API if you need to delete conversations for all participants.
Provide Archive Alternative
Provide Archive Alternative
Consider offering an “archive” feature using conversation tags instead of deletion, allowing users to hide conversations without losing them permanently.
Update UI Immediately
Update UI Immediately
Remove the conversation from your UI immediately after successful deletion to provide instant feedback to users.
Troubleshooting
Delete Failed - Conversation Not Found
Delete Failed - Conversation Not Found
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.Delete Failed - Invalid Receiver Type
Delete Failed - Invalid Receiver Type
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.Conversation Reappears After Delete
Conversation Reappears After Delete
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.