TwilioSheet is a little utility that makes it easy for developers to receive SMS messages in a Google Spreadsheet.
I write a lot of simple little SMS applications, but they can be daunting at times. I often wonder if the idea is worth the time it takes to write the code to store, process, and act on the incoming messages. Why not use something a little easier? A spreadsheet perhaps? Well, that’s what TwilioSheet lets you do.
Want to get started right now? Head over to the GitHub repository for TwilioSheet. Otherwise, read on.
Are you wondering what sort of application you can built with TwilioSheet?
One sample application has to do with the story of how I became inspired to write TwilioSheet.
Several months ago, while I was attending Startup Weekend Chandler, I ran into Jason Laveglia. Jason asked me if he could use Twilio to set up a marketing campaign where people could sign up for updates by texting a phone number a keyword and email address, separated by a space. I told Jason that Twilio would be perfect for that and I could write him an example application in 15 minutes.
As I wrote the application, I found myself wondering what I was going to use to store the text message data. Furthermore, I wanted Jason to be able to start playing with the data as it arrived. Clearly, meeting those criteria wasn’t going to happen in 15 minutes. What was I going to do? Then it hit me, a spreadsheet. I quickly set up a Google Spreadsheet and then turned it into a Google Form. Next, I wrote a simple little program to process the text message data and then submit the data to the Google Spreadsheet (by way of the Google Form).
Here is what I wrote:
Well, it worked! In a little over 15 minutes, I had a demo working for Jason.
After I built the sample application for Jason, I realized that with a little more code I could turn my sample application into something that could be used for all sorts of other use cases. Thus, TwilioSheet was born. At it’s core, TwilioSheet is a pretty simple little application. Here are the two key parts of the application:
- The code that takes the incoming SMS from Twilio and translates the incoming POST parameters into the appropriate Google Form POST parameters.
All the rest of the code is for error handling and validation.
Building a simple keyword marketing campaign with TwilioSheet
Going back to the original inspiration for this code, here is how to build a simple keyword marketing campaign using TwilioSheet:
- You’ll need a Twilio account to make this work. Sign up for Twilio if you haven’t already.
- Buy a new number on Twilio – or use one you have already.
- Follow the instructions on the GitHub repository for TwilioSheet and set up your Twilio number to send SMS data to a Google Spreadsheet.
- Send your Twilio number the following text as an SMS:
- You should see that SMS message show up in your spreadsheet in about 7 seconds.
- If everything worked as planned, here is what you should be seeing:
- Enter into cell F1:
1=ArrayFormula(IF(ISERROR(FIND(" ", E:E)),"",FIND(" ", E:E)))
- Enter into cell G1:
- Enter into cell H1:
- At this point, here is what you should see:
There you go, you just made a proof-of-concept keyword marketing campaign.
Just remember what I said before, this is for doing quick little proof-of-concept applications. Please, don’t run your production code off of a Google Spreadsheet.
Tune in next time
You can build all sorts of simple little SMS applications using TwilioSheet. Other use cases that come to my mind are: SMS “contact forms”, expense tracking, time tracking, and polling/voting applications.
Next up: I’ll be showing you how to build a simple little live voting application using TwilioSheet.
In the meantime, please tell me what you think of TwilioSheet. Did you have trouble setting it up? Did you build something cool? Let me know, or email firstname.lastname@example.org!