Javascript 发送解析推送通知的webhook后
是否可以为通过解析发送推送通知的任何时间设置web钩子Javascript 发送解析推送通知的webhook后,javascript,parse-platform,push-notification,Javascript,Parse Platform,Push Notification,是否可以为通过解析发送推送通知的任何时间设置web钩子 我想检索推送通知的详细信息,并针对推送通知发送到的任何设备设置一列,我不知道有什么钩子,但您可以通过代码中的一个位置(客户端或云函数)运行所有推送,并在那里执行任何推送后的工作。假设JS和高级目标定位,它可能如下所示: function pushToInstallations(query, data) { var params = { where: query, data: data}; return Parse.Push.
我想检索推送通知的详细信息,并针对推送通知发送到的任何设备设置一列,我不知道有什么钩子,但您可以通过代码中的一个位置(客户端或云函数)运行所有推送,并在那里执行任何推送后的工作。假设JS和高级目标定位,它可能如下所示:
function pushToInstallations(query, data) {
var params = { where: query, data: data};
return Parse.Push.send(params).then(function() {
// this is the interesting part, run the installation query
return query.find();
}).then(function(installations) {
var date = new Date();
// presumes underscore, but a regular for loop works too
_.each(installations, function(installation) {
installation.set("mostRecentPushDate", date);
});
return Parse.Object.saveAll(installations);
});
}
var query = new Parse.Query(Parse.Installation);
query.equalTo('someColumn', someValue);
pushToInstallations(query, {alert: "some message"}).then(function(installations) {
// these installations passed back were pushed to and updated
}, function(error) {
// handle error
});
然后,在代码中构建安装查询并调用push的任何地方,都可以调用新的push函数,如下所示:
function pushToInstallations(query, data) {
var params = { where: query, data: data};
return Parse.Push.send(params).then(function() {
// this is the interesting part, run the installation query
return query.find();
}).then(function(installations) {
var date = new Date();
// presumes underscore, but a regular for loop works too
_.each(installations, function(installation) {
installation.set("mostRecentPushDate", date);
});
return Parse.Object.saveAll(installations);
});
}
var query = new Parse.Query(Parse.Installation);
query.equalTo('someColumn', someValue);
pushToInstallations(query, {alert: "some message"}).then(function(installations) {
// these installations passed back were pushed to and updated
}, function(error) {
// handle error
});