logo
In-app Chat
Powered Byspreading
On this page

Set group member roles


Overview

You can call this operation to set roles for group members within the group.

The ZIM SDK supports setting users as group owners, administrators, and regular members by default. In a group, the group owner has all client permissions and can perform all group functions. Administrators have most client permissions, while regular members have the fewest client permissions. The specific client permissions for each role are shown in the table below:

Client PermissionsGroup Owner
(corresponding enum value: 1)
Administrator
(corresponding enum value: 2)
Regular Member
(corresponding enum value: 3)
Modify group avatar, group name, group noticeSupportedSupportedSupported
Modify group attributes
Modify group member nicknameSupported, can be used for all group role usersSupported, can be used for all regular membersSupported, can only be used for oneself
Recall group member messages
Kick out membersNot supported
Mute individual group members
Mute specific group roles
Set group member rolesNot supported
Transfer group ownership
Dismiss the group
Mute all members

In addition, you can also customize the group role, but the client permissions of this role are the same as those of ordinary members.

After the setting is successful, the group members will receive notifications through the following ZIM callbacks:

iOSAndroidmacOSWindowsWeb
groupMemberInfoUpdatedonGroupMemberInfoUpdatedgroupMemberInfoUpdatedonGroupMemberInfoUpdatedgroupMemberInfoUpdated
FlutterUnity3DReact Native
onGroupMemberInfoUpdatedOnGroupMemberInfoUpdatedgroupMemberInfoUpdated

Operation prototype

  • Request method: GET
  • Request URL: https://zim-api.zego.im/?Action=SetGroupMemberRole
  • Protocol: HTTPS
  • QPS limit: 20 times/second.

Request parameters

The following table describes only the operation-specific request parameters and some common request parameters. For the complete list of common request parameters, see the Public request parameters section of the Accessing Server APIs topic.

Parameter Type Required Description
FromUserIdString Yes The ID of the operator. It is recommended to fill in the user ID of the group owner.
GroupIdString Yes Group ID.
ToUserIdString Yes Target user for whom the role is to be set  ID.
RoleNumber Yes Role:
  • 2: Administrator.
  • 3: Ordinary member.
  • Other values: You can customize the role. The recommended value range is [100, 255]. The permissions are the same as those of ordinary members.

Sample response

Untitled
https://zim-api.zego.im/?Action=SetGroupMemberRole
&<Common request parameters>
&FromUserId=zego
&GroupId=group
&ToUserId=zego2
&Role=3
1
Copied!

Response parameters

Parameter Type Description
CodeNumberThe return code.
MessageStringThe description of the operation result.
RequestIdString The request ID.

Sample response

Untitled
{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782"
 }
1
Copied!

Return codes

The following table describes only the return codes related to the business logic of the operation. For the complete list of return codes, see Return codes.

Return Code Description Solution
660000001Server error.Try again or contact ZEGOCLOUD technical support.
660000002Parameter error.Check the input parameter.
660300005The QPS limit specified in AppID is exceeded.Try again later.
660600001The group does not exist.Check whether the value of the GroupId parameter is valid.
660600009Querying group information failed.Please confirm whether the GroupID is correct. If it is correct, please contact ZEGOCLOUD Technical Support.
660600024ToUserId is not in the group.Please confirm whether ToUserId is in the group:
  • If yes, please contact ZEGOCLOUD Technical Support.
  • If no, please add ToUserId to the group.
660600029Role cannot be set to 1. Please modify the Role.
660600030FromUserId cannot be equal to ToUserId. Please modify ToUserId.

Previous

Set nicknames of group members

Next

Mute a group