Skip to main content

Receive Speech to Text for a different language in a conversation

This example goes over how you can use the Symbl Telephony API to receive a speech-to-text transcription Íof a conversation in many different languages. This example uses both the Symbl's Javascript SDK and native Javascript.

info

Currently, the PSTN connection requires a US phone number. You can use a SIP connection to connection to a SIP URI instead. Learn more about how to connect using SIP.

Connect#

When we're connecting to the Web Socket, we can define which language we use in the configuration. Here we will set the languageCode key to Spanish (es-US). You can view the full list of supported languages here. After you make the connection the phone number you specified will be dialed and you can begin speaking in the language you specified.

Once the connection is finished you will receive a Conversation ID which you can use with our Conversation API to get a speech-to-text transcription. You can learn how to receive speech-to-text from the Conversation API here.

Configuration Snippet#

Here you set the language key to Japanese: "languages": ["ja-JP"], and the timezone to Tokyo: "timezone": "Asia/Tokyo".

{
"operation": "start",
"endpoint": {
"type" : "pstn",
"phoneNumber": "phoneNumber"
},
"languages": ["ja-JP"],
"timezone": "Asia/Tokyo",
"actions": [{
"invokeOn": "stop",
"name": "sendSummaryEmail",
"parameters": {
"emails": [
"user@example.com"
]
}
}],
"data" : {
"session": {
"name" : "My Meeting"
}
}
}

Full Code Example#

info

The Symbl SDK (Node.js) snippet must be run using Node.js, while the Native Javascript snippet can be run in your web browser.

curl -k -X POST "https://api.symbl.ai/v1/endpoint:connect" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-KEY: $AUTH_TOKEN" \
-d $'{
"operation": "start",
"endpoint": {
"type" : "pstn",
"phoneNumber": "'$PHONE_NUMBER'" #
},
"languages": ['ja-JP'],
"timezone": "Asia/Tokyo",
"actions": [{
"invokeOn": "stop",
"name": "sendSummaryEmail",
"parameters": {
"emails": [
"'$EMAIL_ADDRESS'"
]
}
}],
"data" : {
"session": {
"name" : "My Meeting"
}
}
}'

Testing#

Open up your shell terminal and copy in the command. Replace the placeholder values with the proper values and hit enter.

Running this code should connect our API to your phone call. Once the call is completed you will receive an email that details the conversation and provides you with a transcription and Insights about the call.

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