jlcvp / fcm-node

A Node.JS simple interface to Google's Firebase Cloud Messaging (FCM) for Android & iOS & Web Notification and data push
MIT License
125 stars 48 forks source link

what is registration token, collapse key, and data? #14

Closed hafizali05 closed 7 years ago

hafizali05 commented 7 years ago
var message = { //this may vary according to the message type (single recipient, multicast, topic, et cetera)
    to: 'registration_token', 
    collapse_key: 'your_collapse_key',

    notification: {
        title: 'Title of your push notification', 
        body: 'Body of your push notification' 
    },

    data: {  //you can send only notification or only data(or include both)
        my_key: 'my value',
        my_another_key: 'my another value'
    }
};

I am ok to create a working example code though, I am not finding what should I put on the above mentioned field for registration token, collapse key and the data keys.

jlcvp commented 7 years ago

Registration token is a token firebase mobile api generate to your application instance for every device that has it installed. collapse_key is used to collapse notifications before they get delivered. Data could be any key:value set, it'll be received by your application's firebase service implementation.

For complete information, see https://firebase.google.com/docs/cloud-messaging/http-server-ref