logo
In-app Chat
Powered Byspreading
On this page

Pin or unpin conversations to or from the top


Overview

You can call this operation to batch pin or unpin up to 20 conversations to or from the top for a user. If you need a higher limit, contact ZEGOCLOUD technical support.

The client receives the change for conversations being pinned or unpinned in the following ZIM SDK callbacks.

iOSAndroidmacOSWindows
conversationChangedonConversationChangedconversationChangedonConversationChanged
WebFlutterReact NativeUnity3D
conversationChangedonConversationChangedconversationChangedOnConversationChanged

Operation prototype

  • Request method: POST
  • Request URL: https://zim-api.zego.im/?Action=ConvPinned
  • 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 conversations are to be pinned or unpinned.
ConvListArrar of ObjectYesThe list of conversations. By default, up to 20 conversations can be included.
└ConvIdStringYesThe conversation ID.
  • In a one-to-one chat, set conversationID to the ID of the other user.
  • In a group chat, set conversationID to the ID of the group.
└ConvTypeNumberYesThe conversation type. Valid values:
  • 0: one-to-one chat.
  • 2: group chat.
PinnedTypeNumberYesSpecifies whether to pin conversations to the top. Valid values:
  • 0: no.
  • 1: yes.
Note

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

Sample request

  • Request URL:

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

    Untitled
    {
        "FromUserId": "user0",
        "ConvList": [
            {
                "ConvId": "user1",
                "ConvType": 0
            },
            {
                "ConvId": "user2",
                "ConvType": 0
            }
        ],
        "PinnedType": 1
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumberThe return code.
Note
When you request to pin or unpin multiple conversations, take note of the following items:
  • If one or more conversations are successfully pinned or unpinned, 0 is returned, indicating a success. For more information, see ErrorList.
  • If all conversations fail to be pinned or unpinned, 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, all conversations are successfully pinned or unpinned.
    • If ErrorList is not empty, some conversations fail to be pinned or unpinned. 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, all conversations fail to be pinned or unpinned.
└ConvIdStringThe ID of the conversation that fails to be pinned or unpinned.
└ConvTypeNumberThe conversation type.
└SubCodeNumberThe code returned when the request fails.
└SubMessageStringThe error message.

Sample response

Untitled
{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782",
    "ErrorList": [
        {
            "ConvId": "user1",
            "ConvType": 0,
            "SubCode": 660000002,
            "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.
660800001If a one-to-one chat is to be pinned or unpinned, this indicates that the user in the conversation (ConvID) is not registered.Check whether the user in the conversation (ConvID) is registered. - If so, contact ZEGOCLOUD technical support. - If not, register the user.
660800048Too many conversations are included in the list. The maximum value is 100 and cannot be changed.No handling is required.

Previous

Mute notifications for conversations

Next

Query conversation list