Documentation
zim In-app Chat
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • In-app Chat
  • Server APIs
  • Group related
  • Set group member roles

Set group member roles

Last updated:2024-05-31 15:18

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 Permissions Group Owner
(corresponding enum value: 1)
Administrator
(corresponding enum value: 2)
Regular Member
(corresponding enum value: 3)
Modify group avatar, group name, group notice
Supported
Supported
Supported
Modify group attributes
Modify group member nickname
Supported, can be used for all group role users
Supported, can be used for all regular members
Supported, can only be used for oneself
Recall group member messages
Kick out members
Not supported
Mute individual group members
Mute specific group roles
Set group member roles
Not 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:

iOS Android macOS Windows Web
groupMemberInfoUpdated
onGroupMemberInfoUpdated
groupMemberInfoUpdated
onGroupMemberInfoUpdated
groupMemberInfoUpdated
Flutter Unity3D React Native
onGroupMemberInfoUpdated
OnGroupMemberInfoUpdated
groupMemberInfoUpdated

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
FromUserId
String
Yes
The ID of the operator. It is recommended to fill in the user ID of the group owner.
GroupId
String
Yes
Group ID.
ToUserId
String
Yes
Target user for whom the role is to be set  ID.
Role
Number
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

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

Response parameters

Parameter Type Description
Code
Number
The return code.
Message
String
The description of the operation result.
RequestId
String
The request ID.

Sample response

{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782"
 }

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
660000001
Server error.
Try again or contact ZEGOCLOUD technical support.
660000002
Parameter error.
Check the input parameter.
660300005
The QPS limit specified in AppID is exceeded.
Try again later.
660600001
The group does not exist.
Check whether the value of the GroupId parameter is valid.
660600009
Querying group information failed.
Please confirm whether the GroupID is correct. If it is correct, please contact ZEGOCLOUD Technical Support.
660600024
ToUserId 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.
660600029
Role cannot be set to 1.
Please modify the Role.
660600030
FromUserId cannot be equal to ToUserId.
Please modify ToUserId.
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code