Skip to main content
Quick Reference for AI Agents & Developers
// Update group details
val group = Group("GUID", "New Name", CometChatConstants.GROUP_TYPE_PUBLIC, "")
group.description = "Updated description"
group.icon = "https://example.com/icon.png"

CometChat.updateGroup(group, object : CometChat.CallbackListener<Group>() {
    override fun onSuccess(updatedGroup: Group) { }
    override fun onError(e: CometChatException) { }
})
Note: Only admins and moderators can update group details. See Group Class for editable fields.
Available via: SDK | REST API | UI Kits

Update Group

As a group owner, how can I update the group details? You can update the existing details of a group using the updateGroup() method.
private String GUID = "GUID";
private String groupName = "Hello Group!";
private String groupType = CometChatConstants.GROUP_TYPE_PUBLIC;
private String password = "";
Group group = new Group(GUID, groupName, groupType, password);

CometChat.updateGroup(group,  new CometChat.CallbackListener<Group>() {
  @Override
  public void onSuccess(Group group) {
    Log.d(TAG, "Groups details updated successfully: " + group.toString());
  }
  @Override
  public void onError(CometChatException e) {
    Log.d(TAG, "Group details update failed with exception: " + e.getMessage());
  }
});
This method takes an instance of the Group class as a parameter, which should contain the data you wish to update.
ParameterDescription
groupAn instance of the Group class
After the successful update of the group, you will receive an instance of the Group class containing the updated information of the group. For more information on the Group class, see here.

Best Practices

Create a Group object with the GUID and only set the fields you want to update. Unchanged fields will retain their existing values.
Store custom group properties in the metadata field as JSON to extend group functionality without modifying the core schema.
Validate group names, descriptions, and icon URLs before calling updateGroup() to avoid API errors and improve user experience.
Listen for group update events to keep your UI synchronized when other admins or moderators modify group details.

Troubleshooting

Symptom: updateGroup() fails with “Insufficient permissions” error.Cause: User is not an admin or moderator of the group.Solution: Only admins and moderators can update group details. Check the user’s scope using group.getScope() before attempting updates.
Symptom: updateGroup() fails with “Group not found” error.Cause: The GUID in the Group object is incorrect or the group doesn’t exist.Solution: Verify the GUID is correct. Fetch the group first using retrieve-groups to ensure it exists.
Symptom: Group type doesn’t change after calling updateGroup().Cause: Group type (public/private/password) cannot be changed after creation.Solution: Group type is immutable. If you need a different type, create a new group and migrate members.

Next Steps