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.recorded | No — use Send Test Event | Yes — after grant, update, revoke |
widget.session.* | No automatic delivery | Yes when subscribed |
proof.* / evidence.link.issued | Not produced | Yes on the live evidence pipeline |
| Verify endpoint and HMAC | Send 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).

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.
| Package | Helpers |
|---|---|
@sammati/webhook-utils | Standalone HMAC verification |
@sammati/server-sdk | verifyWebhookSignature(), parseWebhookEvent() |
Steps:
- Read raw body bytes (before JSON parse).
- Parse
x-sammati-signature(t=…,v1=…). - Reject if the timestamp is outside tolerance (recommended 300s).
- Recompute HMAC on
<timestamp>.<canonical_json>. - 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.
| Method | Purpose |
|---|---|
client.webhooks.testEndpoint(params) | Queue a sample consent.recorded (data.type: "delivery.test") |
| Portal Send Test Event | Same action on Webhooks → Endpoints |
This is the supported way to exercise webhooks during sandbox integration.
Security
- HTTPS only in production.
- Verify every request before business logic.
- Store secrets in a secrets manager; never log
whsec_*. - Respond quickly with
2xx— process async if needed. - 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).