Room API
You can also manage rooms via API.
Create room
Endpoint https://chatbackend.watchers.io/external/room
Request payload
Parameter | Type | Required | Description |
---|---|---|---|
roomId | string | Yes | Unique room ID |
name | string | Yes | Room name shown in the admin panel |
about | string | Yes | Room description, used for scheduled rooms |
isSpeak | boolean | Yes | Enables voice chat in the room |
startTime | string | No | Room start time. Format: 2024-12-31 05:33:32 |
endTime | string | No | Room end time. Format: 2024-12-31 05:33:32 |
streamUrl | string | No | Optional. External livestream URL (Vimeo, YouTube Live, etc.) |
If startTime
is provided, the room will be scheduled with the status SOON and will automatically switch to LIVE at the specified time.
If endTime
is provided, the room will automatically switch to the status ENDED at the specified time.
If streamUrl
is provided, an embedded video player will be displayed inside the room on the frontend.
CURL example
curl -X 'POST' \
'https://chatbackend.watchers.io/external/room' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {Api key of project from admin panel}' \
-H 'Authorization: Bearer {Bearer token from admin panel}' \
-d '{
"roomId": "liveevent123",
"name": "Live Conference",
"about": "Annual keynote",
"isSpeak": true,
"startTime": "2024-06-19T08:00:00.000Z",
"endTime": "2024-06-19T21:00:00.000Z",
"streamUrl": "https://player.vimeo.com/video/12345678"
}'
Get room
Endpoint https://chatbackend.watchers.io/external/room/:roomId
GET parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomId | string | Yes | Unique room ID |
CURL example
curl -X 'GET' \
'https://chatbackend.watchers.io/external/room/321textroom321' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {Api key of project from admin panel}' \
-H 'Authorization: Bearer {Bearer token from admin panel}'
Enable Voice in room
Endpoint https://chatbackend.watchers.io/external/room/speak
Request payload
Parameter | Type | Required | Description |
---|---|---|---|
roomId | string | Yes | roomid |
isSpeak | boolean | Yes | Enables or disables voice in room |
CURL example
curl -X 'POST' \
'https://chatbackend.watchers.io/external/room/speak' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {Api key of project from admin panel}' \
-H 'Authorization: Bearer {Bearer token from admin panel}' \
-d '{
"roomId": "321textroom321",
"isSpeak": false
}'
Change room status
Endpoint https://chatbackend.watchers.io/external/room/status
Request payload
Parameter | Type | Required | Description |
---|---|---|---|
roomId | string | Yes | Room ID |
status | enum | Yes | One of: LIVE , SOON , ENDED , DISABLED |
streamUrl | string | No | Optional. Update external video URL |
CURL example
curl -X 'POST' \
'https://chatbackend.watchers.io/external/room/speak' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {Api key of project from admin panel}' \
-H 'Authorization: Bearer {Bearer token from admin panel}' \
-d '{
"roomId": "321textroom321",
"isSpeak": false,
"streamUrl": "https://player.vimeo.com/video/87654321"
}'
Delete room
Endpoint https://chatbackend.watchers.io/external/room/:roomId
GET parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomId | string | Yes | roomid |
CURL example
curl -X 'DELETE' \
'https://chatbackend.watchers.io/external/room/321textroom321' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {Api key of project from admin panel}' \
-H 'Authorization: Bearer {Bearer token from admin panel}'
Updated 26 days ago