After I gave a talk at Shakacon this year, I was pleased that people came up to me with additional questions—pleased, that is, until someone asked me for a business card and I realized I didn’t have any with me. Whoops.
In this quick post, I’ll describe how I solved that problem by creating an app that sends business cards over SMS and I’ll show how you can do it too.
Why Build an SMS Business Card
I wanted to create something quickly that would let me share information selectively; not everyone should have my cell phone number. It had to be flexible and extensible. It had to solve the problem with the resources I had on-hand. That meant my laptop, a power adapter, and a Twilio account were my raw materials.
This app really showcases the power of Twilio and what’s possible with our APIs. I thought through the best way to solve my problem, and quickly decided to build an app that would listen for keywords sent in via SMS then respond with my contact information.
For example, if you text me the name of the conference where we’ve met, I can send back the appropriate information for you tailored to that conference. The app gives me complete control over which information I send to different people. The keyword and phone number also fit nicely on a slide so people can easily see how to contact me (without, say, having to take a picture of the contact info in my presentation).
Build Your Own SMS Business Card with Node.js
To make this work you’ll need a Twilio account and a Twilio phone number, so you should go get those first. I’ll wait.
The Node.js code that makes this work is below.
When my function gets called by an inbound SMS handler, it first creates a TwiML MessagingResponse
object. The case statement then creates the appropriate response based on the keyword received. This approach makes it simple to add new keywords and corresponding responses. Finally, the MessagingResponse
is returned and finds its way to the recipient.