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

> 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 [#understand-the-tech-1]

    The Chat SDK provides the `IAgoraChatGroupManager`, `AgoraChatGroupManagerDelegate`, and `AgoraChatGroup` classes for chat group management, which allows you to implement the following features:

    * Modify the chat group name and description
    * Manage chat group announcements
    * Manage chat group shared files

    ## Prerequisites [#prerequisites-1]

    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 [#implementation-1]

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

    ### Modify the chat group name and description [#modify-the-chat-group-name-and-description-1]

    The chat group owner and chat group admins can modify the name and description of the chat group.

    Refer to the following sample code to modify the chat group name and description:

    ```objc
    // The chat group owner and chat group admins can call changeGroupSubject to modify the name of the chat group. The name length can be up to 128 characters.
    [[AgoraChatClient sharedClient].groupManager changeGroupSubject:@"subject"
                                                            forGroup:@"groupID"
                                                               error:nil];

    // The chat group owner and chat group admins can call changeDescription to modify the description of the chat group. The description length can be up to 512 characters.
    [[AgoraChatClient sharedClient].groupManager changeDescription:@"desc"
                                                           forGroup:@"groupID"
                                                               error:nil];
    ```

    ### Manage the chat group avatar [#manage-the-chat-group-avatar-1]

    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 `createGroupWithSubject:avatar:description:invitees:message:setting:completion:`. For details about the other parameters, see [Create and destroy a chat group](./manage-chat-groups#create-and-destroy-a-chat-group).

    ```objc
    AgoraChatGroupOptions *options = [[AgoraChatGroupOptions alloc] init];
    [AgoraChatClient.sharedClient.groupManager createGroupWithSubject:@"group name" avatar:@"group avatar" description:@"group description" invitees:@[@"user1", @"user2"] message:@"group message" setting:options completion:^(AgoraChatGroup * _Nullable group, AgoraChatError * _Nullable error) {
    }];
    ```

    After the group is created, the chat group owner and admins can call `updateGroupAvatar:groupId:completion:` to set or update the avatar. Once the avatar is changed, all the other chat group members receive the `groupSpecificationDidUpdate` callback.

    ```objc
    [AgoraChatClient.sharedClient.groupManager updateGroupAvatar:@"new group avatar" groupId:@"groupId" completion:^(AgoraChatGroup * _Nullable group, AgoraChatError * _Nullable error) {
        if (error == nil) {
            // Updated successfully.
        } else {
            // Update failed.
        }
    }];
    ```

    All chat group members can retrieve the group avatar from the group details:

    ```objc
    [AgoraChatClient.sharedClient.groupManager getGroupSpecificationFromServerWithId:@"groupId" completion:^(AgoraChatGroup * _Nullable aGroup, AgoraChatError * _Nullable aError) {
        if (aError == nil) {
            NSString *groupAvatar = aGroup.groupAvatar;
        }
    }];
    ```

    ### Manage chat group announcements [#manage-chat-group-announcements-1]

    The chat group owner and chat group admins can set and update chat group announcements. Once the announcements are updated, all chat group members receive the `groupAnnouncementDidUpdate` callback. All chat group members can retrieve chat group announcements.

    Refer to the following sample code to manage chat group announcements:

    ```objc
    // The chat group owner and chat group admins can call updateGroupAnnouncementWithId to set or update the chat group announcements. The announcement length can be up to 512 characters.
    [[AgoraChatClient sharedClient].groupManager updateGroupAnnouncementWithId:@"groupID"
                                                                  announcement:@"announcement"
                                                                           error:nil];

    // All chat group members can call getGroupAnnouncementWithId to retrieve the chat group announcements.
    [[AgoraChatClient sharedClient].groupManager getGroupAnnouncementWithId:@"groupID"
                                                                       error:nil];
    ```

    ### Manage chat group shared files [#manage-chat-group-shared-files-1]

    All chat group members can upload or download group shared files. The chat group owner and chat group admins can delete all of the group shared files, whereas group members can only delete the shared files that they have personally uploaded.

    Refer to the following sample code to manage chat group shared files:

    ```objc
    // All chat group members can call uploadGroupSharedFileWithId to upload group shared files. The file size can be up to 10 MB.
    // Once shared files are uploaded, group members receive the groupFileListDidUpdate callback.
    [[AgoraChatClient sharedClient].groupManager uploadGroupSharedFileWithId:@"groupID"
                                                                     filePath:@"filePath"
                                                                     progress:nil
                                                                   completion:nil];

    // All chat group members can call downloadGroupSharedFileWithId to download group shared files.
    [AgoraChatClient.sharedClient.groupManager downloadGroupSharedFileWithId:@"groupId" filePath:@"filePath" sharedFileId:@"fileId" progress:nil completion:^(AgoraChatGroup * _Nullable aGroup, AgoraChatError * _Nullable aError) {

        }];

    // All chat group members can call removeGroupSharedFileWithId to delete group shared files.
    // Once shared files are deleted, chat group members receive the groupFileListDidUpdate callback.
    [[AgoraChatClient sharedClient].groupManager removeGroupSharedFileWithId:@"groupID"
                                                                 sharedFileId:@"fileID"
                                                                        error:nil];

    // All chat group members can call getGroupFileListWithId to retrieve the list of shared files in the chat group.
    [[AgoraChatClient sharedClient].groupManager getGroupFileListWithId:@"groupID"
                                                              pageNumber:pageNumber
                                                                pageSize:pageSize
                                                                   error:nil];
    ```

    ### Listen for chat group events [#listen-for-chat-group-events-1]

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

    
  
      
  
      
  
      
  
      
  
      
  
