Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. exports.sendNotification = functions.https.onRequest((request,response) =>{
  2. var instanceId = "ff1mVdJKDJ4:APA91bEojZyqpQ4EtoegJVSYFifYT_OiZtOUR4Ls9C5S5A8xtK6v85aSWRmzqWPPd1OVoUuJnoPGJgjSMhT6H4cOYYTCrpAJXygd5VCEuWE3jZdv5Qj09zeLpNksqtruhY4f8XqEI9Lv";
  3. const payload = {
  4. notification: {
  5. title:"Prueba desde cloud functions",
  6. body:"Hola"
  7. }
  8. };
  9. admin.messaging
  10. admin.messaging().sendToDeviceGroup
  11. admin.messaging().sendToDevice(instanceId,payload)
  12. .then(function (response) {
  13. console.log("Successfully sent message:", response);
  14. })
  15. .catch(function (error) {
  16. console.log("Error sending message:", error);
  17. });
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement