Skip to content

Webhooks

Webhooks push real-time notifications to your server when things happen in Chronary — events created, updated, deleted, or agents modified. No polling required.

  1. You register a webhook URL and choose which event types to listen for
  2. When a matching event occurs, Chronary sends an HTTP POST to your URL
  3. The request includes an HMAC-SHA256 signature for verification
  4. Failed deliveries are retried on a fixed schedule (see Retry behavior)
Terminal window
curl -X POST https://api.chronary.ai/v1/webhooks \
-H "Authorization: Bearer chr_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhooks/chronary",
"events": ["event.created", "event.updated", "event.deleted"]
}'
Event typeTrigger
event.createdA new event is added to any calendar
event.updatedAn event’s fields are modified
event.deletedAn event is deleted
agent.createdA new agent is created
agent.updatedAn agent’s fields are modified

Each delivery is an HTTP POST whose body is the raw event payload — there is no { id, type, timestamp, data } envelope. The event type travels in the X-Chronary-Event-Type header, the delivery ID in X-Delivery-Id, and the signing timestamp in X-Timestamp. The X-Signature-V2 signature covers those headers as well as the body, so once a delivery verifies you can trust them. For example, an event.created delivery body:

{
"calendar_id": "cal_x1y2z3",
"event": {
"id": "evt_m1n2o3",
"calendarId": "cal_x1y2z3",
"title": "Strategy sync with Acme Corp",
"startTime": "2026-04-07T14:00:00Z",
"endTime": "2026-04-07T14:30:00Z",
"status": "confirmed"
}
}

Each event type carries its own payload shape — see the event catalog in the API reference.

Every delivery includes an X-Signature-V2 header: sha256=<hex>, an HMAC-SHA256 keyed with your webhook secret over the raw body and the X-Timestamp, X-Delivery-Id, X-Chronary-Event-Type, X-Chronary-Test and X-Chronary-Replay-Of headers (the exact message is in the API reference). Because those headers are signed, nobody holding a copy of a delivery can re-send it as another event type, with a new delivery ID, or with the test flag removed. Verify the signature against the raw request body before trusting the payload or any of those headers, and reject deliveries whose X-Timestamp is older than ~5 minutes to defend against replay. The SDKs do both for you:

import express from 'express';
import { verifySignature } from '@chronary/sdk';
const app = express();
// express.raw() keeps the body as the exact bytes Chronary signed.
// Register this route before any app-wide body parser such as
// app.use(express.json()), or make that parser skip this path: once
// the body has been parsed, the raw bytes are gone and every delivery
// fails verification.
app.post('/webhooks/chronary', express.raw({ type: 'application/json' }), async (req, res) => {
let payload;
try {
// Pass the RAW body string and the request headers.
// Throws on a bad/missing signature or a stale timestamp.
const rawBody = req.body.toString('utf8');
await verifySignature(rawBody, req.headers, process.env.WEBHOOK_SECRET);
payload = JSON.parse(rawBody);
} catch {
return res.status(401).send('Invalid signature');
}
// ...handle the verified payload
res.status(200).end();
});

On the Developer or Pro plan you can replace an endpoint’s secret without dropping deliveries. Rotate it in the console (the endpoint’s Settings tab) or with POST /v1/webhooks/:id/secret/rotate, and choose when the old secret stops working: now, in 1 hour, in 24 hours (the default) or in 7 days. The new secret is shown once.

Until the old secret expires, each delivery carries two v2 signatures over the same message: X-Signature-V2 with the new secret and X-Signature-V2-Previous with the old one (and the v1 pair X-Signature / X-Signature-Previous). The SDK verifiers above accept the delivery if your secret matches either v2 header, so:

  1. Update the SDK first (SDK versions released before secret rotation check only one signature header). If you verify by hand, accept a match on either header.
  2. Rotate and store the new secret.
  3. Deploy the new secret to your receiver before the old one expires.

Rotating again before the old secret expires ends it at once: only the current secret and the one it replaced are ever valid. See Rotate the signing secret for the full reference.

Deliveries also carry X-Signature (and, during a rotation, X-Signature-Previous): the v1 signature, an HMAC-SHA256 of `${X-Timestamp}.${rawBody}` only. It does not cover the event type, delivery ID, test flag or replay ID, so a receiver that checks only v1 must not trust those headers. v1 is deprecated and still sent, with no removal date. The current SDKs (@chronary/sdk 0.14.0, chronary 0.14.0 for Python, chronary-go 0.13.0) check X-Signature-V2 only and never fall back to v1; older SDK versions check v1. If you verify by hand, move to v2.

Your endpoint has 10 seconds to respond with a 2xx status. A non-2xx status, a timeout or a network error counts as a failed attempt, and Chronary tries again on a fixed schedule:

AttemptFreeDeveloperPro
1ImmediatelyImmediatelyImmediately
2+1 min+1 min+1 min
3+5 min+5 min+5 min
4+30 min+30 min+30 min
5—+1 h+1 h
6—+2 h+2 h
7——+6 h
8——+12 h

Free makes 4 attempts, Developer makes 6 and Pro makes 8.

After the last attempt the delivery is marked failed.

An endpoint is disabled automatically (active: false) after 20 consecutive failed deliveries or 24 hours of continuous failures, whichever comes first. A webhook.deactivated event goes to your other active endpoints.

Terminal window
curl https://api.chronary.ai/v1/webhooks \
-H "Authorization: Bearer chr_sk_your_key_here"

Change the URL, event types, or active status:

Terminal window
curl -X PATCH https://api.chronary.ai/v1/webhooks/whk_a1b2c3 \
-H "Authorization: Bearer chr_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"events": ["event.created", "event.updated"],
"active": false
}'

Set active: false to temporarily pause deliveries without deleting the webhook.

Terminal window
curl -X DELETE https://api.chronary.ai/v1/webhooks/whk_a1b2c3 \
-H "Authorization: Bearer chr_sk_your_key_here"

Returns 204 No Content.

  • Always verify signatures — never trust a webhook payload without checking the HMAC
  • Return 200 quickly — process the payload asynchronously if it takes more than a few seconds
  • Handle duplicates — use the X-Delivery-Id header (signed by X-Signature-V2; event.deliveryId / delivery_id / DeliveryID from the SDKs) to deduplicate, as retries reuse the same delivery ID