Firebase Cloud Message icon

Firebase Cloud Message

Send push notifications via Firebase Cloud Messaging

Overview

This node sends push notifications via Firebase Cloud Messaging (FCM) based on a specified condition. It evaluates a condition expression against topics and sends a message to devices that meet the condition. This is useful for targeted notifications where messages are sent only to devices subscribed to certain topics that satisfy logical conditions. For example, sending weather alerts only to users interested in weather and news or traffic updates.

Use Case Examples

  1. Send a notification to devices subscribed to topics where 'weather' is included and either 'news' or 'traffic' is also included.
  2. Send a high priority notification with a custom title, body, and image URL to devices matching a complex condition.

Properties

Name Meaning
Condition The logical condition expression to evaluate against topics for conditional messaging. For example, "'weather' in topics && ('news' in topics |
Message The message content to send, including notification title, body, image URL, priority, sound, click action, and custom data payload. This defines the notification details that the user will see or the data the app will handle.
JSON Parameters Whether to use raw JSON for the message configuration instead of the structured message fields.
Message JSON The full JSON payload of the message when using raw JSON parameters. This allows advanced users to specify the entire message structure manually.
Message Type The type of message to send: either a notification that appears on the device with optional data, or a data-only message handled by the app without appearing as a notification.

Output

JSON

  • success - Indicates if the message was sent successfully.
  • result - The result object returned from Firebase Cloud Messaging after sending the message.

Dependencies

  • Firebase Cloud Messaging API
  • An API key credential for Firebase Cloud Messaging

Troubleshooting

  • Ensure the condition string is valid and includes 'in topics' with logical operators (&&, ||). Invalid conditions will cause errors.
  • Device tokens must be valid FCM tokens; invalid tokens will cause the operation to fail.
  • When sending to multiple tokens, the maximum allowed is 500 tokens per request.
  • When subscribing or unsubscribing tokens to/from topics, the maximum allowed is 1000 tokens per request.
  • Invalid JSON in the custom data field will cause errors; ensure JSON is well-formed.
  • Firebase initialization errors usually indicate incorrect or missing credentials; verify the API key or service account key is correct.

Links

Discussion