You cannot send objects directly. You will get an exception (I had this problem a few days ago, but I did not write the name of the exception). The best answer so far is BrentonGray88.
I assume you are not using Android because you turned on the icon: the value is "Increment", but I would do this:
Android code to send notification:
Make sure the Comment object has a pointer (_User) column for the user who posted the comment. When you create a comment, include user.put("commentAuthor", ParseUser.getCurrentUser()); into your Android code so that you can always access the user who created the comment.
Now you need to request a comment in order to send it to the object via a push notification.
ParseQuery<ParseObject> query = new ParseQuery<>("Comment"); query.whereEqualTo("objectId", I AM NOT SURE WHAT CONDITION YOU WANT HERE); query.findInBackground((comment, e) -> { if (e == null) for (ParseObject commentObject: comment) { String recipientObjectId = commentObject.getParseObject("commentAuthor").getObjectId(); final Map<String, Object> params = new HashMap<>(); // This is to send the notification to the author of the Comment params.put("recipientObjectId", recipientObjectId); // This is so we can use values from the Comment in the notification params.put("commentObjectId", commentObject.getObjectId()); // This is a required lined params.put("useMasterKey", true); ParseCloud.callFunctionInBackground("pushMessage", params, new FunctionCallback<String>() { public void done(String result, ParseException e) { if (e == null) { Log.d(getClass().toString(), "ANNOUNCEMENT SUCCESS"); } else { System.out.println(e); Log.d(getClass().toString(), "ANNOUNCEMENT FAILURE"); } } }); } });
Now for the request in your Cloude codec:
Parse.Cloud.define("pushMessage", function (request, response) { // Again, we are sending the notification to the author of the Comment var pushQuery = new Parse.Query(Parse.Installation); pushQuery.equalTo('user', request.params.get("recipientObjectId")); // We retrieve information from the Comment created by that author var commentQuery = new Parse.Query(Parse.Comment); commentQuery.equalTo('objectId', request.params.commentObjectId); commentQuery.get("commentObjectId", { success: function(userObject) { var displayName = userObject.get("displayName"); var content = userObject.get("content"); var message = displayName + ': '; message += content.trim(); Parse.Push.send({ where: pushQuery, data: { alert: message }, }, { useMasterKey: true, success: function () { response.success("Success!"); }, error: function (error) { response.error("Error! " + error.message); } }); console.log(); }, error: function(error) { console.log("An error occured :("); } }); });
Sorry I'm not the best in JavaScript, but the way I would do it. Good luck! :)