Skip to main content

Update Group

In other words, as a group owner, how can I update the group details? You can update the existing details of the group using the updateGroup() method.
var GUID = "GUID";
var groupName = "Hello Group";
var groupType = CometChat.GROUP_TYPE.PUBLIC;
var 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);
}
);
This method takes an instance of the Group class as a parameter which should contain the data that you wish to update.
ParameterDescription
groupan instance of class Group
After a successful update of the group, you will receive an instance of Group class containing update information of the group.
There is no real-time event listener available to receive updated group details when the updateGroup() method is called. To get the latest group information, you need to fetch the group details again using the appropriate method.
For more information on the Group class, please check here