Building an Unconference App For RailsConf with Twilio and Twitter

August 21, 2012
Written by
Meghan Murphy
Contributor
Opinions expressed by Twilio contributors are their own

Twilio Bug Logo
Jeff Lindwood

Jeff Linwood is a software developer based in Austin, Texas with LeanMeanTech. He recently was challenged with building a way to organize content around the Unconference during RailsConf. We asked Jeff if he would share his story about building an app with Twilio and Twitter, and how he did it. Follow @JeffLinwood and read about his many ongoing projects on his blog.

How do you keep everyone at a mega-conference up to date about what’s going on in a community-organized unconference that’s running side-by-side? That’s the problem Austin on Rails set out to solve when RailsConf 2012 came to our city.

What’s an unconference? It’s a participant-led conference – instead of having speakers apply to speak months ahead of time, and having committees set the schedule in advance, unconferences are more fluid. This is great for a fast-moving technology like Rails, where you may have put something up on GitHub last night, and you can show it off the next day! Of course, the problem with this format is – how do you let people know what’s going on?

Austin on Rails took on the responsibility of organizing the unconference, BohConf. We could have hack sessions, talks, or birds-of-a-feather going on. Based on previous BohConf/RailsConfs, one of the biggest complaints was that people would have gone to a BohConf happening if only they’d known about it!

Reaching Attendees with Twitter and Twilio

Chap Ambrose, Josh Butner, and Damon Clinkscales worked on the RailsConf 2012 community web site, built in Rails. They built an awesome responsive web design and a scheduling app for the BohConf, but we needed an alert system. Luckily, I’ve had some experience integrating with Twilio, so I suggested that we use Twitter to reach people, and we use Twilio to send SMS’s to people who were interested. Tweets can get lost really easily during a conference when things are going fast and furious. There is a way to set up Twitter to receive SMS’s from only some people, but then if the BohConf accounts retweets or replies to people, you get that as well. We wanted to limit the amount of texts that anyone got.

I’d used the Twitter Streaming API before with the TweetStream ruby gem. The basic idea is that you can run a process that listens for any tweets that contain a username or keyword that you’re interested in.

In this case, I was looking for tweets from the @bohconf username, with the hashtags #talk, #bof or #hack. The great thing is that all that advanced processing is only a few lines of Ruby code. Now I needed to do something with those tweets, so I brought in the Twilio Ruby gem. To send an SMS with Twilio is only two lines – one to set up the Twilio gem with my account information, and one to send an SMS.

Twitter sends the app any tweets by @bohconf, and then as I get those tweets, I check to see if I should send them out – basically, they include one of our hash tags, and they are not a retweet.

To see how I set this up, checkout my Twitter2Twilio project on GitHub.

Adding SMS Subscribers

Now all we needed was a way to get a list of SMS subscribers. Twilio lets you respond to SMS messages that come into a phone number, so I registered a phone number with Twilio for $1/month, and then wrote a simple Sinatra web app in Ruby that listened for incoming SMS’s, and then added their numbers to list stored in Redis. I shared the RedisToGo db with the Twitter2Twilio app, so that each had access to the same data structure. The Sinatra web app responded to the users with TwiML, which is the Twilio markup language.

This app is pretty simple – the source code is up on GitHub.

The app worked great – we had a few small tweaks to get rid of retweets, and to add #hack sessions, but both apps ran on Heroku as free apps, and we had no problems!  One interesting thing I learned from this is that if another user retweets @bohconf’s tweet, the Twitter Streaming API will send it over as if it was the original tweet. We were sending too many SMS’s out that looked like duplicates, so I had to do a quick fix to the script while we were live to screen out those retweets.

The TweetStream code can run for months without being touched, as long as whatever you stick the tweets into doesn’t run out of space.

Thank you Jeff! Looking forward to next year’s BohConf.