WebHooks

AgilityManagement.Client. WebHooks

Agility Management API JS SDK for managing WebHooks in Agility CMS

Source:

Methods

(static) deleteWebHook(requestParams) → {Promise}

Deletes a WebHook.

Source:
Parameters:
Name Type Description
requestParams Object

The paramaters for the API request.

Name Type Description
url String

The url of the WebHook to delete.

Returns:
Type:
Promise
  • No return value.
Example
//Specify the URL of the webhook to delete
const urlToWorkOn = `http://test.url.com`;

api.deleteWebHook({ url: urlToWorkOn })
.then(function() {
	 console.log("deleted");
})
.catch(function(error) {
 //handle error
});

(static) saveWebHook(requestParams) → {Promise}

Saves a WebHook.

Source:
Parameters:
Name Type Description
requestParams Object

The paramaters for the API request.

Name Type Description
name String

The name of the webhook.

url String

The url of the webhook.

publishEvents boolean

Whether to receive publish events or not.

saveEvents boolean

Whether to receive save events or not.

workflowEvents boolean

Whether to receive workflow events or not (such as approve, decline, etc).

Returns:
Type:
Promise
  • No return value.
Example
//Create a new webhook and set what events to receive
const name = `Test Webhook`
const urlToWorkOn = `http://test.url.com`;

api.saveWebHook(
{ url:urlToWorkOn, name, publishEvents: false, saveEvents: true, workflowEvents: false 
})
.then(function() {
	//handle success
})
.catch(function(error) {
 //handle error
});