See Spaces for an explanation of "what is a Space?"
Depending on your business operations, our integration offers two unique approaches to consider:
There are no additional costs incurred for the number of Spaces you create, but depending on the age of the Spaces there may be charges incurred for storage of the Session Playbacks for those Spaces.
There are a few requirements to consider before creating a Space, which are outlined below:
The Launch endpoint requires the id key to be populated. The id key uniquely identifies the Space and can be an identifier of your choosing, with a maximum length of 64 characters.
A response with a status code of 201 indicates that a new Space has been created. If a Space with the corresponding id already exists for your organisation, a status code of 200 will be returned and the details of the existing Space will be retrieved.
{
"id": "biology101-2023"
}
You can include Leader Mode in the Space configuration by including the user object in the payload. The user object has multiple settings with which you describe the rights and identity of the users who will be joining the Space via the returned client_url parameter. For now we will create a Leader as the returned client_url which, in our scenario, will be used by the Teacher.
See more about the client_url parameter below.
A leader or a general user (student) can be added to a Space at any future date. It is, however, more convenient to perform this when the Space is first being created and thus reduces the number of calls to the Launch endpoint.
{
"user": {
"id": "Teacher_1",
"name": "Peter Parker",
"role": "teacher",
"leader": true, // Enabling Leader Mode
"custom_jwt_parameters": {
"meta": {
"displayName": "Spiderman"
}
}
}
}
The Lessonspace API provides the option to assign webhooks which can communicate real-time metrics such as user joins, session ends, etc. to your system.
Webhooks are set using the Launch endpoint. For full details on webhook configuration, events, and payloads, see Webhooks.
{
"webhooks": {
"session": {
"start": "<endpoint-url>",
"end": "<endpoint-url>"
},
"user": {
"join": "<endpoint-url>",
"leave": "<endpoint-url>"
}
}
}
Given the above, an example of the body for a POST to the Launch endpoint can be seen below. This will create a Space with the following configuration (following the configuration as mentioned above):
client_url will be for the Teacher "Peter Parker" who will have Leader Mode enabled (leader set to true)Other useful ids could be some sort of relationship identifier for the people intended to join the Space, e.g. teacher123_student456. You could also use a term (as in our case) that identifies the lesson or course at hand, e.g. biology101_2023.
{
"id": "biology101_2023",
"user": {
"id": "Teacher_1",
"name": "Peter Parker",
"role": "teacher",
"leader": true, // Enabling Leader Mode
"custom_jwt_parameters": {
"meta": {
"displayName": "Spiderman"
}
}
},
"webhooks": {
"session": {
"start": "<endpoint-url>",
"end": "<endpoint-url>",
"idle": "<endpoint-url>"
},
"user": {
"join": "<endpoint-url>",
"leave": "<endpoint-url>",
"idle": "<endpoint-url>"
}
}
}
It is possible to have multiple potential leaders in a Space but we do not recommend this. Having multiple users leading at the same time will often lead to undesirable behaviour.
Below is a demo example using cURL, copy and paste it to give it a try - webhooks omitted:
curl \
http://api.thelessonspace.com/v2/hello{
"request": {
"method": "POST",
"url": "https://api.thelessonspace.com/v2/spaces/launch/",
"headers": [
{
"name": "Authorization",
"value": "Organisation YOUR_API_KEY"
}
],
"postData": {
"mimeType": "application/json",
"text": "{\"id\": \"biology101_2023\", \"user\": {\"id\": \"Teacher_1\", \"name\": \"Peter Parker\", \"leader\": true, \"custom_jwt_parameters\": { \"meta\": { \"displayName\": \"Spiderman\" }}}}"
}
},
"response": {
"status": 200,
"httpVersion": "HTTP/2",
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"content": {
"text": "{\"client_url\": \"https://go.room.sh/...\", \"api_base\": \"https://ew2-aa.room.sh/v1/room/\", \"room_id\": \"uuid\", \"secret\": \"uuid\", \"session_id\": \"uuid\",\"user_id\": \"int\"}",
"mimeType": "application/json"
}
}
}
Upon a successful Launch request, you will receive a JSON object similar to the following:
{
"client_url": "https://go.room.sh/...",
"api_base": "https://<region>.room.sh/v1/room/",
"room_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // uuid
"secret": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // uuid
"session_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // uuid
"user_id": 1 // integer
}
Now if you put the client_url in your browser, you will open your Space!
A little information about the returned object now follows (with a big focus on the client_url):
client_url refers to the raw URL of the Space itself (this url will contain go.room.sh). This URL has all of the settings specified by the user object encoded as parameters, along with any feature configuration you've specified. This allows you to create additional user-specific client_urls for your Spaces depending on user requirements.It is important to understand that the returned client_url uses all your default organisation settings if they are not set the in body of the POST request. This means that the URLs will contain the settings (state) of your organisation on creation and not when they are being used. If you create a link and change the organisation settings later these will not be applied to the old client_url; you will need to call the Launch Endpoint with the same Space ID again in order to apply the updated settings.
api_base the endpoint used for all live sessions. This is region-specific and will automatically find the nearest server to you for low latency (unless explicitly overridden in the Launch parameters).room_id this UUID is used to identify your space within our backend (which manages sessions and whiteboard). It is the same identifier used for the Space in the Lessonspace API.secret token to ensure all calls to our backend are authenticated.session_id refers to the ID of the upcoming session. This ID will only change once a session has started and subsequently ended. Subsequent calls will then generate a new session_id.user_id is the unique identifier assigned to the user. This references the user record in Lessonspace database.This client_url must be kept private and is only for use by the Tutor/Teacher assigned to the Space. See more about Leader Mode below.
A user with leader mode enabled will be given certain privileges over standard users, including the ability to invite others, end sessions, control participant audio/video, and initiate read-only mode.
For full details on Leader Mode capabilities and usage, see Leading Mode.
Leader mode is not designed as a security mechanism. By using the Javascript console, any peer could disable it and move around the Space freely.