Parse platform 从云代码向通道发送推送
要从解析云代码发送推送,我有如下代码:Parse platform 从云代码向通道发送推送,parse-platform,push-notification,parse-cloud-code,Parse Platform,Push Notification,Parse Cloud Code,要从解析云代码发送推送,我有如下代码: var channelList = ["IssuesAnswers"]; if (isNotificationNeed) { var pushQuery = new Parse.Query(Parse.Installation); pushQuery.equalTo('user_email', owner.get("username")); Parse.Push.send({ channels: channelL
var channelList = ["IssuesAnswers"];
if (isNotificationNeed) {
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.equalTo('user_email', owner.get("username"));
Parse.Push.send({
channels: channelList,
where: pushQuery,
data: {
action: "com.mycompany.myapp.NEW_MESSAGE",
issue_id: issue.id,
issue_title_preset: issue.get("title"),
message_id: request.object.id,
}
},
{
success: function () {
console.log("Notification sent!");
// Push was successful
},
error: function (error) {
// Handle error
}
});
}
它不起作用。控制台日志中没有错误,“推送”部分中没有日志。
但如果我评论这句话:
//channels: channelList,
它起作用了。但我的目标是,若用户订阅了香奈儿,那个么我会将推送至单一安装。我该怎么修 你不能同时使用两个频道和Push.send body中的位置 你应该这样写:
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.equalTo('user_email', owner.get("username"));
pushQuery.containedIn('channels', channelList);
并从Push.send正文中删除频道。您不能同时使用频道和Push.send正文中的位置 你应该这样写:
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.equalTo('user_email', owner.get("username"));
pushQuery.containedIn('channels', channelList);
并从Push.send正文中删除通道