Upload Prerecorded Conversations for Voice Intelligence
Time to read: 3 minutes
With Twilio’s Voice Intelligence product, every call can be a source of data. Keywords and insight are transcribed and plotted to understand customers, with the assurance that regulatory policies are followed. Gone are the days of manually listening to old audio recordings to gather information. In this blog, we’ll cover uploading audio recordings and using voice intelligence to transcribe and gather information from the call.
Prerequisites
- A Twilio account - sign up for a free Twilio account here
- A Twilio phone number with Voice capabilities - learn how to buy a Twilio Phone Number here
- Node.js (version 18 or above) installed - download Node.js here
- An AWS account if you do not have a pre recorded conversation
Setup
If you don't have a pre-recorded conversation handy but want to follow along, you can create one with a friend. (Remember to give your friend notice that you will record the conversation!)
The following steps will guide you through the process. If you have a dual-channel recorded call handy, proceed to the section titled “Create a Voice Intelligence Service in the Twilio Console”.
Record and download a call
Follow this blog to buy a Twilio number and set up a call forwarding feature. This way your Twilio number will act as a proxy when contacting your friend. When setting up the Connect Call To widget, make sure Record Call is toggled ON. Publish your Flow, assign it to a Twilio number, and you're ready to make your call!
Once the call has terminated, head to the left panel of the Console and select Monitor > Logs > Call Recordings. Click on the recording that you'd like to download and download the WAV format.
Upload the recording to an AWS S3 bucket
Once downloaded, head over to AWS and create an S3 bucket. Upload the recording as an object in the bucket.
In your S3 bucket, select the recording object, click on the Actions drop down menu and select Share with a pre-signed URL. For its desired expiration time, 2 hours is recommended. Finalize the creation of the pre-signed URL by clicking the submit button, then a confirmation should appear with its URL automatically copied to your clipboard.
Create a Voice Intelligence Service in the Twilio Console
Head to the Twilio Console and navigate to Voice Intelligence/Services . Create a new Service and give it a unique name. Services use AI to analyze phone calls for keywords and determine intent. All selections when creating a Service are optional.
After your Service is created, select any prebuilt language operators provided by Twilio and create any language operators you'd like to include.
Upload the pre-recorded call to the Twilio Console
Make a directory for this project, run npm init, and accept all the defaults.
Inside the directory, install the necessary dependencies.
Next, add a .env file containing the account sid and authorization token for the Twilio account. The credentials can be found by navigating to the Twilio home page.
Create a file called create-transcript.js and add the following code:
And fill in with the necessary information. The Voice Intelligence Service SID can be found in the Twilio Console at Voice Intelligence/Services then choosing the SID for the newly created Service. The full name and email information will be viewable in the console once the code has run and the call is uploaded to the console. Participant information is optional.
Run the file by pasting the following command in your terminal:
Now that the call has been uploaded to the Twilio Console and analyzed by the service, copy the transcript SID logged in the Console for the next step.
Create a Transcription of the recording
Create a file called pull-transcript-information.js, add the following code:
With the transcript sid logged in the previous step, add that value to the appropriate places.
Run the file by pasting the following command in your terminal:
The output in your terminal will display the level of confidence for the applied language operators in your service and a new file, transcript.txt will be created in the repository folder!
Next Steps
Once the pre-recorded call is uploaded, the transcript and invoked operators can be viewed in the Console. Additional steps can be taken to aggregate the operator results to an external data source for another team to decode and discover trends. To learn more about Twilio’s voice intelligence product, follow this tour to see its features!
My name is Kaelyn and I'm a Developer Evangelist at Twilio whose primary focus is Twilio’s Voice API. If you have any questions, comments, or would like to show me any cool projects you’re working on, let me know online!
Email: kchresfield@twilio.com
Github: kchresfield
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.