Quick Reference for AI Agents & Developers// Delete a group (admin only)
await CometChat.deleteGroup("GUID");
Requirement: Logged-in user must be an Admin of the group.
This operation is irreversible. Deleted groups and their messages cannot be recovered.
Delete a Group
To delete a group you need to use the deleteGroup() method. The user must be an Admin of the group they are trying to delete.
JavaScript
TypeScript
Async/Await
var GUID = "GUID";
CometChat.deleteGroup(GUID).then(
response => {
console.log("Groups deleted successfully:", response);
}, error => {
console.log("Group delete failed with exception:", error);
}
);
var GUID: string = "GUID";
CometChat.deleteGroup(GUID).then(
(response: boolean) => {
console.log("Group deleted successfully:", response);
}, (error: CometChat.CometChatException) => {
console.log("Group delete failed with exception:", error);
}
);
var GUID = "GUID";
try {
const response = await CometChat.deleteGroup(GUID);
console.log("Group deleted successfully:", response);
} catch (error) {
console.log("Group delete failed with exception:", error);
}
The deleteGroup() method takes the following parameters:
| Parameter | Description |
|---|
GUID | The GUID of the group you would like to delete |
Next Steps