Ubercart CRM for the iPad: My DrupalCon 2012 Twilio Developer Contest Entry

I won 2nd place (and a Kindle Fire) in the Twilio DrupalCon 2012 Developer Contest with an Ubercart customer support iPad app. The idea is that a e-commerce site customer support representative could use an iPad that not only handled customer support calls, but also showed the customer’s most recent order information as soon as they call.

I’ve been to a couple of dev days/hackathons sponsored by Twilio, but I’ve never had a chance to actually use Twilio in an app or project. Twilio is a voice-over-IP provider that lets you add voice capabilities to your web application or iOS mobile app. It also handles SMS sending and receiving, if you’re doing text messaging.

Twilio iPad Ubercart Drupal App

Twilio just came out with an iOS SDK, which I thought could be pretty interesting for their DrupalCon Developer Contest up in Denver. The first step I took was to research different ways to use Twilio in Drupal, and I ran across the voip modules - unfortunately, they were only released for Drupal 6 (beta 9), and when I tried out the Twilio integration, I ran into lots of little errors, and Twilio couldn’t connect to my Drupal 6 site. I need to go back and file some issues in the issue queue. I dropped the VOIP Drupal modules, and simply followed Twilio’s directions for integrating the iOS SDK with a standard PHP app, and then rolled that into a Drupal 6 module and dropped it on the server. This actually worked really well, and pretty quickly, I had a phone number I could call from my iPhone that would ring my iPad, and then my iPad could answer the call and I could have a nice, illuminating conversation with myself. Luckily no one walked in on me talking to myself and a few Apple devices. From what I understand, the Twilio SDK is coming to Android pretty soon, and I would imagine the Drupal integration would be exactly the same.

So I had a great little app thrown together for calling someone on an iPad through a telephone number, but that’s not the most exciting thing. Luckily Twilio had one of their developer evangelists stationed in a room at DrupalCon, so I picked his brain about what to add - he suggested CiviCRM, but I’d used that before and didn’t think I could get that integrated in 6 hours. I liked the idea, though, so I went with Ubercart, even though I’d never used it before. Ubercart was actually super easy to set up, so no real issues there. The only catch was trying to figure out how to integrate Ubercart with the iPad app - I ended up rolling my own integration with JSON, because I needed to search Ubercart orders by phone number, and I needed to pull the products that the order contained as well.

On the iPad side, I used the AFNetworking library, which makes asynchronous network calls extremely easy. I also created a user interface in the Apple’s XCode Interface Builder, which is more or less drag-and-drop for positioning UI elements.

Twilio App in Interface Builder

That actually took a decent amount of time, simply to get all of the UI elements into place that a customer service rep might need from someone’s order. I wrote some Objective-C to set the properties on each of those UI elements from the JSON returned by my Drupal/Ubercart integration module, and the app now could show order information!

I read the email saying I was selected as a finalist for the Developer Contest around 8am on Wednesday, and I would need to do a 10 minute demo at 5pm - that was great, but I was giving a presentation on PhoneGap and Drupal at DrupalCon at 1pm, so I couldn’t really worry about the Developer contest demo until after that :)

There were two other great entrants at the Developer Contest - VuzzBox and Drupal SMS Server - so that was cool to see that there was such a wide variety of things you could do with Twilio and Drupal.

I came in second place, which I’m really happy with - I basically entered the contest so I would have something to keep me from going nuts worrying about my PhoneGap presentation before DrupalCon started! Now my plans are to figure out if there is an actual need or desire for this app with some of the e-commerce/shopping cart packages out there - if this sounds interesting to you, let me know!