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
  • Mute a group

Mute a group

Last updated:2024-07-03 15:41

Overview

This interface allows you to mute or unmute all members or certain roles in a group.

After a successful API call, all users in the group will be notified through the following ZIM SDK callback, indicating which roles are unable to speak in the group or can resume speaking:

iOS Android macOS Windows
groupMutedInfoUpdated
onGroupMutedInfoUpdated
groupMutedInfoUpdated
onGroupMutedInfoUpdated
Web Flutter React Native
groupMutedInfoUpdated
onGroupMutedInfoUpdated
groupMutedInfoUpdated

Operation prototype

  • Request method: GET
  • Request endpoint: https://zim-api.zego.im/?Action=MuteGroup
  • Protocol: HTTPS
  • Rate limit: 20 times/second

Request parameters

The following list only shows the request parameters for this interface and some public parameters. For a complete list of public parameters, please refer to Accessing Server APIs - Public parameters.

Parameter Type Required Description
FromUserId
String
Yes
The ID of the operating user.
GroupId
String
Yes
The ID of the group.
IsAllMuted
Bool
No
Whether to mute all members. If not passed, it defaults to false.
MuteRoleList[]
Array of Number
No (only works when IsAllMuted is false or not passed)
A list of roles to be muted. Up to 20 group roles can be muted in a single request. The enumerations are as follows:

  • 1: Group owner.
  • 2: Administrator.
  • 3: Group member.
  • Others: roles defined by you, which are recommended to be greater than 100.
Duration
Number
No
The duration of the mute. If not passed, it defaults to 0.

  • -1: Permanent mute.
  • 0: Cancel the group-level mute.
  • Greater than 0: The duration of the mute in seconds. The maximum duration is 30 days (2592000 seconds).
If a mute duration is set within the validity period of a previous mute, the mute status will be extended based on the duration set in the most recent request.
  • If IsAllMuted, MuteRoleList, and Duration are not passed, all users in the group will have their mute status lifted.
  • If Duration is not 0 and IsAllMuted is set to false, the MuteRoleList passed in will override the muuted role list set previously.
  • FromUserId only supports numbers, English characters, and the following special characters: '!', '#', '$', '%', '&', '(', ')', '+', '', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', '{', '}', '|', '~'.
  • If FromUserId is an administrator, MuteRoleList[] cannot include 1 (group owner).

Sample request

https://zim-api.zego.im/?Action=MuteGroup
&<Public Request Parameters>
&FromUserId=user1
&GroupId=group
&IsAllForbid=false
&MuteRoleList[]=2
&MuteRoleList[]=3
&Duration=100000

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 list only shows the return codes related to the business logic of the interface. For a complete list of return codes, please refer to Return codes.

Return Code Description Suggested Action
660000001
Business related general error.
Please try again or contact ZEGOCLOUD Technical Support.
660000002
Invalid parameter. 
The parameter entered is missing or invalid. Please check the parameters.
660300005
The call frequency of the interface exceeds the AppID level limit.
Please try again later.
660600001
The group does not exist.
Please check the GroupID.
660600009
Failed to obtain group-related information.
Please confirm if the GroupID is correct. If it is correct, please contact ZEGO technical support.
660600024
FromUserId is not in the group.
Please check FromUserId or add FromUserId as a group member.
660600032
FromUserId does not have permission.
FromUserId needs to be the group owner or administrator.
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code