Skip to main content
Version: v1.0

Webhooks

Register HTTPS endpoints for async events. Deliveries are signed with HMAC-SHA256. Details: API Reference (Webhooks).


Overview​

Subscribe to events such as consent.recorded, proof.ready, evidence.link.issued, proof.anchor_confirmed, and widget.session.*. Failed deliveries retry with backoff.

Receipt readiness: proof.ready means Merkle sealed. evidence.link.issued means the Evidence Link JWT is stored (use receipt_path in the payload). Do not treat grant HTTP 200 as a signed receipt — Proofs & Anchors.


Test vs Live delivery​

Test (smm_test_*)Live (smm_live_*)
Automatic consent.recordedNo — use Send Test EventYes — after grant, update, revoke
widget.session.*No automatic deliveryYes when subscribed
proof.* / evidence.link.issuedNot producedYes on the live evidence pipeline
Verify endpoint and HMACSend Test Event / testEndpoint()Same test path + automatic events

Registration​

In the Company Portal, go to Webhooks — create an endpoint, select events, and copy the signing secret (shown once).

Create webhook endpoint

await client.webhooks.createEndpoint({
url: "https://api.example.com/webhooks/sammati",
events: ["consent.recorded"],
// mode / other fields per API Reference
});

Also available: listEndpoints, updateEndpoint, deleteEndpoint.


Verification​

Use the SDK helpers — do not reimplement crypto.

PackageHelpers
@sammati/webhook-utilsStandalone HMAC verification
@sammati/server-sdkverifyWebhookSignature(), parseWebhookEvent()

Steps:

  1. Read raw body bytes (before JSON parse).
  2. Parse x-sammati-signature (t=…,v1=…).
  3. Reject if the timestamp is outside tolerance (recommended 300s).
  4. Recompute HMAC on <timestamp>.<canonical_json>.
  5. Compare in constant time.

Retries​

Failed deliveries (non-2xx, timeout) retry with backoff. Your endpoint should be idempotent — use x-sammati-event-id or x-sammati-delivery-id for deduplication.


Failed deliveries​

After retries are exhausted, fix your endpoint (HTTPS, 2xx, signature verify). Ask support if you need a failed delivery replayed. New events deliver once the endpoint is healthy.

In the portal: Webhooks → Diagnostics.


Rotation​

Rotate signing secrets without downtime — current and previous secrets both verify during the rotation window.

await client.webhooks.rotateSecret({ /* endpoint id */ });

Testing​

Use Send Test Event to validate URL reachability and HMAC without a live consent write.

MethodPurpose
client.webhooks.testEndpoint(params)Queue a sample consent.recorded (data.type: "delivery.test")
Portal Send Test EventSame action on Webhooks → Endpoints

This is the supported way to exercise webhooks during sandbox integration.


Security​

  1. HTTPS only in production.
  2. Verify every request before business logic.
  3. Store secrets in a secrets manager; never log whsec_*.
  4. Respond quickly with 2xx — process async if needed.
  5. Rotate on compromise or on a schedule.

Event types​

Subscribe only to events you handle. The full list is in the API Reference (CreateWebhookEndpointBody.events).


Next steps​