logo
In-app Chat
Powered Byspreading
On this page

Set Conversation Marks


Overview

By calling this API, you can set or cancel marks on multiple conversations for multiple users. Each conversations can have up to 20 marks.

The client will receive mark changes of conversations through the following callback interface of the ZIM SDK:

iOSAndroidmacOSWindows
conversationChangedonConversationChangedconversationChangedonConversationChanged
WebU3DFlutterReact Native
conversationChangedonConversationChangedonConversationChangedconversationChanged

Request method and endpoint

  • Request method: POST
  • Request endpoint: https://zim-api.zego.im/?Action=SetConvMark
  • 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
FromUserIdStringYesUser ID of the operator (registered).
ConvMarkInfoListArray of StConvMarkInfoListYesObjects for conversation marking, up to 100 each time. An error will be reported if it exceeds 100 or is 0.
Note

FromUserId only supports numbers, English characters, and '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', '{', '}', '|', '~'.

StConvMarkInfoList Description

ParameterTypeRequiredDescription
UserIdStringYesSets or cancels the mark for this UserID's conversations.
Note
When the target conversation is a group chat, the user should be in the group chat.
SetMarkC2cObject of ConvMarkInfoAt least one is requiredOne-to-one conversation list. The key is the conversation ID, and the value is the ConvMarkInfo structure. The list can contain up to 100 conversations.
SetMarkGroupObject of ConvMarkInfoGroup conversation list. The key is the conversation ID, and the value is the ConvMarkInfo structure. The list can contain up to 100 conversations (The group chat conversations should exist and not be deleted.).
ActionBoolYesMark operation:
  • true: set marks.
  • false: cancel marks.
Note

UserId only supports numbers, English characters, and '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', '{', '}', '|', '~'.

ConvMarkInfo Description

ParameterTypeRequiredDescription
MarkContentNumberYesMark. An integer ranging from 1 to 20.

Sample request

  • Request URL:

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

    Untitled
    {
        "FromUserId": "user_test",
        "ConvMarkInfoList": [
            {
                "UserId": "userA",
                "SetMarkC2c": {
                    "conv_c2c_1": {
                        "MarkContent": 2
                    },
                    "conv_c2c_2": {
                        "MarkContent": 2
                    }
                },
                "SetMarkGroup": {
                    "conv_group_1": {
                        "MarkContent": 2
                    },
                    "conv_group_2": {
                        "MarkContent": 2
                    }
                },
                "Action": true
            },
            {
                "UserId": "userB",
                "SetMarkC2c": {
                    "conv_c2c_1": {
                        "MarkContent": 2
                    },
                    "conv_c2c_2": {
                        "MarkContent": 2
                    }
                },
                "SetMarkGroup": {
                    "conv_group_1": {
                        "MarkContent": 2
                    },
                    "conv_group_2": {
                        "MarkContent": 2
                    }
                },
                "Action": true
            }
        ]
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumber

Return code.

Note

When you initiate a request to set or cancel marks for multiple conversations:

  • If you successfully complete the operation for at least 1 conversation, Code will return 0, indicating success. Please refer to the specific information in FailList to understand the details of the failed operations.
  • If all operations for the conversations fail, Code will return the corresponding return code. Please refer to the Return codes for details.
MessageStringDescription of the request result.
RequestIdStringRequest ID.
FailListArray of UserFailList

List of users for whom the conversation marker failed.

  • Code is 0:
    • FailList is empty, indicating that the conversation marker operation was successful for all users.
    • FailList is not empty, indicating that the conversation marker operation failed for some users. Please refer to SubCode and SubMessage in FailList for details.
  • Code is not 0:
    • FailList is empty, indicating parameter error, interface rate limit, or system error.
    • FailList is not empty, indicating that the conversation marker operation failed for all users.

UserFailList Description

ParameterTypeDescription
SubCodeNumberUsed to identify the result of a conversation marking operation performed for a user.
SubMessageStringDescribes the result of a conversation marking operation performed for a user.
UserIdStringID of the target user for whom the conversation marking operation is performed.
FailListArray of ConvMarkFailList

Failed target conversation list of marking operations for the target user.

  • If SubCode is 0:
    • FailList is empty, indicating that all conversation marking operations for the target user were successfully operated on.
    • FailList is not empty, indicating that some conversation marking operations for the target user failed. Please refer to the Code and Message in FailList for handling.
  • If SubCode is not 0:
    • FailList is empty, indicating parameter error, interface rate limit, or system error.
    • FailList is not empty, indicating that all conversation marking operations for the target user failed.

ConvMarkFailList Description

ParameterTypeDescription
CodeNumberReturn code.
MessageStringDescription of the failed operation.
ConvIdStringConversation ID.
ConvTypeNumberType of conversation.
  • 0: One-on-one conversation.
  • 2: Group conversation.

Sample response

Untitled
{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782",
    "FailList": [
        {
            "SubCode": 0,
            "SubMessage": "succ",
            "UserId": "UserA",
            "FailList": [
                {
                    "Code": 1,
                    "Message": "mark content is invalide",
                    "ConvId": "conv_id_1",
                    "ConvType": 0
                },
                {
                    "Code": 1,
                    "Message": "mark content is invalide",
                    "ConvId": "conv_id_2",
                    "ConvType": 0
                }
            ]
        },
        {
            "SubCode": 1,
            "SubMessage": "user not exist",
            "UserId": "UserB"
        }
    ]
}
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 CodeDescriptionSolution
660000001

Business related general error.

Please try again or contact ZEGOCLOUD Technical Support.
660000002The parameter entered is missing or invalid. Please check the parameters.
660300005The frequency of calling the interface exceeds the limit at the AppID level.Please try again later.
660800001Error querying user information.Please contact ZEGO technical support.
660800054Marking operations for all conversations have failed.Please contact ZEGO technical support.

Previous

Query the message list of group chats

Next

Obtain a license