DrootERP sends each published domain event to the webhooks that subscribe to it: a signed HTTPS POST
with a small JSON body. Set them up in Setup → Integrations → Webhooks (capability integrations.webhooks).
What a Receiver Gets
POST /hooks/erp HTTP/1.1
Content-Type: application/json
X-Droot-Event: record.updated
X-Droot-Delivery: dlv_3f0c2a9e41b7d6c58e0a1f2b
X-Droot-Timestamp: 1791367200
X-Droot-Signature: v1=5d1f…c09e
{"id":"evt_6650c0ffee0000000000a001","type":"record.updated","version":1,"occurredAt":"2026-10-07T10:00:00.000Z",
"company":"6650c0ffee00000000000001","actor":{"kind":"user","id":"u-17"},"sequence":4,
"data":{"modelKey":"crm.lead","recordId":"6650c0ffee0000000000a001","changedFields":["value"]}}
- The body is the event envelope (see events.md) plus
id(unique per event) andsequence(1, 2, 3… per record). Events are thin: ids and what changed, never values. Read the record through the API v1 with your own credentials. X-Droot-Deliveryis the same on every retry of one delivery. Use it (or the eventid) to ignore duplicates: delivery is at least once.- Answer any
2xxwithin the webhook's timeout (default 10 s). Anything else, a timeout or a refused connection is retried.
Verifying the Signature
X-Droot-Signature holds v1=<hex> where <hex> is HMAC-SHA256 with your signing secret over
<X-Droot-Timestamp>.<raw body>. After Rotate Secret the old secret stays valid for an overlap (default 24 h)
and the header carries one v1= per live secret, comma-separated: accept the request when any of them matches.
Refuse timestamps more than 5 minutes from your clock. Always verify the raw body bytes, before parsing JSON.
Node.js:
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyDroot(secret, rawBody, headers, toleranceSeconds = 300) {
const ts = headers["x-droot-timestamp"];
const sig = headers["x-droot-signature"] ?? "";
if (!/^\d+$/.test(ts ?? "") || Math.abs(Date.now() / 1000 - Number(ts)) > toleranceSeconds) return false;
const expected = createHmac("sha256", secret).update(`${ts}.${rawBody}`).digest();
return sig.split(",").some((part) => {
const m = /^v1=([0-9a-f]{64})$/.exec(part.trim());
return !!m && timingSafeEqual(Buffer.from(m[1], "hex"), expected);
});
}
Python:
import hmac, hashlib, time
def verify_droot(secret: str, raw_body: bytes, headers, tolerance=300) -> bool:
ts = headers.get("X-Droot-Timestamp", "")
if not ts.isdigit() or abs(time.time() - int(ts)) > tolerance:
return False
expected = hmac.new(secret.encode(), ts.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return any(hmac.compare_digest(p.strip()[3:], expected)
for p in headers.get("X-Droot-Signature", "").split(",") if p.strip().startswith("v1="))
The kernel exports the same check as verifySignature({ secret, body, signature, timestamp }) for tests and
internal receivers.
Delivery Guarantees
| Topic | Behaviour |
|---|---|
| Transactions | An event is written in the same transaction as the change. A change that rolls back sends nothing. |
| Order | Per webhook and per record, in commit order: a record's next event waits until the previous one is delivered or dead-lettered. Different records are independent. |
| Retries | Exponential backoff with jitter (30 s, 1 min, 2 min … capped at 1 h), 8 tries by default (WEBHOOK_MAX_ATTEMPTS). |
| Dead letters | After the last try the delivery is Dead-Lettered in the delivery log; the record's later events continue. Use Retry on the row. |
| Pause | Pause holds new and queued deliveries in order; Resume sends them. |
| Replay | Replay From… a time or an event id queues every stored event the webhook matches today, again, as new deliveries (up to 2,000 per call). |
| Retention | Events are kept EVENT_RETENTION_DAYS (default 30) for replay; the delivery log WEBHOOK_LOG_RETENTION_DAYS (default 30). |
| Rate limit | Per webhook, per minute (default 600). Over the limit a delivery waits briefly, then retries later. |
| Egress | No redirects are followed; private, loopback and link-local addresses are refused unless the webhook is marked internal (capability integrations.webhooks.internal). An instance can restrict target hosts with WEBHOOK_ALLOWED_HOSTS (hooks.example.com,*.example.net). |
Choosing Events
A webhook names event types (record.created), a family (record.*) or every event (*), the companies it covers
(or every company: group-wide, which needs access to every company and also receives group-wide events) and up to ten
conditions on the event: type, company, actor.kind, actor.id or data.<key>, with eq, neq, in or
exists. A condition on a list (data.changedFields eq "stage") holds when the list contains the value.
Admin API
All under /api/admin/webhooks (signed-in users with integrations.webhooks): GET /event-types, GET /,
POST / (returns the secret once), GET|PATCH|DELETE /:id, POST /:id/pause, /:id/resume,
/:id/rotate-secret ({ overlapHours }), /:id/test, /:id/replay ({ from } or { eventId }),
GET /:id/deliveries?outcome=&eventType=&before= and POST /:id/deliveries/:deliveryId/retry. Every change is audited.
Internal Subscribers
Kernel code consumes the same stream with kernel.events.registerSubscriber({ key, title, events, matches?, handle }):
the same at-least-once, per-record order, retries and dead letters, in its own unit of work.
Package Subscribers
An app or connector package subscribes through its manifest's scopes and its per-company activation
(kernel.events.registerPackageSubscriber({ package: { id, scopes }, key, title, events, handle })):
- declaring one needs the
events.subscribescope; an event type tied to one family (stock.moved,journal.posted) needs that family's read scope, or registration is refused; - events about the package's own models always reach it; events about another app's models need
<family>.read(or.write); events naming no family (a job run) reach it; - an event of a company where the package is not active (Setup › Apps,
platform.app-activation) is acknowledged and dropped; activation is read at delivery, so switching a company off takes effect at once.
Its key on the stream is pkg.<id>.<key> (@ as .), with the same delivery guarantees as any internal subscriber.