Skip to main content
Courier sends push through Firebase Cloud Messaging (FCM) in your Firebase project. It adds templates, user preferences, routing and failover, message logs, and more channels like email, SMS, and in-app Inbox.

Prerequisites

  • A Firebase project
  • A service account private key from that project
  • For iOS, an APNs key uploaded to Firebase

Setup

Configure FCM provider

1

Generate a private key

In your Firebase Project, go to “Project Settings” > “Service Accounts” and generate a new private key.
2

Add the key to Courier

Copy the contents of the downloaded private key JSON file and paste it into Service Account JSON in the Courier FCM provider configuration.
3

Review the remaining settings

  • Apply Recommended Courier Mobile SDK Formatting, on by default. It ships the message as a data payload rather than notification, so Android wakes in the background and your own notification style applies. That background wake is also what reports the delivery back to Courier. It attaches an APNs override for Courier’s iOS Notification Service Extension too, so an iOS device receiving through FCM still tracks delivery. See Delivery and click tracking.
FCM provider configuration showing the Apply Recommended Courier Mobile SDK Formatting toggle

The Courier FCM provider configuration with the Apply Recommended Courier Mobile SDK Formatting toggle enabled.

To add an image, set icon in a push channel override. The override applies to the whole push channel, so Courier Inbox and Pusher get the same icon on that send. With Apply Recommended Courier Mobile SDK Formatting on, the image arrives as image in the data: on Android, read it when you build the notification, and on iOS, attach it in your Notification Service Extension. With the setting off, FCM puts it in notification.image, and Android shows it for you while the app is in the background.
  • Bundle ID and Filter By Bundle ID, off by default. Together they restrict a send to tokens whose device.app_id matches, so a user with two app installs only gets it on the right one.
4

Install the provider

Click “Install Provider” or “Save” to complete the configuration.

Enable iOS support (if required)

1

Integrate Firebase into your iOS project

Integrate Firebase into your iOS project.
2

Select your iOS project in Cloud Messaging

In your Firebase project settings, go to “Cloud Messaging” and select your iOS project under “Apple app configuration”.
3

Create an APNs key

Create a new key in your Apple Developer Account with “Apple Push Notifications Service (APNs)” enabled.
4

Upload the .p8 file to Firebase

Download the generated .p8 file and upload it to your Firebase project settings under “Apple apps” > your app > “APNs Authentication Key”.

Profile requirements

Device tokens live on the user profile rather than on the send, so one profile can hold tokens for several devices and every push provider reads them from the same place. Send push covers the model. FCM addresses the device by registration token, so the profile you send to needs a firebaseToken. Store the token once with POST /profiles/{user_id}, which merges into the profile and creates it if it doesn’t exist:
A single registration token, as a string.
On Android the Courier SDK keeps that token current once you forward onNewToken to it. You send to a user_id and never put a token on a profile yourself. On iOS, FCM is a token you register and refresh, because the SDK’s own hook there is APNs. For a one-off with no stored profile, pass it inline instead: "to": { "firebaseToken": "YOUR_FCM_TOKEN" }.

Set up push notifications

Wire up the SDK, sync tokens, and send your first push.

Send by user id

The call in every language, and the rest of the profile object.

Send to a recipient

Courier reads firebaseToken off the saved profile, so preferences apply and the value can change without touching this code.

Overrides

How overrides work covers the two levels and which one wins. Push channel overrides lists the fields every push provider takes. An override changes the request Courier sends to FCM. Two paths cover most cases:
  • providers.firebase-fcm.override.body.data.YOUR_CUSTOM_KEY adds custom data, usually to open a screen on tap. Firebase requires data to be flat, and override values merge in raw, so every value must already be a string. See Firebase’s data field reference.
  • providers.firebase-fcm.override.body.apns applies iOS-specific values. See Apple’s remote notification guide.
providers.firebase-fcm.override.config replaces the integration’s own settings for a single send: Put personalization variables in message.data, not in to. Courier reads anything nested in to as profile data, so it fills no template variables and triggers no data mapping. Custom data not reaching the device? Data mapping covers the one template setting that stops it.

Override the payload

Provider details

Courier recommends routing to the channel. Naming this key in routing.channels instead is supported, and sends through just this provider.

Send to a specific provider

When that is worth doing, and what you give up: failover, channel priority, and providers you add later.