Real-time 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 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 startedTo 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 provides various insights from the call. The main insights categories are
question
and action_item
. To include insights in processing, you
need to specify them in the 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:
#
Real-time 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 separationWe can send different speaker events to our connection indicating that different speakers started speaking. That will give us more personalized insights and get a better meeting summary
In our example, we will do it by calling the helper function getScheduleEvent
, which 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 the 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.
#
Full Code Example#
Running The ExampleCreate a javascript file named app.js and copy this code into the file. Fill in the placeholder values with the proper values. Use npm to install the required libraries: npm install symbl-node. Now in the terminal run
If successful you should receive a response in the console.
info
If you have any questions or concerns about our API, you can join our Support Slack or send us an email at developer@symbl.ai