Rocking Queens of Stone Age with Code and Reaching Over 20,000 Fans

Rockstars, Records and Code

Lee MartinJosh Homme has sold out stadiums, played with the who’s who of the rock music world, and produced critically acclaimed albums with his band Queens of the Stone Age. He writes music, not code but that’s where developer Lee Martin (pictured right) comes in.

When Homme wanted to make an interactive experience to promote his band’s latest album …Like Clockwork, he turned to Lee for help. The goal was to create a feature that would capture the personality of the record, and the attention of fans. Lee figured a good way to grab someone’s attention is to ask for their number. A better way is to have a clown ask for their number.

Getting A Call From A Clown

Lee Martin PhoneworkWhen Queens of the Stone Age fans go to …Like Clockworks’ website they’ll see a live image of a creepy clown standing next to a rotary phone. Below the image is a phone icon and 10 blank spaces. When the curious fan enters his phone number they’ll see the clown dial their number on the rotary phone and realtime. Then they’ll receive a call via Twilio, and hear a voice on the line reciting QOTSA’s lyrics “Keep Your Eyes Peeled”. When the voice hangs up, they get a text promoting the new album.

Over 20,000 QOTSA fans dialed in.

Josh is “like an open faucet of creativity and mischief,” says Lee. To make Josh’s vision and the mischievous clown come to life Lee used the Twilio API to call QOTSA fans and Pusher to update the video in real time. “Twilio is perfect for creating magic like this,” said Lee.

Restarting

For Lee, the project was more than just a chance to work with QOTSA and a fun hack, it marked a proverbial “restart” of his career.

After working at SoundCloud, and SAM from Los Angeles, Lee decided it was time to return home to his native Louisiana where his 10-year career as music–minded hacker started. “I began as a freelancer from my bedroom. I’m trying to have a fresh restart of open-minded creativity by working in a place that works at my current speed: The Big Easy!” said Lee.

To try out “…Like Phonework” visit QOTSA’s website here. To learn more about Lee Martin visit his website here, and read his technical post on creating …Like Phonework

Posted by Kyle Kelly-Yahner on June 18, 2013 Tagged , , , ,

Checkfront Eliminates Booking Hassles, Helps Businesses Keep In Touch w/ Customers via Twilio SMS

Grant Jurgeneit

Grant Jurgeneit, CEO of Checkfront

Kayaking is fun. Searching for the paperwork you filled out to go on a kayak tour is not fun. Checkfront aims to automate booking processes so both companies and customers have less to worry about.

The Checkfront online reservation system allows companies to log their booking and reservation information through web portal that integrates into their existing website, without any redesign work. The goal of the service is to get all of the customer’s key information in one place and keep it organized.

Grant Jurgeneit, CEO of Checkfront, saw how messy travel plans can get when he volunteered to book a vacation for his family and friends. He combed through emails, voicemails, and texts from his loved ones as well as hotel and car services. It was far too difficult to do something so simple. He decided to build the solution. “We wanted to build a system that was organized and could scale booking for everything from kite surfing to airport parking.”

CheckfrontSay you’re running a bike rental service. Using Checkfront, you can update bike inventory, bike tour schedules, pricing, and process payments for reservations. To keep customers in the loop, you can use Checkfront’s Twilio SMS integration to send them the details of their reservation as soon as they book a bike. You can also notify that customer right before their reservation starts via SMS

“Being able to leverage SaaS based applications has been hugely advantageous,” says Grant. In addition to their Twilio integration, Checkfront’s online booking software also integrates with platforms like MailChimp, Apple Passbook, Salesforce and Constant Contact.

Grant and his team are currently building out their API platform, allowing developers and businesses to create new tools to automate booking processes.

To learn more about Checkfront, visit their website here.

Posted by Kyle Kelly-Yahner on June 14, 2013 Tagged , ,

Create a Twilio SMS Language Translator Using Mashape

Chris IsmaelThe following is a guest post by Chris Ismael, Developer Evangelist at Mashape, a cloud API hub allowing developers to discover and distribute APIs. Learn more about Chris here.

Hi, my name is Chris Ismael, Developer Evangelist from Mashape.  In this tutorial, we will build a phone service that lets you translate messages to your preferred language using SMS.  The service will also call you back with a native language pronunciation of the translated message.  Here’s a quick video demo:

We will do this using node.js, and a couple of APIs:

  1. Twilio APIs for SMS and voice
  2. APIs from Mashape to let us detect language and translate messages.  We will also use a text-to-voice API to read out the message in a native language pronunciation.

You can find the source code here on Github. Try out the service by sending an SMS message to +1 (415) 992-9984 like “Take me to the bar ES”.  The “ES” stands for Spanish.  You can try other languages such as “DE”, “IT”, etc.  You can also translate a non-English message like “Hola mundo en”.  

Let’s get started!

How do we interact with Twilio?

Twilio makes it easy for our applications to send and receive messages and calls.  There’s a lot more you can do with the Twilio API and I encourage you to check out this page for an overview.  For our app, receiving, sending SMS, and calling back are the things we need to do.  Here’s a diagram of the process flow from our phones, to Twilio, to our app, and back.
image

  1. Receiving an SMS in Twilio – To do this, we need to register for a Twilio account in order to a) get a Twilio number where our SMS messages will be sent, and b) associate that number with the URL of our app that will get called whenever it gets an SMS.  Here’s what mine looks like after setting it up (note that I blurred the app name to lessen the possibility for abuse. You can also set up authentication but I’ll let you check that out in your spare time)

    image

    Here’s the snippet of node.js code that receives the POST request from Twilio as a result of sending an SMS to the number above.  We are simply getting the SMS message, the sender’s phone number, and number the message it was sent to (which is my number above)

  2. Sending an SMS from Twilio – To get Twilio to do stuff, we need to respond to it with an XML file (they call it TwiML) that contains instructions such as sending an SMS, calling a phone, playing audio, and more. When a user sent an SMS to our Twilio number, Twilio will expect a TwiML back so it will know what to do next.  Here’s a function that sends back a TwiML to Twilio to send an SMS back to the message sender:
     
  3. Calling a phone from Twilio – To call a phone from Twilio, we can use their REST endpoint as described in the code below.  One thing to note is that aside from the ‘From’ and ‘To’ fields (phone numbers), the ‘Url’ parameter expects a TwiML response that contains instructions on what Twilio should do when the call is picked up. (We will explore this in number 4 below shortly):
  4. Playing audio when call is picked up – In the code below, we are sending back a TwiML to Twilio that plays either Twilio’s default voice, or a link to an mp3.  This will be played to the person we’re calling from Twilio when he/she picks it up.  Also note in the code below that we are introduced to a Mashape API that does text-to-voice for us:
     

What is Mashape and how do I call their APIs?

Mashape is a Cloud API Marketplace where you can discover interesting and cool APIs for your apps.  If you developed your own API, you can add them to Mashape too so that more developers can discover them.  You can find a list of 40+ machine learning APIs here!  For this project, we used the following APIs:

  1. Sprawk Language detection - figures out the language of a message
  2. MyMemory Translation Memory - can translate from one language to another
  3. Text To Voice - a wrapper to Google Translate that saves the mp3 audio to a public URL in Dropbox

Each of the links above will take you to a Mashape documentation page.  It provides a test console, among other things, to help developers test the API before actually using it for their apps.

You need to have a Mashape account in order to use the test console, and most importantly to use the API in your app.  Go on and register for a Mashape account, we’ll wait for you below.

Once you have signed up, you will get a Mashape key that you can use for all the APIs in Mashape.  (Do note that some APIs require a paid subscription.)

You’ve already seen how to call a Mashape API from number 4 above.  If you’re wondering where the url and X-Mashape-Authorization values came from, you can inspect the curl request from the Mashape test console, as below:

image

As you’ve probably noticed, there are also code snippets for Java, PHP, Python, Obj-C, and Ruby.  Go ahead and check them out.

Piecing them all together

So far, we’ve described the major components of our service.  Hopefully this has given you a good understanding of how each part fits.  We won’t go into the nitty gritty of explaining each part line by line.  Instead, you can check out the source code in its full glory in Github here.

The important thing to remember here is the flow from the user, to Twilio, to our node.js app, and back:

  1. User sends an SMS message to our Twilio number.
  2. Twilio calls our node.js app, passing along the SMS message and the sender’s number. (Line 15 – 19 index.js)
  3. Our node.js app calls Mashape’s language detection API to determine the language of the message.  This will be used to determine which language to translate from and to.  The actual translation is done by the translation API. (Line 43 and 64 in index.js)
  4. We send a TwiML to Twilio to send the translated message SMS to the user. (Line 91 in index.js)
  5. We also do a REST call to Twilio that initiates the call to the user.  When the user picks up the call, we call the text-to-voice Mashape API to give us a public URL of the translated voice audio mp3.  We then send back a TwiML to Twilio that plays back this mp3 to the user. (Line 112 and 156 from index.js)

I hope this tutorial was useful.  Please send me a note at chris@mashape.com if you have questions, comments, or feedback!  Happy coding!

Posted by Kyle Kelly-Yahner on June 13, 2013 Tagged , ,

A Letter to our Customers, the DOers

The world of communications is undergoing the largest change since the invention of the telephone. What was once stagnant, expensive, and esoteric – an industry still coasting on the legacies of national monopolies around the world – is becoming a vibrant hotbed of innovation due to one main thing – the rise of Software People who are changing everything.

In fact, there are two important macro-changes afoot. First, in businesses around the world, from SMBs to the mid-market to the enterprise, software is migrating from the closet to the cloud. Instead of 100,000 businesses all running their own copies of “big hardware” and “big software” in their own dank closets and datacenters, they’re turning to multi-tenant clouds. CRM has undergone this transition. What was once a multi-million dollar, multi-year Siebel implementation is now a credit card and an afternoon on Salesforce.com. This story has been told ad-nauseum – but what’s most interesting is that every company – big and small, from a three person sales team to a 30,000 person global salesforce – has access to the best-of-breed, always updated software with no administration. Category after category has undergone this transition – and the closet to cloud migration in communications is happening now. Without a doubt, in 10 years, the overwhelming majority of our corporate communications applications will be delivered from the cloud. In this transition, new winners will emerge, and many of today’s incumbents will fall. You, the Software People, are building this future in the cloud.

Second, and even more exciting, is the migration from communicating on “special purpose devices” to “general purpose computers.” Think about it: ten years ago, if you wanted to make a telephone call, you picked up a telephone – a device manufactured to do that one thing forever. On the day it rolled off the assembly line, it had all the capabilities it would ever have. Want a new feature? Throw that thing away and buy a new device. Innovation was largely limited to those who manufactured this gear — people who understood the esoteric composition of circuits and connectivity that comprised telecommunications. But today, you pick up a general-purpose computer – your iPhone, your Android, your browser.  Advancements are no longer limited to the slow pace of companies manufacturing telecom guts – servers in closets and plastic on our desks. With the software mindset, most anything we can imagine is not just possible, but inevitable.

Communications is becoming integrated into everything we do, not just a phone on the desk and 10 digits to punch in. Power has shifted to the Software People who are rolling communications into their companies, their applications and their workflows – and creating great experiences for their customers in the process.

These two shifts are permanently and significantly changing the face of the trillion-dollar communications industry. Instead of one application — the phone call — the future is a million context-specific interactions. Going forward, APIs are the new dialtone and Twilio exists to empower you — the Software People — to invent the future of human interaction every day.

Last week, we announced the closing of a $70M investment from Redpoint Ventures, Bessemer Venture Partners, and Draper Fisher Jurvetson. In addition, Scott Raney of Redpoint will join our board.

Our existing and new investors share this vision of the coming world of software-defined communications and the opportunities it presents not just for Twilio, but more importantly for our customers. We raised this Series D investment round to continue to accelerate the pace of innovation we can affect for our customers. Our mission — to change communications forever – is just beginning.

We’ve got great new products in the pipeline, we’re bringing Twilio to more geographies around the world, and we look forward to working with more and more of the world’s best developers and companies. We want to change communications forever by empowering you to build the future of your industries and create great experiences for your customers – and we can’t wait to see what you’ll build next.

Onward,

jeffiel

6550838145_76e49c4dbf_m

Posted by twilio on June 12, 2013 Tagged , ,

NodeConf Contest Winner: SMSFoo Lets You Edit Wufoo Forms via Twilio SMS

NodeConf JedLast week, we announced a contest to send one lucky node.js hacker to NodeConf 2013.  We had a bunch of amazing entries, but the hack that stood out as the most useful and innovative use of the API was SMSFoo, by Jed Wood (pictured right).

About The Hack

Wufoo is an online form builder which makes it incredibly easy to build and distribute web forms.  SMSFoo SMS-enables forms you’ve built in Wufoo, so you can distribute them and collect responses via SMS.  This enables you to use Wufoo forms to collect information from users without internet access, or on any mobile device.  Very cool stuff.

When you visit the prototype SMSFoo site, you can enter your Wufoo subdomain/username, and an API token, which will pull in the questions from your phone, and expose them via a Twilio SMS number.

SMSFoo is open source on GitHub, and incorporates technologies such as MongoDB, express, and stylus, in addition to the Twilio module for node.js.

About Jed

Jed has spent the past decade bridging the gap between design and programming by creating rapid prototypes and production applications. He recently served as a Presidential Innovation Fellow. Now he’s back in Chicago, spending most of his time building and connecting APIs with node.js.

Follow Jed on Twitter, and keep up with his open source contributions on GitHub.
Congrats Jed!  You’re going to NodeConf!

Posted by Kyle Kelly-Yahner on June 11, 2013 Tagged , , ,

London’s Tech Community Funds Shoreditch’s Village Hall, A Place for DOers

Shoreditch Twilio

Here in the Twilio Europe office, right in the heart of London, we’re always hearing about cool and exciting projects happening in the local tech scene. London is one of the most beautiful and vibrant cities for doers, builders, dreamers and creators that I’ve ever had the fortune to live in – and this week, we’re absolutely over the moon to be supporting a great project by tech-space-sourcing foundation Shoreditch Works.

Shoreditch, as this video explains, is an area of London widely known as ‘Silicon Roundabout’ thanks to the huge number of tech companies that inhabit it. There are great co-working spaces, meeting rooms, and coffee houses, but the Shoreditch Works team still felt that there was something missing.

A Place For DOers

Wouldn’t it be great if there was a ‘village hall’ for the doers? A place where people in the Shoreditch tech community are always welcome, a space to, in their own words, “help young companies get started and grow.”

That’s just what Shoreditch Works decided to do. Thanks to a kickstarter campaign, their vision of “a space where kids can come and code after school, where artists can present their work, where local meetups can take place and where our co-workers can meet and discuss their issues” is going to become a reality!

If you didn’t think that was enough, they’ll also be giving 20% of all the time slots in the new 200 seat event space contained within the building for free to community groups that are important but don’t necessarily have the cash to hire a big events space.

The Power of Community Spirit

With backing from almost 300 individuals, startups and local tech companies on their Kickstarter page, the project looks set to rock the tech scene in London and provide a space for people do create, dream, build and DO for years to come.

From everyone here at Twilio, we wish Shoreditch Works’ new Village Hall all the very best. We’ll join you for a coffee soon!

Posted by Ben Nunney on June 7, 2013 Tagged , , ,

DOer of the Month: Hung Truong – From Geocities to iOS Apps

DOer of the Month: Hung Truong

Hung Truong

Developer Hung Truong started putting together basic websites when Geocities was still in style (if it ever was). Now, Hung is an iOS developer at a creative marketing company in Ann Arbor Michigan. In his free time he likes making apps (like award winning Weathergram) that help automate daily tasks from turning your lights on and off, checking in on Foursquare, and checking the weather.

We talked to Hung about how he got started coding, what type of apps he’s interested in building with Twilio, his Callin’ Oates inspiration, and why code literacy is so important.

We profiled Hung Truong and featured his developer profile on the front page of the DOer Gallery. If  you’d like to share your story on the blog, create your DOer profile and email community@twilio.com

What’s your background in coding and when did you get started?

I got my start making really basic web pages on Tripod and Geocities back when I was in middle school. I was basically making documents and linking them together.

It wasn’t until college that I started coding formally, which is a bit atypical of the stories you’ll hear of hackers getting started by writing compilers at the age of 6. Around my Junior year in college I got really interested in blogging, which led me to learning PHP for WordPress and Ruby on Rails for writing other web based apps. I’ve also picked up some Python for general scripting and Objective C for writing native iOS apps. Lately I’ve been learning Chef to automate my server provisioning.

You’ve put together some really interesting projects from Weathergram, to Checkmate, to MapsKreig. What unites them?

Weathergram is a Twilio service that you can call to get your weather forecast in the form of song. It’s inspired by the other Twilio project, Callin’ Oates. I also have another project called Instascriber that automatically adds new items to Instapaper via RSS.

Most of my projects were built to automate some kind of task for myself, and by releasing them as apps or web apps, I’ve been able to share them with a lot of people.

How are you using Twilio?

I am mostly using Twilio for personal side projects. I’ve been playing around with an idea for an app that sends you a text message when it’s time to go catch your bus so you don’t have to spend a lot of time waiting for it.

What project are you working on currently and do you have anything in the works?

I have big plans for an app that ties in a variety of data sources for home automation and security. I’m using the Belkin Wemo for controlling light switches in my house and monitoring for motion. I want to tie that in with an iOS app that uses geofencing to let my apartment know when I’m home and when I’m away. I’d also like to integrate a Lockitron and other “internet of things” devices. I think there is a small wave of these sorts of devices on the horizon with a really huge wave coming after that, when the feasibility of such devices has been proven.

Anything you’d like to add?

One idea that’s gained popularity recently is code literacy: the idea that “normal” people should be have at least a fundamental level of ability to write code. I think that’s a really powerful idea that is more or less an inevitability. The ability to demonstrate your particular set of skills will be important in the future, especially when basically everyone will know how to code.

I think Twilio and a few other companies have the right idea in putting the developer front and center. I hope that other organizations follow the same approach, because the people who end up getting things done will be the ones with the keyboards and a vim (or emacs, I guess) window open.

Posted by Kyle Kelly-Yahner on June 5, 2013 Tagged , ,

Win a ticket to NodeConf with a Twilio hack

NodeConf 2013 is around the corner and shaping up to be an awesome event. One of our favorite events of the year, NodeConf is the best opportunity to hang out with and learn from some of the most active node.js contributors and community members around, all while camping out at the picturesque Walker Creek Ranch.  Team Twilio will be there taking it all in, but we’d love to see you there as well.

We have a NodeConf bunk ticket (an $800 value) up for grabs and we’d like to give it away to a node.js developer who hacks something cool using Twilio’s node.js module. It can do or be anything you like, so long as it uses node.js and the Twilio module in some capacity. If you’re looking for inspiration or examples, here are a few resources to get you started:

Due Date

Hacks must be submitted using the form embedded below by 5pm PST on Monday, June 10th, 2013. The winner will be notified via e-mail and announced via our developer blog the following day. Good luck – JavaScript FTW!

Posted by Kevin Whinnery on Tagged , ,

Pair Programming in the Browser with Twilio

Pair Programming in the Browser

The tools for creating real-time applications in the browser are getting better all the time. Running node.js on the server, in conjunction with libraries like socket.io, makes it ridiculously simple to facilitate server push and event-driven communication between clients. Combine this with Twilio Client for voice communication in the browser and you have an incredibly powerful platform for facilitating communication between users of your application.

In this tutorial, we will examine a sample application enabling pair (or large group!) programming in the browser. Check it out live here! You’ll be able to voice chat with other coders as changes are magically beamed in real time from their editor to yours. Check out the complete source code on GitHub to see how it all comes together.

Pair programming live with a distributed team is very much a possibility with some of the technologies we’ll look at today. Let’s run through a list of ingredients for this hack:

The app is reasonably large, so we’ll only focus on the most important code paths on both the client- and server-side. Let’s start with what’s going on in the browser.

Understanding The Client Side

The markup for the app’s only page is not very complex, but I would like to point out a few key bits:

On line #4, we’re including the browser component of the socket.io library. This will handle communication via web sockets or HTTP long polling with our node.js program running on the server. Looking at the script tag, you might think that “socket.io/socket.io.js” is in our web app’s static content directory, but it’s actually generated dynamically by socket.io. This is handled for you automatically – no need to configure anything extra.

On the next line, we load the JavaScript for the Ace editor from rawgithub.com, which is a handy service to quickly access raw files from a GitHub repository. It is possible to download and serve this JavaScript locally, as well.

Next on line #6, we load the Twilio Client JavaScript SDK from a Twilio-provided static content server. It’s included with a protocol-relative URL, so it can be served over both HTTP or HTTPS. Immediately after that, we load jQuery 2.0 from a Google CDN. We now have all the third-party JavaScript dependencies we need loaded for the page.

The UI markup for the page is pretty sparse – a few divs and an empty unordered list. We’ll be populating most of this via JavaScript later. On line #20, we load the JavaScript which will actually drive our application. The CSS for the page sets up a full page, two-column layout for our editor and list of connected clients.

Let’s dive into the JavaScript which powers the client side application, which can be found here.

First, we configure the Ace editor with the JavaScript syntax highlighting plugin:

Then, we create our socket.io client-side interface, and listen for updates from other clients:

Note that we’re setting a boolean flag every time we get a new update from the server, to indicate that the editor has been updated by our own client side code. We do this to prevent the editor’s “change” event from firing every time an update is received from the server, which would then fire updates to every other client, causing an undesirable infinite messaging behavior. Sort of like when your mom learned how to send text messages.

Inside the document ready event handler, we set a listener on the editor object to be fired every time the user updates the contents of the text editor:

If the change was initiated by user input, we immediately publish a message on our socket indicating that we have editor changes to publish to all clients. This updates all connected clients almost immediately.

These bits of code power the real time updates for the text editor, but how about the voice chat and presence events as new users log on? This is where we begin to use the Twilio Client JavaScript SDK. In the document ready event, we initialize our browser’s soft phone, the “Twilio.Device” object, with a server-generated capability token:

We send an Ajax request to the server using jQuery to fetch this capability token, using the username our user gave us when we “prompt()”ed them on page load. In the success handler, we initialize our Twilio.Device and are ready to make outbound calls to a voice conference set up for this editor.

Also inside the success handler function, we register a listener for the presence event fired by Twilio Client. This event will fire once for every attached client, whenever they connect or disconnect. In our case, we will add (or remove) them from an unordered list of connected clients, just to demonstrate who is available (potentially) to chat with:

To connect to the editor’s conference call, we call Twilio.Device.connect(). To leave the conference (hang up), we call Twilio.Device.disconnectAll().

That about wraps up the salient bits of the client side part of our application. We propagate changes to the text editor using socket.io, and manage presence and voice chat via Twilio Client. Let’s take a look at the server-side portions of our application.

Understanding The Server Side

Our server-side application is a single JavaScript file which handles HTTP requests and socket communication with the client. Let’s examine the most interesting bits, leaving out the dependency declaration and Express configuration boilerplate.

You might remember that on the client side, we made an Ajax request for a capability token, which empowers our Twilio.Device to make outbound calls (and connect to a conference). This is the Express handler function for that route:

We use the twilio module for node to generate a capability token with two pieces of data – a client identifier (it’s like the client’s inbound phone number) and a TwiML app SID (this is an identifier for a TwiML application that serves up TwiML instructions for an outbound call from the browser). The TwiML used to place the outbound call looks like this:

It uses text-to-speech to announce to the user they are joining a conference, then drops the user into a conference with all other users of the editor currently connected.

Note that the capability token constructor must have access to your Twilio account SID and auth token – by default, the node library looks for these values in environment variables, available programmatically at “process.env.TWILIO_ACCOUNT_SID” and “process.env.TWILIO_AUTH_TOKEN”. Storing your Twilio account credentials in environment variables is a good security practice, so they don’t get accidentally checked into source control.

Now, we’re ready to look at the implementation of socket.io on the server. socket.io first needs to be attached to an HTTP server. Then, you will be able to listen for and emit events:

In this application, every time a message is received from the client, we will turn around and emit it back to all connected clients. The way to accomplish this is with the “socket.broadcast.emit()” function – this will send a message to all connected clients with the new value of the editor in the browser.

In the live demo, I deployed the application to the AppFog PaaS. Like many node.js PaaS services, AppFog does not yet support web sockets. Luckily, socket.io allows us to very easily fall back to HTTP polling, which I configure on the server here. If your PaaS supports web sockets (or you’re running on a dedicated server or VPS), you might omit this configuration.

Conclusion

In a few hundred lines of code, we’ve created a code editor and live chat application that, with a few improvements, can empower distributed teams to code together effectively. We’re able to do this because the tools of real time collaboration have matured significantly, and we have server and client side platforms built from the ground up to support event-driven communications. I hope you’re able to explore this sort of interaction in your own apps very soon!

Posted by Kevin Whinnery on June 4, 2013 Tagged , , ,