Webhooks

Scrapely pushes watchlist events to HTTPS endpoints you register. Each endpoint has its own signing secret, so you can prove every delivery came from Scrapely, rotate a secret without missing one, and route lists to different receivers.

Embed
Preview of the card
<a href="https://scrapelyserp.com/docs/webhooks"><img src="https://scrapelyserp.com/docs/_api/public/orgs/affc5b0f-d3c2-423a-8143-9d10db5736ae/spaces/981e6275-da3f-446c-82de-889f59c83b6f/pages/d0083c1f-28ff-4ac0-8cd1-97717287566d/social-card.svg?v=3e7ae33eec8b" alt="Webhooks" width="600" height="315"></a>

Scrapely pushes watchlist events to HTTPS endpoints you register. Each endpoint has its own signing secret, so you can prove every delivery came from Scrapely, rotate a secret without missing one, and route lists to different receivers.

Endpoints

An endpoint is a URL of yours that receives events. Register up to 10 per account under Dashboard → Developers → Webhooks, or with the API. Each has a description (up to 120 characters), an on/off switch, a list of the events it subscribes to, and its own signing secret.

The secret (whsec_…) is returned once, when you create the endpoint or rotate its secret, and never again: it is stored encrypted, and lists show only its last four characters. Save it straight into your receiver's secret store.

curl -X POST "https://api.scrapelyserp.com/v1/webhook_endpoints" \
  -H "Authorization: Bearer $SCRAPELY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/hooks/scrapely",
    "description": "Production",
    "events": ["watchlist.product.changed", "watchlist.run.completed"]
  }'

Full reference → POST /v1/webhook_endpoints, GET /v1/webhook_endpoints, PATCH /v1/webhook_endpoints/{id}

Which endpoint gets what

The event is from

It goes to

A watchlist with webhook_url (or webhook_endpoint_id)

That endpoint only, whatever it subscribes to. One way to send a client's lists to the client's own receiver.

A watchlist without one

Every enabled endpoint subscribed to that event (events: null means every event).

POST /v1/webhook_endpoints/{id}/test

That endpoint only, once, without retries.

Event

Sent when

watchlist.product.changed

A notify route fired on a change (the default pipeline: a tracked field moved).

watchlist.product.matched

A notify route fired on any other branch, such as a value test.

watchlist.product.delisted

An item came back not_found and was delisted.

watchlist.mention.found

A mention list found posts its queries had not seen before.

watchlist.run.completed

A run finished, was skipped or failed. Always sent, last.

monitor.alert

A monitor alert went to this endpoint as a notification destination: the alert plus its template rendering (rendered).

webhook.test

You press Send test or call /test.

Payloads field by field, with examples: Webhook events.

Delivery and retries

Every delivery is a POST with a JSON envelope (id, type, created_at, data) and five headers: the signature, the event type, the delivery id, the attempt number and the receiving endpoint's id.

Answer with any 2xx within 10 seconds, then do the work (queue it). Anything else (a 4xx or 5xx, a timeout, a redirect) is a failure, and the same event is sent again on this schedule:

Attempt

Sent

1

When the event happens

2

10 s after attempt 1 failed

3

1 min after attempt 2 failed

4

5 min after attempt 3 failed

5

30 min after attempt 4 failed

6

2 h after attempt 5 failed

  • Redirects are never followed. A destination refused for safety (see below) is not retried.

  • Delivery is at least once: a retry can arrive after a response Scrapely did not see. Scrapely-Delivery (the event id) is the same on every attempt: record the ones you processed and skip repeats.

  • Every attempt is listed in the dashboard's delivery log with its status code and duration.

  • Missed everything during an outage? GET /v1/watchlists/{id}/items?changed_since=… returns what changed meanwhile.

Verifying signatures

Anyone can POST to your URL. The signature proves a delivery came from Scrapely, unmodified, and recently:

  1. Scrapely-Signature looks like t=1792000000,v1=5f2b…: a Unix timestamp and one or more signatures.

  2. Each v1 is the hex HMAC-SHA256 of <t>.<raw body>, keyed with the endpoint's secret. Scrapely-Endpoint names the endpoint, so a receiver serving several knows which secret to use.

  3. Compute it yourself and accept the delivery when it equals any v1, compared in constant time.

  4. Refuse a t more than 5 minutes from now: the timestamp is inside the signature, so a captured delivery cannot be replayed later.

Use the raw body

Verify the exact bytes you received, before parsing JSON. Re-serialising changes whitespace and the signature will not match.

Copy-paste verification code for Python, Node.js, Go and PHP: Verifying signatures. Then press Send test (or call /test) to prove it end to end.

Rotating a secret

Rotate from the endpoint's row in the dashboard, or with POST /v1/webhook_endpoints/{id}/rotate. The new secret is returned once and signs every delivery from that moment. By default the old one keeps signing too, for 24 hours, so nothing fails while you deploy:

sequenceDiagram
  participant You
  participant Scrapely
  participant Receiver as Your receiver
  You->>Scrapely: rotate, overlap true
  Scrapely-->>You: new secret, shown once
  Note over Scrapely,Receiver: Overlap starts: 24 h of double signatures
  Scrapely->>Receiver: delivery signed v1=new, v1=old
  Receiver-->>Scrapely: 2xx, the old secret matches
  You->>Receiver: deploy the new secret
  Scrapely->>Receiver: delivery signed v1=new, v1=old
  Receiver-->>Scrapely: 2xx, the new secret matches
  Note over Scrapely,Receiver: Overlap ends: only v1=new
  Scrapely->>Receiver: delivery signed v1=new
  Receiver-->>Scrapely: 2xx

With overlap, every delivery carries one signature per secret for 24 hours; the receiver accepts whichever it holds.

Rotate with

Use it when

What happens

{ "overlap": true } (default)

Routine rotation

Two v1= per delivery for 24 hours (previous_secret_expires_at says until when). Deploy the new secret within that window.

{ "overlap": false }

The secret may have leaked

The old secret stops at once. Deliveries fail verification (and are retried) until your receiver has the new one.

Full reference → POST /v1/webhook_endpoints/{id}/rotate, POST /v1/webhook_endpoints/{id}/test

Allowed destinations

An endpoint URL must be https://, on port 443 or 1024–65535, and resolve to a public address. Loopback, private, link-local and cloud metadata addresses are refused when the endpoint is registered and again at every delivery.

For local development, expose your receiver through a tunnel (such as ngrok or Cloudflare Tunnel) or point an endpoint at a request inspector.

Updated