Moved firebase messaging notification handling to messaging generation.

This commit is contained in:
Patrick Fic
2020-07-23 08:30:28 -07:00
parent ffedc41c26
commit 3eb2c0d787
5 changed files with 49 additions and 31 deletions

View File

@@ -28,24 +28,26 @@ exports.testResponse = async (req, res) => {
body: "Test Body",
},
tokens: uniqueTokens,
android: {
notification: {
body: "This is an FCM notification specifically for android.",
title: "FCM Notification for Android",
//image: "url-to-image",
},
},
// android: {
// notification: {
// body: "This is an FCM notification specifically for android.",
// title: "FCM Notification for Android",
// image: "/logo192.png",
// badge: "/logo192.png",
// },
// },
webpush: {
headers: {
// Urgency: "high",
},
notification: {
body: "This is a message from FCM to web",
// requireInteraction: "true",
// actions: [{ action: "the action - matched in sw", title: "title" }],
requireInteraction: "true",
actions: [{ action: "the action - matched in sw", title: "Read" }],
// renotify: true,
//tag: "1234",
//tag: "1234", image: "/logo192.png",
badge: "/logo240.png",
//badge: "/badge-icon.png",
},
},

View File

@@ -75,9 +75,9 @@ exports.receive = (req, res) => {
const uniqueTokens = [...new Set(allTokens)];
var message = {
notification: {
title: `New SMS From ${phone(req.body.From)[0]}`,
title: `SMS - ${phone(req.body.From)[0]}`,
body: req.body.Body,
//click_action: "TEST CLICK ACTION",
click_action: "TEST CLICK ACTION",
},
data: {
jobid: "1234",