🪝 Webhook Implementation

Webhooks Best Practices

Respond to webhooks quickly by queuing payloads for background processing. Avoid handling them inline to prevent timeouts and retries.

Background vs. Inline Processing

  • Inline: Slower—handles tasks immediately.
  • Background: Faster—queues tasks, allowing immediate webhook response.

Handling Webhooks

  1. Use a queue for long-running tasks to avoid timeouts and retries.
  2. Always acknowledge the webhook immediately upon receipt.
  3. Webhooks may be sent more than once—add deduplication logic to prevent duplicate events.

Security Tips

✅ Keep your API key secure
✅ Verify webhook authorization
✅ Validate message format

ℹ️

Coinflow will retry sending webhook events until:

  • Your server returns a 200 OK
  • Or 36 hours passes
  • Note: Your server must respond within 5 seconds or the request will timeout and retry.