Share Your Experience With Others

What is Webhook? Who Created It? How it’s different from API?

What is Webhook?

A webhook is a way for web applications to receive real-time data from other applications or services, without the need for constant polling. When an event occurs in the source application or service, a webhook is triggered, which sends a payload of data to a predefined URL in the recipient application or service.

Who created it?

Webhooks were not created by any one person or company, but rather emerged as a popular pattern for integrating web applications. They have been used by companies like GitHub, Stripe, and Zapier, among others.

How it’s different from API?

Webhooks are different from APIs in that APIs require the recipient application to actively query the source application for new data. This can be resource-intensive and may lead to latency issues. Webhooks, on the other hand, allow for real-time data transfer, so that the recipient application is notified immediately when new data is available.

Here’s a simple example: Let’s say you have an e-commerce website and you want to receive real-time notifications of new orders. You could create a webhook that is triggered every time a new order is placed on your website. When the webhook is triggered, it would send a payload of data (e.g. order details) to a URL you’ve defined in your inventory management system. This would allow your inventory management system to update inventory levels in real-time, without the need for constant polling or manual updates.

Let’s understand it in a different way

Imagine you’re at a restaurant and you’re hungry for some data. You have two options: a waiter and a food truck.

The waiter is like an API. You tell them what you want, and they go back to the kitchen to get it for you. They bring it back to your table, and you can enjoy your meal. But if you want something else, you have to call the waiter again and wait for them to bring it to you.

The food truck is like a webhook. It’s parked outside the restaurant, and every time it has something new to offer, it sends out a loud and flashy message. You can go outside and grab what you want whenever you want it, without having to wait for the waiter to bring it to you.

So, if you’re in a hurry and want data as soon as it’s available, go for the food truck (webhook). But if you want to have more control over what you get, go for the waiter (API). And if you’re really hungry, maybe go for both!

Leave a comment