allBlogsList

Webhooks

WikiPedia defines webhooks as “….a method of augmenting or altering the behavior of a web page, or web application, with custom callbacks. …

Ho-hum right?  Sounds very boring.  It is boring until you realize that webhooks are a simple straight forward convention that create user defined HTTP callbacks.   In September 2015 the ASP.NET team pushed a preview version of ASP.NET Webhooks

This preview allows a developer to receive as well as send webhook calls. That’s important and interesting because it opens up another avenue of inter-application communication.

Imagine there is a Salesforce app running that needs to fire an event notifying a custom .NET website whenever a lead has been created.  A webhook allows it to do that.  

SF fires a notification – a JSON POST -  to a given end point in a web app and passes along a json payload. The web app runs the SF receiver and intercepts the post, processing the data from Salesforce.  That’s it. Simple and clean.

Here is another example: Using the GitHub API, one can make webhooks update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to servers. Granted we may not use Github in this manner but it’s certainly easy to imagine that a webhook can trigger multi-step processes in our applications.

The entire process is convention based, which may lead someone to argue that it’s possible to create a home grown equivalent. Yes it is, but why spend the time reinventing the wheel when this functionality will be available directly from the ASP.NET team.

According to Microsoft

  • On the receiving side, the code provides a common model for receiving and processing WebHooks from any number of providers. It comes out of the box with support for AzureAlerts, Dropbox, GitHub, Kudu, Instagram,MailChimp, PayPal, Pusher, Salesforce, Slack, Stripe, Trello, and WordPress but it is easy to add support for more.
  • On the sending side it provides support for managing and storing subscriptions as well as for sending event notifications to the right set of subscribers. This allows you to define your own set of events that subscribers can subscribe to and notify them when things happens.

[Source: MSDN]

Perhaps the following links will stir your imagination and next time we have an unusual integration request, who knows, a webhook might just be the thing you needed.

Resources:

MS Webhooks Announcement :
http://blogs.msdn.com/b/webdev/archive/2015/09/04/introducing-microsoft-asp-net-webhooks-preview.aspx

Sales Force Webhook Receiver Nuget Package: https://www.nuget.org/packages?q=Microsoft.AspNet.WebHooks.Receivers.Salesforce

Facebook – Zapier Webhook integration:
https://zapier.com/zapbook/facebook/webhook/

Parse Webhooks:
http://blog.parse.com/announcements/introducing-cloud-code-webhooks/