Push Notifications - Getting Started

Push Notifications - Getting Started


Let's get you started sending mobile push notifications with Customer.io! There are two parts to setup:

  1. What needs to be done in the interface, which is what this doc will help with, and
  2. Changes to your app. For that, you can have a look at our Technical Integration Guide

Enabling Push

Before you can add a push notification to your workflow, you'll first need to enable it in your Email & Actions settings. There, you'll see fields for both Android and iOS platform configuration.

...for Android

Sending push notifications to Android devices is done via Firebase Cloud Messaging. You'll need to generate a .JSON server key, which you enter in the push notification settings. Here's how you do that:

  1. Make sure that the Firebase Cloud Messaging API is enabled for your project. You can check that here.
  2. Log into the Firebase Console for your project
  3. Head into your Project settings by clicking on the gear icon in the sidebar:

project-settings.png

  1. Select the Service Accounts tab and click on the Generate New Private Key button. You will see a confirmation dialog after which the prompt to download the credential file should appear:

generate-key.png

This will generate the JSON key that you can upload into your Android settings:

image.png

Sending to iOS via Firebase

You will see this option in your iOS configuration:

image.png

What it means is that we can use Firebase Cloud Messaging to identify and send messages to iOS devices as well, provided that you've set up FCM to do so. This might make sense for you if FCM is a critical part of your infrastructure, and you don't plan on configuring the Apple Push Notification Service anytime soon.

If you select the option, you will be able to send to iOS via FCM. Please note, you will still need to setup the configuiration for Android if you haven't yet done so.

...for iOS

Sending push notifications to Apple devices is done via the Apple Push Notification service (APNs). You'll need a few things:

  • A .p8 certificate from APNs, which you upload to Customer.io
  • A Key ID, Team ID, and Bundle ID for your app. These are usually found in your Apple Developer Account.

image.png

Testing your configuration

There are a couple of ways to make sure that your initial configuration is working. You can send a single test message from the settings, or (if you have an iOS app) use a separate sandbox environment for your tests.

Sending a single test message

If you want to send a single test message to make sure your configuration and certificates are working, you can do that from within a platform settings page, right next to the platform certificates (after they have been uploaded):

image.png

Enter your token you'd like to test with (see how to find those here), and you'll hopefully get a test push to that device with the following content: "If you're reading this, it means your integration with Customer.io is working!" and you're set to start adding push notifications to your campaigns.

Sending to an iOS sandbox environment

Your iOS certificate may have both sandbox and production environments. If you'd like to send all of your push notifications to your sandbox environment, you can choose that option in your iOS configuration.

Note: We recommend creating a separate workspace to do this.

image.png

Creating Push Notifications

When it comes time to add push notifications to your campaign, click and drag them from the visual workflow sidebar.

Then, you can add content to your push notification, change its behaviour from Queue Draft to Send Automatically, or Don't Send (skip), add action conditions, etc.

You will also see an option to choose which platform you'd like to send your push notification to (for example, if you only want to send to one of iOS or Android):

image.png

When you click to add content, you'll be brought to the composer, where your message has three elements:

image.png

To: By default, your push notification will go to all devices associated with a particular user. However, you have two other options:

  • "Last used device": This will send the message to the device that your customer most recently used to interact with your app. You can provide this last used timestamp when updating devices via our API.
  • Customize: If you have a specific device token that you'd like to send to, or use a Liquid variable, you can do so here.

Title is what appears above the main text of your message. This is optional. If you don't specify one, then...

  • For Android devices, it will default to your app name.
  • For iOS devices, the title simply doesn't display.

Message is your message text. This can be as long as you like, though brevity will likely serve you well!

And that's it! Save, and you've set up a push notification in Customer.io. Next, you're ready to track their success.

Want images, deep links, or custom code? Use custom payloads!

Previewing Push

You'll be able to select from a few different contexts to see what your push might look like. Here's the iOS lock screen:

image.png

We've chosen an "Alert" style for our display, but kept it fairly generic due to the sheer amount of devices that might be out there. To truly see what it looks like on a specific device, we encourage you to send a test to that device.

A/B Tests

If you'd like to test one aspect of a push notification's content (a slight copy change, perhaps), you can do that by clicking the workflow item to edit it, and clicking Turn into an A/B Test

image.png

Then, once you start your test and your campaign is active, you can check in on the results in the A/B test tab.

QA for Push Notifications

Best practice
when it comes to testing whether or not your Push notifications are sending correctly, we recommend that you keep separate development/test and production workspaces — especially if they don't share configuration credentials. Here's why

If you want to send a single test push to a particular device for QA purposes, you'll need to have a device token ready.

How to find your device token(s)

You may already have some test device tokens handy, but if you want to test with a specific user, you can find these in a few places on an individual Person page. First, you'll find them in the Devices tab, but also the Overview:

image.png

From either of these places, you can quickly copy a device token to your clipboard by hovering over it.

QA your Push content

To see your push notification's content on a single device, click the "Send test" button in the top right-hand corner of the composer. You'll see this modal:

image.png

Paste your device token into the "Send test..." box in the Push composer and send a test to it. You may see a "Device type" option if you have both Android and iOS enabled, and you'll need to tell us which type your test device is.

If you've chosen to send to sandbox in your Push settings, that will be enabled here. To disable it, you'll need to return to your settings and uncheck that box:

image.png

Once you've sent a test, you'll be able to quickly re-use that token, by checking the 'Last tested token' box.

Using Event/Attribute/Broadcast Data

As with all other Customer.io messages, you can use relevant customer data in your notification! If you've got an event or API triggered broadcast campaign, you can also use event and broadcast data! For example, if it's a purchase event you're sending and there is a total amount, your push text might look something like:

Thanks for purchasing! You've spent {{event.total}}!

Have feedback?

Yes, please!

We are actively working to improve on this feature! Please let us know your feedback.

  • Found a bug?
  • Have a feature request?
  • Something doesn't work as you expected?
  • Is some functionality missing?
  • Or are you loving the new changes and want to make sure we keep something?

Let us know!

Was this article helpful?