The BlendVision Chatroom system uses a different access token from BlendVision One. To access the Chatroom APIs, you must acquire a separate access token. You must obtain the API token from BlendVision One to acquire the chatroom token. For more information about the API token, see Authentication.
Create a Chatroom (Optional)
If you don't already have a chatroom, you can create one by sending a POST request to the following API:
POST /bv/chatroom/v1/chatrooms
A successful response will contain an id
, which is the ID of the created chatroom.
Create a Chatroom Token
To create a chatroom token, send a POST request to the following API:
POST /bv/chatroom/v1/chatrooms/{id}/tokens
Replace {id}
with the ID of your chatroom.
The request body should contain the following parameters:
Name | Type | Required | Description |
role |
string | No | The role of the token. Default is ROLE_VIEWER if not provided. Allowed values: ROLE_VIEWER , ROLE_ADMIN
|
device_id |
string | No | The device identifier of the token. Default is a generated UUID string if not provided |
subject |
string | No | The user identifier of the token. Default is a generated guest UUID string if not provided |
Here is an example of a request in Curl
:
curl --request POST \ --url https://api.one.blendvision.com/bv/chatroom/v1/chatrooms/id/tokens \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'authorization: Bearer <chatroom-token>' \ --data '{ "role": "ROLE_ADMIN", "device_id": "string", "subject": "string" }'
To manage the chatroom, the role
field must be ROLE_ADMIN
.
A successful response will return the chatroom token and other details:
{ "endpoint": "string", "authorizer": "string", "token": "string", "signature": "string", "chat": { "pub": "string", "sub": "string" } }