In this guide, we will learn how to use the SquadCast API to get current sessions in a NodeJS application. The SquadCast API supports many languages, you can view different examples in your preferred language over at the API Reference Page. For this guide, we will use NodeJS Back end to listen to events and create a new session.
âšī¸Â Heads Up In order to create a new API Key, you will need to be an Administrator of the Organization you wish to use in order to access the API requests and properly create an Auth Token.
đ API Authentication
Before being able to access the API we need to register an API Key on our SquadCast Account.
- Login to https://app.squadcast.fm and navigate to https://app.squadcast.fm/account/developers. Create a new API Key.
đ¨ Be sure to keep this API key Secret.
- Authentication to the API is performed via bearer auth. Provide your API secret key as the
Authorization
header’s value, for exampleBearer YOUR_API_KEY
.curl –location –request GET 'https://api.squadcast.fm/v1/sessions' \
–header 'Authorization: Bearer YOUR_API_KEY'Curl Example GET Sessions Request
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.squadcast.fm/v1/sessions',
'headers': {
'Authorization': 'Bearer YOUR_API_KEY'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});Curl Example GET Sessions Request
đĒ Webhooks
The SquadCast API supports custom Webhooks that allow users to receive and listen to different events provided by the API. These events include:
Event | Example Payload |
---|---|
recording_session.createdReturns a payload with detailed information on the new session scheduled. |
{
"event": "recording_session.created", "id": "sessionID", "date": "2021-12-13", "startTime": "12:00 PM", "endTime": "1:00 PM", "timeZone": "America/New_York", "title": "Test Recording Session", "links": { "host": "https://app.squadcast.fm/hostLink" "guest": "https://app.squadcast.fm/guestLink" } } |
recording_session.deletedReturns a payload when a session is deleted with the sessionID |
{
"event": "recording_session.deleted", "id": "sessionID" } |
recording_session.updatedReturns a payload with detailed information when a session’s information is updated. |
{
"event": "recording_session.updated", "id": "sessionID", "date": "2021-12-13", "startTime": "12:00 AM", "endTime": "1:00 PM", "timeZone": "America/New_York", "title": "Test Recording Session", "links": { "host": "https://app.squadcast.fm/hostLink" "guest": "https://app.squadcast.fm/guestLink" } } |
audio.renderedReturns a payload with audio rendered information |
{
"event": "audio.rendered", "wav": "https://storage/file_mastered.wav", } |
audio.masteredReturns a payload with audio information of a mastered track |
{
"event": "audio.mastered", "wav": "https://storage/file_mastered.wav", } |
audio.mixedReturns a payload with audio information of a mixed track |
{
"event": "audio.mastered", "wav": "https://storage/file_mastered.wav", } |
video.renderedReturns a payload with video information of a rendered video recording |
{
"event": "video.rendered", "mp4": "https://storage/file_mastered.mp4", } |
In order to create a webhook we can follow these steps:
- Navigate to your Account page and select Developers within the left side navigation
- Click the Create Webhook button
- Input the Webhook URL that you would like to send your data to
- The URL must be accessible over HTTPS
- The URL cannot be served from localhost, we recommend Localtunnel for testing purposes
- Check the box to the left of one or more Webhook Events that you would like to send your data
- Click the Create button to save your Webhook
Delivery
- If webhooks URLs do not respond with HTTP status code 200 or the request times out, we will retry the request
- We will continue to retry the request for a few minutes with an exponential backoff strategy
Jeanâs a senior software engineer at SquadCast; working with the latest software technology in the industry. Aiming to bring collaboration, engineering, and team leadership to SquadCast.