Google Firebase Notifications icon

Google Firebase Notifications

Consume GoogleFirebaseNotifications API (v.0.1.6)

Actions4

Overview

This node enables sending push notifications through Google Firebase Cloud Messaging (FCM). It is designed to send messages either as structured JSON objects or as simple notification payloads with title and body text to client devices identified by their FCM tokens.

Common scenarios where this node is useful include:

  • Sending real-time alerts or updates to mobile or web app users.
  • Triggering notifications based on workflow events, such as order status changes or system alerts.
  • Broadcasting messages to specific user devices using their unique FCM tokens.

Practical example:

  • A retail app sends a promotional notification with a title and body to a user's device.
  • An IoT monitoring system sends a JSON-formatted message containing sensor data to a device for processing.

Properties

Name Meaning
JSON Message Whether to send the message as a raw JSON object conforming to the Google FCM Message format.
Message The full JSON object representing the message to send when "JSON Message" is true. Must be a valid JSON object, not a string.
FCM Token The Firebase Cloud Messaging registration token identifying the target client app instance. Used when "JSON Message" is false.
Message Title The notification's title text. Used when "JSON Message" is false.
Message Body The notification's body text. Used when "JSON Message" is false.
Additional Fields Optional additional fields to include in the message when "JSON Message" is false. Currently supports:
• Data: A JSON object containing custom key-value pairs to send as message data payload.

Output

The node outputs an array of JSON objects representing the results of sending each notification. Each output item corresponds to one input item processed.

  • When sending a notification, the output contains the message ID string returned by Firebase upon successful delivery.
  • If multiple messages are sent, the output is an array of these message IDs.
  • In case of errors, the output may contain error objects describing the failure.

The node does not output binary data.

Dependencies

  • Requires a configured Google Firebase service account credential with permissions to send messages via Firebase Cloud Messaging.
  • The node uses the Firebase Admin SDK internally, which requires the project ID, client email, and private key from the service account.
  • No additional environment variables are needed beyond the API credentials configured in n8n.

Troubleshooting

  • No credentials got returned!
    This error indicates missing or misconfigured Firebase API credentials. Ensure that the Google Firebase service account credentials are properly set up in n8n.

  • The operation "send" is not supported for resource "notifications"!
    This suggests an invalid operation-resource combination was selected. Verify that the Resource is "Notifications" and Operation is "Send".

  • Invalid JSON message format
    When "JSON Message" is enabled, the "Message" property must be a valid JSON object, not a string. Providing incorrect JSON will cause errors.

  • FCM Token missing or invalid
    When sending simple notifications (not JSON), ensure the FCM token is provided and correctly represents the target device.

  • Firebase initialization errors
    Errors related to Firebase app initialization usually stem from incorrect or malformed private keys. Make sure the private key string includes proper newline characters (\n).

  • Continue On Fail behavior
    If enabled, the node will continue processing subsequent items even if some fail, returning error details in the output.

Links and References

Discussion