Sending an Urban Airship push notification
What you need to get started
You’ll need a couple of things before you can set up your Urban Airship action:
An Urban Airship account: If you don’t have one you can sign up on urbanairship.com
The Urban Airship SDK installed and configured in your mobile app(s). You will have the option to create development apps in Urban airship. Your development and production app credentials will both work with Customer.io.
Configure your users to be Urban Airship named users: named users ids are how you will associate your profiles in customer.io with the users in your mobile app and Urban Airship app. See [Getting started, part II] for more details.
A master secret and Application Key from your Urban Airship app:
Note: You can configure multiple apps with Urban Airship, so make sure you are using the credentials associated with your production apps.
The right data in Customer.io: You need to make sure you’re getting the right data from your users. This is a little more complex, and is explained in detail below.
Configure your user data in Customer.io
To make sure that you can reach your customers via push notification, you’ll need to make sure that you have the right data in Customer.io.
Most importantly, your users in Urban Airship must be associated with a
named_user_id. Documentation for creating this association can be found here. If your users do not have a
named_user_id created with this association they cannot be messaged.
In Customer.io you will need to store the
named_user_id you previously defined for your users as an attribute (for example, an attribute called
named_user). This id is what we will use as the TO address for your push notifications.
What is a named user?
A Named User is an identifier managed by Urban Airship. Here’s how they describe the value of named users:
It is useful to think of a Named User as an individual consumer who might have more than one mobile device registered with your app. For example, Named User “john_doe_123” might have a personal Android phone and an iPad, on both of which he has opted in for push notifications. If you want to reach John on both devices, associate the Channel (device) identifiers for each device to the Named User “john_doe_123,” and push to the Named User. Notifications will then fan out to each associated device.
This allows you to consistently message a user regardless of whether they switch devices and prevents you from having to manage individual device ids between Urban Airship and Customer.io.
Enabling Urban Airship in Customer.io
From your Customer.io dashboard, head to Settings > Email & Actions, and click ‘Get Started’ next to Urban Airship:
What you’ll need is your Application Key and Master Secret — as we mentioned, you can get these on app settings page under the APIs & Integrations section in your Urban Airship app. Copy and paste them into the fields in Customer.io:
Create your campaign
You’re finally ready to create your campaign, and start sending your push notifications!
First, create a campaign in Customer.io that will trigger sending an push notification. Here, we’re using an event triggered campaign with
account_upgrade as the trigger. So, once a customer upgrades their account, we want to send them a push notification that gives them a confirmation:
Add your Urban Airship action to the workflow
Now you can click to add an item to your workflow:
Choose an Urban Airship push:
Create a name that is descriptive; your end-users won’t see this. Then, click Add Push. We’re calling it “Account Upgrade Notification” so we can easily identify its purpose from the Campaign Overview:
Next, click Add Content to open the SMS composer and set up your push notification message.
Compose your Urban Airship Push
You’re now ready to write your SMS. In the Customer.io composer, it consists of two parts:
- The “To:” field: The
named_user_idthat the message is headed to; defined earlier.
- The message Body: This is where your message’s content goes.
Note: You can use Liquid here to send to specify a a different attribute if you’ve stored your
named_user_id with a different name during setup. Just make sure you have the right attributes for that user. You can see this in action in our example below, or click here to learn more about Liquid in Customer.io.
At this point, your Push composer should look something like this (you can hit Preview to see what your SMS looks like):
Send test request
To make sure your push notification works, you can send a test message by entering a
named_user_id in the test box (shown in the screenshot below), and clicking “Send Test”. This will send a real Push, so make sure you’re sending the test to yourself (or a test account)!
Once sent, Customer.io will show you the response from Urban Airship, and you should see Test sent.
The push notification should then appear on your phone (or whichever device you chose to send it to)! We have a separate guide for tracking your sent push notifications.