node-gcm is a Node.js library for sending push data through Firebase Cloud Messaging from your server. It targets topics, registration tokens, and rich notification payloads for mobile clients.
Overview
node-gcm provides a server-side JavaScript interface for Firebase Cloud Messaging, carrying forward the older Google Cloud Messaging name. It focuses on making FCM HTTP calls from Node backends with structured message objects and callback-style responses.
Recipients can be a single topic, registration tokens (up to one thousand per request), or deprecated registration ID lists. Messages support collapse keys, priority, dry-run mode, custom data payloads, and user-visible notification fields with platform-specific options for Android and iOS.
The library documents Legacy API server key setup in the Firebase console and notes compatibility constraints with some third-party mobile clients. Custom HTTP options such as proxies or timeouts can be passed where the FCM client allows.
Project maintainers state the package depends on the Legacy FCM API and urge migration to libraries supporting the FCM HTTP v1 API before that legacy endpoint is retired. New work toward a 2.0 rewrite is noted as in progress.
Key features
- Send to topics or registration token batches
- Notification and custom data payloads
- Collapse keys and priority options
- Dry-run requests for testing
- Android and iOS notification field mapping
- Configurable HTTP client options
- DEBUG logging for FCM requests
Use cases
- Pushing alerts from a Node.js backend to mobile apps
- Broadcasting messages to an FCM topic
- Testing FCM payloads with dry-run mode
- Targeting up to one thousand device tokens per call