Posts Tagged ‘tropo scripting’

No More Coworking Lockouts with Tropo and CouchDB

Monday, February 28th, 2011

Has this ever happened to you?

You’re feeling a bit randy so you decide to head over to your local coworking facility or hacker dojo to get some work done. Although it’s a bit of an odd hour, the caffeine is pumping in your veins and you’re raring to code up the next big thing. CloudKnock in action Unfortunately, when you get to your coworking site your realize that the door is locked, and you don’t know who is inside to call or send a message to so they may come and let you in. Bummer!

I’ve create a simple Tropo Scripting application that uses CouchDB that can prevent this from ever happening to you or your coworkers. It’s called CloudKnock. You can get the source code for this application over on GitHub.

The screencast below demonstrates how you can use CloudKnock to get into your coworking site quickly and easily.

Some of the really nice features of CloudKnock:

  • There is no special hardware required to unlock the door at your facility.
  • You don’t need to advertise that you are at your local hacker dojo (and not at home) on a social networking site.
  • Coworking members get notified on the channel they choose to utilize, which makes them more likely to get your message and come let you in. ;-)

I’d love to hear feedback on this application from anyone who ha a chance to test it out.

Happy coworking!

Hacking History with Tropo

Tuesday, February 8th, 2011

Photo of Brian Suda by Flickr user adactio At the Hacking History Day event held recently in London, Tropo developer Brian Suda had an idea about how to use audio to help people relate better to history.

Inspired by the upcoming 100th anniversary of the sinking of the Titanic, Brian constructed a Tropo application that helps people relate to the disaster in a unique way and, hopefully, better understand the tragic events of April 14th, 1912.

Intrigued by Brian’s ingenuous use of the Tropo platform, we wanted to find out more about his project.

Briefly describe your project – what is it, what does it do?

I setup a phone boarding pass system that you can call and state your age and gender. It will then attempt to match you to a person of similar stats who was on board the Titanic in 1912. History can sometimes be cold and big, but matching you to someone similar can help you relate and hopefully this opens a door to deeper understanding and more learning about the past.

So after you state your information, it reads a brief history of the disaster and lets you know if your doppelganger survived or perished at sea. Audio is really a powerful tool to emotionally explain history.

What was the motivation for your project? What inspired you to build it?

I was attending History Hack Day in London, were we had access to loads of data sets containing plenty of historic data. With the 100th anniversary of the sinking of the Titanic approaching next year, I decided to experiment with some of the available data related to the disaster.

What technologies does your project use?

With Tropo I could easily choose between several. I am pretty proficient with PHP, so I choose that, but it was easy enough to port to Javascript or any other. Since the data set wasn’t very large, less than 2,000 there was no need for a database. It is entirely self-contained script with a single array of data.

Explain your decision to use the Tropo platform. Why did you choose Tropo?

Some friends were raving about Tropo, so I gave it a look and low and behold it let me play with the full feature set as a developer for free. Since I had access to everything from day one, I built on top of it and was hook in an instant at what was possible!

What did you like best about using Tropo?

It couldn’t have been easier to build and deploy. Within an afternoon, I had a project that I could have people listen too. It also opened my ears to the world of the blind – people who have to navigate and interact purely with audio. Taking existing data from tables on a web page and putting it into an audio format really made me think about other information that could be presented aurally.

Congratulations to Brian on this unique use of Tropo, and to all of the other participants in the Hacking History Day event.

To find out more about the cool things Brian is working on, go to his site.

To test out the Tropo app he built for Hacking History Day, use the contact numbers below:

  • (804) 316-9215 (US)
  • 44 2035142721 (UK)
  • Skype Voice: +990009369991481398
    • Image credit: Flickr user adactio

How to build an automated Twitter bot using JavaScript and Tropo

Friday, August 13th, 2010

We’re back with more how-to goodness!  While perusing our relatively extensive blogging history and existing documentation, we noticed the previous examples showing how to link Twitter and Tropo were moderately complex and potentially daunting, especially for someone just trying to get an initial feel for how it works.  So, in an attempt to remedy that, we endeavored to provide an easy, all-inclusive example from start to finish.  Hopefully we succeeded.

Our example today is a simple RSVP Twitter Bot; when someone tweets the Twitter account attached to your application, it responds back automatically with a confirmation indicating their RSVP was received.   In this case, we set it up to be password driven; if the application receives the Tweet “Tropo Rocks!”, it responds with an approval message.  Any other message will cause the Twitter bot to respond with a message indicating they sent the wrong password and to try again.

We’ll assume you have a Tropo account at this point and begin with creating your Twitter app.  If you don’t already have a account, you can click here to create one.

1) Login to your Tropo account, then go to Your Applications and click the Create New Application link:

2) Choose Tropo Scripting; this will bring up the New Application window:

3) Give the application a name; we chose ClubTropo to fit the example, but you can use whatever you’d like.  Next, click the link for Hosted File (next to What URL powers your app?) and choose Create a new hosted file for this application.  This will open the New Mapped File window:

4) You will need to give the file a name; as with the application name, it can be anything you like, but make sure this one ends with .js to identify it as Javascript .  In the box for File Text, enter in the following simple code:

message = currentCall.initialText;
if(message == "Tropo Rocks!"){
    say("You just learned how to make a Twitter bot with @Tropo for free!  Welcome to the club.");
}
else {
    say ("Say what?  Try it again - send us a tweet with the correct password to get on the list.");
}

Then click Create File to save it.

To explain what the code does:

  • We define the variable message as currentCall.initialText, which contains the tweet sent by the user (go here for more on currentCall).
  • Next, we specify what to tweet back if the user’s tweet has the correct message (i.e., Tropo Rocks!) and when it does not.
  • That’s it!  That’s all the code you need.

5) Once the file has been created and you’re back on the New Application screen, you’ll see the path to your file has been automatically filled in for you.  Now click Create Application to save the application as a whole:

6) This will bring up the page in the next screenshot.  Here, we need to add our Twitter account to the application; this will be the Twitter account that will act as the bot.  Select the Twitter icon at the bottom of the screen and you’ll see a link that says Click to activate Twitter.  This will attempt to connect to whatever Twitter account you’re currently logged into, so make sure you’re in the right one before you click the link.

7) Twitter will display a webpage in your browser asking you to Deny or Allow Tropo access to your Twitter account.  If you’re definitely in the right account, go ahead and click Allow:

8) You will then return back to the Tropo New Application screen and your Twitter account name will be listed:

9) Click the Update Application button to save the change, and you’re ready to test!  Our Twitter bot is named ClubTropo and we sent it a message from two different accounts.  From TropoUser, we sent “@ClubTropo Tropo Rules!”, which was rejected.  From JD_Gryph, we sent “@ClubTropo Tropo Rocks!”, which was accepted as the correct password.  Check out the responses below:

Voila!  RSVP Twitter Bot achieved.  Feel free to test with @ClubTropo and/or create your own; the door is wide open!

For more information, check out our Tropo Scripting documentation, or check out our Tutorials and Samples.

(Sidenote:  You may want to check out this blogpost before testing any Twitter apps; Twitter can be touchy with multiple instances of identical messages)