Skip to main content
A webhook is an address of yours that we call as soon as something happens: an order is placed, paid or shipped, a listing is approved or sold. Your system no longer has to ask filter[updatedSince] every few minutes whether anything changed.

Setting one up

Webhooks belong to one of your own keys. In the dashboard, go to Settings → Integrations and choose Settings beside the key. Under Webhooks you give:
  • the address — a public https URL. Addresses in a private network, and plain http, are refused;
  • the events it should hear about. Only the events your key may read are offered: hearing that an order was paid is reading that order, so the order events need orders:read and the listing events watches:read.
A key can have up to five webhooks. Each one gets its own signing secret, starting with whsec_, which you can read again on the same screen. Send test sends a ping straight away and tells you what your address answered.
The scopes keep counting after you subscribe. If a key loses orders:read, its webhooks stop hearing about orders, and a withdrawn key stops them all — including deliveries that were still being retried. The same goes for the business’s subscription: without an active one, nothing is sent, as the API answers nothing.

The events

Every order event needs orders:read; the listing events need watches:read. Each step of an order is sent once, even if the status is written twice. Listing events come for every listing of the business — also one without an externalIdentifier (null), and one from a Connect feed. Changes to what a listing says send nothing: a new price, description or specification — by you, in the dashboard, or by Wristler — is not an event; only its status, its creation and its deletion are. Sync those by updatedAt (filter[updatedSince]). Orders are the other way round: every step and every tracking change is an event.

What we send

A POST with a JSON body:
Times are in UTC, as everywhere in the API. Every order event names the listings in the order (items), so a stock system knows without a call which watch an order is about: order.awaiting_payment holds it for a bank transfer, order.cancelled frees it again. The body says what happened and to what, not everything about it. Read the rest from data.links.self with your key’s token: that way a webhook never carries more than the key may read, and you never act on a copy that went stale while it was being retried. watch.status_changed carries the listing’s externalIdentifier, so you can find your own product without a call, and the status before and after:
The headers:
string
The event, the same as type in the body. ping for a test delivery.
string
The event’s id, the same as id in the body. A retry carries the same id: store the ones you handled and drop a repeat.
string
Our number for this delivery of this event to this address, for when you ask us about one. It counts up across all deliveries and stays the same on a retry: it is not the attempt number. Tell a retry by a Wristler-Event-Id you have seen before.
string
t=<unix time>,v1=<signature>. See below.

Checking the signature

Anybody can post to your address, so check that a delivery came from us before you act on it. v1 is the hex HMAC-SHA256 of the timestamp, a full stop and the raw body, keyed with the webhook’s signing secret:
Sign the raw bytes you received, not JSON you decoded and encoded again: the signature is over exactly what was sent. Refuse a timestamp more than five minutes off, so a delivery somebody captured cannot be sent to you again later.

Answering, and retries

Answer with any 2xx within 10 seconds; what you put in the body is not read. Do the work afterwards, in your own queue, rather than before you answer. Anything else — another status, a timeout, a refused connection, a redirect — counts as not arrived, and we try again: after 1 and 5 minutes, half an hour, 1, 3, 6 and 12 hours. Eight attempts, about a day in all. Redirects are not followed: if the address moved, change it in the dashboard. Deliveries can arrive out of order and, rarely, twice. Use createdAt and the order or listing you read back, not the order in which deliveries arrived.
A webhook whose deliveries keep failing — ten in a row that used up every retry — is switched off, and the dashboard says so. We email whoever created the key (or the business’s main account) once, when it happens. Switch it on again once your address answers.
The dashboard lists the last deliveries to each address with what it answered. We keep them for 30 days.