You'll learn what webhooks are, how they differ from regular API calls, and what to plan for when your product uses them.
A webhook lets one system send data to another automatically when an event happens. Instead of your app repeatedly asking whether something has changed, the other system tells your app as soon as it does.
Approach | How it works | Trade-off |
|---|---|---|
Polling | Your app asks the API for updates every few seconds or minutes | Simple, but wasteful, and updates can be delayed |
Webhook | The other system sends a message to your URL when an event happens | Near real-time and efficient, but needs more setup |
When a customer pays on your website, the payment gateway sends a webhook to your server to say the payment succeeded. Your system then confirms the order and sends the receipt, without having to keep checking the payment status. The same pattern powers new order alerts in e-commerce and notifications when new code is pushed to a repository.
Webhooks make real-time features like payment confirmations and instant notifications possible.
They cut down unnecessary API calls, which can lower costs and improve performance.
Assuming webhooks always arrive on time instead of planning for delays and retries.
Processing the same event twice when a webhook is sent more than once.
Accepting webhooks without verifying they come from the real sender.