An Introduction to Webhooks

An Introduction to Webhooks

Webhooks are a mechanism which enables communication between two applications or services where one service (client) is waiting for a response from the other (server). In case of webhooks, the server sends the response to the client when it is ready. This is an alternative to the polling approach where the client polls regularly to check if the operation has been completed.

Basically, webhooks enable one application to send automatic notifications or data to another application when a specific event occurs. Though not specifically an API, webhooks are also called “reverse APIs” or “push APIs”.

WebHooks Flow Diagram

Article content


WebHooks are not APIs but they work together. An application must have an API to use a webhook.

Advantages of Webhooks:

  1. Eliminates needs for polling
  2. Can be set up quickly - Client enters app’s webhook URL and basic parameters, like which event they are interested in in the server app’s UI.
  3. Automate data transfer - Data transfer is initiated by server so happens as soon as the event happens.

Risks of WebHooks:

  1. Security: Without proper security measures, malicious third party actors may be able to access sensitive data.
  2. Data Integrity: Data is transferred over HTTP, which can be vulnerable to tampering.

Some examples of webhooks:

  1. An E-Commerce website can use webhooks to notify another application when an order is placed.
  2. An analytics application can use webhooks to receive data from another application that stores usage data.
  3. Social media platforms make extensive use of WebHooks to notify users of new news, posts and updates.

#fundamentals #webhooks

Shrini Kulkarni

Independent Software Engg Consultant | Ex QA Director, OLA | Ex VP JP Morgan | Ex VP Barclays | IIT Madras Alumnus

1y

Ravi Shankar - good one. Some questions though When you say "Webhooks are also called as "reverse APIs" or "Push APIs"  Reverst API meaning - instead of client asking for info or asking for some action to be performed - webhooks do the reverse - let server tell to client when something has happened? Is that how they work? When you say Push API - this push from server I guess as we have POST API that sends data from client and server makes the action ? >>>They put the onus of response on the server instead of on the client. Is'nt that a normal API course of action anyway? When client makes the request, onus of response is on the server right? Client cannot have the onus of response anyway... can it?

To view or add a comment, sign in

Others also viewed

Explore topics