Some tickets that come into the service desk might create the need for a new change request. Like many other tasks, the Dispatch'r can help automate this as well. This can be done by using a webhook.


What is a webhook?


A webhook is a “callback” to an application or web service that is triggered when a specific event occurs. What that means is that a webhook lets you look for a specific update or action to occur, and automatically makes a change you specify. The most common of these changes are:


GET : Requests are typically used to retrieve one or all resources

POST : Requests usually create new resources

PUT and PATCH : Requests are used to update a resource

DELETE : Requests are usually used to delete a resource


How can a webhook be used in the Dispatch'r to automatically create change requests?


You can follow the steps given here:


1. Go to the Admin console and click on Dispatch'r.


2. Click on New and select Ticket Rule.


3. Enter a name and description for the rule.


4. Specify conditions which will trigger this rule. You can add new conditions by clicking on the '+' icon and remove conditions by clicking on the corresponding '-' icon.


5. Specify whether all the conditions need to be matched or any one condition is enough to trigger the rule.


6. Under Actions, select 'Trigger Webhook' from the drop-down.


7. In the Request Type drop-down, select POST.


8. In the Callback URL field, enter 'https://<yourdomain>.freshservice.com/itil/changes.json'.


9. Select the Requires Authentication checkbox and authenticate using admin credentials or API.


10. In the Encoding section, select JSON and AdvancedThe advanced option lets you write custom API requests. These requests have to be encoded in the format you just chose.


11. Enter this API request in the Content field:

 

{
 "itil_change":{
                           "subject":"{{ticket.subject}}",
                           "description_html":"{{ticket.description_html}}",
                           "email":"{{ticket.from_email}}",
                           "priority":1,
                           "status":1,
                           "change_type":1,
                           "impact":1,
                           "risk":1
                         }
}

 

12. Add any new actions that you would like this rule to perform and click on Save.


Webhook Callback Request LimitsThe number of webhook requests you can use in 1 hour is limited to 1000 calls. If the status codes are between 200 and 299, the callback is a success and status codes between 300-399 will be taken as callback redirects. When a callback fails (status codes other than 2xx and 3xx), the webhook will automatically be retried once every 30 minutes, totalling 48 calls. Calls requested after the rate limit will be buffered until fresh calls are available after 1 hour.