Webhooks
When a task reaches a final state we send a POST to the task's callback_url and to every webhook endpoint you configured under Settings → Webhooks.
| Header | Value |
|---|---|
| X-Nexus-Event | task.succeeded | task.failed | task.cancelled |
| X-Nexus-Delivery | Unique delivery id (use it to de-duplicate) |
| X-Nexus-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256> |
Verifying signatures
Compute HMAC_SHA256(secret, t + "." + raw_body), hex-encode it, and compare it in constant time with v1. Reject timestamps older than 5 minutes. Your signing secret is shown in Settings.
import crypto from "node:crypto";
export function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
import hmac, hashlib, time
def verify(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if abs(time.time() - int(parts["t"])) > 300:
return False
expected = hmac.new(secret.encode(), f"{parts['t']}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])
function verify(string $rawBody, string $header, string $secret): bool {
$p = [];
foreach (explode(',', $header) as $kv) { [$k, $v] = explode('=', $kv, 2); $p[$k] = $v; }
if (abs(time() - (int) $p['t']) > 300) return false;
return hash_equals(hash_hmac('sha256', $p['t'].'.'.$rawBody, $secret), $p['v1']);
}
Retries
Respond with any 2xx within 10 seconds. Failed deliveries are retried with exponential backoff (1 min, 5 min, 30 min, 2 h, 6 h) up to 6 attempts.