Server APIs v2

Send a Broadcast Message

Update Time:2021-10-25 17:41

1 Description

Sends a Broadcast Message to a room, which will be delivered to all users in the room.

On the client side, the ZEGO Express SDK will trigger the following callback when it receives a Broadcast Message:

Platform ZEGO Express SDK callback
iOS/macOS onIMRecvBroadcastMessage
Android onIMRecvBroadcastMessage
Windows onIMRecvBroadcastMessage
Web IMRecvBroadcastMessage

2 Request method and endpoint

  • Request method: GET
  • Request endpoint:
  • Transmission protocol: HTTPS
  • Rate limit (Rooms with the same AppID): 100 requests/second (Testing environment: 10 requests/second)

3 Request parameters

Listed below are the parameters specific to this request and part of the public request parameters. For the complete list of public request parameters, see Server APIs public request parameters.

Parameter Type Required Description
RoomId String Yes Room ID.
UserId String Yes User ID of the message sender.
UserName String No User name of the message sender.
MessageCategory Int Yes Message type.
  • 1: System Message
  • 2: Chat Message
MessageContent String Yes Message content, with a maximum length of 1024 bytes.

4 Request example
&<Public Request Parameters>

5 Response parameters

Parameter Type Description
Code Number Return code.
Message String Description of the request execution result.
RequestId String Request ID.
Data Object Returned data.
└ MessageId Number Message ID.

6 Response example


7 Return codes

Listed below are the return codes related to this API. For the complete list of return codes, see Return codes.

Return code Description
50001 Room does not exist.
  • When there are no users in a room, the room will be automatically destroyed by the SDK.
  • When there is only one user in a room and the user exits or is kicked out of the room, the room will be automatically destroyed by the SDK.
  • When a room's heartbeat request times out by 100 seconds, the room will be destroyed by the SDK.
50002 User ID does not exist.
50003 Failed to get online user count.
50004 Failed to get user information.
50011 The number of recipients of the custom message has exceeded the limit.
50012 The length of the custom message has exceeded the limit.
50013 Failed to send custom message.