NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


find packages
Search
sign up or log in
log in
New Patch, Merge?
npm Enterprise
features
pricing
documentation
support
fcm-push
A Node.JS simple interface to Firebase Cloud Messaging (FCM) for Android and iOS

Installation

Via npm:

$ npm install fcm-push
Usage

var FCM = require('fcm-push');

var serverKey = '';
var fcm = new FCM(serverKey);

var message = {
to: 'registration_token_or_topics', // required fill with device token or topics
collapse_key: 'your_collapse_key',
data: {
your_custom_data_key: 'your_custom_data_value'
},
notification: {
title: 'Title of your push notification',
body: 'Body of your push notification'
}
};

//callback style
fcm.send(message, function(err, response){
if (err) {
console.log("Something has gone wrong!");
} else {
console.log("Successfully sent with response: ", response);
}
});

//promise style
fcm.send(message)
.then(function(response){
console.log("Successfully sent with response: ", response);
})
.catch(function(err){
console.log("Something has gone wrong!");
console.error(err);
})
See FCM documentation for details.

Credits

Written and maintained by Rasmunandar Rustam & Oscar Kurniawan Thanks to Changshin Lee for his great work on node-gcm, cloned and modified from there.

License

The MIT License

Copyright (c) 2016 Rasmunandar Rustam ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Changelog

1.1.2

Edit ES6 syntax to standard (by @ans-4175)
Fixing #19 "No error on invalid to-token" bug (by @ans-4175)
Remove unused variables (by @ans-4175)
1.1.1

Remove unused dependency
1.1.0

Add ability to send topic (by @ans-4175)
Multicast, now using promise style bluebirdjs (by @misugijunz)
Support callback on promise (by @misugijunz)
Fixed NotRegistered bug (credit to Saber-Technologies solution)
1.0.7

Fixed calling the inherits function before declaring .prototype.send function instead of after (thanks to @dnunes)
1.0.6:

Fixed the length calculation for strings with special UTF-8 characters (ie. german umlauts) which caused FCM errors (by @denisu)
1.0.5:

Major yet silly bug fix in index.js
1.0.3:

README updated
1.0.1:

README added
1.0.0:

Initial release
Private packages for the whole team
It’s never been easier to manage developer teams with varying permissions and multiple projects. Learn more about Private Packages and Organizations…


npm install fcm-push
how? learn more

nandarustam nandarustam published 8 months ago
1.1.2 is the latest of 9 releases
github.com/nandarustam/fcm-push
MIT Licensed on OSI-approved terms®
Collaborators list
nandarustam
Stats
586 downloads in the last day
2,274 downloads in the last week
9,827 downloads in the last month
9 open issues on GitHub
No open pull requests on GitHub
Try it out
Test fcm-push in your browser.
Keywords
fcm, gcm, push, notification, push notification, firebase, firebase cloud messaging, google, android, ios

Dependencies (2)
bluebird, retry

Dependents (2)
pakkasmarja-berries, flamebase-database-node

WEAREREASONABLEPEOPLE is hiring. View more…
You Need Help

Documentation
Support / Contact Us
Registry Status
Website Issues
CLI Issues
Security
About npm

About npm, Inc
Jobs
npm Weekly
Blog
Twitter
GitHub
Legal Stuff

Terms of Use
Code of Conduct
Package Name Disputes
Privacy Policy
Reporting Abuse
Other policies
npm loves you
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.