A webhook, also known as a web callback, is an HTTP POST request to the Kumulos backend.

This lets another service notify you when a specific event occurs or when certain data becomes available, saving you from having to wait for events to complete or continuously polling another service to see if new data is available.

You can create a webhook URL to any of your Kscript API methods and so KScript must be enabled for your app in order to use webhooks.

Adding a webhook

Click on the app, expand Build in the left hand menu, select "API" and then the "Webhooks" tab. Click on the primary action button to add a webhook.

Add webhook

From the dropdown, select the Kscript method you want a webhook URL for and click "Create"

Select Kscript method

A cryptographically secure token will now be generated and shown in the list of webhooks. Click on this to copy the complete webhook URL to the clipboard.

Copy webhook URL

Parsing an incoming webhook

Webhooks expect to receive JSON in the request body, which Kumulos will attempt to parse and make available via the K.params object. For example:

// Request body: { foo: bar }
K.log( K.params.foo );  // bar

You can access the raw request body via the K.params.getRaw() method for when the request body contains an array. For example:

/* Request body:
       { name: Mark },
       { name: Bob }

var myArray = K.params.getRaw();
for (var i = 0; i < myArray.length; i++) {
    K.log( myArray[i].name );  // Mark, Bob

Deleting a webhook

To delete a webook, click on the delete icon next to the token in the list and click 'OK' when prompted.

Delete webhook