Before we describe SharePoint WebHook, first let’s understand what is a WebHook.
I believe you are familiar with concepts of API which has been popular for few years now, in API model / setup you request data from an application and in return you get data from the application.
So let’s consider a scenario that you want to know every time something changes in the application, to deal with that in API is cumbersome you will have to keep on asking for data and find out if there was any change from last time.
What if you can get a notification that something has been changed, means you get a response without asking that something has been changed. Now that is what WebHook is, you get a notification that something has changed.
Before I describe SharePoint WebHook you must know that WebHook is not something which has been created by Office 365 or Microsoft but it’s a concept already used in WordPress etc.
SharePoint WebHook can be created for Lists as of now, so basically any changes in a library or list will send a notification if you have subscribed to WebHook. Based on this notification you should a response and also process it further for implementing changes or activities.
Now if you know about Remote Event Receivers you might find it similar but it is different as you can prevent the action or change happening in SharePoint but only be notified about it. Also like traditional WCF based notifications you don’t have information of what has been changed, you just a get a response that something has been changed in library or list.
So as an Application you need to do certain things to make WebHook work
- First of all subscribe to a WebHook
- Once subscribed you will receive POST messages from SharePoint
- Once you receive POST message you should response in 5 seconds with HTTTP/1.1 200 OK
- After that your application should store the notification to process it further.
This is basic overview of SharePoint WebHook, in next post we will do more hands on and learn to set up WebHook and how to process it.