In plain English
The usual way to exchange data is a request: your program calls an API and asks, "Are there new orders?" A webhook works the other way around. You tell the service in advance an address on your server, and when the event happens, the service itself sends a request with the data to that address.
Many everyday things work this way: a payment system sends a notification about a successful payment, a messenger passes an incoming message to a bot, a CRM reports a deal stage change, and a form on a site sends a request to a spreadsheet.
How it works
You create a receiving endpoint on your server and specify it in the service's settings. When the event occurs, the service sends a request to it containing the event type and data: order number, amount, status. Your server accepts the request, verifies the signature and performs the needed actions.
It's important to respond quickly and correctly. If the endpoint is unavailable or returns an error, most services try to resend after some time. That's why processing is made idempotent: receiving the same event again must not, for example, credit a bonus twice.
Why a business owner needs this
For a business, a webhook means an instant reaction with no manual work. The customer paid — access to the course opened right away, the order reached the warehouse, the manager got a notification. A delay of even a minute already annoys the buyer.
It also saves resources: no need to request data every few seconds, loading both your server and someone else's. Webhooks are the basis of most modern integrations between services.
Real-world example
A programming school in Astana sold a course through its site, and after payment a manager sent the access link by hand. They connected the payment system's webhook: as soon as the money arrives, the server opens access and sends the link in Telegram. Complaints like "I paid but have no access" stopped.
Common mistakes
- Not verifying the request signature and accepting any data
- Processing for too long and failing to respond in time, which triggers retries
- Not protecting against duplicate events
- Not logging incoming requests and not understanding what went wrong
- Using a receiving endpoint without https