25 lines
509 B
JavaScript
25 lines
509 B
JavaScript
|
|
|
|
function sendPush(msgtoken, title, text){
|
|
var message = {
|
|
notification: {
|
|
title: title,
|
|
body: text
|
|
},
|
|
token: msgtoken
|
|
};
|
|
|
|
firebaseAdmin.messaging().send(message)
|
|
.then(function(response) {
|
|
// See the MessagingDevicesResponse reference documentation for
|
|
// the contents of response.
|
|
console.log('Successfully sent message:', response);
|
|
})
|
|
.catch(function(error) {
|
|
console.log('Error sending message:', error);
|
|
});
|
|
|
|
}
|
|
module.exports = {
|
|
sendPush
|
|
} |