Skip to content
Support

Webhook recipes: subscribe, verify and handle deliveries

Owner, AdminLast checked 25 November 20265 min readArticle ID: developers-webhook-recipes
On this page

Copy-paste webhook code in curl, JavaScript and PHP: subscribe to an event, check the signature, ignore repeats, answer in time and stop deliveries.

Five things you'll do with webhooks, ready to copy, each in three tabs: curl, JavaScript and PHP. $SKEDULER_API is your Skeduler API address and $ACCESS_TOKEN an access token (see API recipes). SKEDULER_SIGNING_SECRET is the signing secret you got when you subscribed. In the JavaScript and PHP tabs, the same names in capitals are variables you set. Nothing here is a real key or secret.

1. Subscribe to an event

Scope: none beyond the event's own read scope (for example read:jobs for job.created). Keep the signing_secret from the answer: it's shown only once.

curl

curl -s -X POST "$SKEDULER_API/api/v1/webhooks/subscriptions" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: A_NEW_UNIQUE_KEY" \
  -d '{"event":"job.created","target_url":"https://example.com/skeduler/webhook"}'

See Subscribe to webhook events and Webhook events and payloads.

2. List your subscriptions

Check what's subscribed, and whether a subscription has been switched off (status is disabled).

curl

curl -s "$SKEDULER_API/api/v1/webhooks/subscriptions" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

3. Receive a delivery and check its signature

Check the X-Skeduler-Signature-V2 header (t=<unix seconds>,v1=<hex>) on every delivery: v1 must equal HMAC-SHA256(secret, "<t>.<raw body>"), and t must be within 5 minutes of your clock. Use the raw body, exactly as received. The curl tab sends your own endpoint a signed test delivery, so you can try your code before Skeduler sends a real one.

curl

# Send yourself a signed test delivery. YOUR_WEBHOOK_URL is your own endpoint.
BODY='{"event":"job.created","occurred_at":"2026-11-03T01:00:00+00:00","delivery_id":"TEST_DELIVERY_ID","data":{"id":"JOB_ID","title":"Hot water system repair"}}'
T=$(date +%s)
SIG=$(printf '%s' "$T.$BODY" | openssl dgst -sha256 -hmac "$SKEDULER_SIGNING_SECRET" -hex | sed 's/^.* //')
curl -s -X POST "$YOUR_WEBHOOK_URL" \
  -H "Content-Type: application/json" \
  -H "X-Skeduler-Signature-V2: t=$T,v1=$SIG" \
  -d "$BODY"

If the signature never matches, see My webhook signature doesn't match.

4. Ignore a repeat

The same event can arrive more than once, for example after a retry. Its delivery_id stays the same, so keep the ids you've handled and skip one you've seen. If one endpoint takes deliveries for more than one subscription, key on the subscription as well as delivery_id: the same event has the same delivery_id in each. The curl tab sends the same test delivery twice: your endpoint should answer 2xx both times, and handle it once.

curl

# Run the recipe 3 commands, then send the same body again with a fresh signature.
T=$(date +%s)
SIG=$(printf '%s' "$T.$BODY" | openssl dgst -sha256 -hmac "$SKEDULER_SIGNING_SECRET" -hex | sed 's/^.* //')
curl -s -X POST "$YOUR_WEBHOOK_URL" \
  -H "Content-Type: application/json" \
  -H "X-Skeduler-Signature-V2: t=$T,v1=$SIG" \
  -d "$BODY"

5. Answer in time, or stop deliveries

Answer 2xx within 10 seconds, and do slow work afterwards. A 4xx or 5xx answer, or a timeout, is retried up to 4 times (after 10 seconds, 30 seconds, 1 minute and 2 minutes). To stop a subscription for good, answer 410 Gone to a delivery, or unsubscribe:

curl

curl -s -X DELETE "$SKEDULER_API/api/v1/webhooks/subscriptions/SUBSCRIPTION_ID" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

See Webhook retries, and when a webhook is switched off.

In this section