A webhook is a mechanism where a service automatically sends an HTTP request (typically POST) to a pre-registered URL when a specific event occurs. It's like giving someone your phone number and saying "call me when something happens" - enabling event-driven service integration.
The opposite of webhooks is polling, where you repeatedly ask "any updates?" at regular intervals. Polling is inefficient because requests are made even when nothing has changed. Webhooks only fire when events occur, providing better real-time responsiveness with lower server load.
In URL shortening services, webhooks can notify you in real-time when links are clicked. For example, you could receive instant Slack notifications for important campaign link clicks, or automatically feed click data into your own database.
Several considerations are important when implementing webhooks. First, the receiving endpoint must be publicly accessible over HTTPS. Second, retry logic for failed deliveries needs consideration - most services retry with exponential backoff, but events may be lost if the receiver is down for extended periods. Third, verifying the webhook sender through signature validation (HMAC-SHA256) is a critical security measure.
Webhooks are widely used across modern web services: GitHub (push notifications), Stripe (payment confirmations), Slack (message posting), and many more. Automation platforms like Zapier and IFTTT are built on webhooks internally. Related books are available on Amazon.