Polling vs. webhook
Previously, to get data from a system, you used polling: "Any new data?" every 5 minutes. Inefficient.
Webhooks flip this: "When there's new data, call me." You register a URL; the system sends a POST request to that URL when an event occurs.
Polling = phone calls; webhook = text messages. The second is vastly more efficient.
Typical webhook events
E-commerce: Order received, payment completed, shipment dispatched.
Onremo: system.purchased, user.invited, payment.completed.
Slack: Message received, channel created.
GitHub: Push completed, pull request opened.
Webhook design rules
1. Be idempotent. Receiving the same webhook twice should cause no harm (network errors happen).
2. Respond fast. Return 200 OK within 5 seconds. Do the real work asynchronously.
3. Think about retry logic. Systems like Onremo retry 3 times (after 1, 5, and 60 minutes).
4. Verify signatures. Use a signature to verify the webhook actually came from that system.