App Development

How to create Webhook using Parse.com

WebHook

Webhook is a service which is using to process or call  some events when something happens. It is like a simple HTTP call back which is process HTTP POST method when something happens before/after in database.

WebHooks using parse cloud function

Following parameters needed to implements webhooks in parse

  1. master: Set true if the master key was used and otherwise set false.
  2. user: If set, this will contain the Parse User who made the request, in our REST API format. This is not set if the master key is used.
  3. installationId: If you want to add installation Id which made the request.
  4. params: You can pass your parameters in JSON format.
  5. functionName: Your application Cloud function name.
    you can specify triggers names like beforeSave and afterSave on objects, as well as when a Cloud Function is called.

Create new Webhooks section located in the Core dashboard. Enter webhook type ,function name and server URL, for example, let’s say you want to hit your server at www.abcexample.com whenever a “USER” class object is saved. All you have to do is specify this as a beforeSave webhook:

In parse, You can also write parse web-hook function in cloud code. The code like this:

1
2
3
4
5
{ "object": { "className": "User",
 "name": "name", 
 "email":”[email protected]", 
 "age": 1 }, 
 "triggerName": "beforeSave" }

Here User is your table name.in parse your Table name is called class Name.

When Parse receives a request to save a User, server will receive a POST with the JSON payload.

WUsing After Save

Just change trigger name to

1
2
3
4
{"object":{"className":"User",
"Name":"name",
"Age":""8";},
"triggerName":"afterSave"}
Limitations of parse webhook

1. In parse webhooks are limited to 30 seconds after that parse will be automatically terminate.

2. Only POST methods Request handled.

3. It requires TTPS connection and valid SSL certificate.

4. It will not accept self-signed certificate in parse because of security reasons.

Need help?

We are Perfomatix. We specialize in building highly scalable APIs and Mobile apps and we also have strong expertise in IoT apps, Virtual Reality apps, and Augmented Reality apps. Get in touch with us to find out how we can help in shaping your disruptive idea into a prototype, MVP and finally into a killer product. Visit our success stories section to find out more about some of the startups which made it big with us.