Put simple Webhooks are HTTP callbacks, user defined. Wiki:(a callback is a piece of executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time). Essentially it is a way for a program or system to notify you or another application when an event occurs. Webhooks deliver the data as they happen via ‘Events’. They are different from API’s in the way that they don't need to check for data changes. In setting up a Webhook URL (webhook endpoint) is registered and notified anytime an event occurs.
Webhooks allow for open ended integration with web services. They are not by any means a new technology, nor are they explicitly tricky to work with. Web applications and SaaS technologies today are relying on real time notifications between applications. It is gradually becoming an essential UX feature in creating rich and aesthetic applications. Webhooks play an important role in communication over the internet.
Many are familiar with the messaging service Slack. Slack API now provides support for incoming and outgoing Webhooks. For example users can now do things like send messages from a Slack channel to an external source. Any external source could be utilized as long as it is capable of working with JSON payloads. Users can also request notifications based on a store of changing data.
If you are familiar with Dropbox you may notice that when a file is “Dropped” into a folder all the users of that shared folder get a notification. A Webhook is responsible for giving you this real time notification. This works in the exact same manner as a windows outlook notification that an email has been received.
Recurring events may be considered the most important role of Webhooks. Let's take an example of a video or music streaming service like Spotify or Netflix. All users that register for their premium services must pay a flat monthly “recurring fee”. Here are a few use cases in which we could use webhooks to fulfill notifications when any of the following events occur.
Fictitious Example (Ace Apples):
In this example i am going to discuss how Webhooks may be beneficial to all the operations that could happen in any business. In this use case we have a company called Ace Apples. Ace apples sell apples through their Shopify based site. Behind their company walls they have the usual collection of employees (Yellow).
In (Blue) you can see the SaaS applications that each of these groups choose. They all have their own areas, however they all work closely with Dropbox for files storage and secure transfer, and they all chat via Slack.
Let's discuss a few Webhook use cases via this fictitious company.
With just 3 simple use cases and a diagram above you can see how this communication between all these 3rd party applications works. I’m sure you can see many other combinations of events that can occur, along with many other SaaS applications you know of.
If you are working with an SaaS product you should already be on this Webhook trend for real time notifications. If not get the dev team going! As you can see above the relationship between one service and another can be a massive selling point when companies are choosing between third party products and integrations. I for example have found myself fully committed to the Confluence packages (JIRA, BitBucket, Confluence) mainly because they work so well together but also because they work with some many other products seamlessly.
Articles for Devs:
If you are interested in reading a more technical based article on Webhooks then do refer to Scott Hanselman’s great article: http://www.hanselman.com/blog/IntroducingASPNETWebHooksReceiversWebHooksMadeEasy.aspx
Ravi Kiran also wrote a great article on consuming Webhooks from Github: http://www.dotnetcurry.com/aspnet/1245/aspnet-webhooks-receive-webhooks-from-github
I hope found this article insightful as you start diving into Webhooks. I will be building out an ASP.NET C# example shortly and providing it for forking on Github so please do check soon for a link to that article.