Wednesday, June 6, 2012

In The Cloud: Voice and SMS

Tropo isn’t fundamentally different from any of those other SMS/Voice services that are available, but it has one major advantage: in development-stage it is free. I will of course, if I am going to look into any serious business with SMS/Voice services, look for other alternatives. Caveat emptor. 

As with every single cloud-based service it is very easy to get started with, just create an account, wait for the e-mail with your password and then you are ready to go. The control panel is very intuitive, so just start creating a hosted file on their servers and then write some code for the API to understand. It is very approachable. 

An JS example could be: (as we always do, let’s start with a Hello World)

say(“Hello World”);

Then you can set up a telephone number (Danish number is also available, for the Danes out there) or you can use a Skype number and call it; and it will after 3 seconds say: Hello World and then hang up. It is brilliant in its simplicity. You can code in a variety of languages including, Ruby, PHP, JS, XML/JSON and so forth.

Now while the “Hello World”-example was very simple, you can also include choices. Say, I can ask you a yes or no question (the caller you can then reply by yes or no by voice recognition) and based on the answer you can make an if statement to interpret the answer by the caller. 

say(“I like milk from a cow.”);

var results = ask(“Do you like milk from a cow? Yes or no?”, {

  choices: “yes, no”

});

log(“results.value: ” + results.value)

if (results.value == “yes”) {

  say(“We have something in common!”);

}

else {

  say(“Oh, well you are missing something!”);

}

So it is a very complex system in which you can play around with. I like it, also for its multiple language support. I don’t know how I can apply this to any of my current or past projects, but I may in the future. 

Anyway, I wanted to share it with you, hope you’ll find it useful!