Firebase Cloud Messaging
Configure Firebase Cloud Messaging in Notiflows
Firebase Cloud Messaging (FCM) delivers push notifications to Android, iOS, and web applications using the FCM v1 API.
Prerequisites
Before configuring FCM in Notiflows, you need:
- A Firebase project
- A service account with the Firebase Cloud Messaging API enabled
- A service account JSON key file
Configuration
| Field | Required | Description |
|---|---|---|
| Project ID | Yes | Your Firebase project ID (e.g., my-app-12345) |
| Service Account JSON | Yes | Full contents of your service account key file |
Generating service account credentials
Notiflows authenticates with FCM using a Google service account. The service account JSON contains the credentials needed to request OAuth2 tokens for the FCM v1 API.
- Go to the Firebase Console and select your project
- Click the gear icon next to Project Overview and select Project settings
- Go to the Service accounts tab
- Click Generate new private key, then confirm
- A JSON file downloads automatically — store it securely
The service account JSON contains a private key. Treat it like a password. Do not commit it to version control or expose it in client-side code.
The downloaded JSON looks like this:
{
"type": "service_account",
"project_id": "my-app-12345",
"private_key_id": "key123...",
"private_key": "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-abc@my-app-12345.iam.gserviceaccount.com",
"client_id": "123456789",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/..."
}Paste the entire JSON contents into the Service Account JSON field in Notiflows. The Project ID field should match the project_id value in the JSON.
Enabling the FCM API
If you created your Firebase project recently, the FCM v1 API should be enabled by default. If not:
- Go to the Google Cloud Console
- Select your Firebase project
- Navigate to APIs & Services > Enabled APIs
- Search for Firebase Cloud Messaging API and enable it
Setup in Notiflows
- Navigate to Channels in your project
- Click Create Channel
- Select Mobile Push as the channel type
- Select Firebase Cloud Messaging as the provider
- Enter your Project ID
- Paste the full contents of your service account JSON
- Save the channel
Syncing device tokens
To deliver push notifications, Notiflows needs the FCM registration token for each user. Your app receives this token from the Firebase SDK at runtime and must sync it to Notiflows via the User API.
Set the device token as a channel setting on the user:
curl -X PUT https://api.notiflows.com/api/user/v1/channel-settings \
-H "Authorization: Bearer USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "YOUR_FCM_CHANNEL_ID",
"settings": {
"device_tokens": ["FCM_REGISTRATION_TOKEN"]
}
}'A user can have multiple device tokens (one per device). Notiflows sends the notification to the first token in the list.
FCM registration tokens can change over time. Your app should listen for token refresh events and sync the new token to Notiflows. See the Firebase documentation for token management on each platform.
Payload
When Notiflows delivers a push notification via FCM, the payload includes a notification message, a data message, and platform-specific overrides. Only non-empty template fields are included.
{
"message": {
"notification": {
"title": "Rendered title",
"body": "Rendered body",
"image": "https://cdn.example.com/image.png"
},
"data": {
"notiflowsNotificationId": "notif_abc123",
"notiflowsDeliveryId": "del_xyz789",
"notiflowsActionUrl": "https://app.com/orders/123",
"notiflowsData": "{...}"
},
"android": {
"priority": "NORMAL",
"collapse_key": "order_123",
"ttl": "3600s",
"notification": {
"sound": "default",
"channel_id": "orders",
"click_action": "ORDER_UPDATE",
"tag": "order_123",
"notification_count": 3
}
},
"apns": {
"headers": {
"apns-collapse-id": "order_123",
"apns-priority": "5"
},
"payload": {
"aps": {
"sound": "default",
"badge": 3,
"category": "ORDER_UPDATE",
"thread-id": "conv_456",
"mutable-content": 1,
"interruption-level": "time-sensitive",
"relevance-score": 0.8
}
}
},
"token": "device_registration_token"
}
}The data fields are always delivered as strings. notiflowsData is a JSON-encoded string containing the full delivery data.
FCM automatically includes an apns override block so iOS devices receiving via FCM get the full native APNs experience (action buttons, Focus mode, Notification Summary ranking, etc.).
FCM-specific template fields
This field is only shown when the channel provider is FCM:
| Field | Description |
|---|---|
| Android Channel ID | Android 8+ notification channel. Must be created in your app before use. |
See the Mobile Push overview for all shared template fields.