尝试使用Cloud Functions发送Firebase Cloud Messaging通知时出现问题

时间:2019-11-28 14:07:04

标签: firebase google-cloud-firestore firebase-cloud-messaging google-cloud-functions

我尝试在照片和字段中发送title = 123和body = 321:newValue.volume> 5时,通过Cloud Function将222,333发送到应用程序,但失败了。您能帮我找到问题吗? (请原谅我的英语不好)

enter image description here

enter image description here

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();

exports.Changes = functions.firestore
.document('save/{saveId}')
.onUpdate((change, context) => {

  const newValue = change.after.data();
  const previousValue = change.before.data();

  if (newValue.volume > 5) {
var message=
    {
      "message":{
        "token":"e2vSSYp2Zi4:APA91bGQ4-MbNpc3Y6TwokZ-gs8ghxhNU459qvIml4HGjEAn7xVIVYoH-XzjwCna817C3UByp_8GXbnzn6DK_IAqzCO-XEEh3cWLZGo3wD1i5wb2oI3r8r_rAbEUF3GF_th0j4L7ID8Y",
        "notification":{
          "title":123,
          "body":321
        },
        "data" : {
          "latlng" : "222,333",
          
        }
      }
    }
}
    });

0 个答案:

没有答案