Broadcast to online users
Broadcast a system channel message to all currently online users.
- Uses a polling mechanism — online recipients receive the message within 3 minutes.
- Offline users who come online within 10 minutes of sending can still receive the message. After 10 minutes, the message is no longer available.
- Server-side history storage is not supported for online broadcasts.
- Online broadcast messages cannot be recalled.
tip
- Broadcast messages use a polling mechanism. The SDK fetches the message within 3 minutes.
- Offline users who reconnect within 10 minutes can receive the message.
Prerequisites
Enable the Broadcast Service for the current App Key. See Broadcast service configuration. Returns error 1009 if not enabled.
Request
POST: https://[Base URL](/platform-chat-api/base-url)/v4/system-channel/message/broadcast-online
Rate limit: 60 per minute
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. |
messageType | String | Yes | Message type. See Message type overview. |
content | String | Yes | Message content, max 128 KB. |
disableUpdateLastMsg | Boolean | No | Prevent updating the last message in the channel list. |
Request example
HTTP
POST /v4/system-channel/message/broadcast-online HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Timestamp: 1585127132438
Nonce: 14314
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json
{
"fromUserId": "2191",
"messageType": "RC:TxtMsg",
"content": "{\"content\":\"hello\"}"
}
Response
| Property | Type | Description |
|---|---|---|
code | Number | Status code. 0 indicates success. |
result | Object | Response data. |
result.messageUID | String | Broadcast message ID. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 0,
"result": {
"messageUID": "XXXX-JJJJ-KKK-LLLL"
}
}