Skip to content

Verifying Usher webhooks

A rule with the “send a webhook” action POSTs to a URL you choose each time a customer starts or stops matching it. The payload carries the customer’s BigCommerce id, and you join on that at your end. Usher never sends names, email addresses or postal addresses. Pro plan.

The payload

{
  "event": "rule.matched",
  "rule": { "id": "6f1c…", "name": "VIP" },
  "customer_id": 12345,
  "store_hash": "abc123",
  "platform": "bigcommerce",
  "occurred_at": "2026-09-20T12:00:00.000Z"
}

event is rule.matched when the customer starts matching the rule, rule.unmatched when they stop, and rule.test for the test send from the rule builder, which carries customer_id 0 and a rule named “Test rule”.

platform names the commerce platform that store_hash and customer_id belong to. It is always bigcommerce today. The field is an addition to the original payload, so ignore unknown fields in your parser and nothing else changes.

The headers

The timestamp is inside the signed content, so a captured delivery cannot be replayed later with a different time. Reject anything more than five minutes old.

Verifying in Node

import { createHmac, timingSafeEqual } from 'node:crypto';

export function verifyUsher(rawBody, headers, secret) {
  const timestamp = headers['x-usher-timestamp'];
  const expected =
    'sha256=' +
    createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
  const given = headers['x-usher-signature'] ?? '';
  if (given.length !== expected.length) return false;
  if (!timingSafeEqual(Buffer.from(given), Buffer.from(expected))) return false;
  return Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
}

Use the raw request body, not a re-serialised object. Key order and whitespace are part of what was signed.

Getting the secret

Settings, then Webhook signing secret, then Generate. It is shown once. Rotating replaces it, and every delivery from then on is signed with the new one, so update your receiver first and rotate second.

Delivery and retries

Usher waits ten seconds for a response. Any 2xx counts as delivered. A non-2xx, a timeout or a connection failure is retried up to five more times, waiting 10, 20, 40, 80 and 160 seconds between attempts. Between attempts the Activity tab shows the entry as Queued with the last status code and attempt time; after the last failure it shows Failed with the status code.

Seeing what arrives

CommerceHook gives you a URL that shows every request it receives, headers and body. Paste it into a webhook rule, press “Send test”, and the payload above appears with its signature headers. Once your own endpoint verifies the signature, swap the URL.

Last updated