Realtime Output with PSTN Dialing using Symbl's Javascript SDK
In this example let's walk through how to get the real-time transcription and insights events in a Telephone call.
Throughout the documentation you'll find various references to these variable names, which you will have to replace with your own values:
Key | Description |
---|---|
APP_ID | The application ID you get from the home page of the platform. |
APP_SECRET | The application secret you get from the home page of the platform. |
AUTH_TOKEN | The JWT you get after authentication with Sybml. |
YOUR_PHONE_NUMBER | A phone number that you want the API to connect to. Be sure to include the country code. |
EMAIL_ADDRESS | The email address you wish to send the summary email to. |
#
Getting startedIn order to get started using this API, you need to sign up for the Symbl Developer Platform and receive your API credentials.
For this example you will be using Node.js and the Symbl Javascript SDK. You can install this using the Node Package Manager:
You can then use the library within your project like this:
Initliaze the SDK:
Open up the connection and pass the configuration options:
You'll notice various configuration options available such as endpoint
, insightTypes
, and actions
.
#
EndpointsThis example uses a PSTN connection but you can also connect via SIP:
#
Insight TypesSymbl provide various insights from the call. Main insights categories are
question
and action_item
. In order to include insights in processing, you
need to specify them in configuration like so:
#
ActionsYou can specify different actions to happen during the call. you will define just one, which defines an email which Symbl will use to send a summary email of the conversation to.
#
Getting the Connection IDFor subscribing to the data, we will need to use connectionId
unique to each
active connection. to get it you can simply retrieve it from connection
response:
#
Realtime insightsFor subscribing to the data, you will need to use connectionId
unique to each
active connection. to get it you can simply retrieve it from connection
response:
After you have the connection ID you can use that to subscribe to our connection:
data
is an object with a type
field. Supported types are transcript_response
,
insight_response
and message_response
.
For real time trasncription you want to check for transcript_response
.
Transcripts are changing all the time, but once they are processed into reasonable message and not just words, you will get a message_response
which you will want to handle:
And finally if there will be any question or action item during conversation, you will get insight_response
:
#
Speaker separizationWe can send different speaker events to our connection indicating that different speakers started speaking. That will give us more personalised insights and get better meeting summary
In our example we will do it by calling helper getScheduleEvent
function, that
we will review in a bit. We pass SpeakerEvent type to it by using
SpeakerEvent.types
enum from symbl-node
, passing user data and timestamp:
We retrieve users just from the global array of users but in real world example that might be users data retrieved from database:
In order to push event to our connection we will create an event like so:
And push it using pushEventOnConnection
function provided by SDK:
This example just touches the surface of what you can do with our Streaming API. If you would like to learn more about it you can visit the Streaming API documentation.