WIP Firebase Changes for messaging

This commit is contained in:
Patrick Fic
2020-07-22 12:46:40 -07:00
parent 4abef35822
commit 8005a5c1f1
2 changed files with 6 additions and 2 deletions

View File

@@ -54,6 +54,8 @@ const messaging = firebase.messaging();
// // ... // // ...
// }); // });
self.addEventListener('fetch',() => console.log("fetch"));
messaging.setBackgroundMessageHandler(function (payload) { messaging.setBackgroundMessageHandler(function (payload) {
console.log( console.log(
"**********[firebase-messaging-sw.js] Received background message ", "**********[firebase-messaging-sw.js] Received background message ",

View File

@@ -77,9 +77,12 @@ exports.receive = (req, res) => {
notification: { notification: {
title: `New SMS From ${phone(req.body.From)[0]}`, title: `New SMS From ${phone(req.body.From)[0]}`,
body: req.body.Body, body: req.body.Body,
click_action: "TEST CLICK ACTION",
}, },
data: { data: {
jobid: "1234", jobid: "1234",
title: `New SMS From ${phone(req.body.From)[0]}`,
body: req.body.Body,
}, },
tokens: uniqueTokens, tokens: uniqueTokens,
}; };
@@ -92,7 +95,7 @@ exports.receive = (req, res) => {
.then((response) => { .then((response) => {
// Response is a message ID string. // Response is a message ID string.
console.log( console.log(
"[SMS Receive] Successfully sent FCM Broadcast.:", "[SMS Receive] Successfully sent FCM Broadcast.:"
//JSON.stringify(response) //JSON.stringify(response)
); );
}) })
@@ -160,6 +163,5 @@ exports.receive = (req, res) => {
// [0] ApiVersion: '2010-04-01' // [0] ApiVersion: '2010-04-01'
// [0] } // [0] }
// [0] MediaContentType0: 'image/jpeg', // [0] MediaContentType0: 'image/jpeg',
// MediaContentType0: 'video/3gpp', // MediaContentType0: 'video/3gpp',