NodeJS module to send firebase messages
npm install firebase-messaging
Send message to topic
Send message to device
- collapse_key [String]
- priority [String]
- time_to_live [Number]
- delay_while_idle [Boolean]
- notification [Object]
const firebase = require("firebase-messaging");
var client = new firebase(CLOUD_MESSAGING_KEY);
var data = {
title: "@Test",
content: "@Content"
};
var options = {
delay_while_idle : true
};
client.topic("news", data, options, function(result){
// request err or message id
console.log(result);
});
client.message(DEVICE_TOKEN, data);