Webhooks
A webhook enables user to call an external URL or API to facilitate communication between ServiceDesk Plus MSP and any third-party applications. For example, you can sync information between two different services, say between ServiceDesk Plus MSP and any third-party service you might use to maintain your information. You can configure webhooks requests module.
Role Required: SDAdmin
To create a webhook,
- Go to Admin > Integrations > Webhooks and click New.
- A new webhook form will be displayed.
- Enter a unique name for the webhook in the Name field. This is a mandatory field.
- Provide a description related to the webhook.
- Select the required Pre Function and Post Function from the corresponding drop-down. Pre function and post function are used to control the source object before and after the API call.
- Choose the required HTTP method.
- POST - To send data to a server.
- GET - To retrieve the data from a given server using the given URL.
- DELETE - To delete any specific data.
- PATCH - To update one field of a resource.
- PUT - To send data to a server to create/update a resource.
- Enter the API URL. This is a mandatory field.
- Specify URL parameters and Request Headers. Type $ to insert a variable into URL parameters, Request Headers, and Request Parameters.
- Choose the type of Authentication details.
- Enter the Request Payload. The request payload contains the data that you wish to send to the server when you make an API request.
- Select the Content Type from the drop-down.
- Click Save.
List View Actions
Edit/Delete Webhook - Click the icon beside the webhook to edit or delete it.
Enable/Disable Webhook - A webhook can be enabled/disabled from the list view page.
- Click to disable the webhook.
- Click to enable the webhook.
- Test Webhook - Click the icon beside the webhook and click Execute to check whether the created webhook executes successfully.
- Delete Webhook in Bulk - Select the webhooks and click to delete the webhooks in bulk.
- Search Webhook - Click the icon to search through the webhooks from the list view.
How to use deluge
A webhook can be created using the global function of DELUGE. Using Deluge scripting, you can build custom functions that can manipulate data within ServiceDesk Plus MSP and other external applications.
If the end user wants to change the payload/params they can receive the data as an input parameter of global function and return the same. The modified object values set in the metadata is used by dollar variable to replace the payload/params.
First, create a global function with parameter name "metadata" and type as "Map". In this metadata,
1. Pre function will get input of source object (SDP MSP request, diffJson)
2. Post function will get input of source object (SDP MSP request, diffJson) and response of third-party application.
Note: Pre function is used to alter the source object (if needed) before calling the third-party application. Even without the pre function, the existing source object can be passed to replace the payload/params.
Sample screenshot to modify the content via deluge.
Execute Webhook
The actions configured for a webhook can be executed via custom trigger.
- Go to Admin > Incident Management > Custom Triggers.
- Create or select an existing trigger group and click Add Trigger.
- Fill in the necessary details and set the criteria.
- Click the Select Custom Action drop-down and choose Webhook.
- From the drop-down, select the required webhook and click Save.
You can also edit the selected webhook by clicking Edit Webhook. This will direct you to the Edit Webhook page.