Webhooks

Oyster calls your server when a scan finishes, when each set of recommendations is ready, and when a shopper wins a Spin the Wheel reward. Everything here is per-vendor: you register the endpoints, you hold the secret, and nothing is sent anywhere you have not named.

Registering an endpoint

In your Oyster dashboard, go to Developers → Webhooks and add your URL. Pick which events it should receive, and copy the signing secret it gives you. You can register more than one endpoint, and each gets its own secret and its own selection of events.

Press Send test before you point real traffic at it. A test delivery has the same shape and the same signature as a real one, and is marked test in the delivery log on the same page.

The events

EventFires whenTiming
scan.completed A scan finished analysing. Face and body arrive as one event: a body add-on belongs to the same scan and does not fire its own. Seconds after the shopper finishes.
recommendation.ready That scan's product routine finished generating. Usually about a minute later.
procedure.ready That scan's in-clinic treatment suggestions finished generating. Only for accounts with treatments enabled. Usually about a minute later.
wheel.reward_won A shopper won a reward on Spin the Wheel. The event carries the code and its terms. The Oyster Shopify app and WooCommerce plugin create the code in their store, and a checkout you registered yourself creates it from this event. As soon as the spin is saved.

The two recommendation events are independent. Products and treatments are generated separately and either can land first, so do not wait for one before handling the other, and do not treat the absence of one as a signal about the other. A scan can also produce only one of them, depending on what your account has enabled.

What a delivery looks like

Every delivery is a POST with a JSON body in the same envelope:

{
  "id": "01JD...",               // this delivery, stable across retries
  "event": "procedure.ready",
  "created_at": "2026-10-20T09:14:22+00:00",
  "data": { ... }                // the event's own fields
}

and these headers:

Oyster-Event:     procedure.ready
Oyster-Delivery:  01JD...
Oyster-Signature: t=1760950462,v1=9f86d081...

For the three scan events, data always carries batch_id, vendor_id, occurred_at, and your own external_user_ref and meta when the embed supplied them. See Matching a scan to your customer.

Honouring wheel.reward_won

Every endpoint subscribed to this event hears every win, and what you do with it is up to you: show the code, email it, log it, or honour it in a checkout of your own. redemption_authority names the checkout that already honours it: shopify or woocommerce when the Oyster app or plugin in that store creates the code, store when it was issued for a checkout you registered yourself, or oyster for the widget's own checkout.

"data": {
  "reward_id": "9b1f0c2e-...",          // key your handler on this
  "code": "WHEEL-7QK2M9XWD4H8RZ3PLT6NVB5CJ1GYEA0S",
  "email": "[email protected]",
  "type": "percentage_discount",        // fixed_discount, free_item, free_delivery, free_scan
  "value": 10,
  "currency": "NGN",
  "min_order_amount": null,
  "usage_limit": 1,
  "expires_at": "2026-11-26T09:14:22+00:00",
  "instructions": "Use this code at checkout.",
  "restrictions": {
    "allowed_product_ids": [],          // your checkout's own product ids
    "excluded_product_ids": [],
    "combines_with_discounts": false
  },
  "product_id": null,                   // the free item, for free_item
  "variant_id": null,
  "terms_hash": "5e8f...",              // changes if the terms ever differ
  "vendor_id": 42,
  "redemption_authority": "shopify"
}

The code is live the moment the event is sent and the shopper already sees it. If you honour it yourself, create it with the same terms, restricted to that email if your checkout supports it.

If your shoppers check out on your own site, register that checkout. Rewards then arrive as store: create each code in your checkout and report its use, and it shows in your Spin the Wheel report. See Spin the Wheel rewards. Without a registration or the Oyster app or plugin, every reward arrives as oyster and is for Oyster's own checkout. Create a code only in the checkout redemption_authority names: creating it in a second checkout as well lets the shopper use it twice.

A retry arrives with the same reward_id and must not create a second code. If you cannot honour a reward, answer 2xx anyway: a refusal is retried, and repeated failures switch your endpoint off for every event.

Verifying the signature

Compute HMAC-SHA256 over "<t>.<raw request body>" using your endpoint's signing secret, and compare it with the v1 value in constant time. Sign over the raw bytes you received, not a re-serialised copy: re-encoding JSON changes key order and whitespace, and the signature will not match.

// Express: take the body as raw bytes on this route, not parsed JSON.
app.post('/oyster/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  const rawBody = req.body.toString('utf8')
  const parts = Object.fromEntries(
    (req.get('Oyster-Signature') || '').split(',').map((part) => part.split('=')),
  )

  const expected = crypto
    .createHmac('sha256', process.env.OYSTER_WEBHOOK_SECRET)
    .update(`${parts.t}.${rawBody}`)
    .digest('hex')

  const ok =
    typeof parts.v1 === 'string' &&
    parts.v1.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected)) &&
    Math.abs(Date.now() / 1000 - Number(parts.t)) < 300
  if (!ok) return res.status(400).end()

  const event = JSON.parse(rawBody)
  // Store it, answer, then do the work.
  res.status(200).end()
})

Check the length before comparing: timingSafeEqual throws on inputs of different lengths, so a malformed header would otherwise crash the handler instead of being refused.

Reject a timestamp more than 300 seconds old. The signature is recomputed on every retry attempt, so t moves and an old delivery cannot be replayed at you.

Retries and ordering

Delivery is at least once. Return a 2xx as soon as you have stored the message and do the rest of your work afterwards; anything else is retried with a backoff. Key your handler on batch_id (reward_id for wheel.reward_won), or on Oyster-Delivery, which stays the same across every retry of one delivery, and make it safe to run twice.

We wait three seconds for your reply. Storing the message is what has to fit in that window, not acting on it: a handler that reads files, renders an email or resizes an image before answering gets cut off, recorded as failed and retried, and does the whole job again on the retry.

An endpoint that keeps failing is disabled automatically and you are emailed about it. The delivery log under Developers → Webhooks shows each attempt, its response code and its body, so a 500 from your side is visible without you digging through your own logs.

Bring your own storage

Your account can be set up so that every scan is written straight into object storage you own and announced on these same webhooks. Your storage is the system of record: the widget captures, and you render the outcome from your own files.

If that is your account, configure the destination under Developers → Scan Storage and verify it before your first scan. Verification writes and deletes a probe object; until it passes, scans are refused rather than taken and lost. Every event below then carries an extra storage block naming exactly what was written.

What that changes for your customers, and how to build the surfaces you take over, is in Bring your own storage.

The files in your bucket

One prefix per scan, with a file per phase as each finishes:

<your-prefix>/scans/2026/10/20/<batch_id>/
    images/front-1a2b3c4d.jpg
    images/left-5e6f7a8b.jpg
    result.json            ← scan.completed
    recommendations.json   ← recommendation.ready
    procedures.json        ← procedure.ready

result.json carries the scan itself: the per-image analysis, the quiz answers, and the key of every capture. recommendations.json carries the product routine and procedures.json the treatment suggestions, each on its own, because they finish at different times.

The webhook names keys, it does not carry their contents, and it is not sent until every key it names exists. So you can read them the moment it arrives. Each object is listed with its size and SHA-256:

"storage": {
  "driver": "s3",
  "bucket": "acme-oyster-scans",
  "region": "auto",
  "endpoint": "https://abc123.r2.cloudflarestorage.com",
  "prefix": "oyster/scans/2026/10/20/<batch_id>/",
  "objects": [
    { "kind": "procedures", "key": "...procedures.json",
      "content_type": "application/json", "bytes": 2184, "sha256": "..." }
  ]
}

A phase you have switched off produces no file and no event, so do not block on one you have not enabled. If a phase fails on our side it is retried, and the scan is held until it succeeds or ages out, which means a late file is still a real one rather than a duplicate of something you already had.