Set up webhooks and catch up on missed events
Register a webhook URL, check every request's signature, and find and process the events your server missed while it was down.
This recipe registers a webhook URL, checks every request's signature, and finds and processes the events your server missed while it was down. The example is a savings app whose server was down for an hour during a release.
Status. Available.
Money example
transfer.inflow.completed fails, and Gravv schedules a retry for later.transfer events that are still retrying or have failed, and read the stored event.event_id. When Gravv's retry arrives later, you see that event_id again, respond with 200 and credit nothing.Before you start
2xx within 30 seconds. It must not redirect, and it must not be on a private network.event_id of every event you have processed, such as a table with a unique key.Find out what is required
max_retries on GET /v1/webhooks/event/{id} tells you how many attempts Gravv makes in your environment. It can differ between sandbox and live, so do not hard-code it.Steps
1. Register your URL
In the Dashboard, go to the webhook settings (see Webhooks), enter the URL and generate the secret. Keep the whole secret, whsec_ included.
X-Signature or X-Signature-Next.2. Check every request
Compute the HMAC-SHA256 of the raw body bytes with the whole secret as the key, and compare it in constant time with the lower-case hex in X-Signature, and in X-Signature-Next when the request has it:
Full Node, Python and Go handlers are on Verify webhook signatures.
3. Store first, answer fast
For each request that passes the check:
event_id, respond with 200 and stop.event_id, then respond with 200.Do not deduplicate on the X-Event-ID header. It is the same for every event about one deposit, transfer or customer, so deduplicating on it drops real updates.
4. Find what you missed
List the events of the category that are still retrying, then those that are failed. event_type takes the category, and deposits into accounts are in the transfer category.
status takes one value per call. The values are pending, processing, sent, failed and retrying. Any other value returns an empty list, not an error.2026-10-13T10:00:00Z, 2026-10-13 or 2026-10-13T10:00:00. A date alone means 00:00 that day, so end_date=2026-10-13 leaves out the 13th.page starts at 1, and limit is at most 100. Read total_pages and fetch every page.items[].id is the id of the delivery record. You use it in the next step. It is not the event_id your endpoint receives.5. Read the stored event and process it
payload is the event Gravv sent to your endpoint. Process it as if it had arrived, and deduplicate on payload.event_id (4e6a8c0b-…).event_id is the event_group_id, the same value as the X-Event-ID header. For a deposit, it is the deposit's transaction_id. Do not deduplicate on it.payload with your API key, so you do not check a signature on it. You could not check it anyway, because its keys are in a different order from the request Gravv sent.response_body is your endpoint's last response. Gravv wraps a response that was not JSON, such as an HTML error page, as {"error":"Invalid JSON response","raw":"…"}.attempts counts failed attempts. When the event is retrying, Gravv sends it again at next_attempt, signed, and your step 3 check skips it.6. Optional: see each attempt, or resend
Trace a transfer and resend a webhook shows GET /v1/webhooks/calls/{id} and the resend. Gravv does not sign a resend, so an endpoint that checks signatures, as in step 2, rejects it. Reading the stored event, as in step 5, is the safer way to catch up.
What can go wrong
| Response | Why | Fix |
|---|---|---|
Every delivery fails, response_status_code is 0 and the history lists no attempts | The URL is http, on a private network, or not set, so Gravv made no call | Register a public https URL |
| The signature never matches | You used the secret without whsec_, or you parsed and serialized the body again before hashing | Hash the raw bytes with the whole secret |
| Some updates seem lost | You deduplicate on X-Event-ID | Deduplicate on the body's event_id |
| Events arrive out of order | Gravv delivers in parallel, and retries mix with new events | For transfers, apply only a higher sequence in idempotency_key. For others, compare the status with what you hold |
| Two webhooks for one bank deposit into an account that settles on-chain | transfer.inflow.deposit_settled and inflow.onchain.completed describe the same money | Link them by tx_hash (the same on both) or by settlement_event_group_id, and credit once |
History returns nothing for event_type=transfer.inflow.completed | event_type takes the category, not the event name | Use event_type=transfer |
400 invalid event ID format or event not found | The id is not a history items[].id, or it is from the other environment | Use items[].id, with a key for the same environment |
400 failed to process event data on the event | Your endpoint responded with JSON that is not an object | Respond with a JSON object or an empty body |
400 circuit breaker open for webhooks: circuit breaker is open | Gravv's webhook service is failing briefly | Try again after about 30 seconds |
Webhooks you will receive
Gravv sends every category to your one URL. For deposits, it sends transfer.inflow.* for bank deposits into accounts and inflow.onchain.* for stablecoins. The event catalogue lists every type.
Testing in sandbox
500 for a while.200. Watch the retry arrive and your step 3 check skip it.Sandbox stores and delivers events within seconds, and the first retries follow within a minute or two. Use sandbox keys for the history routes, because a live key does not see sandbox events.