javascript - parse cloud code push notifications not working -
i'm working on project , decided use cloud code send these user user push notifications. here's want do:
when new row created/saved take content 'touser' column pointer<_user>
, once i've got content 'touser' column i'd send push notification username, , usernames available under 'username' string in '_user' class.
this code i've tried use:
parse.cloud.aftersave("custommessage", function(request, response) { var touser = request.object.get('touser'); var pushquery = new parse.query(parse.installation); pushquery.equalto('touser', touser); parse.push.send({ where: pushquery, // set our installation query data: { alert: "you've got new message " + touser } }, { success: function() { // push successful response.success(); }, error: function(error) { throw "got error " + error.code + " : " + error.message; response.error(); } }); });
for reason, code isn't working me. sends push notification onto parse , reads this:
could please show me how this?
i appreciate help,
armanb21
to nofity user, need link _installation , _user class. application, i've added user column in _user class.
// notify var query = new parse.query(parse.installation); query.equalto('user', request.object.get('touser')); parse.push.send({ 'where': query, 'data': { 'alert': "you've got new message " + touser } }, { success: function() { // push successful }, error: function(error) { // handle error } });
Comments
Post a Comment