Add channels to a tag
Add one or more channels to a specified tag. A single channel can belong to multiple tags. Each tag can contain up to 1,000 channels.
tip
- You must create the tag first using Create user channel tags.
- When a tag exceeds 1,000 channels, the oldest channel is automatically removed.
- Max 100 channels per request.
- Supported channel types:
1(Direct channel),3(Group channel),6(System channel).
Request
POST: https://[Base URL](/platform-chat-api/base-url)/v4/channel/tag/add
Rate limit: 100 per second
Signature: Required. See API request signature.
Request body
Content type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | String | Yes | The user ID. |
tagId | String | Yes | Tag ID. Must be an existing tag. You can verify via List user channel tags or create one via Create user channel tags. |
channels | Object[] | Yes | Channel list. Max 100 per request. |
channels[].channelId | String | Yes | Target ID. Depending on the channel type, this is the other user's ID, group ID, or system target ID. |
channels[].channelType | Number | Yes | Channel type. 1 (Direct channel), 3 (Group channel), 6 (System channel). |
Request example
HTTP
POST /v4/channel/tag/add HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json
{
"userId": "testUserId",
"tagId": "tag1",
"channels": [
{
"channelId": "user1",
"channelType": 1
},
{
"channelId": "group1",
"channelType": 3
}
]
}
Response
| Field | Type | Description |
|---|---|---|
code | Number | Return code. 0 indicates success. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{"code":0}