Tag Archives: Tropo

Initiate your first text message (SMS) via HTTP

Since a few days there is a Scripting API for the Interactive Voice Response System (IVR) called Telekom Tropo. Thanks to this API it is easy to start immediately scripting your text messages without the need of a self-maintained infrastructure: All you need is internet access (which you probably have while reading this article) and a phone capable receiving text messages (SMS).

1. Sign-in

02_login

To start your first IVR project you need to be registered and logged in at Developer Garden. You find a detailed description of this 3-step-process in my blog.

2. Activate Telekom Tropo

04_api_management

Once logged-in go to the “My Account” page and select the API Management to activate the Telekom Tropo usage.

3. Add an application

05_application_management

In this step you create your application. First select the Application Management. Please do not get confused because of the image above: I have already created a bunch off applications – in your case this dialog might be more or less empty.

06_add_application

Finally click on “Add a new application”. A dialog appears where you select the type of your application which indeed is Telekom Tropo here. Furthermore you can choose Scripting or Web API. For this tutorial I recommend Scripting, because no hosting is required by you. And don´t worry, you can change this setting at any time.

If you are curious about the differences between the new Scripting API and the legacy Web API, here are some facts:

  • Use Web API for your own hosting (as long as your hosting is basically capable of HTTP, JSON and XML)
  • Using the Scripting API the hosting and maintenance is done by Developer Garden (the Scripting API allows hosting up to 200 MByte).

Please see my Quickstart Telekom Tropo for more details on the Web API:

  1. Quickstart Telekom Tropo Web API: Hello World (German)
  2. Quickstart Telekom Tropo Web API: Text to speech and voices (German)
  3. Generic SMS and Voice service with Telekom Tropo Web API (English)

4. Create your code

09_edit_basic_settings

In the settings page of your application click on “Map a hosted file” to create, upload, edit or delete your code.

For testing purpose we use the sandbox mode. This mode is free of charge, but has some limitations: E.g. only 10 SMS per day are allowed and each SMS contains the text “SMS API by developergarden.com”.

07_create_hosted_file

Clicking on the “NEW” menu and selecting “create file” generates a code file of the language of your choice – therefore make sure to use the right suffix (e.g. .js for JavaScript). The Scripting API supports a couple of dynamic languages on top of Java:

  • Javascript – Rhino – 1.7_R1 / ECMA-262 Edition 3
  • Groovy – Groovy – 1.6.0
  • PHP Quercus – 4.0.14 (equivalent to PHP 5.3.2)
  • Python – Jython – 2.5.2 (equivalent to Python 2.5)
  • Ruby – JRuby – 1.6.1 (equivalent to Ruby 1.9)

After you have created the file, an editor opens. To be honest, this editor is very rudimentary, but sufficient for simple scenarios (if you do not like it, use your own editor instead and upload the file here).

The Scripting API supports most of the “standard” libraries provided with that language’s Java implementation as well as the Java API available in the underlying JDK. You can find more info here:

08_edit_hosted_file

In the screenshot above we use JavaScript, but the code for sending a text message (SMS) looks very similar in all available languages. Just use your favorite and paste it in the editor:

JavaScript:

message("Developer Garden rocks!", {
   to:"+14075550100",
   channel:"text",
   network:"SMS"
});

Ruby:

message "Developer Garden rocks!", { 
   :to => "+14075550100",
   :channel => "text",
   :network => "SMS"
};

PHP:

<?php
message("Developer Garden rocks!", array( 
   "to" => "+14075550100", 
   "channel" => "text",
   "network" => "SMS"
));
?>

Python:

message("Developer Garden rocks!", { 
   "to":"+14075550100", 
   "channel":"text",
   "network":"SMS"
})

Groovy:

message("Developer Garden rocks!", [ 
   "to":"+14075550100", 
   "channel":"text",
   "network":"SMS"
])

Finally submit your code and make sure to map the desired file clicking on “Map”.

5. Run your application

You have two options to use your application. Either call a certain phone number (which you have to assign first in the applications settings) or just call a URI via the Telekom Tropo Rest API. As long as you do not have a phone number to assign, we do the latter.

10_edit_advanced_settings

To initiate an outbound call or text message you need just two things: The URI for the used Rest API and a token to identify your application (for security reasons do not make the token public). The URI looks like:

https://tropo.developergarden.com/api/sessions?action=create&token=TOKEN

The token is available in your applications settings. There you can create a new token as well.

11_url_call

This URI now starts your application identified via the used token. And your application itself sends a text message to the given phone number. That´s it…

If you need further information or if you like to test an incoming call with a SIP client, please see the official Telekom Tropo documentation.

One Portal – Simplified registration process at Developer Garden

Since a few days there is a simplified registration process to get access to the Developer Garden services and APIs like Telekom Tropo – in most cases these offerings are still free for developers for testing purpose as long as used in the sandbox. And even in production mode only the usage will be charged (please check the pricing for more details).

Previously you had to register twice: At Developer Garden and Deutsche Telekom´s Developer Center. This hassle is gone: There is no need to maintain two accounts anymore, because those two accounts are now “married”. Hence it´s sufficient to register at Developer Garden only to get access to the services and APIs. And this process is damn easy.

1. Start registration

00_site

Click on “Register” at the top which starts the registration process.

As an alternative you can sign in via several authentication services also known as OpenID clicking on “Login”. Currently Facebook, Google, Telekom My Login and Windows Live are supported as identity providers. If you take this path, you will be asked for a few additional details like your name.

2. Minimum of information

01_register

The registration is easy and you only have to enter a minimum of information like your name (e.g. to use our forum), email (e.g. to verify your existence via so called confirmed opt-in – otherwise somebody else could register you) and a password. Please agree to terms of usage and prove you are a human due to entering the digits of the image (this is called CAPTCHA).

3. Confirm registration

As mentioned before, misuse of your personal data will be prevented via opt-in. Therefore an email is sent to the given email address. Click on the confirmation link inside this email to verify the email and the registration process is finished.

4. Start using Developer Garden services and APIs

03_account

Once you are registered (and logged in), you can activate and explore Developer Garden services and APIs via “My Account” at the top of the page…

Talk to your vending machine in the cloud

It seems that one of my new year´s intentions comes true: I want to build a ubiquitous computing sample each month (in average). And last Friday we managed to connect a vending machine to our voice control system Tropo to get it´s state via phone and to buy something via voice or DTMF.

Thanks to our M2M partner Cumulocity that was all in all damn easy: They have a sensor cloud including real time administration tools which you can access through the Developer Garden for free. Furthermore Cumulocity, a Nokia Siemens Networks spin off, has a cloud based vending machine telemetry solution (aka VendMe) in its portfolio. So we only had to plug the bricks together.


In this rough video Frank Zimmer and I try out our proof of concept to make sure it will work at the Embedded World fair: Feel free to meet us and the phone controlled vending machine at booth 5-307.

In detail: For our proof of concept we created a PHP application which connects to the API of the Vending Machine via REST with JSON and uses Tropo´s capabilities handling voice calls to tell the user via text-to-speech what´s going on. Once the user has selected a slot (either via phone or keypad) the machine gets the information through the air, the payment is transferred and a confirmation is send back to the user – in this case we again use Tropo to send a text message. As usual the best thing comes at the end: Grab the gummy bears and enjoy!