[Infographic] A Developer’s Guide to What are Webhooks?
With a simple concept we can look at a WebHook as an HTTP callback (an HTTP POST that occurs when an event is triggered an event-notification is pushed via HTTP POST). Essentially, there are two ways your web apps can communicate to share information: polling and webhooks. A web application using WebHooks will POST a message to a URL when events are triggered. When a web application enables users to register their own URLs, the users can then extend, customize, and integrate that application with their own custom extensions or even with other applications around the web.
Did you know? The term "Webhook" was coined by Jeff Lindsay in 2007 from the computer programming term 'hook'.
For the user, WebHooks are a way to receive significant data in real time, rather than incessantly polling for that data. The most profound examples are :
- Paypal uses webhooks to tell your accounting app when your clients pay you.
- Shopify offers webhooks to keep parts of your commerce system updated, so you don’t have to enter new transaction details manually again.
Webhooks typically are used to connect two different applications. When an event happens on the trigger application, it serializes data about that event and sends it to a webhook URL from the action application—the one you want to do something based on the data from the first application. The web application can then send a CALLBACK message, with an HTTP status code like
302 to let the trigger application know if the data was received successfully or
404 if not.
Webhooks Working Diagram
Webhooks make your web more programmable - How?
There are three ways it can:
1. Push: Want to receive data in real- time?
Push is the most promising reason to use implement webhooks. No more polling every couple of minutes to find out if there is a refreshed data. We can basically register a WebHook and receive the data at our doorstep in real-time. Push is hassle free and the simplest!
2. Pipes: Want to share data after you receive?
A Pipe is said to be triggered when our WebHook receives real-time data and triggers events unknown to the original event. For instance, suppose you create a script, register its URL at a shopping site, and have it email you when your wife puts something on the cart or make a script that creates a Facebook message, and have it triggered by a WebHook whenever you add a podcast to your Youtube channel!
Did you know? An event can be defined as “a prominent change in state.”
3. Plugins: Want to dig deeper and venture into data processing?
The internet is now your programming hub! You can now let users make an extension of your web app. The general idea is that a web application sending out data via WebHooks would use the reply triggers to modify its own data.
Consider this scenario:
Whenever you access an application on Facebook, it sends a notification to your application that an external application want to communicate with your web app and what you wish to do about it? PayPal, for instance, uses Instant Payment Notifications or IPNs to send notifications whenever you receive a payment.
I hope you now have the basic idea of what webhooks are and how can they be implemented.
Check out the below infographic to get a quick recap whenever you need.
Check if emails from your domain are landing in Spam - Email Blacklist Tool