Prompt
What should I use for reliable webhooks instead of polling?
Latest observation
Use webhook events with retries and idempotency rather than polling.
If you want it to be reliable, the usual pattern is:
- Provider sends an HTTP POST webhook when something changes.
- Your endpoint acknowledges quickly with a
2xxresponse. - The provider retries on failure/timeouts.
- Your handler is idempotent so duplicate deliveries are safe.
- You store a deduplication key / event ID and process asynchronously if needed.
For a more robust setup, consider:
-
Message queue in the middle
Webhook → your receiver → queue (SQS, RabbitMQ, Kafka, Pub/Sub) → worker
This avoids losing events if your app is briefly down. -
Event sourcing / change streams if the source supports it
Better than polling when available. -
Delivery signatures
Verify HMAC/signature headers to ensure authenticity. -
Dead-letter queue + retries
For events that fail processing repeatedly.
If you’re asking what to use as an alternative communication pattern, the answer is:
- Webhooks for push-based notifications
- Pub/Sub or event streaming for higher reliability and scale
- Queues if you need guaranteed internal processing
If you tell me your use case (e.g. Stripe-like payments, GitHub-like events, internal microservices), I can recommend the best architecture.