notiflowsDocs
Channels & ProvidersMobile Push

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:

  1. A Firebase project
  2. A service account with the Firebase Cloud Messaging API enabled
  3. A service account JSON key file

Configuration

FieldRequiredDescription
Project IDYesYour Firebase project ID (e.g., my-app-12345)
Service Account JSONYesFull 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.

  1. Go to the Firebase Console and select your project
  2. Click the gear icon next to Project Overview and select Project settings
  3. Go to the Service accounts tab
  4. Click Generate new private key, then confirm
  5. 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:

  1. Go to the Google Cloud Console
  2. Select your Firebase project
  3. Navigate to APIs & Services > Enabled APIs
  4. Search for Firebase Cloud Messaging API and enable it

Setup in Notiflows

  1. Navigate to Channels in your project
  2. Click Create Channel
  3. Select Mobile Push as the channel type
  4. Select Firebase Cloud Messaging as the provider
  5. Enter your Project ID
  6. Paste the full contents of your service account JSON
  7. 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:

FieldDescription
Android Channel IDAndroid 8+ notification channel. Must be created in your app before use.

See the Mobile Push overview for all shared template fields.

On this page