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.
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
- Python
- Node.js
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"]
}'import os
import requests
HEADERS = {"Authorization": f"Bearer {os.environ['SCRAPELY_API_KEY']}"}
r = requests.post(
"https://api.scrapelyserp.com/v1/webhook_endpoints",
headers=HEADERS,
json={
"url": "https://example.com/hooks/scrapely",
"description": "Production",
"events": ["watchlist.product.changed", "watchlist.run.completed"],
},
timeout=30,
)
r.raise_for_status()
data = r.json()
save_secret(data["id"], data["secret"]) # returned only nowconst res = await fetch('https://api.scrapelyserp.com/v1/webhook_endpoints', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SCRAPELY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://example.com/hooks/scrapely',
description: 'Production',
events: ['watchlist.product.changed', 'watchlist.run.completed'],
}),
signal: AbortSignal.timeout(30_000),
});
if (!res.ok) throw new Error((await res.json()).error.code);
const data = await res.json();
saveSecret(data.id, data.secret); // returned only nowFull 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 | 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 ( |
| That endpoint only, once, without retries. |
Event | Sent when |
|---|---|
| A notify route fired on a change (the default pipeline: a tracked field moved). |
| A notify route fired on any other branch, such as a value test. |
| An item came back |
| A mention list found posts its queries had not seen before. |
| A run finished, was skipped or failed. Always sent, last. |
| A monitor alert went to this endpoint as a notification destination: the alert plus its template rendering ( |
| You press Send test or call |
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:
Scrapely-Signaturelooks liket=1792000000,v1=5f2b…: a Unix timestamp and one or more signatures.Each
v1is the hex HMAC-SHA256 of<t>.<raw body>, keyed with the endpoint's secret.Scrapely-Endpointnames the endpoint, so a receiver serving several knows which secret to use.Compute it yourself and accept the delivery when it equals any
v1, compared in constant time.Refuse a
tmore 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 |
|---|---|---|
| Routine rotation | Two |
| 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.