Reference
Webhooks
A signed POST to your own URL when a job is done, Dus needs you, an incident opens or recovers, or a deploy goes live. Payload, headers, and how to check the signature and refuse replays.
Duscode can post its key events to a URL you choose, for your own automations, on-call tools or dashboards.
To set it up, go to Settings → Apps & connectors → Webhook and give it two things:
- The URL. It must use
https://. Plainhttp://is accepted only for this computer, for testing. - A signing secret of at least 32 characters. For example, run
openssl rand -hex 32.
Both are kept in your vault. You can switch each kind of news on or off in the webhook's row, as for Slack and Teams. Send test posts a test event straight away. Quiet hours hold deliveries back, the same way they do for other channels.
Events
type |
When |
|---|---|
job.done |
An engineering job merged |
needs_you |
Dus stopped and waits on you: an Owner's Call, a budget, a job blocked on you |
incident.opened |
Watch diagnosed a new incident on a live system |
incident.recovered |
Checks from outside confirm the system recovered |
deployed |
A deploy went live |
test |
You pressed Send test |
The request
POST /your/path HTTP/1.1
content-type: application/json
user-agent: Duscode-Webhook/1
x-duscode-event: job.done
x-duscode-delivery: 5f0c… (a UUID: the same on every retry)
x-duscode-timestamp: 1760870400 (Unix seconds)
x-duscode-signature: v1=9a1b… (hex HMAC-SHA256)
{"id":"5f0c…","type":"job.done","at":"2026-10-19T10:00:00.000Z","project":"shop","projectId":"…","status":"Engineering job done: merged","tone":"ok","detail":"Merged as 1a2b3c4d5e6f.","session":"Add CSV export","link":"http://localhost:4317/code?p=…"}The body never carries code, command output or secrets. Anything that looks like a secret is masked before sending.
Answer with any 2xx. A delivery that fails is tried again after 1 second and again after 4 seconds, each time with the same delivery id. The last failure shows on the webhook's row.
Checking a delivery
The signature is v1= followed by the hex HMAC-SHA256 of timestamp + "." + delivery + "." + raw body, keyed with your signing secret. Refuse a delivery if:
- the signature doesn't match (compare in constant time);
- the timestamp is more than 5 minutes from now;
- you have seen the delivery id before. Keep ids for at least 5 minutes.
import { createHmac, timingSafeEqual } from 'node:crypto';
const seen = new Map(); // delivery id → time seen
export function verify(secret, rawBody, h) {
const ts = Number(h['x-duscode-timestamp']);
const id = h['x-duscode-delivery'];
const want = Buffer.from('v1=' + createHmac('sha256', secret).update(`${ts}.${id}.${rawBody}`).digest('hex'));
const got = Buffer.from(h['x-duscode-signature'] ?? '');
if (want.length !== got.length || !timingSafeEqual(want, got)) return false;
if (Math.abs(Date.now() / 1000 - ts) > 300) return false; // too old: maybe replayed
if (seen.has(id)) return false; // already delivered
seen.set(id, Date.now());
return true;
}Verify the raw body exactly as it arrived, before any JSON parsing.