Tropo WebAPI Development Guide Home  |  Frameset Home

  How It Works  |  TOC  |  Example Application  

Quickstart


Seeing some sample JSON is useful to understand the methodology behind the WebAPI, but actually getting an application up and running will be even more useful. Next, we'll show you a simple example that utilizes the Ruby WebAPI Library and Sinatra. You'll need both of those installed on your web server, as well as Ruby and Rubygems in order for this to work (or you could use a service provider like Heroku, which has all of that installed for you already). When called, the application will ask for the caller's year of birth, calculate a range of ages for the caller and recite it back to them (told you it was simple).

Setting your account up is pretty much the same process in both the WebAPI and the Scripting API, except some of the fields will be different. If you’ve already registered for an account with Tropo, you can skip the first two steps:


You can specify your URLs in one of two ways, either

http://example.com/index.json

or

http://example.com/index.php?tropo-engine=json

The second option would be used if you need to override the engine Tropo infers from the URL (PHP in the listed example); this method will typically be rare. These URLs serve as the starting location for your application; Tropo will send the initial session JSON document to the appropriate URL whenever a new request arrives from a user.

Even though the example URL looks like we're using pure JSON, index.json is actually a resource on our Sinatra application stored on our web server. The web server interprets the URL and redirects to the appropriate resource accordingly. While some simple, static applications can use pure JSON (e.g., an app that launches from a URL, calls your phone, gives you a list of appointments for the day then hangs up) the vast majority of applications will need to use a language like Ruby or PHP to handle logic (e.g., an app that asks you to choose from a set of options and moves you in different directions based on your response).

These URLs will typically point to your web server, but you could redirect to your local computer utilizing a service like Tunnlr (for more information on utilizing Tunnlr, please review the Using Tunnlr chapter).


Next Step: the Quick Start Example


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  How It Works  |  TOC  |  Example Application  

© 2011 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site