Skip to main content
Firebase Cloud Messaging is a free notification delivery service provided by Google Firebase. To enable the FCM integration, you need to get your service account key from the Firebase Console.

Generating a Service Account Key JSON

To acquire the account key JSON file for your service account
  1. Select your project, and click the gear icon on the top of the sidebar.
  2. Head to project settings.
  3. Navigate to the service account tab.
  4. Click Generate New Private Key, then confirm by clicking Generate Key.
  5. Clicking Generate Key downloads the JSON file.
After that, paste the entire JSON file content in the Service Account field of the FCM provider in the integration store on Novu’s web dashboard. Make sure your service account json content contains these fields

FCM Overrides

The overrides field supports apns, android, webpush and fcmOptions overrides

Setting Device Token

Before triggering the notification to a subscriber(user) with push as a step in the workflow, make sure you have added the subscriber’s device token as follows:
Checkout the API reference for more details.

SDK Trigger Example

Device/notification identifiers can be set by using setCredentials or by using the deviceIdentifiers field in overrides.
Novu uses FCM version V1
Suppose you’re using the Firebase (FCM) provider to send push notifications to web browsers via Novu and want users to be returned to the website after clicking the notification. In that case, you must use the link property with a relative URL.

FCM Cost

As per Firebase pricing, Cloud Messaging product is free of cost to use. If other Firebase products are used, the cost will be charged as per the product.

FAQs

You may come across an error like so:""Sending message failed due to “The registration token is not a valid FCM registration token""".This error happens because of invalid or stale token. The fix for this is to remove old tokens, generate a new token and save it into user subscribers.
Try to generate a new token after clearing device cache and retry with this fresh token.
This error occurs when your token is no longer valid. To fix this, generate a new token and use it.
This error occurs if the fcm integration is active but subscriber is missing from the fcm credentials (deviceTokens). The credentials (deviceTokens) for the subscriber needs to be set.