logo
Video Call
Server API
Stream Mixing and Transcoding APIs
On this page

SendBroadcastMessage

GET

https://rtc-api.zego.im/

Call this interface to send broadcast messages in a room, i.e., send text messages to all users in the same room.

Clients receive messages using ZEGO Express SDK callback interfaces:

ZegoExpress SDKLiveRoom SDK
iOS/macOSonIMRecvBroadcastMessageonRecvRoomMessage
AndroidonIMRecvBroadcastMessageonRecvRoomMessage
WindowsonIMRecvBroadcastMessageOnRecvRoomMessage
WebIMRecvBroadcastMessageonRecvRoomMsg
Rate Limit
All rooms under the same AppID: 100 requests/second (test environment: 10 requests/second)
Warning
  1. When sending a message from the server using a specific User ID, the client using the same User ID will not receive that message, meaning the sender cannot receive the message they sent.
  2. If developers need all users in the room to receive the message, when calling this interface, a User ID other than those in the room should be used.
  3. The User ID used does not need to log in to the room to send messages directly.

Request

Query Parameters

    Action stringrequired

    Possible values: [SendBroadcastMessage]

    Interface prototype parameter

    https://rtc-api.zego.im?Action=SendBroadcastMessage

    AppId uint32required

    💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.

    SignatureNonce stringrequired

    💡Common parameter. A 16-character hexadecimal random string (hex-encoded 8-byte random number). For the generation algorithm, refer to the signature example.

    Timestamp int64required

    💡Common parameter. Current Unix timestamp in seconds. For the generation algorithm, refer to the signature example. A maximum deviation of 10 minutes is allowed.

    Signature stringrequired

    💡Common parameter. Signature used to verify the legitimacy of the request. Please refer to the signature mechanism to generate it.

    SignatureVersion stringrequired

    Possible values: [2.0]

    Default value: 2.0

    💡Public parameter. Signature version number.

    RoomId stringrequired

    Room ID.

    UserId stringrequired

    Sender User ID.

    UserName string

    Sender username (corresponds one-to-one with UserId).

    MessageCategory uint32required

    Possible values: [1, 2]

    Message category. 1: System message. 2: Chat message.

    MessageContent stringrequired

    Possible values: <= 1024 characters

    Message content, length cannot exceed 1024 bytes. When using, URL encoding (UrlEncode) must be performed on the content.

Responses

Operation successful
Schema
    Code int32

    Return code. Only part of the return codes related to the interface business logic are listed below. For complete return codes, please refer to Global Return Codes.

    Return CodeDescriptionSuggested Action
    121Failed to save broadcast message.-
    122Failed to generate message ID.Please retry, or contact ZEGOCLOUD technical support for assistance.
    151Failed to push broadcast message.Please retry, or contact ZEGOCLOUD technical support for assistance.
    5201Failed to encode broadcast message.Please retry, or contact ZEGOCLOUD technical support for assistance.
    5202Failed to generate message ID.Please retry, or contact ZEGOCLOUD technical support for assistance.
    50012Message length exceeds limit.Please check if the parameter length exceeds the limit.
    Message string

    Operation result description.

    RequestId string

    Request ID.

    Data object
    MessageId integer

    Message ID.

Previous

Global Return codes

Next

SendBarrageMessage

On this page

Back to top