npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mrcuongnt/fcm-node-receiver

v2.2.6

Published

A module to subscribe to GCM/FCM and receive notifications within a node process. v2 is compatible with the latest FCM registration endpoints.

Downloads

73

Readme

[!WARNING] This library is based on reverse‑engineering legacy GCM/FCM protocols and is not actively maintained.
It is provided for reference/experimentation only and may stop working if Google/Firebase change their internals.

fcm-node-receiver

Repository: [email protected]:cuongdev/fcm-node-receiver.git

Goal: receive push notifications sent via Firebase Cloud Messaging (FCM) inside a Node.js process by emulating a device client and using the latest known FCM registration endpoints.

The original push-receiver FCM registration endpoint was deprecated and removed as of June 20, 2024.
This project uses the newer Firebase Installation + FCM registration APIs where possible, but still depends on undocumented behaviour which may break over time.

When should I use fcm-node-receiver?

  • Receive push notifications in a Node.js process (e.g. for bots, bridges, or background workers).
  • Communicate with a Node.js server through Firebase Cloud Messaging infrastructure.

When should I not use fcm-node-receiver?

  • You only need to send notifications → use official Firebase Admin SDK / client SDKs instead.
  • Your app runs on an officially supported FCM platform (Android, iOS, Web) → use the official clients instead of emulating a Node client.

Install

npm install --save fcm-node-receiver

Requirements

  • Node v8+ (async/await support).
  • Firebase apiKey, appID, and projectID to receive notifications.

Basic usage

const { register, listen } = require('fcm-node-receiver');

// Firebase config
const config = {
  firebase: {
    apiKey: 'XXxxXxX0x0x-Xxxx0-X0Xxxxx_0xxXx_XX0xXxX',
    appID: '1:000000000000:android:xxx0xxxx0000x000xxx000',
    projectID: 'the-app-name',
  },
  vapidKey: '', // optional
};

// First time
// Register to FCM and obtain credentials
const credentials = await register(config); // Call once and persist the credentials somewhere
storeCredentials(credentials);
const fcmToken = credentials.fcm.token; // Use this token to send notifications via FCM
sendTokenToBackendOrWhatever(fcmToken);

// Next times (reuse stored credentials)
const savedCredentials = getSavedCredentials(); // Load from file/db/...
// persistentIds is the list of notification ids received, to avoid replaying old notifications.
const persistentIds = getPersistentIds() || [];
await listen({ ...savedCredentials, persistentIds }, onNotification);

// Called on new notification
function onNotification({ notification, persistentId }) {
  // Persist the new persistentId
  updatePersistentIds([...persistentIds, persistentId]);
  // Handle the notification payload
  display(notification);
}

Test notification (HTTP v1)

To test, you can use the scripts/send/index.js script in this repo, which uses the FCM HTTP v1 send endpoint. You need a Firebase service account JSON file and the FCM registration token as arguments:

node scripts/send \
  --serviceAccountPath="/path/to/serviceAccount.json" \
  --token="<FCM_TOKEN>" \
  --projectId="<FIREBASE_PROJECT_ID>"

The projectId argument is optional if project_id is present in the service account JSON.

Acknowledgements