JSPM

node-firebase-push-notification

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q18108F
  • License MIT

An npm package that simplifies sending push notifications using Firebase Cloud Messaging (FCM) in Node.js applications.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-firebase-push-notification) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Node Firebase Push Notification

    npm version License

    Node Firebase Push Notification is an npm package that simplifies sending push notifications using Firebase Cloud Messaging (FCM) in Node.js applications.

    Installation

    To install the package, use npm:

    npm install node-firebase-push-notification

    Usage

    const { FirebaseAdmin } = require('node-firebase-push-notification');
    
    // Initialize FirebaseAdmin with your credentials
    FirebaseAdmin.initialize({
    projectId: 'your-project-id',
    privateKey: 'your-private-key',
    clientEmail: 'your-client-email',
    databaseURL: 'your-database-url'
    });
    
    // Get the FirebaseAdmin instance
    const firebaseAdmin = FirebaseAdmin.getInstance();
    
    // Send push notifications to a list of device tokens
    firebaseAdmin.sendMulticastMessaging(
    ['deviceToken1', 'deviceToken2'],
    'Notification Title',
    'Notification Body',
    { customData: 'value' },
    )
    .then((batchResponse) => {
    console.log('Push notification sent:', batchResponse);
    })
    .catch((error) => {
    console.error('Error sending push notification:', error);
    });

    Please remember to replace the placeholders such as 'your-project-id', 'your-private-key', 'your-client-email', 'your-database-url', 'your-username', and 'link-to-your-documentation' with the appropriate values for your project.

    Contributing

    Contributions are welcome! Please follow the contribution guidelines before submitting a pull request.

    License

    This package is MIT licensed.