Skip to main content

Pin a channel

Pin or unpin a channel for a specific user.

The server persists the pin status. Pin status set from the client is synced to the server and automatically synchronized when switching devices.

You can also set pin status via the Platform Chat API. After the change takes effect, the updated pin status is automatically synced to the client SDK, and you can use it to update the UI.

Request

POST: https://[Base URL](/platform-chat-api/base-url)/v4/channel/pin/set

Rate limit: 100 per second

Signature: Required. See API request signature.

Request body

Content type: application/json

ParameterTypeRequiredDescription
userIdStringYesThe user ID that the channel belongs to.
channelTypeStringYesChannel type. Supported values: 1 (Direct channel), 3 (Group channel), 6 (System channel).
channelIdStringYesTarget ID. Depending on the channel type, this is the other user's ID (direct), group ID (group), or system target ID (system).
isPinBooleanYesWhether to pin. true to pin; false to unpin.

Request example

HTTP
POST /v4/channel/pin/set HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json

{
"userId": "XivuFwkcl",
"channelId": "RfqHbcjes",
"channelType": 1,
"isPin": true
}

Response

FieldTypeDescription
codeNumberReturn code. 0 indicates success.

Response example

HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{"code":0}