Skip to main content

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

ParameterTypeRequiredDescription
fromUserIdStringYesSender user ID.
messageTypeStringYesMessage type. See Message type overview.
contentStringYesMessage content, max 128 KB.
disableUpdateLastMsgBooleanNoPrevent 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

PropertyTypeDescription
codeNumberStatus code. 0 indicates success.
resultObjectResponse data.
result.messageUIDStringBroadcast 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"
}
}