A webhook in web development is a method of augmenting or altering the behavior of a web page, or web application with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with the originating website or application.
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.
When we talk in the context of api a webhook is an concept that's growing in popularity. A webhook (also called a web callback or HTTP push API) is a way for an app to provide other applications with real-time information. A webhook delivers data to other applications as it happens, meaning you get data immediately.
Webhook or API?
Although they are very similar, they are not the same thing.
Thanks to the API, your applications can pull data from another application. Your application can periodically check for new data and keep in constant communication with the API server. The situation is different in Web Hook. Web Hooks only work when an event occurs.
Web Hook consumes less resources than API because it only runs when the event occurs.