Travis Spencer Presents Twilio + Twitter Mashup at Demolicious! Tonight in Portland

October 07, 2009
Written by
Danielle Morrill
Contributor
Opinions expressed by Twilio contributors are their own

Twilio Bug Logo

Travis-spencer
Travis Spencer reached out to us last week to let us know about an event being held in Beaverton, Oregon tonight where he will be presenting a Twilio plus Twitter mashup.  Demolicious! is hosted by the Portland Web Innovators, as part of the Portland Incubator Experiment for startups in the area.

A Twitter Bot That Literally Speaks

Travis blogged about his bot earlier this week, explaining the path that lead him to adopt Twitter recently and the thought process behind figuring out what kind of app he could create that would be valuable.  In the end, he decided to pair Twitter with Twilio to enable sending voice messages triggered by direct messages on Twitter.

In just two hours with no prior understanding of Twitter’s API or
Twilio’s, I was able to create a bot that uses these innovative Web
services to respond to an IM, call an arbitrary phone number, record
the user’s message, transcode the resulting audio clip, and update the
bot’s status with a URL pointing to the follower’s
actual voice.
Isn’t cloud computing incredible?!  Kevin Kelly was right: We have
created just one machine, the Internet, and our phones, laptops,
servers, and other devices are just ways to interface with it.
Considering that we can do this today, it’s mind boggling to imagine
what we’ll be able to do in the next 5,000 days.  I can’t wait!

Before I talk about all the technical details of how I implemented this, let me describe the big picture:

  • * Followers of the bot send it a direct message of the form “callme
    NNN-NNN-NNNN”, the N’s being the Twitter user’s American phone number.
    (I don’t know if Twilio works with non-American numbers.)
  • * Twitter sends an email to the address of the bot with some special headers and the direct message in the body of the mail.
  • * Procmail is configured to pipe all emails with these Twitter-specific headers to a script.
  • * This script initiates a call with Twilio.
  • * Twilio makes a phone call and records the message that the recipient leaves.
  • * Twilio invokes a callback script and provides a URL to the recording.
  • * This callback handler updates the bot’s status with this URL, so that followers can click on it and hear the greeting.
To read the technical details of Travis’ Twitter + Twilio bot please visit his blog

Want to Help Spread Twilio?

If you’re planning on attending or presenting at a meetup where you think Twilio would be a good fit, please let us know with an email to help@twilio.com so we can send you t-shirts, stickers, gift credit gift cards, and other goodies to give away.