How to Broadcast a Voice Message With Fonoster Voice API

voice_broadcast.png

Sending a voice message with Fonoster is straightforward. In this entry, I will show how to create a simple voice message using the voice API and how to originate a call using the Restful API. At the end of this tutorial, you will be able to develop, test, and deliver voice applications using Fonoster’s Voice API and a rest-client.  

All the code for this tutorial is available in the Github repository callflow-examples. Feel free to copy, edit, and share with anyone.

Our Project Tools

For this tutorial, you will need a free Fonoster Account and a rest-client. I will be using Curl, a command-line tool for data transfer via HTTP. You may also use the Chrome extension Advanced REST client or the equivalent for your favorite browser.

Creating a New Voice Application

In Fonoster, a voice application is set of scripts that combined together will take control of the call’s flow. With this scripts, you can break down the logic of your application as needed. For now, just focus on the entry-point script main.js.

Assuming that you already have a Fonoster account, go to the Fonoster Console and log-in. Click in the Apps section to see a list of your apps or create a new one.

open_app_section.png

Next, find and click the plus(+) sign to open the editor and create a new application. Your screen should look similar than this:

add_app.png

Take a minute or two to explore the editor, you will get a nice tour the first time you create an application. With the editor, you can change your application’s name, add scripts, change the phone number for your test and many other features.

Note, that you must format your phone number using the standard E.164. Your phone number may look a bit different than the one in the image bellow – It will be different based on your country.

Also, change the content of the main.js to something like this:

say("En hora buena amigos!", {voice: 'enrique'});

edit_phone_number

At this point, you should be ready to test your new application. All you need to do is click on the circular phone button on the editor and wait for the call.

Making Calls

So far, you’ve been able to create and test a simple voice application in Fonoster. You also learned how to list your phone numbers. Our final step is to originate a phone call using the Restful API. As I mentioned at the beginning of this tutorial, I will be using Curl to make the HTTP calls. Before we continue, you must collect the following information:

  • Account ID and Account Token
  • The Application ID
  • The originating number

Getting the Account ID and Account Token

The Account ID and Account Token can be found in the ACCOUNT tab of the Settings section of the console. It will look similar to this:

account_id_and_token.png

The Application ID

You can find the application ID in the application editor, close to the applications’ name. Here is an example:

App Identifier

Finally, go to the Numbers section of the console, and write down the number you will be using to originate the call. We will provide you with a test number during your trial period. Remember, it has to be formatted using the standard E.164.

api_call

 

That’s all. Replace the ACCOUNT ID, ACCOUNT TOKEN, APP ID and the ORIGINATING, DESTINATION for the values you’ve collected before and run the command in the above image. In few seconds, you will receive a call and the message will be delivered.

What’s Next?

You can check out the callflow-examples at Github to see more examples. If you have any questions leave a message or contact me via:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s