3

Objective:

  • When a table is updated with a new row (ParseFile + ParseUser + ParseUser), send one of the ParseUsers a push notification
  • When a new user is created, add a new row to a table (ParseFile + user)

Can either of these be easily achieved without jumping through some major hoops? I'm completely unfamiliar with Cloud Code, though I tried to read through some of the documentation. Cloud Code looks like it has the potential to perform this task, but I haven't seen any examples of doing something like I would like to do.

Does anyone have concrete examples of using Parse Cloud Code in conjunction with the .NET SDK and table updates?

1 Answer 1

3
+50

Parse has a nice Documentation: Parse CloudCode

This is an example Code, which sends a push every time a user is created

//instead of Parse.User you can use any custom parse class too, but write them inside quotes
Parse.Cloud.afterSave(Parse.User, function(request) {
    if(!request.object.existed()){//existed() returns false if the object was just created
        var query = new Parse.Query(Parse.Installation);
        query.equalTo("User", request.object);
        Parse.Push.send({
            where: query,
            data: {
                badge: "Increment",
                alert: "Welcome " + request.object.get("username"),
                sound: "beep.caf"
            }
        }, {
            success: function(){
                //succeed
            },
            error: function(err){
                console.error("Got an error " + error.code + " : " + error.message);
            }
        });
    }
});

There are also other hooks available:

Inside these hooks you can send push notifications, create new objects, manipulate objects, do nearly whatever you want.

In Parse CloudCode you can take advantage of the Parse JavaScript API.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.