
Research
/Security News
TensorLake npm SDK Compromised in ChainDrop Shai-Hulud Credential-Stealing Attack
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.
ts-fcm-notification
Advanced tools
A simple Firebase Cloud Messaging (FCM) notification library for Node.js
ts-fcm-notification is a simple library to send push notifications using Firebase Cloud Messaging (FCM) in Node.js. This library provides functionalities to send messages to individual tokens, multiple tokens, and topics.
To install the library, use npm or yarn:
npm install ts-fcm-notification
or
yarn add ts-fcm-notification
First, initialize the library with your Firebase service account key:
import { FCM } from 'ts-fcm-notification';
import key from './path/to/your-service-account-file.json';
const fcm = FCM(JSON.stringify(key));
const
message = {
data: {
message: 'Hello FCM, You are working fine',
},
notification: {
title: 'Test Notification',
body: 'Hello FCM, You are working fine body',
},
token: 'your-device-token',
};
const response = await fcm.send(message);
console.log(response);
const tokens = ['token1', 'token2', 'token3'];
const message = {
data: {
message: 'Hello FCM, You are working fine',
},
notification: {
title: 'Test Notification',
body: 'Hello FCM, You are working fine body',
},
};
const response = await fcm.multipleTokens(0, tokens, message);
console.log(response);
const message = {
data: {
message: 'Hello FCM, You are working fine',
},
notification: {
title: 'Test Notification',
body: 'Hello FCM, You are working fine body',
},
topic: 'your-topic',
};
const response = await fcm.send(message);
console.log(response);
const topics = ['topic1', 'topic2'];
const message = {
data: {
message: 'Hello FCM, You are working fine',
},
notification: {
title: 'Test Notification',
body: 'Hello FCM, You are working fine body',
},
};
const response = await fcm.sendToMultipleTopics(0, topics, message);
console.log(response);
const token = 'your-device-token';
const topic = 'your-topic';
const response = await fcm.subscribeToTopic(token, topic);
console.log(response);
const token = 'your-device-token';
const topic = 'your-topic';
const response = await fcm.unsubscribeFromTopic(token, topic);
console.log(response);
FCM(key: string)Initializes the FCM library with the provided service account key.
send(payload: any)Sends a message to a single token or topic.
multipleTokens(i: number, tokens: string[], payload: any)Sends a message to multiple tokens.
sendToMultipleTopics(i: number, topics: string[], payload: any)Sends a message to multiple topics.
subscribeToTopic(token: string, topic: string)Subscribes a device token to a topic.
unsubscribeFromTopic(token: string, topic: string)Unsubscribes a device token from a topic.
An example usage of the library can be found in the examples/index.ts file.
import { FCM } from '../lib/index';
import key from './key.json';
const token = 'your-device-token';
const fcm = FCM(JSON.stringify(key));
const message = {
data: {
message: 'Hello FCM, You are working fine',
},
notification: {
title: 'Test Notification',
body: 'Hello FCM, You are working fine body',
},
topic: 'all',
};
const sendMessge = async () => {
const response = await fcm.send(message);
console.log(response);
};
sendMessge();
This project is licensed under the ISC License. See the LICENSE file for details.
FAQs
A simple Firebase Cloud Messaging (FCM) notification library for Node.js
We found that ts-fcm-notification demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Research
/Security News
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.

Research
/Security News
Socket found 16 malicious Firefox extensions designed to steal crypto wallet recovery phrases and private keys using cloned Rabby and OKX interfaces.

Product
Socket now scans VS Code extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.