Skip to content

Introducing Cloud Code Webhooks

Ever since launching Cloud Code, we've been amazed at what Parse developers have built with bits of JavaScript code. From simple object mutations to complex game state management systems, Cloud Code has proved to be a versatile tool. But one of the biggest requests we've received is the ability to run any kind of language or framework to manipulate your data.

Today, we're excited to announce the launch of Cloud Code Webhooks. With this, you can now specify any URL to receive a POST in response to triggers like beforeSave and afterSave on objects, as well as when a Cloud Function is called. You now have the freedom to write code in whatever language you want. As long as you have a server running it, your Cloud Code can integrate with it.

To get started, head over to the new Webhooks section located in the Core dashboard. For example, let's say you want to hit your server at www.example.com/process_puppy whenever a Puppy object is saved. All you have to do is specify this as a beforeSave webhook:

Screen Shot 2015-03-24 at 8.06.32 PM

When Parse receives a request to save a Puppy, your server will receive a POST with the following JSON payload:

{
  "object": {
    "className": "Puppy",
    "name": "Spot",
    "type": "Corgi",
    "age": 1
  },
  "triggerName": "beforeSave"
}

Now, your server can process the Puppy data however you want. In addition to these parameters, you can get data about the User, Installation, and other relevant fields.

Similar to regular Cloud Code triggers, you can change the Puppy by returning a 200 response with an altered object. For example, if you wanted to change the name of the Puppy to Rover, you would return:

{
  "success": {
    "className": "Puppy",
    "name": "Rover",
    "type": "Corgi",
    "age": 1
  }
}

The possibilities are endless. Perhaps you want to reliably save and process all your object data for offline analytics. You could easily stand up a Rails app on Heroku to receive this. Or, maybe you have extensive experience running LAMP stacks on AWS—now it's possible. Whatever server you love, Parse can integrate with it.

Check out more in our Cloud Code Guide on Webhooks and get started today.