In this guide you will learn how to get started with Symbl’s native Streaming API, which is our most accurate API for conversation analysis. Symbl's Streaming API is an API for enabling real-time conversational analysis on voice, video, or chat, or any live streaming directly through your web browser. If you have voice, video, or chat enabled, Symbl's API for streaming enables you to tap the raw conversational data of those streams.
You can view the complete code sample for this tutorial on GitHub:
NOTE: The code sample you use today runs entirely in the browser without Node.js.
In this guide you will learn the following:
- Getting Started
- Create the WebSocket
- Create the Audio Stream
- Stopping the WebSocket Connection
- Grabbing the Conversation ID
- Full Code Sample
The first thing you want to do is create the endpoint for the WebSocket to connect to. The WebSocket endpoint has two parts:
- A unique meeting ID. The unique meeting ID is used to connect each client to the same namespace. It can be any string of your choosing.
- A GET parameter named
access_token. This is the access token generated during our Authentication process.
Check the example below:
Now that you have constructed the endpoint, let's create a new WebSocket!
Before you connect the WebSocket to the endpoint you first want to subscribe to its event listeners so you don’t miss any messages.
Once the connection has been opened you want to send this message to the WebSocket to start the connection to the Streaming API.
Check out our guide on the Best Practices for Audio Integrations with Symbl to learn more about our audio encoding options.
Once the connection to the Streaming API is set up, the next step is creating an audio stream.
You can do this with the
Navigator API by accessing
mediaDevices and calling
This will allow you to grant the browser access to your computer's microphone.
Now that you have granted access to the microphone you can actually use the
WebSocket to handle the data stream so transcripts and insights can be analyzed in real-time.
You can do this by creating a new
AudioContext and using the microphones stream you retrieved
from the Promise resolution above to create a new source and processor.
To stop the WebSocket connection once you're done, run this code in your web browser:
To verify and check if the code is working open up your browser's development environment and copy the code directly into the console. You'll see the popup for microphone permissions and if you accept the application will start recording. Start speaking to see the results being logged to the console.
The Conversation ID is very useful for our other APIs such as the Conversation API. We don't use it in this example because it's mainly used for non-real-time data gathering, but it's good to know how to grab it as you can use the Conversation ID later to extract the conversation insights.
If you look closely at the
onmessage handler you can see how to get the Conversation ID:
With the Conversation ID you can do each of the following (and more!):
View conversation topics
Summary topics provide a quick overview of the key things that were talked about in the conversation.
View action items
An action item is a specific outcome recognized in the conversation that requires one or more people in the conversation to take a specific action, e.g. set up a meeting, share a file, complete a task, etc.
This is a category of action items with a connotation to follow-up a request or a task like sending an email or making a phone call or booking an appointment or setting up a meeting.
Here's the complete code sample below which you can also view on GitHub:
If you properly implemented the code, the code runs in the browser without anything else.