Skip to main content
Your server gets each event as an HTTPS POST with a JSON body. This page covers how to answer it, check that it came from ReachHunt, and handle retries.

Answer quickly

Answer with any 2xx status within 10 seconds. Redirects are not followed: a 3xx counts as a failure.
  1. Answer with 2xx first, then do the work.
  2. Skip an id you already handled. The same event can arrive more than once, for example when your server worked but answered too late.
  3. Compare createdAt when order matters. Events can arrive out of order, for example when one is retried.

Check that a request came from ReachHunt

ReachHunt doesn’t sign requests. Add a secret header to the webhook instead, then reject any request that doesn’t carry it.
1

Add a secret header

In Settings → Webhooks, select Add a secret header when you add or edit a webhook. For example, use X-Webhook-Secret with a long random value.
2

Check it on your server

Compare the header with the value you saved, using a constant-time comparison. Answer 401 when it doesn’t match.
The header is sent with every request, including retries and test events. Keep its value only on your server.

Example handler

In production, store handled IDs in your database, and hand slow work to a queue so you still answer within 10 seconds.

Retries

ReachHunt tries a delivery again when your server:
  • does not answer within 10 seconds, or cannot be reached
  • answers 408, 429 or any 5xx
It retries 6 times, after 1 minute, 5 minutes, 30 minutes, 1 hour, 6 hours and 24 hours. Any other answer, such as 400 or 401, fails the delivery at once, without retries.

Turning off

ReachHunt turns a webhook off when:
  • your server answers 404 or 410, or the URL points to an address ReachHunt does not send to
  • an event fails all its retries and nothing else reached your server since that event happened
The webhook shows as Off in Settings → Webhooks, with the reason. While it is off it gets no events, and events from that time are not sent later. Fix your server, then turn the webhook back on from its menu in Settings → Webhooks.

Testing

Open the menu on your webhook in Settings → Webhooks and select Send test event. It sends a sample of the event you pick, with your headers, and shows how your server answered. A test event’s id starts with test_.

Common mistakes