Overview
This node allows users to interact with Firebase Cloud Messaging (FCM) to send push notifications and manage topic subscriptions. Specifically, the 'Subscribe to Topic' operation subscribes an array of device tokens to a specified topic, enabling those devices to receive messages sent to that topic. This is useful for grouping devices by interest or category, such as subscribing users to weather updates or news alerts.
Use Case Examples
- Subscribe multiple device tokens to a 'weather' topic to receive weather notifications.
- Manage user subscriptions by adding or removing device tokens from specific topics.
Properties
| Name | Meaning |
|---|---|
| Topic | The name of the topic to which device tokens will be subscribed. This is required and must follow the valid topic format. |
| Device Tokens | An array of device registration tokens to subscribe to the specified topic. Maximum 1000 tokens per request. |
Output
JSON
success- Indicates whether the subscription operation was successful (true or false).result- The result object returned from the Firebase Messaging API after attempting to subscribe tokens to the topic.
Dependencies
- Requires Firebase Cloud Messaging API credentials, including either OAuth2 or a service account key for authentication.
Troubleshooting
- Ensure the topic name is provided and matches the required pattern (alphanumeric characters, dashes, underscores, periods, tildes, and percent signs).
- Verify that the device tokens array is not empty and does not exceed 1000 tokens per request.
- Common errors include invalid topic format, missing topic or tokens, and exceeding token limits. These will throw descriptive errors to guide correction.
- Firebase initialization errors may occur if credentials are invalid or missing.
Links
- Firebase Cloud Messaging Documentation - Official documentation for Firebase Cloud Messaging, including topics and subscription management.