Quick Reference for AI Agents & Developers// Delete user conversation
await CometChat.deleteConversation("user_uid", "user");
// Delete group conversation
await CometChat.deleteConversation("group_guid", "group");
// Note: Only removes from YOUR list, not other participants
// Messages are still accessible if you receive new ones
Delete a conversation to remove it from the user’s conversation list. This only affects the logged-in user’s view.
Availability: SDK, API, UI KitsDeleting a conversation only removes it for the logged-in user, not for other participants.
Delete a Conversation
User Conversation
Group Conversation
TypeScript
Async/Await
const UID = "user1";
const type = "user";
CometChat.deleteConversation(UID, type).then(
(response) => console.log("Conversation deleted:", response),
(error) => console.log("Failed to delete:", error)
);
const GUID = "group-123";
const type = "group";
CometChat.deleteConversation(GUID, type).then(
(response) => console.log("Conversation deleted:", response),
(error) => console.log("Failed to delete:", error)
);
const UID: string = "user1";
const type: string = "user";
CometChat.deleteConversation(UID, type).then(
(response: string) => console.log("Conversation deleted:", response),
(error: CometChat.CometChatException) => console.log("Failed:", error)
);
const deleteConversation = async () => {
try {
const UID = "user1";
const type = "user"; // or "group" for group conversations
const response = await CometChat.deleteConversation(UID, type);
console.log("Conversation deleted:", response);
} catch (error) {
console.log("Failed to delete:", error);
}
};
| Parameter | Description |
|---|
conversationWith | UID of user or GUID of group |
conversationType | "user" or "group" |
What Gets Deleted
| Deleted | Not Deleted |
|---|
| Conversation from your list | Messages (still accessible) |
| Unread count | Other users’ conversations |
| Last message preview | Group membership |
If you receive a new message from the deleted conversation, it will reappear in your conversation list.
Delete for All Users
To delete a conversation for all participants, use the REST API:
curl -X DELETE "https://api-{region}.cometchat.io/v3/users/{uid}/conversation" \
-H "apiKey: YOUR_API_KEY" \
-H "Content-Type: application/json"
View REST API Documentation →
Next Steps