Send a system channel message
Send a system channel message from a specified user to one or more recipients. System channel messages can only be sent via the server API. Recipients cannot reply to system channel messages.
- Supports built-in and custom message types.
- Send to up to 100 users per request.
- The message type determines push behavior, client display, and local storage.
For example, sending a text message (RC:TxtMsg):
- Online recipients receive the message immediately in a system channel (channel type: SYSTEM) with the sender ID as the channel target.
- Offline recipients receive a push notification (if push is integrated and enabled).
Request
POST: https://[Base URL](/platform-chat-api/base-url)/v4/system-channel/message/send
Rate limit: 100 messages per second. Sending to 100 users in one request counts as 100 messages.
Authentication: All server API requests require signature verification. See API request signing.
Request body
Content type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
fromUserId | String | Yes | Sender user ID. Must have obtained an access token. |
toUserIds | String[] | Yes | Recipient user IDs. Max 100 per request. |
messageType | String | Yes | Message type. Accepts a built-in message type or custom type. Custom types must not start with RC: and must not exceed 32 characters. |
content | String | Yes | Message content, max 128 KB. For built-in types, pass the content JSON serialized as a string. For custom types, any format is accepted. |
pushContent | String | No | Push notification content for offline recipients. Required for notification/signal types and custom types that need push. |
pushData | String | No | Custom data in the push payload. Accessible as appData on iOS and Android. |
shouldPersist | Number | No | Whether to store in cloud message history. 0: no. 1 (default): yes. Requires Direct and Group Channel Cloud Message Storage. |
contentAvailable | Number | No | iOS only. Enables silent push. 1: enable. 0 (default): disable. |
disablePush | Boolean | No | Suppress push notifications. Default: false. |
pushExt | String | No | Push configuration (title, template, provider channels). See pushExt parameters. Ignored when disablePush is true. |
disableUpdateLastMsg | Boolean | No | Whether to prevent updating the last message in the channel list. |
Request example
HTTP
POST /v4/system-channel/message/send HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Timestamp: 1585127132438
Nonce: 14314
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json
{
"fromUserId": "2191",
"toUserIds": ["2191", "2192"],
"messageType": "RC:TxtMsg",
"content": "{\"content\":\"hello\"}",
"pushContent": "thisisapush",
"pushData": "hello"
}
Response
| Property | Type | Description |
|---|---|---|
code | Number | Status code. 0 indicates success. See Server API status codes. |
result | Object | Response data. |
result.messageUIDs | Array | List of message UIDs. |
result.messageUIDs[i].userId | String | Recipient user ID. |
result.messageUIDs[i].messageUID | String | Unique message ID for the corresponding recipient. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 0,
"result": {
"messageUIDs": [
{
"userId": "uid1",
"messageUID": "XXXX-JJJJ-KKK-LLLL"
},
{
"userId": "uid2",
"messageUID": "XXXX-JJJJ-KKK-LLKL"
}
]
}
}