Skip to main content
Sparkles webhooks are the primary event delivery mechanism. Each request contains one event and uses an HMAC-SHA256 signature over the exact request bytes.

Prerequisites

  • An active Sparkles API access grant.
  • A public HTTPS endpoint on port 443.
  • A handler that can read the unmodified request body.
Webhook URLs cannot contain credentials, a query string, or a fragment. Their hostname must resolve only to public IP addresses and cannot point back to Sparkles.

Step 1: Register an endpoint

Open the API access page, enter your endpoint URL, and copy the whsec_ signing secret. Sparkles shows the secret only when it is created or rotated. Keep the endpoint pending until your server implements signature and challenge verification.

Step 2: Verify every request

Read these headers before parsing the JSON body: The signed value is:
This TypeScript verifies the timestamp and accepts any valid signature in constant time:
During signing-secret rotation, Sparkles sends both the old and new signatures for 24 hours. Accept either valid v1 value, then remove the old secret after the overlap ends.

Step 3: Answer endpoint verification

Selecting Verify endpoint sends a signed endpoint.verification request:
Verify its normal request signature, then add this response function to the same module:
Verification requests do not contain sequence or Webhook-Attempt.

Step 4: Acknowledge durable acceptance

Return any 2xx response only after saving the event durably. Delivery is at least once, so deduplicate on the body UUID before applying side effects. Sparkles retries transient failures after approximately 1 minute, 5 minutes, 30 minutes, 2 hours, 8 hours, 1 day, 2 days, and 3 days. An HTTP 429 response may override the next delay through Retry-After, capped at one day. Return HTTP 410 to disable the endpoint and stop delivery.

Verification

The API access page marks the endpoint active after it receives a valid challenge response. A delivered event should have a matching body id and Webhook-Id, a current timestamp, and a valid signature.

Troubleshooting

  • Signature mismatch: verify against the raw bytes before JSON parsing or reserialization.
  • Verification timeout: respond within 15 seconds with no more than 4 KiB of JSON.
  • Endpoint rejected: use public HTTPS on port 443 without a query string or fragment.
  • Duplicate event: acknowledge it without applying its side effects again.