firebase-fcm
TypeScript icon, indicating that this package has built-in type declarations

1.0.33 • Public • Published


Logo

Package for firebase push notification


Powered by Quokkalabs LLP

About The Package

It a wrapper package of firebase push notification REST api.
It can be used with ES5 and upper versions as well as with Typescript and Nest.js.


Built With

This package use following third party packages.

Axios Dotenv


Installation

Follow the steps to install and configure the package.

Step 1 - Install the package

npm install firebase-fcm

Step 2 - Configure server key

Add environment variable in .env | .env.local | .env.development | .env.production

FIREBASE_SERVER_KEY="server-key"

or, configure in your code manually.

FirebaseFCM.config("server-key");

Usage

Import the package

If you use require for importing.

  const FirebaseFCM = require("firebase-fcm").default;

If you use import for importing.

  import FirebaseFCM from "firebase-fcm";

Send notification on single device.

  const response = await FirebaseFCM.sendOnMultiDevice(
    'token', 
    'title',
    'subject',
    'image-url',
    {}
  );
  console.log(response);

Send notification on multiple device.

  const response = await FirebaseFCM.sendOnSingleDevice(
    ['token1', 'token2'], 
    'title',
    'subject',
    'image-url',
    {}
  );
  console.log(response);

Package Sidebar

Install

npm i firebase-fcm

Weekly Downloads

8

Version

1.0.33

License

ISC

Unpacked Size

13.6 kB

Total Files

7

Last publish

Collaborators

  • sumit-ql