# Manage chat group attributes (/en/realtime-media/im/build/build-groups-rooms-and-threads/chat-group/manage-group-attributes/unity)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

Chat groups enable real-time messaging among multiple users.

This page shows how to use the Chat SDK to manage the attributes of a chat group in your app.

## Understand the tech

The Chat SDK provides the `Group`, `IGroupManager`, and `IGroupManagerDelegate` classes for chat group management, which allows you to implement the following features:

* Update the name and description of a chat group
* Retrieve and update the announcements of a chat group
* Manage the shared files in a chat group
* Update the extension fields of a chat group

## Prerequisites

Before proceeding, ensure that you meet the following requirements:

* You have initialized the Chat SDK. For details, [SDK quickstart](../../../get-started-sdk).
* You understand the call frequency limits of the Chat APIs supported by different pricing plans as described in [Limitations](../../limitations).
* You understand the number of chat groups and chat group members supported by different pricing plans as described in [Pricing Plan Details](../../../reference/pricing-plan-details).

## Implementation

This section describes how to call the APIs provided by the Chat SDK to implement chat group features.

### Update the chat group name

The chat group owner and admins can call `ChangeGroupName` to set and update the chat group name. The maximum length of a chat group name is 128 characters.

The following code sample shows how to update the chat group name:

```csharp
SDKClient.Instance.GroupManager.ChangeGroupName(groupId, groupName, new CallBack(
  onSuccess: () =>
  {
  },
  onError: (code, desc) =>
  {
  }
));
```

### Update the chat group description

The chat group owner and admins can call `ChangeGroupDescription` to set and update the chat group description. The maximum length of a chat group description is 512 characters.

The following code sample shows how to update the chat group description:

```csharp
SDKClient.Instance.GroupManager.ChangeGroupDescription(groupId, description, new CallBack(
  onSuccess: () =>
  {
  },
  onError: (code, desc) =>
  {
  }
));
```

### Update the chat group avatar

Since SDK v1.4.0, you can set, update, and retrieve the chat group avatar.

You can set the group avatar when you create the group by passing the `avatar` parameter to `CreateGroup`. For details about the other parameters, see [Create a chat group](./manage-chat-groups#create-a-chat-group).

```csharp
GroupOptions options = new GroupOptions(GroupStyle.PublicOpenJoin);
List<string> inviteMembers = new List<string> { "member1" };
SDKClient.Instance.GroupManager.CreateGroup(name, options, avatar, desc, inviteMembers, inviteReason, new ValueCallBack<Group>(
    onSuccess: (group) => { },
    onError: (code, error) => { }
));
```

After the group is created, the chat group owner and admins can call `UpdateGroupAvatar` to set or update the avatar. Once the avatar is changed, all the other chat group members receive the `OnSpecificationChangedFromGroup` callback.

```csharp
SDKClient.Instance.GroupManager.UpdateGroupAvatar(currentGroupId, "newAvatar", new CallBack(
    onSuccess: () => { },
    onError: (code, desc) => { }
));
```

All chat group members can retrieve the group avatar from the group details returned by `GetGroupSpecificationFromServer`:

```csharp
SDKClient.Instance.GroupManager.GetGroupSpecificationFromServer(currentGroupId, new ValueCallBack<Group>(
    onSuccess: (group) => { },
    onError: (code, desc) => { }
));
```

### Update the chat group announcements

Only the chat group owner and admins can call `UpdateGroupAnnouncement` to set and update the announcements. Once the chat group announcements are updated, all the other chat group members receive the `IGroupManagerDelegate#OnAnnouncementChangedFromGroup` callback. The maximum total length of chat group announcements is 512 characters.

The following code sample shows how to update the chat group announcements:

```csharp
SDKClient.Instance.GroupManager.UpdateGroupAnnouncement(groupId, announcement, new CallBack(
  onSuccess: () =>
  {
  },
  onError: (code, desc) =>
  {
  }
));

```

### Retrieve the chat group announcements

All chat group members can call `GetGroupAnnouncementFromServer` to retrieve the chat group announcements from the server.

The following code sample shows how to retrieve the chat group announcements:

```csharp
SDKClient.Instance.GroupManager.GetGroupAnnouncementFromServer(currentGroupId, new ValueCallBack(
  onSuccess: (str) =>
  {
  },
  onError: (code, desc) =>
  {
  }
));
```

### Manage the chat group shared files

#### Upload chat group shared files

All chat group members can call `UploadGroupSharedFile` to upload shared files to a chat group. The maximum file size is 10 MB. Once a shared file is uploaded, all the other chat group members receive the `IGroupManagerDelegate#OnSharedFileAddedFromGroup` callback.

The following code sample shows how to upload chat group shared files:

```csharp
SDKClient.Instance.GroupManager.UploadGroupSharedFile(groupId, filePath, new CallBack(
  onSuccess: () =>
  {
  },
  onError: (code, desc) =>
  {
  }
));
```

#### Delete chat group shared files

All chat group members can call `DeleteGroupSharedFile` to delete shared files in a chat group. Once a shared file is deleted, all the other chat group members receive the `IGroupManagerDelegate#OnSharedFileAddedFromGroup#OnSharedFileDeletedFromGroup` callback. The chat group owner and chat group admins can delete all of the shared files, whereas chat group members can only delete the shared files that they have personally uploaded.

The following code sample shows how to delete chat group shared files:

```csharp
SDKClient.Instance.GroupManager.DeleteGroupSharedFile(groupId, id, new CallBack(
  onSuccess: () =>
  {
  },
  onError: (code, desc) =>
  {
  }
));
```

#### Retrieve the shared file list

All chat group members can call `GetGroupFileListFromServer` to retrieve the list of shared files in a chat group from the server.

The following code sample shows how to retrieve the list of shared files in a chat group:

```csharp
SDKClient.Instance.GroupManager.GetGroupFileListFromServer(groupId, pageNum, pageSize, callback: new ValueCallBack> (
  onSuccess: (fileList) =>
  {
  },
  onError: (code, desc) =>
  {
  }
));
```

### Update the chat group extension fields

Only the chat group owner and admins can call `UpdateGroupExt` to update the extension fields of a chat group. The extension fields enable users to perform customized operations on a chat group. The maximum length of each extension field is 8 KB, and it must be in the JSON format.

The following code sample shows how to update the chat group extension fields:

```csharp
SDKClient.Instance.GroupManager.UpdateGroupExt(currentGroupId, extension, new CallBack(
  onSuccess: () =>
  {
  },
  onError: (code, desc) =>
  {
  }
));
```

### Listen for chat group events

For details, see [Chat Group Events](./manage-chat-groups#listen-for-chat-group-events).

    
  
      
  
