我的代码工作得非常好,但后来我开始使用" InternalServerError"在响应有效载荷中。
这是我的Javascript:
var notifBody = "XYZ accepted your invitation";
// FCM payload
var payload = {
to: token,
content_available: true,
sound : "default",
priority: "high",
notification : {
body: notifBody,
title: "K,",
badge : "1"
},
data: {
inviteId: pThis.identifier
}
};
var serverKey = "#serverkeygoeshere";
var data = JSON.stringify(payload);
$.ajax({
url: 'https://fcm.googleapis.com/fcm/send',
type: 'POST',
data: data,
headers: {
"Authorization": "key="+serverKey,
"Content-Type": "application/json"
},
dataType: 'json',
success: function (data) {
console.info(data);
}
});
我得到的回应: {" multicast_id":4805899833962074421,"成功":0,"失效":1," canonical_ids":0,"结果& #34;:[{"错误":" InternalServerError"}]
有任何线索吗?