How To Use Recording Add-ons in Ruby
Time to read: 2 minutes
In this guide we’ll cover how to combine Twilio Add-ons with Programmable Voice to use data from Twilio's partners in your Sinatra web application. Let's get started!
What’s an Add-On?
Twilio Add-ons are pre-integrated third party services that you can use with your Twilio application. Add-ons enhance the responses your application receives from Twilio by including additional data from Twilio’s partners.
In this guide we’ll cover how to combine Twilio Add-ons with Programmable Voice to use data from Twilio's partners in your Sinatra web application. The sample code in this guide will use the Twilio Ruby SDK and the Sinatra web framework. Let's get started.
Here’s an example that uses the IBM Watson Speech to Text Add-on. The generated transcription will be pushed to the application through a callback from Twilio.
The IBM Watson Speech add-on can convert Twilio audio recordings into text using machine intelligence to combine information about grammar and language structure.
Enabling Add-ons in the Twilio Console
The first stop in using an add-on is your Twilio Console. Log in and navigate to the Add-ons page within the Marketplace section.
Then choose on the add-on you want to enable and click the “Install” button. After accepting the Terms of Service, it will be installed on your account. In this example, we’ll use the IBM Watson Speech to Text Add-on.
Once installed, select the checkbox for the recording method you are using (see the different recording methods here). In our example to follow, we would only need the "Record Verb Recordings".
Set the "Callback URL" and "Callback Request Method" as appropriate for your public server URL (instructions below).
Pro Tip: you can quickly inspect what Twilio will send to your callback URL using tools like PostBin before you actually set up your server.
Now we’re ready to use the extra data from our add-on in our application.
Using Add-on data in your application
Twilio will include data from all of your add-ons in an “AddOns” field on HTTP requests it makes to your application. The following example demonstrates how to access add-on data within your application.
This application gets the transcription for the recorded call from IBM Watson Speech to Text Add-on we configured in the Twilio console. You can find a detailed specification of the data structure for an individual add-on within that add-on's page in the catalog.
And that’s it! Try giving your application a call to see your add-on in action. If you've never received a Twilio phone call with Ruby before, check out our guide on that topic.
Where to next?
We focused on the IBM Watson Speech to Text Add-on in this guide, but you can just as easily use any of the add-ons available in the catalog in your Twilio Console.
Check out the full Add-Ons API Reference documentation if you want to learn more about how add-ons work, or even how to publish your own.
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.