logo
In-app Chat
Powered Byspreading
On this page

Mute a group


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:

iOSAndroidmacOSWindows
groupMutedInfoUpdatedonGroupMutedInfoUpdatedgroupMutedInfoUpdatedonGroupMutedInfoUpdated
WebFlutterReact Native
groupMutedInfoUpdatedonGroupMutedInfoUpdatedgroupMutedInfoUpdated

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.

ParameterTypeRequiredDescription
FromUserIdStringYesThe ID of the operating user.
GroupIdStringYesThe ID of the group.
IsAllMutedBoolNoWhether to mute all members. If not passed, it defaults to false.
MuteRoleList[]Array of NumberNo (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.
DurationNumberNoThe 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.
Note
  • 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

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

Response Parameters

ParameterTypeDescription
CodeNumberThe return code.
MessageStringThe description of the operation result.
RequestIdStringThe request ID.

Sample response

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

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 CodeDescriptionSuggested Action
660000001Business related general error.Please try again or contact ZEGOCLOUD Technical Support.
660000002Invalid parameter. The parameter entered is missing or invalid. Please check the parameters.
660300005The call frequency of the interface exceeds the AppID level limit.Please try again later.
660600001The group does not exist.Please check the GroupID.
660600009Failed to obtain group-related information.Please confirm if the GroupID is correct. If it is correct, please contact ZEGO technical support.
660600024FromUserId is not in the group.Please check FromUserId or add FromUserId as a group member.
660600032FromUserId does not have permission.FromUserId needs to be the group owner or administrator.

Previous

Set group member roles

Next

Mute group members