Webhooks
In short: A webhook is a notification in which a service calls an address of your application as soon as something happens, for example a payment is completed.
In more detail: Instead of your application constantly asking (“polling”), the other service reports by itself. It sends an HTTP POST request with the event data to a URL you provided.
In Depth
- Check the signature: Anyone can call the URL. The sender signs the message (HMAC) and you verify the signature with a secret key.
- Answer quickly: Confirm with 2xx, do the work afterwards in the background.
- Retries: If the confirmation is missing, the sender sends again. Hence idempotence.
- Order: Events can arrive swapped.
- Local tests: Tunnel services forward webhooks to the development machine.
See also: Idempotence, Message queue