Create SMS QR Codes with Twilio

December 21, 2021
Written by

SMS QR Code Blog Post (1).png
  • Interested in trying out our QR code generator? Click here!

QR codes have been around for decades. In the 2010s they were the “next big thing” – until they weren’t. But QR codes have made a big comeback during COVID. Adoption has also been helped by built-in support on the iOS and Android camera apps. Gone are the days when you needed to install a QR code app.

Most of us know QR codes as virtual tickets, or maybe the new way to get a link to a restaurant’s menu. But did you know that you can start an SMS conversation with a QR code? They’re a great way to seamlessly onboard customers into an SMS campaign, WhatsApp conversation, phone call, or email thread.

If you’re coming to Twilio and want to know how QR codes can be used with communications, this post is for you! You’ll learn about:

  • How QR codes for SMS work
  • How to generate QR codes for 4 different communication channels: SMS, WhatsApp, phone calls, and email
  • How to bulk generate QR codes

Try it out!

Before we dive into how everything works, let’s try out an SMS QR code to see what all of this is about. You, dear reader, must now make a choice of colossal importance: do you want a photo of a dog or a photo of a cat?

Scan your choice below and reply back with the SMS message that you’re given! It might take a few seconds for your reply to arrive.

Cat vs. Dog QR Code Graphic

Can’t reach your phone because your cat is laying on top of it and won’t move? I’ve anticipated your plight. Here’s what you’d see if you could get to your phone:

 

Image showing the steps of the interactive demo: 1) QR Code shows prompt to open messaging app, 2) Messaging app opens with phone number and message pre-filled, 3) Auto-response is sent based on the pre-filled message.

 

It’s a simple 3 step process: scan the code, send a prefilled text message, and get a custom response back.

How QR Codes for SMS Work

QR codes seem a bit magical, but when you get down to it they’re just a set of characters and words that your phone can read. Take this SMS QR code for example:

Example QR Code

When we decode QR code, it translates to this message:

SMSTO:+18397772633:Send me a cat photo!

This is already sort of readable, but let’s break this message down even further into its three parts (separated by colons):

  • SMSTO tells our phone that this QR code is for the messaging app.
  • +18397772633 is a phone number (in this case a number we bought on Twilio)
  • Send me a cat photo! is the message body that will pre-populate in the SMS app.

Opening that QR code brings us directly to our SMS app with a keyword pre-populated. That’s a major improvement over having to type out a 10-digit phone number and a keyword.

QR Codes for Other Channels

If we can make a QR code for SMS, what about other channels like WhatsApp, email, and phone calls? For those we just encode a slightly different format for our instructions:

  • WhatsApp: https://wa.me/14135555555?text=hello
  • Email: mailto:email@example.com?subject=Subject&body=Body
  • Phone call: tel:+555-555-555

With SMS, email, and phone calls we can use QR codes in all sorts of ways. For example:

  • Retail stores could place QR code next to a checkout station with an offer to get a coupon code in return for signing up for SMS updates.
  • Realtors could put a QR code on listing signs and have interested buyers call or text.
  • A local government could solicit input on a public notice of construction sign by initiating an SMS survey by a QR code.

So many possibilities, but how do we actually make a QR code?

Creating an SMS QR Code on Twilio

Now that we know how SMS QR codes work, let’s take a look at how to generate one. Follow these steps:

1. Get a Number

First we’ll need a number that we can text or call. You can get one by signing up for a Twilio account and then buying a phone number. If you’re making an Email QR code, check out how to set up SendGrid’s inbound parse functionality (or just use your business email).

2. Configure your Number

Once we have a number, we need to configure it with how we want to handle inbound communications. Twilio Studio is one of the easiest ways to build automated communications flows like SMS auto-responders or call menus and forwarding.

3. Generate a QR Code

With your configured Twilio number in hand, head to my Twilio Serverless QR Code builder and plugin the info to generate your QR code. Plenty of other generators are available with a quick google search.

Once you have your QR code, you can start adding it to signs, billboards, brochures, maybe even a needlepoint?

Using Keywords and Auto-Responses

The neat thing about being able to specify a message keyword via a QR code is that we can use that keyword to determine how to respond. For example, our real estate agent might have a QR code that opens a text message with words “Home #15” pre-populated to send.

Using Twilio Studio, we could match that incoming keyword to a property and respond back with a list of open house dates. The flow might look something like this:

Screenshot of phone messaging app showing an automated conversation where the sender messages "Home #15" and receives a prompt to book an open house visit.

Because we’ve received the ID of the home in the first message, a Twilio Studio flow could do a data dip to our open house scheduling system.

A common way to use keywords with a QR code is to link the user to a location, for example:

  • A museum could have SMS QR codes next to an exhibit that prepopulate a keyword and send a response back with more details about the artwork.
  • A transit system could post SMS QR codes on bus stop signs and prepopulate a stop number to be sent. The response back could include upcoming bus arrivals.
  • A store chain could ask for customer feedback and pre-populate the store number so that SMS survey responses would be linked to each retail location.

Making Lots of QR Codes

Let’s say you need to make a lot of unique QR codes. For example, maybe we want to put a QR code with a unique bus stop number at every bus stop in the city. That would take a while with a one-off QR code generator.

A simple approach is to use Google Spreadsheets with a formula to generate a QR code for each row. Check out this template we built that bulk generates QR codes for SMS, WhatsApp, phone calls, and email.

Another option would be to use an open-source command line tool like the qrencode library available for linux to script the creation of your QR codes. This blog post has more details about how to use qrencode along with some handy examples. This might be useful to you if you wanted to generate a lot of personalized QR codes to send out with an email campaign.

Wrap Up

This was a quick dip into the world of SMS QR codes. Do you have questions or are you using QR codes in an interesting way? I’d love to hear about it on Twitter.