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
.
{
"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.
{
"event": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"recipient": "abc123",
"profile": {
"firebaseToken": "MTI2MjAwMzQ3OTMzQHByb2plY3RzLmdjbS5hbmFTeUIzcmNaTmtmbnFLZEZiOW1oekNCaVlwT1JEQTJKV1d0dw=="
},
"override": {
"firebase-fcm": {
"body": {
"notification": {
"title": "Portugal vs. Denmark",
"body": "great match!"
},
"data": {
"Nick": "Mario",
"Room": "PortugalVSDenmark"
}
}
}
}
}
Everything inside of override.firebase-fcm.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.