I'm attempting to send a push notification to a specific user's installation.
In the user class I have a column which is a pointer to an installation instance. Here's my code:
Parse.Cloud.beforeSave("Notification", function(request, response) {
var user;
if (!request.object.get("reciever")) {
response.error("Please include a user");
} else {
user = request.object.get("reciever");
}
var message = request.object.get("message");
var query = new Parse.Query(Parse.User);
query.include("installation");
query.equalTo("objectID", user.get("objectID"));
query.find({
success: function(result) {
var obj = result[0];
var intst = obj.get("installation");
console.log(intst);
Parse.Push.send({
where: intst,
data: {
alert: message
}
}, {
success: function() {
console.log("Push was successful");
response.success();
},
error: function(error) {
console.error(error);
response.error(error);
}
});
},
error: function(error) {
response.error(error);
}
});
});
From looking at my logs, the installation instance was received correctly. When sending, I get the following error:
Failed to create new object, with error code: {"code":115,"message":"Missing the push channels."}
What am I doing wrong?