Reputation: 3989
This is how I'm using Parse JS Cloud Code to send push notifications to the "highPush" subset of users:
Parse.Cloud.job("sendHighPush", function(request, status) {
Parse.Cloud.useMasterKey();
Parse.Push.send({
channels: ["highPush"],
data: {
alert: "New match found!",
badge: "Increment"
}
},
{
success: function() {
// Push was successful
console.log('Push Notifications completed successfully.');
},
error: function(error) {
throw "Got an error " + error.code + " : " + error.message;
}
}).then(function() {
// Set the job's success status
status.success("Push Notifications completed successfully.");
}, function(error) {
// Set the job's error status
status.error("Uh oh, ain't no pushing going on here.");
});
});
What I want to do is not only send this push notification to all "highPush" users, but for the push notification string to include info specific to each user respectively. So rather than the alert saying "New match found!", I want it to say "New match found for iPhone 5S 16gb!", where "iPhone 5S 16gb" is a string property of an object associated with that specific user.
From what I can see in the Parse documentation, I can only find ways to send a standard push notification to a subset of users, but no way to customize the push notification content to each user individually. Is there any way to do this?
Upvotes: 0
Views: 81
Reputation: 38526
Unfortunately no.. The push data / alert is not customizable for each target in the push query.
At this time you would need to send individual push notifications to those users and include the specific information.
Upvotes: 1