Created
December 24, 2018 13:19
-
-
Save Sikandarkhan/f568c9cbea751af5c6a605f0474e32e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var admin = require("firebase-admin"); | |
var serviceAccount = require("../controllers/updated_key_iot.json"); | |
admin.initializeApp({credential: admin.credential.cert(serviceAccount), | |
databaseURL: "https://your-domain.firebaseio.com"}); | |
var registrationToken = "deviceRegisterationToken-generates-from-ios-application"; | |
var payload={ notification:{ | |
title: "Have a great weekend",} }; | |
var options = { priority: "high", | |
timeTolive: 60*60*24 | |
}; | |
admin.messaging().sendToDevice(registrationToken, payload, options).then(function(response){ | |
console.log("Succesfully sent Message:",response);}).catch(function(error){ console.log("Error Sending Message:", error);}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment