Click here to Skip to main content
15,879,095 members
Articles / Web Development / ASP.NET

Getting Started with Microsoft ASP.NET WebHook Preview

Rate me:
Please Sign up or sign in to vote.
4.27/5 (6 votes)
8 Sep 2015CPOL5 min read 36.3K   5   13
In this article, we will discuss about ASP.NET WebHook-Preview.

Editorial Notes

This article starts with Preview of Microsoft ASP.NET WebHook and needs update time-to-time. It would contain reference links for further discussion or clarifications. This is an ongoing article and needs lot of upcoming updates.

Background

There was an announcement for 'Microsoft ASP.NET WebHooks Preview' on September 04, 2015, where Henrik F Nielsen announced the release of 'Microsoft ASP.NET WebHooks Preview' as a new member of ASP.NET family.

For more information regarding this announcement, please refer to:

Introduction

In this article, we will discuss about ASP.NET WebHook-Preview.

Through-out this article, we will discuss about WebHooks, implementation with very first preview release of 'Microsoft ASP.NET WebHooks Preview'.

Purpose

Currently, 'Microsoft ASP.NET WebHooks Preview' is not finalized for release and in the stage where developer can try to use the magic of WebHooks in their code. In this article we will discuss more about this new member of ASP.NET family and try to understand the power of WebHooks using a simple program.

Pre requisite

There is no such major things required to start with WebHooks, we just need to know:

  • Basics of Services (Web APIs etc.)
  • Visual Studio 2013 or later
  • Basic knowledge of ASP.NET

What is WebHook?

To understand, first think about a scenario, where we need to perform some action on the output/result of an existing action.

Image 1

We can also consider callback in C#, where we are performing few custom actions on results. Its not wrong if I say <var>Program-A</var> automatically trigered with an input of output from <var>ProgramA</var>.

In simple words, we can say <var>WebHooks</var> are program/methods/functions/piece-of-code, which modified the actual behavior of a Web page, application, Resource etc.

The interesting thing is that these program/triggers can be/ can not be a part of actual WebSite, Web Application, where <var>Program-A</var> belongs.

The term Web reminds us to HTTP. So, we can say that <var>Webhooks</var> are nothing but just HTTP callback moreover these are user-defined HTTP Callback. In year 2007, term <var>WebHook</var> came to announce, when Jeff Lindsay take it from <var>Hook</var>.

WebHooks:

WebHook is a lightweight HTTP pattern providing a simple pub/sub model for wiring together Web APIs and SaaS services. When an event happens in a service, a notification is sent in the form of an HTTP POST request to registered subscribers. The POST request contains information about the event which makes it possible for the receiver to act accordingly.

Real time examples of WebHooks

We have lot of examples in our day-to-day life, might be we missed these:

  • Checking-in/pushing a code into repository.
  • Trigring deployment build.
  • Posting comments on your favorite blogs.
  • Post Trackback.

More Real time examples of WebHooks

Think a scenario of a factory, which uses a crude oild as a raw material. There is a huge consumption of this oil in the factory on daily basis. They have three mark to maintain the oil storage/stock level in the factory.

Image 2

  • Red for lowest stock and denotes stop usage.
  • Yellow for in stock and denotes can use.
  • Green for lower stock and denotes order to purchase more.

Think a scenario, where factory workers/store-keepers or field-supervisors are maintaining numerous records for the stock of this oil. You can think how much complex this in real scenario?

What is the problem here?

In normal scenario, where the consumption of this crude oil is not so much and can esialy be maintained by manual interventions/activities. Unfortunately, in our case it is not so much simpler to take a byte of brea with Tea.

Here, we need skilled workers to maintain records and set the indicators accordingly so, related actiona can be taken. Think, how much time, cost and manpower would be required in this scenario. Isn't it good to automate it?

What is the solution then?

There might be many solutions we can think over. But here are the possible solutions:

  • Make this process automate
  • Write a short program/app to maintain the difference stock level
  • Automate process so, related person get notified for action(s)

In all of above solutions, we need to trigger some action on the output of a particular action or taks. Isn't it relate to WebHook?

In my personal opinion, I should suggest to do something like this:

  • Write a program/app, which maintain the stock time-to-time (on/when action required)
  • And notify the Panel-section to alarm Red, Yellow or Green indicators

With this solution as soon as there is any addition/substraction in the quantity of Crude-oil our program notify our Stock-Panel (which is nothing but similar to Traffic control light) and it trigers accordingly.

What is pub/sub model?

This is nothing but a publish-scubscribe pattern/model - a messaging pattern. We can assume this as a message-queue paradigm too. We are not geeting in more depth for pub/sub model, please refer to below link for further details:

Applications/Projects provide WebHook

Term WebHook is not new (already discussed above it is coined in 2007) in the world of Web. There are lot of applications already provide, support WebHook, followings are fewer name:

  • Dropbox
  • GitHub
  • Trello
  • Zendesk
  • PayPal
  • SalesForce
  • Wordpress

Overview of ASP.NET WebHook Preview

There is nothing much change in Microsoft ASP.NET WebHook Preview, it maintains the same publish-subscribe model/pattern as we discussed above.

In other words, we can say that ASP.NET WebHook does both send and receive Hook as/within ASP.NET application/program. It has two sides:

  • Sending
  • Receiving

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

How to start working with ASP.NET WebHook Preview

Follow these simple step(s)

  • Choose your package app for which you wnat to use WebHooks viz. Github, Trello, DropBox etc.
  • Install from Preview Nuget eg. GitHub
  • Alternatively, you can visit GitHub

Points of Interest

Microsoft ASP.NET WebHook Preview provides us a facility to communicate outside without intervention of our internal implementation of ASP.NET application.

History

  • Initial version on September 09, 2015

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
India India
Learning never ends.

Comments and Discussions

 
QuestionWant to send data to Zapier using Webhook Pin
Time Tracking Software5-Mar-17 23:03
Time Tracking Software5-Mar-17 23:03 
AnswerRe: Want to send data to Zapier using Webhook Pin
Gaurav Aroraa6-Mar-17 21:35
professionalGaurav Aroraa6-Mar-17 21:35 
QuestionCustom Web Hooks Pin
Member 1022290720-Apr-16 22:40
Member 1022290720-Apr-16 22:40 
AnswerRe: Custom Web Hooks Pin
Gaurav Aroraa20-Apr-16 23:41
professionalGaurav Aroraa20-Apr-16 23:41 
QuestionNice :) I have wrote blog on same topic here. If interested then look Pin
neel bhatt14-Oct-15 22:01
professionalneel bhatt14-Oct-15 22:01 
AnswerRe: Nice :) I have wrote blog on same topic here. If interested then look Pin
Gaurav Aroraa15-Oct-15 3:26
professionalGaurav Aroraa15-Oct-15 3:26 
GeneralRe: Nice :) I have wrote blog on same topic here. If interested then look Pin
neel bhatt16-Oct-15 0:13
professionalneel bhatt16-Oct-15 0:13 
QuestionCongrats Pin
Rahul_Saxena12-Sep-15 18:38
professionalRahul_Saxena12-Sep-15 18:38 
AnswerRe: Congrats Pin
Gaurav Aroraa12-Sep-15 23:59
professionalGaurav Aroraa12-Sep-15 23:59 
SuggestionChange 'Notes for Editors' to 'Editorial Notes' Pin
Shuby Arora12-Sep-15 2:59
Shuby Arora12-Sep-15 2:59 
A typo please changes 'Notes for Editors' to 'Editorial Notes'.

GeneralRe: Change 'Notes for Editors' to 'Editorial Notes' Pin
Gaurav Aroraa12-Sep-15 3:19
professionalGaurav Aroraa12-Sep-15 3:19 
QuestionLooking for source code for WebHook for Zendesk Pin
Shuby Arora12-Sep-15 2:58
Shuby Arora12-Sep-15 2:58 
AnswerRe: Looking for source code for WebHook for Zendesk Pin
Gaurav Aroraa12-Sep-15 3:25
professionalGaurav Aroraa12-Sep-15 3:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.