Upload an Audio File to a Digital Receptionist

When building an Interactive Phonation Response, or IVR, system with Twilio y'all might beginning off using text-to-speech to read out your prompts. As you move to production you may desire to replace the text-to-speech with real recordings.

In this post you will learn how to utilize the Twilio CLI Assets Plugin to store your recordings in a Twilio Assets service and apply them in a Twilio Studio IVR application.

Let'due south build an IVR

To see this in action, let's put together a quick IVR system in Twilio Studio. To exercise this you will demand a Twilio account. If you don't take ane yet, sign upwards for a free Twilio account here and receive $ten credit when you upgrade.

Open the Studio dashboard in the Twilio console and create a new Menstruum. Give your new Flow a proper noun and click Next.

When you create a new Flow a popup appears to ask for a name for the Flow. Call it "IVR".

Select the IVR/Telephone Tree template and click Next.
Once you have named your Flow, you can then choose from some templates: "Start from scratch", "Appointment reminders", "IVR / Phone Tree" and "Messaging Chatbot" are shown on the screen. Choose "IVR / Phone Tree" and click Next.

On the next screen y'all will run into your new IVR system. When a call is made that triggers the flow it starts with a welcome message asking for the caller to provide some input; they can either press 1 or say "Sales" to speak to sales, or press ii or say "Back up" to speak to support. Once the caller input is received, Split based on widgets piece of work out whether the next step should be a call to sales or support. Finally, the call is connected to the relevant department. If you desire to use this IVR yourself, make sure you edit the Connect Telephone call To widgets to the phone numbers of your own sales and support teams.

The template Flow has one trigger, a gather widget, two split widgets and two connect call widgets.

To test this out we demand to connect a phone number to the Flow. Head over to your phone numbers and either select ane you lot already own or buy a new phone number. On the phone number configuration screen, under the Vocalization department, gear up information technology to trigger the Studio Period we just created when a call comes in.

On the phone number config page, choose to configure voice for your phone number with "Webhooks, TwiML Bins, Functions, Studio, or Proxy" then for when a call comes in choose "Studio Flow" and the Flow we named "IVR".

Save the number and requite it a call. You lot will hear the welcome message in the default vox: English with an American emphasis. We can update that to use one of the other voices, simply for this post, let's supplant that generated speech with real, recorded speech.

From text-to-speech to real spoken language

Open your Studio Flow over again and click on the Gather Input on Call widget. In the widget configuration you can alter how to deliver the bulletin.

The Gather Input widget is currently set to "Say a Message"

Currently it is set to Say a Bulletin and you can modify it to Play a Bulletin. When you do so, the text box with the text to say will be replaced with an input that asks for the URL of an audio file to play. Now we volition use the Twilio CLI and the Assets Plugin to upload an sound file that we can use here.

The Twilio CLI

The Twilio CLI allows y'all to use the Twilio API from your final or control prompt. If you don't already have the Twilio CLI, follow the instructions in the Twilio CLI Quickstart to install the CLI and so log in to your Twilio account.

Twilio CLI plugins provide boosted capabilities for the CLI. The Assets Plugin allows you to manage static assets in a Twilio Assets service from your command line. Install the Avails Plugin with:

When it is successfully installed, start past creating a new Avails service with the command:

Now we need an audio file to upload and then that we can utilise it in our IVR. If you don't have one to hand, you can download and use the one I fabricated for this weblog post. It'southward available in my Assets service here: https://earthy-development-1769.twil.io/welcome.mp3

To upload the file utilize the command:

The --protected flag will ensure that Twilio will only render the file to signed webhook requests. This means that you can apply the file from within your Studio Menses or in response to other Twilio webhooks, but no-one else volition be able to admission the file. If you desire the file to be publicly available do not apply the --protected flag.

When the upload is consummate you lot volition be presented with the URL at which the file can be accessed.

After you run the upload command, the terminal will display the results, including the SID of your new asset, the path, the full URL and the visibility.

Copy the URL, return to the Studio Flow and enter it into the widget configuration. Save the widget and and then publish the Menstruation. Requite your number a phone call and you will hear your recording in the IVR instead of the text-to-oral communication.

More uploads

With the Twilio CLI Assets Plugin you tin upload and shop any kind of static file. In this postal service we have uploaded an audio file to be used in a voice awarding, simply you could upload any other media yous want to. Yous might want to upload images, videos, contact information as a vCard or other documents, all of which tin exist used equally media in MMS or WhatsApp conversations.

If you have uploaded more files, you tin can use the plugin to list them and get their URLs with the command:

In the terminal running the list command will show you a table of the assets you have uploaded to your service.

Build and customise your communication flows

In this post we've seen how to build an IVR with Twilio Studio and and so customise the IVR with our own voice recordings, hosted in a Twilio Assets service and managed with the Twilio CLI Avails Plugin.

The Assets Plugin is a Twilio Labs production as office of the Serverless Toolkit. For more information, check out this introduction to the Assets Plugin and the documentation on the Avails Plugin.

The code is open up source and bachelor on GitHub and if yous take characteristic requests or bug reports I encourage you to open an issue in the GitHub repository. Nosotros also accept pull requests.

If y'all take any other feedback delight let me know by e-mail at philnash@twilio.com.

divinescomfor.blogspot.com

Source: https://www.twilio.com/blog/upload-audio-files-studio-ivr-twilio-cli-assets-plugin

0 Response to "Upload an Audio File to a Digital Receptionist"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel