Send Message
POST {{HOST}}/v2/active-rooms/<room_id>/send-message
You can use this API to send messages to a single peer, a set of peers (a particular role), or all connected peers in the active room. This API supports arguments such as peer_id
and role
to implement this.
peer_id
is specified -- message will be sent only to the specified connected peer.role
is specified -- message will be sent to all the connected peers assigned with that particular role.peer_id
and role
are specified -- preference will be given to the peer_id and the message will be sent only to the specified connected peer.peer_id
and role
are not specified -- message(broadcast) will be sent to all the connected peers.Arguments
Name
Type
Description
Required
room_id
— path paramstring
Unique identifier of the room where the peer is active.
Example: 627cda81ab4f3b56a077dc33Yes
message
— body paramstring
Actual message to be sent.
Yes
peer_id
— path paramstring
Unique identifier of the peer/participant for which you wish to send the message.
Example: 1038fa72-9345-4651-beab-436f9242ebf4No
role
— body paramstring
You can use this to send the message to a set of peers (a particular role).
No
type
— body paramstring
Indicates the type of message sent, for example, chat or emoji.
No
Why would you use this API?
Example1 - Inform unavailability of teacher
Example2 - Poker handler
peer.join.success
webhook event. Let's consider below scenario:
peer_id
: 018b84da-0786-48c5-a3a6-02961d9eac03
, // will send the data only to peerid specified.
message
: ",
type:
customevent"
}
message
: ", // will send the data to all the peers in the active room as peer_id or role is not specified.
type:
custom_event"
}
Body
PARAM
Key | Datatype | Required | Description |
HEADERS
Key | Datatype | Required | Description |
RESPONSES
status