Skip to main content

Firebase FCM

Configuration Requirements

You can get your Service Account JSON by following these instructions. Paste the complete contents of the JSON file you download from Firebase into the configuration field.

Profile Requirements

To deliver a message to a recipient over Firebase FCM, Courier must be provided the recipient's Firebase registration token. This token should be included in the recipient profile as firebaseToken.

JSON
{
"message": {
"to": {
"firebaseToken": "MTI2MjAwMzQ3OTMzQHByb2plY3RzLmdjbS5hbmFTeUIzcmNaTmtmbnFLZEZiOW1oekNCaVlwT1JEQTJKV1d0dw=="
}
}
}

Override

You can use a provider override to replace what we send to the Firebase FCM API. For example, you can provide an optional data override. If you are overriding body, Courier will send the supplied body as message payload at the request time to FCM. If you want to change part of the message, you can supply those in the data bag in JSON and use template variables to change the message content dynamically.

JSON
{
"message": {
"template": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"to": {
"firebaseToken": "MTI2MjAwMzQ3OTMzQHByb2plY3RzLmdjbS5hbmFTeUIzcmNaTmtmbnFLZEZiOW1oekNCaVlwT1JEQTJKV1d0dw=="
},
"data": {
"Nick": "Mario",
"Room": "PortugalVSDenmark"
},
"providers": {
"firebase-fcm": {
"override": {
"body": {
"notification": {
"title": "Portugal vs. Denmark",
"body": "great match!"
}
}
}
}
}
}
}

Everything inside of providers.firebase-fcm.override.body will be merged into the Message object we send to the Firebase FCM API.

Tracking Events

Courier will include tracking URL information in the data attribute on the incoming message payload.

See Courier push notification tracking