Before you begin, ensure that you have created a Firebase project. If you havenβt done so already, create a new project here.
Setup
To set up Courier with Firebase FCM integration, follow these steps:Configure FCM Provider
- In your Firebase Project, go to βProject Settingsβ > βService Accountsβ and generate a new private key.
- Copy the contents of the downloaded private key JSON file and paste it into the designated field in the Courier FCM Provider Configuration.
- Click βInstall Providerβ or βSaveβ to complete the configuration.
Enable iOS Support (if required)
- Integrate Firebase into your iOS project.
- In your Firebase project settings, go to βCloud Messagingβ and select your iOS project under βApple app configurationβ.
- Create a new key in your Apple Developer Account with βApple Push Notifications Service (APNs)β enabled.
- Download the generated
.p8file and upload it to your Firebase project settings under βApple appsβ > your app > βAPNs Authentication Keyβ.
Getting FCM Tokens
Using a Courier Mobile SDK
The recommended approach to set up Firebase Cloud Messaging (FCM) with Courier is to use a Courier Mobile SDK. All Courier Mobile SDKs automatically sync FCM tokens to Courier and manage them for you. This allows you to send push notifications directly to auser_id instead of managing FCM tokens manually.
Without a Courier Mobile SDK
If you choose not to use a Courier Mobile SDK, follow the Firebase Cloud Messaging Setup guide for your desired platform. Example FCM token:Sending Messages
Hereβs a common example request you can make to thesend API, demonstrating:
providers.firebase-fcm.override.body.data.YOUR_CUSTOM_KEYfor adding custom data to your payload. This is typically used for opening a specific screen in your app when the user interacts with a push notification. Firebase requires thedatakey to be flat. More details about FCM custom data can be found here.providers.firebase-fcm.override.body.apnsfor applying iOS-specific values. You can learn more about these here.
ClickAction and Data Mapping
To pass a click action link into your push notification, enable the data mapping toggle in the Push channel settings.
Sending to a user_id (Recommended)
Sending to a firebaseToken
Sending to multiple firebaseTokens
Automatic Courier Mobile SDK Formatting
When working with a Courier Mobile SDK, Courier can automatically format the FCM payload to provide a better developer experience. You can toggle this feature in the Courier FCM Provider Configuration.
- Automatically delivers Android push notifications in the background. This allows for more accurate push notification delivery tracking and the ability to use your own custom Android notification style consistently.
- Supports Courierβs iOS Notification Service Extension for improved push notification delivery tracking.
send request looks like when this setting is enabled: