Skip to main content
// Update group details
const group = new CometChat.Group("GUID", "New Name", CometChat.GROUP_TYPE.PUBLIC);
const updated = await CometChat.updateGroup(group);

Update Group

Use updateGroup() to modify group details. Pass a Group object with the updated values.
const GUID = "GUID";
const groupName = "Hello Group";
const groupType = CometChat.GROUP_TYPE.PUBLIC;
const group = new CometChat.Group(GUID, groupName, groupType);

CometChat.updateGroup(group).then(
group => {
  console.log("Groups details updated successfully:", group);
}, error => {
  console.log("Group details update failed with exception:", error);
}
);
ParameterDescription
groupAn instance of Group class with updated values
On success, returns a Group object with the updated details. The method returns a Group object. Access the response data using getter methods:
FieldGetterReturn TypeDescription
guidgetGuid()stringUnique group ID
namegetName()stringDisplay name of the group
typegetType()stringGroup type ("public", "private", or "password")
descriptiongetDescription()stringDescription of the group
icongetIcon()stringURL of the group icon
ownergetOwner()stringUID of the group owner
updatedAtgetUpdatedAt()numberTimestamp when the group was last updated
For more information on the Group class, please check here.

Next Steps

Delete Group

Permanently delete a group

Retrieve Groups

Fetch and filter groups with pagination