Async flows
Webhooks
Long-running workflows can call back into your app when results are ready. Webhook handlers should be idempotent, fast, and easy to replay from logs.
Recommended pattern
Provide a callback URL
Attach a callback URL when you queue work that may complete outside the original request window.
Persist event IDs
Store event identifiers and request IDs so retries do not create duplicate downstream work.
Acknowledge quickly
Accept the webhook, enqueue internal processing, and keep the handler itself lightweight.
Operational note
Treat webhook consumers the same way you treat Stripe webhooks: verify authenticity, make handlers idempotent, and log enough metadata to replay failures safely.