Getting Started: Twilio SMS/MMS Distribution of Urban Airship Digital Wallet Campaigns

Today, we're excited to be a part of Jeff Lawson's keynote at the Twilio Signal conference! Jeff announced our joint collaboration to make the creation, distribution and management of digital wallet passes easier than ever. Now, in addition to delivering a pass via push notifications or e-mail, marketing and loyalty teams can add SMS and MMS as distribution channels to reach even more of their audience.



Here's how it works on iOS:
A user is presented with an MMS that details the offer/loyalty card with the front of the pass shown. Once the user clicks the pass image, they are presented with an "add to Passbook" screen, which allows them to easily add the pass to their phone. Once the pass is installed, Urban Airship Reach allows you to send pass updates and change notifications to the pass, without the user having to reinstall another pass. So now, instead of sending out a new offer on a monthly basis, you can simply update the pass and have it ready for your customer's the next time they go into Passbook. Win! Win! It's like having another channel to engage your end users with -- and the beauty of it is, you don't even need an app.

The integration is really straightforward and consists of three basic steps:
1. Creating the pass
2. Distributing the pass
3. Updating the pass

Step one - creating the pass
Urban Airship Reach provides an easy to use drag and drop UI that guides you through creating a template that will be used for the passes. The one I use below is an event pass, but you can work with all of the pass types that Apple and Google support to create a template.

After creating the template, I create a pass with our API. You can also use our CSV uploader for this step. The following command creates the pass - note the external ID I'm setting is the phone number. This allows me to send updates to this specific pass tied to an ID, which in this case is a phone number. This number could be anything like a customer ID or something that allows people to tie back to their backend systems - it just needs to be unique.

curl -X post https://wallet-api.urbanairship.com/v1/pass/41955/id/5102198521?api_key=your API key goes here -H "Api-Revision:1.2" -d 'json={"fields":{}, "publicURL" : {"type" : "Multiple"}}'

This will return a bunch of text back (the csv uploader will have a new column in the csv file with the PublicUrl returned for you)- what you are looking for is this:

   "publicUrl":{
      "path":"https://wallet-api.urbanairship.com/v1/download/pass/c4f22293-5337-46bb-b82e-d029dd1d67b3",


Edit that down to remove the "" and you get this: https://wallet-api.urbanairship.com/v1/download/pass/c4f22293-5337-46bb-b82e-d029dd1d67b3. This is the URL you will use in step 2.

Step two - distributing the pass
Now comes the Twilio integration to send the passes out over SMS/MMS. I used the Twilio curl examples, but this can be done programmatically and tie into any existing backend systems. The only thing you need to do is specify your text and add in the URL from above into the the MediaUrl field. That's it! - Twilio takes care of the rest. You could do this from a web site where users enter their phone number on a form or run through a list of pre-existing user phone numbers. The distribution is really simple and easy to setup.

curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/your API key goes here/Messages.json'
--data-urlencode "To=+18675309" 
--data-urlencode "From=+1415xxxxxxx" 
--data-urlencode "Body= Here is a sample Twilio SIGNAL 2015 pass. " 
-d "MediaUrl=https://wallet-api.urbanairship.com/v1/download/pass/c4f22293-5337-46bb-b82e-d029dd1d67b3"
-u your API key and Password go here


This is what shows up on the phone (takes about 10-30 seconds for the mms to show up).

Tap the pass to add it into Passbook and done. You now have a digital pass on your end users device and can update it as necessary to keep your users engaged and up to date.


Step three - Pass Updates
I'm updating one field on this pass with a change notification that will show up on the users lock screen or in the notification screen. We've made this extremely flexible so you can update one or many fields at once. Basically, anything on the pass can be updated - barcodes, images, text, background colors, etc. So you can update a pass and let the user know what you changed (the change notification needs to reference one of the fields that changed and is meant to let the user know an update occurred on the pass). Our API makes it easy to integrate this into pre-existing applications and update the pass with a change notification in one easy call which I'll show below:

curl -X put https://wallet-api.urbanairship.com/v1/pass/id/5102198521?api_key=you API key goes here -H "Api-Revision:1.2" -d 'json={"fields": {"Text 2":{"value" : "Thanks for attending!", "changeMessage" : "%25@ We hope to see you next year - stay tuned for details","label" : "Event has finished"}}}'

In about 5-10 seconds - the pass is updated and the user receives the change notification

When you swipe on that from the lock screen - it pulls up the pass with the updated fields.

This update process could continue for multiple campaigns and as new users are targeted, the Twilio platform makes it easy to distribute to them. Three steps and you are engaging users with branded content via the digital wallet channel. Try it yourself free for 45 days.