A Node.js library for Firebase Cloud Messaging (FCM) using REST APIs. Supports sending push notifications to Android, iOS, Web, and topics, as well as subscribing/unsubscribing devices to topics. Uses service account private key for authentication. Current version 1.0.7 has limited recent updates (last update in 2020). Simpler alternative to @firebase/messaging, but lacks TypeScript types and advanced features like message targeting conditions.
npm install fcm-rest-apiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sends a push notification to Android devices using FCM REST API with a service account private key.
Ensure platform string is lowercased: 'android', 'ios', 'web'.
Wrap single token in array: ['token'].
Use an alternative library like firebase-admin or @google-cloud/firestore for up-to-date FCM support.
Use 'fcm.unSubscribeToTopic' exactly as shown.
Use require('./path/to/key.json') to load the key object.Replace import with: const fcm = require('fcm-rest-api');Pass 'android', 'ios', or 'web' (lowercase) as the 5th argument.
Ensure tokens is an array: ['single_token'].
Provide correct path to the Firebase service account key JSON file.