Mute notifications for conversations
Overview
You can call this operation to batch mute notifications for one-to-one chats or group chats. Then, the ZIM SDK does not push message notifications to users, and the total number of unread messages does not increase.
By default, notifications can be muted for up to 500 one-to-one chats. If you need a higher limit (1,000 at maximum), contact ZEGOCLOUD technical support.
The maximum number of group chats for which notifications can be muted is the maximum number of group chats that a user is in.
The client receives the muting status change in the following ZIM SDK callbacks.
iOS | Android | macOS | Windows | ||
---|---|---|---|---|---|
conversationChanged | onConversationChanged | conversationChanged | onConversationChanged | ||
Web | Flutter | React Native | Unity3D | ||
conversationChanged | onConversationChanged | conversationChanged | OnConversationChanged |
Operation prototype
- Request method: POST
- Request URL:
https://zim-api.zego.im/?Action=SilenceConvNotification
- Protocol: HTTPS
- QPS limit: 20 calls per 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 user ID for which notifications are to be muted or unmuted. |
ConvType | Number | Yes | The conversation type. Valid values:
|
ConvIds | Array of String | Yes | The list of IDs of conversations for which notifications are to be muted. Up to 10 IDs can be contained. Warning Conversations in this list must be of the same type. Otherwise, the call fails. |
Enable | Boolean | Yes | Specifies whether to mute notifications. Valid values:
|
The FromUserId
parameter can contain only digits, letters, and the following characters: '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', ', ', '|', '~'.
Sample request
-
Request URL:
Untitledhttps://zim-api.zego.im/?Action=SilenceConvNotification &<Common request parameters>
1 -
Request body:
Untitled{ "FromUserId": "userA", "ConvIds": [ "ConvId1", "ConvId2", ], "ConvType": 0, "Enable": true }
1
Response parameters
Parameter | Type | Description |
---|---|---|
Code | Number | The return code. Note When you request to mute or unmute notifications for multiple conversations, take note of the following items:
|
Message | String | The description of the request result. |
RequestId | String | The request ID. |
ErrorList | Array of Object | The list of failed results.
|
└ConvId | String | The ID of the conversation for which notifications fail to be muted or unmuted. |
└SubCode | Number | The code returned when the request fails. |
└SubMessage | String | The error message. |
Sample response
{
"Code": 0,
"Message": "success",
"RequestId": "343649807833778782",
"ErrorList": [
{
"ConvId": "ConvId1",
"SubCode": 660800030,
"SubMessage": "input params error"
}
]
}
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 | A common service error occurred. | Try again, or contact ZEGOCLOUD technical support. |
660000002 | Invalid parameter. | Check the input parameter. |
660300005 | The QPS limit specified in AppID is exceeded. | Try again later. |
660500002 | FromUserId is not registered. | Register FromUserId . |
660600001 | The group chat does not exist. | Check whether the value of the GroupId parameter is valid. |
660700015 |
| Register the peer user. |
660800030 | Notifications are to be muted or unmuted for too many conversations. The default value is 500 , and a higher limit (1,000 at maximum) can be applied for. | Contact ZEGOCLOUD technical support. |
660800051 | Notifications have been muted for the conversation. | No handling is required. |
660800052 | Notifications have been unmuted for the conversation. | No handling is required. |
660600009 | Failed to obtain the group chat information. | Check whether the value of the GroupID parameter is valid. If so, contact ZEGOCLOUD technical support. |
660600024 | FromUserId is not in the specified group chat. | Add the user to the group chat. |