Webhooks
What is a webhook?
A webhook is a type of API, or application programming interface, which allows a given web application to send data to another application when predefined events occur. While most APIs handle two-way data exchanges between disparate software based on user requests, webhooks send data one-way when certain events occur. For example, a webhook might send the length of time a user spent on a page whenever a user leaves the page. Webhooks can also be called “web callbacks” or “HTTP Push APIs”.Developers use webhooks along with other APIs to create and manage connections between their own software and other applications. Because webhooks send data triggered by events, they are typically favored over APIs when the developer wants to accumulate data over time. By contrast, APIs tend to be more useful when developers want data sharing to occur at instances defined by user behavior. While other types of APIs make requests for data and return a result, webhooks passively wait for data events to occur.To set up a webhook, clients create a webhook URL which they provide to the webhook provider. From then on, the providing webhook sends data to that webhook URL for ingestion by the client’s application. The client’s application validates incoming webhook requests to ensure that the incoming data is from the provider and not a security threat, then receives the data.Like other APIs, the information that can be monitored and sent by a given webhook is governed and understood by both the host site and the client site via comprehensive documentation. This mutual “contract” allows both parties to protect sensitive data, as a webhook will package no more data than is necessary to fulfill the webhook owner’s desired output. In this way, neither application fully exposes its own or its users’ data.