logo
In-app Chat
Powered Byspreading
On this page

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.

iOSAndroidmacOSWindows
conversationChangedonConversationChangedconversationChangedonConversationChanged
WebFlutterReact NativeUnity3D
conversationChangedonConversationChangedconversationChangedOnConversationChanged

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.

ParameterTypeRequiredDescription
FromUserIdStringYesThe user ID for which notifications are to be muted or unmuted.
ConvTypeNumberYesThe conversation type. Valid values:
  • 0: one-to-one chat.
  • 2: group chat.
ConvIdsArray of StringYes

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.

EnableBooleanYesSpecifies whether to mute notifications. Valid values:
  • true: yes.
  • false: no.
Note

The FromUserId parameter can contain only digits, letters, and the following characters: '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', ', ', '|', '~'.

Sample request

  • Request URL:

    Untitled
    https://zim-api.zego.im/?Action=SilenceConvNotification
    &<Common request parameters>
    
    1
    Copied!
  • Request body:

    Untitled
    {
        "FromUserId": "userA",
        "ConvIds": [
            "ConvId1",
            "ConvId2",
        ],
        "ConvType": 0,
        "Enable": true
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumberThe return code.
Note
When you request to mute or unmute notifications for multiple conversations, take note of the following items:
  • If notifications are successfully muted or unmuted for one or more conversations, 0 is returned, indicating a success. For more information, see ErrorList.
  • If notifications fail to be muted or unmuted for all conversations, a corresponding code is returned. For more information, see Return codes.
MessageStringThe description of the request result.
RequestIdStringThe request ID.
ErrorListArray of Object

The list of failed results.

  • If Code is 0:

    • If ErrorList is empty, notifications are successfully muted or unmuted for all conversations.
    • If ErrorList is not empty, notifications fail to be muted or unmuted for some conversations. In this case, see SubCode and SubMessage.
  • If Code is not 0:

    • If ErrorList is empty, one or more parameters are invalid, the QPS limit is exceeded, or a system error occurs.
    • If ErrorList is not empty, notifications fail to be muted or unmuted for all conversations.
└ConvIdStringThe ID of the conversation for which notifications fail to be muted or unmuted.
└SubCodeNumberThe code returned when the request fails.
└SubMessageStringThe error message.

Sample response

Untitled
{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782",
    "ErrorList": [
        {
            "ConvId": "ConvId1",
            "SubCode": 660800030,
            "SubMessage": "input params error"
        }
    ]
}
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 CodeDescriptionSolution
660000001A common service error occurred.Try again, or contact ZEGOCLOUD technical support.
660000002Invalid parameter.Check the input parameter.
660300005The QPS limit specified in AppID is exceeded.Try again later.
660500002FromUserId is not registered.Register FromUserId.
660600001The group chat does not exist.Check whether the value of the GroupId parameter is valid.
660700015
  • If it is a code, the peer user of all one-to-one chats are not registered.
  • If it is a subcode, the peer user of the one-to-one chat (ConvID) is not registered.
Register the peer user.
660800030Notifications 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.
660800051Notifications have been muted for the conversation.No handling is required.
660800052Notifications have been unmuted for the conversation.No handling is required.
660600009Failed to obtain the group chat information.Check whether the value of the GroupID parameter is valid. If so, contact ZEGOCLOUD technical support.
660600024FromUserId is not in the specified group chat.Add the user to the group chat.

Previous

Reject a call invitation

Next

Pin conversations to the top