Posts Tagged ‘github’

AR Drones!!

Friday, August 19th, 2011

We had decided to give a people a bit more time to submit their awesome applications for the AR Drone, but please remember that the extension ends tomorrow.  If you want to do a last minute submission you can check out the rules and submission guidelines on our GitHub Repository. The rules are simple, and can be found here, but the Gist (pun intended) is just to submit something awesome, which lets be honest really isn’t hard when we are talking about our API’s, by 11am Saturday August 20th and then then winner takes home an AR Drone, how cool is that!

Deploying Tropo Apps with Orchestra.io

Friday, April 22nd, 2011

On a visit to Nashville, Tennessee, for the PHP Community Conference (Tropo is one of the sponsors) I got to hear a talk from Helgi Þorbjörnsson on front-end caching techniques.

During his talk Helgi mentioned a new Git-based deployment service for PHP applications – Orchestra.

Orchestra is very similar to other Git-based deployment service for different langages – Heroku for Ruby, and Nodester for Node.js – but it’s meant to support deployment of PHP-based applications.

If you’re like me, and you missed the chance to take part in the Codeita beta, you’re anxious to give a Git-based deployment service for PHP a try. When I checked out Orchestra, it looked incredibly easy to use, and a snap to get started with.

It’s also an excellent match for Tropo applications written with our PHP class library for WebAPI.

How easy is it to use Orchestra to deploy a PHP-based Tropo app?

I was able to write, deploy and test an app before Helgi had finished his presentation at the PHP Community Conference (about 20 minutes total with conference-grade wifi). I was even able to hear the end of Helgi’s talk.

Here is how I did it.

Building a Tropo WebAPI App

I built a very simply Tropo application using the PHP class library WebAPI.

My sample application is meant to answer an incoming call, ask the caller what their favorite programming language is (along with some choices), and then say something snarky based on their response.

Building a speech recognition app like this with Tropo is very easy. I also made use of the awesome Limonade PHP framework for my app.

All of the code for this app is made available on GitHub, which is also part of the process for deploying apps to Orchestra.

Setting up and Deploying to Orchestra

Orchestra settings

Go to the Orchestra site and create a new account. Take a spin through the knowledge base if you want more specifics on how everything works – you have two deployment options, a free deployment or an elastic deployment.

For the purposes of this post, I’ll use a free deployment.

You deploy your application to Orchestra by connecting a repo on GitHub with your Orchestra account – Simply set up a GitHub repo for your app, just as you would for a normal project. You’ll then use information about this repo to set things up in Orchestra.

When you tell Orchestra where your GitHub repo is, it will deploy your app and give you a public URL that you can use to access it.

Setting up a Tropo Application

Now that our application is deployed to Orchestra, we need to set up a phone number to use it in Tropo. Like all of the steps described above, this one is simple.

Log into your Tropo account and create a new application – when prompted select WebAPI. The URL that powers your application is the public URL provided by Orchestra when you deploy your application.

Since we’re using Limonade, we need to add a query string parameter for our starting route.

In our application, our starting route looks like this:

dispatch_post('start', 'tropoStart');
function tropoStart() {
 ...
}

So to access this route from Tropo, we would set up our app URL like this.


http://my-app-name.orchestra.io/index.php?uri=start

When you do this, you’ll be able to call the application and hear it work. Here is a quick screencast demonstrating how the app works.

One of the things I really like about Orchestra is that it uses a standard GitHub repo for deployment. Similar services for other languages often require you to set up a special stand alone repo for deployment, and for me this just always feels like an extra step I have to go through to deploy my app.

I love that I can push changes to GitHub and they are deployed by Orchestra. Quick and easy!

Orchestra has a number of add ons planned (i.e., for CouchDB and MongoDB) so it’s only going to get more awesome.

So if you want a fast, easy way to build powerful multi-channel communication apps in PHP, Tropo and Orchestra make a powerful combination.

Meet Tropo at Github’s #CodeConf in San Francisco this weekend

Friday, April 8th, 2011

April 9-10, our friends over at Github are hosting CodeConf in San Francisco.  Coding is about more than code. Whether it’s building a solid community, writing good documentation, or hacking space exploration, CodeConf is about improving the software ecosystem through best practices. Come with an open mind and leave a better programmer.

Tropo Evangelist (and open data geek) Mark Headd will be joining Voxeo Labs VP of Innovation Jason Goecke at CodeConf this weekend.  If you were lucky enough to get one of the 300 sold-out tickets, please say hello to them.  Who knows, Jason might even offer to buy you a beer :-)

For more information about CodeConf, check out the website here:  CodeConf: For the Love of the Code

 

Simple POST and GET interface to Tropo SMS

Friday, November 19th, 2010

Tropo’s coding model is designed around conversations. Ask a question, get an answer, ask something else, get another answer. Through grammars and our ask() functions, we make it easy to rapidly build a powerful automated phone or text conversation.

But what if you don’t want a conversation? What if you just want to send a text message out, without writing any code. One simple GET request and you’re on your way. And if someone texts your app, you just want that text posted somewhere like a form field would be.

One common case that’s come up a few times is people wanting to build SMS applications that run on SalesForce’s Force.com cloud. The Force.com programming language has a limitation that it can accept form posts, but sending other sorts of complex data into it doesn’t work. For example, there’s no way to receive and parse the JSON data that our WebAPI can send.

I’ve written a small application that anyone can use to do just this. Just drop it into your Tropo application and you can easily send text messages out. by passing the variables “to” and “msg” in the query string. Add in your secret API token from your Tropo account, and sending out messages is easy.

http://api.tropo.com/1.0/sessions?action=create&token=TOKEN&to=NUMBER&msg=MESSAGE

If you prefer to use POST to send your messages, Tropo can do that, too. Just post an XML document to us using the same fields above. The details of the document format can be found toward the end of our session API documentation.

To post incoming messages to a server, all you need to do is change one line in the code to add the URL you want to post to. You can also add a username and password if the server requires authentication.

Incoming messages are posted as form fields to your url. The fields “to”, “from” and “msg” contain the number (or IM address!) the message was sent to, the number or address the message was from, and the contents of the message.

Because Tropo works across multiple services with the same API, you can send and receive instant messages, too. Just remember, in order to send a message on a network, you need to have that an account for that network set up on your Tropo account. In other words, to send or receive SMS, you need an SMS phone number. To send or receive over Jabber, you need to add a Jabber account to your Tropo app.

The code is up on our GitHub account, so go read the short usage guide and grab it and try it out. You can even run it straight from GitHub without copying it up to Tropo if you want. Just fork it, edit to add your URL, then grab the “raw” url for the file off GitHub and use that as your Tropo app URL.

Here’s a short screencast showing you how to fork the code into your own github account, change the URL, and then use GitHub to serve the code to Tropo.

Making of a USB giveaway, part two

Monday, November 8th, 2010

Tropo’s meetup kits come with USB drives that are loaded with tropo samples, libraries, and applications. This is the second half of a series explaining how we get the software loaded onto those drives.

In the first part, I showed how we’re using git’s distributed source code management and a git feature called submodules to manage the contents of the drives. In this part, I’m going to describe the installer.

We’re an all-Apple company, using MacBooks and OSX as our computing platform of choice. The installer created here is Mac-specific, since it uses some software that’s part of OSX to do some of the magic. You could probably find a way to accomplish all this with Linux or even Windows if you wanted to, but these instructions are for a Mac.

I wanted a system where I could plug a USB drive in, run a single command, and end up with the software loaded, the drive renamed to Tropo, and the drive ejected and ready for the next one. Every extra keystroke, window, or mouse click would make it harder to install and increase the time required.

The installer is in two parts. We have some people who might need to load a drive that don’t use git. Or be on a machine where git isn’t installed. For those instances, we maintain a zip file on our intranet and the first step of the installer is to create the zip.

This zip creation is done in a separate shell script, since I often want to just create a zip. bundle.sh pulls from git to ensure it has the latest copy of the USB pack. Next the script performs a submodule update, initializing any new submodules and recursing in case some of our submodules use submodules themselves.

git submodule --quiet update --init --recursive

The –quiet flag is on there because the shell scripts print out their own status messages, and I don’t want a bunch of git output cruft pushing that off the screen.

Finally, it creates the zip file, using tar’s --exclude option to leave the installer shell scripts and the .git directories out of the zip.

tar --exclude=.git --exclude=bundle.sh --exclude=install.sh -czf ../tropo-usb.tar.gz *

The second part of the installer is the install shell script itself. install.sh first runs bundle.sh to update everything and build the zip file. It uses this zip file to actually build the drives.

Next, the installer renames the USB drives to add Tropo branding. Instead of showing “NO NAME” when the drive is plugged in, I want “TROPO” to appear.

This is done using OSX’s command line Disk Utility. My first attempt was by just renaming the volume in /Volumes/ with the mv command, but this didn’t change the name that showed up in Finder or Windows.

The command is pretty simple, just give the target volume and the new name.

diskutil quiet rename /Volumes/NO\ NAME Tropo

The next step is to copy the contents of the zip file to the drive. I started out by just unzipping straight to the drive, but then later decided that if I wanted to load a handful of drives at once, I could speed things up by only running the the git update and zip file creation process once.

With this in mind, the installer unzips the file that bundle.sh created to a temp directory…

tar -zxf ../tropo-usb.tar.gz -C /tmp/tropo

… then calls a function called installme that copies the files over with cp and then uses diskutil to cleanly eject the drive.

diskutil eject /Volumes/Tropo

It then asks the user if they’ve got another drive inserted to load and if so, runs the installme function again.

read -p "Do you have another drive inserted you would like to install to? (y/n):" [ "$REPLY" != "y" ] || installme

When the user eventually says “no” to that question, the installer cleans up by deleting the temp directory it created.

If you want to see what bundle.sh and install.sh look like, they’re both in our github account.

Now that you’ve built your drive installer, here’s the steps to install onto a drive. The very first time you do it on a new computer, you’ll need to fetch the pack from git and run git clone git://github.com/tropo/usb-pack.git

After that, all you need to do is..

  1. Plug a blank USB drive in
  2. ./install.sh
  3. Profit!!

If you have a great sample app that you’d like us to include on these drives, send us the git URL for it. Thanks to the magic of submodules, it can be any publicly available git URL. It doesn’t even need to be on github. If we use your app, we’ll send you a tshirt and one of the drives.

Feel free to copy this whole process to create your own USB drives. And if you want one of ours, find someone from Tropo at an event and ask for one. Or put on an event of your own and order one of our meetup kits.

Want to build voice, SMS, IM and Twitter apps in python? Tropo WebAPI library now available

Tuesday, September 7th, 2010

Python logo

Do you want to use the python language to build applications that interact with your users / customers using voice, text messaging (SMS), instant messaging (IM) or Twitter?

If so, we now have a python module available to help you create those apps on our Tropo platform using the Tropo Web API.  The module is available for download here:

http://github.com/tropo/tropo-webapi-python

You can download it directly from the website or use the git version control system to clone a copy to your local system.

There are a couple of samples provided, one that works with Google AppEngine and one that works with the “itty-bitty python web framework” :

http://github.com/tropo/tropo-webapi-python/tree/master/samples/

We need to get some more samples in there, quite frankly, and will be doing that in the time ahead, so please do check back occasionally.  For more info on what you can do with the Tropo Web API in general, please read the Tropo Web API Guide.

The module is still in development, too, so you may see some changes to it over time as we work on continuing to improve it and make it better.  If you are git-savvy, the best way to stay up-to-date would be to clone a copy and then issue a “git pull origin master” from time-to-time to be sure you have the latest and greatest code.

This python module is freely available as open source, and I and others will be writing more about what you can do with it in the weeks ahead.  If you would like to contribute samples, find bugs or have other issues, please either contact me on Github or via email.

If python’s not your language of choice, we also do have Tropo Web API libraries for Ruby, PHP and C#. Check them all out on http://github.com/tropo/

Enjoy… and please do drop us a line if you build some cool apps with this library!

P.S. And yes, this python library has been updated to line up with our new library naming guidelines, so there are no expected changes to the module name any time soon. That’s been done.

P.P.S. I should note that Ted Gilchrist was the primary author of this python library for Tropo, with additional contributions from Saúl Ibarra Corretgé and myself.

Ruby on Rails Example for Tropo Web API without port forwarding!

Friday, February 12th, 2010

Zhao Lu (aka @zlu) has shared a tutorial he has done using Ruby on Rails and our recently released Tropo Web API. The tutorial shows how to add, or build, the Tropo features to your Rails application in 15 minutes using our REST/JSON API. All of this deployed to Heroku for easy application deployment.

Another great thing that Zhao goes on to show, is the ability to use the Tropo Web API behind a firewall where you can not open or forward ports. For this he shows using Tunnlr to establish a remote SSH tunnel. With this tunnel you obtain a port on Tunnlr’s public IP address that forwards via your SSH tunnel to your application inside your firewall. This is great when you are on a company or university network where opening and forwarding a port through a firewall is not an option.

For more details have a look at the README. The full source code example is available on Github @ http://github.com/zlu/tropo-tutorial. A big thanks to Zhao for showing how easy it is to use the Tropo Web API!