In-app Chat
  • iOS : Objective-C
  • Android
  • Web
  • Flutter
  • React Native
  • Unity3D
  • Windows
  • macOS
  • Introduction
    • Overview
    • Basic concepts
  • Sample app
  • Getting started
  • Client SDKs
    • SDK downloads
    • Release notes
    • Upgrade guide
  • Guides
    • Authentication
    • Manage users
    • Room
    • Group
    • Messaging
    • Call invitation (signaling)
    • Manage sessions
  • Offline push notifications
  • Error codes
  • Client APIs
  • Server APIs
  • Documentation
  • In-app Chat
  • Server APIs
  • Conversation related
  • Mute notifications for conversations

Mute notifications for conversations

Last updated:2024-03-22 15:37

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.

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:
  • 0: one-to-one chat.
  • 2: group chat.
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.

Conversations in this list must be of the same type. Otherwise, the call fails.

Enable
Boolean
Yes
Specifies whether to mute notifications. Valid values:
  • true: yes.
  • false: no.

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

Sample request

  • Request URL:

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

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

Response parameters

Parameter Type Description
Code
Number
The return code.
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.
Message
String
The description of the request result.
RequestId
String
The request ID.
ErrorList
Array 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.
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
  • 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.
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.
Page Directory