Oyster webhooks in production: duplicates, ordering, retries and timeouts

Published · Updated

This guide covers the problems Oyster webhooks cause in production and how to handle each one. What Oyster sends and how endpoints are registered is on the Oyster webhooks overview, every event type is on Oyster webhook events, and the header check is on Verify Oyster webhooks.

At a glance

ProblemWhat to doWith Event Gateway
TimeoutsAnswer with a 200 within 5 seconds; process in a background jobAnswers Oyster on arrival, then queues the event for your service
DuplicatesRecord each id; make handlers idempotentCan drop repeats before they reach your handler
OrderingCompare eventTimestamp, or re-fetch the recordLogs every event, so you can see what arrived when
RetriesStay available; check dispatches and reconcile after an outageAccepts deliveries while your service is down and replays them
Choosing eventsFilter on eventName in your handlerFilters and routes events by type
TestingUse the test endpoint and the developer sandboxForwards to localhost and replays past events
Other limitsTreat the secret as the only credential; keep the endpoint IDChecks the shared secret and keeps Oyster's URL stable

Oyster webhook timeouts and slow handlers

Answer with a 200 within 5 seconds, then do the work in a background job.

Why it happens: Oyster requires a 200 inside its 5-second timeout. Without one, it counts the dispatch as failed and tries again later. A handler that updates an HRIS or payroll system before responding can miss that window. Oyster's docs name only 200, so don't rely on another success code such as 202 or 204.

Fix it in your handler:

  1. Check the Authorization header, store the event and return 200 straight away.
  2. Process the event in a background job. See why to process webhooks asynchronously.
  3. Return 200 for events you ignore too, so they aren't retried.

With Event Gateway: Hookdeck answers Oyster as soon as each webhook arrives and stores it, then delivers it to your service on your own schedule and timeout, so slow processing doesn't cause retries.

Duplicate Oyster webhooks

Oyster says webhooks may be delivered more than once and that your endpoint should be idempotent. Record each id you process and skip repeats.

Why it happens: Retries run for about 48 hours, and a handler can finish its work and still miss the 5-second window, so Oyster sends the event again. The id is globally unique per notification and always prefixed wh_. Oyster doesn't state outright that a retry keeps its id, but its dispatch records show a single id with firstSentAt, sentAt and retries.

Fix it in your handler:

  1. Store each id before processing, in a table with a unique constraint.
  2. Make every handler idempotent: the same result however many times it runs.
  3. If several developer applications feed one system, don't deduplicate across them on id. Each application gets a different id for the same event, so key on eventName and the IDs in data instead.

With Event Gateway: Hookdeck can deduplicate events before they reach your endpoint, so repeats are filtered at the infrastructure level rather than in each handler.

Out-of-order Oyster webhooks

Oyster doesn't document an ordering guarantee. Compare eventTimestamp with the state you last stored, or re-fetch the record.

Why it happens: Retries over 48 hours mean an older event can land after a newer one. A retried time_off.request_created can arrive after the matching time_off.request_status_changed. Oyster says eventTimestamp is when the event occurred, in ISO 8601 UTC, and that you can use it for ordering events and debugging delayed deliveries.

Fix it in your handler:

  1. Store the eventTimestamp of the last event you applied to each record.
  2. Skip an event older than that, unless it records something you still need.
  3. Re-fetch the record from the Oyster API when order matters. data mostly holds IDs and a few status fields, so you often need the API anyway.

With Event Gateway: Every webhook is stored in Hookdeck with its body and arrival time, so you can see what arrived when, and replay events after fixing your handler.

Oyster webhook retries

Oyster makes up to 9 attempts in total over about 48 hours. It doesn't document what happens after the last one.

Why it happens: After a failed delivery, Oyster retries on an increasing schedule: 30 seconds, 5 minutes, 30 minutes, 1 hour, 3 hours, 6 hours, 12 hours and 1 day, with a small random jitter. An outage longer than that can lose events. Oyster describes no way to resend a dispatch, and doesn't say whether repeated failures disable an endpoint, although the endpoint object has an enabled field.

Fix it in your handler:

  1. Keep the endpoint available through deploys, so retries are the exception.
  2. After an outage, call GET /v1/webhooks/dispatches, which lists each dispatch's lastResponseCode and retries for your Developer Application.
  3. Re-read the affected records from the Oyster API, since you can't ask for a dispatch again.
  4. Check enabled with GET /v1/webhooks if deliveries stop.

With Event Gateway: Hookdeck accepts Oyster's deliveries while your service is down and keeps them, so you can replay them when it's back rather than depending on Oyster's 48-hour schedule.

Choosing which Oyster events to handle

Creating an endpoint takes only a url and a sharedSecret, with no list of events, so filter on eventName in your handler.

Why it matters: Oyster documents 97 event types: 96 across 12 namespaces such as hiring and payments, plus async_operation_completed, which has no namespace. Its docs present eventName as the way to filter for the events you care about. The full list is on Oyster webhook events.

Fix it in your handler:

  1. Split eventName on the first dot and route by namespace, so new events in a namespace you already handle reach the right code.
  2. Allow for names without a dot, because Oyster says only that names will usually have a namespace.
  3. Return 200 for anything you don't handle.

With Event Gateway: Hookdeck filters and routes events by type or any other property, so one Oyster endpoint can feed several services and each gets only what it handles.

Testing Oyster webhooks

Send test payloads with Oyster's test endpoint, and build against its developer sandbox.

Why it matters: Oyster's event reference pages give a schema for each event, with data key names and types, but no example body. You have to build fixtures from those schemas, or from what you receive.

Test your handler:

  1. Request a developer sandbox account. It comes with seed data and has its own API at https://api-sandbox.oysterhr.com.
  2. Register an endpoint there, then call POST /v1/webhooks/{id}/test with a data object of at least one property.
  3. Handle names you don't recognise. Oyster's dispatch examples use the eventName test.webhook, which isn't in the event list.
  4. When you move to production, create a production Developer Application, tokens and endpoint.

With Event Gateway: The Hookdeck CLI receives webhooks on your machine without a public server, and you can replay past events to your handler as you change it.

Other Oyster webhook limits

Plan for a static secret, endpoints you can only manage through the API, and no published IP addresses.

A bearer secret, not a signature. Oyster repeats the same bearer value on every request and computes nothing over the body. Anyone who learns the secret can send convincing HR events, such as an approved expense or a terminated engagement, and a captured request passes the check again. Use a long random secret and HTTPS only, keep the header out of logs, and re-read sensitive records from the API using the IDs in data.

Secret rotation. Update the secret with PATCH /v1/webhooks/{id}, then update your receiver, and accept both values briefly while retries drain. The API returns the secret in the endpoint object, so limit who holds a token that can read your endpoints.

No dashboard for endpoints. Oyster's docs describe creating, updating and deleting endpoints only through the API, using the ID returned at creation. Store that ID with your configuration, next to the secret. GET /v1/webhooks lists your endpoints if you lose it.

No published IPs. Oyster names no source IP addresses, so you can't allowlist them.

Partners. Partners receive events for many customers. Look up the customer by companyId before doing anything else.

With Event Gateway: Create a source with the Oyster type and enter your sharedSecret in its Shared Secret field, with or without the Bearer prefix. Hookdeck answers Oyster with a 200 either way, then records a request without the right secret as failed verification, so it never reaches your destination. The URL Oyster holds also stays the same while you move or change the service behind it, so most changes don't need an Oyster API call.

Keep a slow HR system from setting off Oyster's retries.

Event Gateway checks the shared secret, answers Oyster inside the 5-second window and queues each event, so your service can process it on its own schedule.

Not affiliated with Oyster. Facts are compiled from public sources and linked inline.