Skip to main content
Quick Reference for AI Agents & Developers
// Update group details
const group = new CometChat.Group("group_guid", "New Name", CometChat.GROUP_TYPE.PUBLIC);
group.setDescription("New description");
group.setIcon("https://example.com/icon.png");
group.setMetadata({ department: "Engineering" });
group.setTags(["active", "priority"]);
const updated = await CometChat.updateGroup(group);

// Editable: name, icon, description, metadata, tags, owner
// Not editable: guid, type
Update group details like name, icon, description, and metadata.
Availability: SDK, API, UI KitsOnly admins and moderators can update group settings (depending on your configuration).

Update Group Details

const GUID = "group-123";
const groupName = "Updated Team Name";
const groupType = CometChat.GROUP_TYPE.PUBLIC;

const group = new CometChat.Group(GUID, groupName, groupType);
group.setDescription("New description for the team");
group.setIcon("https://example.com/new-icon.png");

CometChat.updateGroup(group).then(
  (updatedGroup) => console.log("Group updated:", updatedGroup),
  (error) => console.log("Failed to update:", error)
);

Update Specific Properties

Update Name Only

const group = new CometChat.Group("group-123", "New Name", CometChat.GROUP_TYPE.PUBLIC);

CometChat.updateGroup(group).then(
  (updated) => console.log("Name updated:", updated.getName()),
  (error) => console.log("Failed:", error)
);

Update Icon

const group = new CometChat.Group("group-123", "Team", CometChat.GROUP_TYPE.PUBLIC);
group.setIcon("https://example.com/new-icon.png");

CometChat.updateGroup(group).then(
  (updated) => console.log("Icon updated:", updated.getIcon()),
  (error) => console.log("Failed:", error)
);

Update Metadata

const group = new CometChat.Group("group-123", "Team", CometChat.GROUP_TYPE.PUBLIC);
group.setMetadata({
  department: "Engineering",
  project: "Alpha",
  priority: "high"
});

CometChat.updateGroup(group).then(
  (updated) => console.log("Metadata updated:", updated.getMetadata()),
  (error) => console.log("Failed:", error)
);

Update Tags

const group = new CometChat.Group("group-123", "Team", CometChat.GROUP_TYPE.PUBLIC);
group.setTags(["engineering", "priority", "active"]);

CometChat.updateGroup(group).then(
  (updated) => console.log("Tags updated:", updated.getTags()),
  (error) => console.log("Failed:", error)
);

Editable Properties

PropertyEditableNotes
nameYesDisplay name
iconYesURL to group icon
descriptionYesGroup description
metadataYesCustom JSON data
tagsYesArray of tags
ownerYesTransfer ownership
typeNoCannot change after creation
guidNoCannot change after creation

Next Steps