A webhook is an event notification transmitted via HTTP, the same protocol used for transferring webpage data. It is typically sent as a POST request, which contains data that is “posted” to a specific URL. The URL defines the location of a script, which processes the data in the POST request.
Webhooks can be built into any application, including web apps, mobile apps, and desktop software apps. Specific events can be programmed to generates webhooks, or “HTTP callbacks,” which are event notifications sent over HTTP. The data may be formatted in whatever way the developer chooses, though JSON and XML formatting are commonly used.
The POST data, which is sent to a specific URL, is parsed by the corresponding script on a web server. The script may be written in one of many different server-side scripting languages, such as PHP, JSP, or C#. It may perform one or more actions, such as saving the data in a database, emailing the information to a specific address, or sending new data back to the source.
Webhooks are used for a wide variety of purposes. Examples include notifying businesses of sales, activating and deactivating software programs, updating customer information, and informing developers of software crashes. Some websites even provide APIs that allow users to send data to a URL when specific events happen. GitHub, for example, provides a list of events that can trigger a webhook, which developers can use to track changes to projects stored in their online repository.
While webhooks are an effective tool, they require an Internet connection between the data source and the web server to function. Additionally, a script must be present on the server at the destination URL and it must be able to recognize and parse the POST data. If the Internet connection or script is not available, the webhook will not work.