Webhooks for Cherwell are here. In this article, we give you an introduction to Webhooks, and how to use them.
Some exciting news from the Cherwell 10.0 release is that webhooks have been implemented into the system, so we wanted to provide you with an overview on what these are, and how they can be used within your own Cherwell system.
Up until version 10 of Cherwell, when working with 3rd party tools we were required to use a polling system or a middleware tool to draw data from that 3rd party tool. With webhooks, we can now be fed that data in almost real-time. Awesome!
So, what is a webhook?
A webhook is an API that delivers data to other applications as it happens, meaning you get data almost immediately, unlike a typical API where you would need to poll for data often in order to get it as close to real-time as possible. Combining the power of Webhooks with the Cherwell Rest API gives us a much more efficient way to open two-way communication between different tools.
Let’s walk through an example using a Todo application as the 3rd Party tool. Prior to webhook support in Cherwell, a typical process for synchronising a task between Cherwell and a third party Todo application would have been:
- A new Task is created in Cherwell.
- Cherwell sends that task to your favourite Todo Application.
- Cherwell repeatedly polls the Todo Application at a set interval to query if the Task is completed. The Todo Application reports that the task is not completed and no action is taken.
- Complete that task on your Todo Application.
- Cherwell polls the Todo Application at the next set interval to query if the Task is completed. The Todo Application reports that the task is completed.
- Cherwell is updated that the task has been completed.
- Cherwell closes the task.
There are a number of problems and limitations associated with this process. The need to repeatedly poll the third party application can be particularly wasteful in terms of processing and bandwidth usage as well as potentially incurring third-party API “per call” costs or eating into API call limits imposed by the third party. This problem is greatly increased if there is a long delay before the Task is completed. The longer the task is open, the more unnecessary calls are made to the third party API before the task is completed and any action is required by Cherwell.
An obvious way to ease this problem is to increase the interval at which the third party API is called. This can have a dramatic effect on the number of unnecessary API calls made. For instance, increasing the interval from five to thirty minutes will reduce the number of unnecessary API calls to ⅙ of the previous amount.
However, this will also increase the amount of time before changes made to the task are reflected in Cherwell. With a 30-minute polling interval, if the user completes the Task in the third-party app one minute after the API was last polled, it will be 29 minutes before the Task is shown as completed in Cherwell. With a polling interval of five minutes, this delay is reduced to four minutes. When polling third party APIs in this way, there is always a tradeoff between efficient resource usage and timely updating of data.
What are the benefits of Webhooks?
Webhooks provide an elegant way to eliminate this tradeoff by requiring the absolute minimum resource usage with near real-time updates of data. Instead of the requirement for Cherwell to repeatedly query the third party application as to whether the task is completed, the third-party application notifies Cherwell that the task has been completed by calling a Cherwell Webhook URL. The process for implementing our example Task-based integration with WebHooks would be:
- A new Task is created in Cherwell.
- Cherwell sends that task to your favourite Todo App.
- Complete that task on your Todo App.
- Cherwell is notified via a Webhook that the task has been completed.
- Cherwell closes the task in response to the Webhook notification.
By relying on the third party application to notify Cherwell at the point at which the Task is completed, all unnecessary polling is eliminated and is replaced with a single Webhook notification from the third party application to Cherwell. As the third-party application is able to notify Cherwell at the time that the Task is completed and Cherwell is able to respond to that Webhook notification immediately, any delay between the completion of the Task by the end-user and the corresponding update in Cherwell is reduced to an absolute minimum¹.
Webhook support and usage is widespread and many 3rd party tools on the market support them. Our development team has been busy implementing webhooks with HubSpot, Slack, Todoist, Trello and Clickup amongst others. Just take a look at the API documentation for a 3rd party tool you use and see what it can do. Or better still, drop us a line at Sollertis to discuss the tool and let us help you explore the possibilities.
¹This does of course depend on the third party application making its Webhook calls at the time the Task is completed.
By Pete Mawle & Mark Povey