Webhooks and events
What a route delivers to your API client becomes an event. You can receive events by webhook, by pulling them, or both.
Pull events
GET {base}/events?cursor=<next_cursor>&limit=50
Events come in cursor order with the message inside: data when it is JSON (FHIR R4), data_base64 when it is HL7 v2. Keep next_cursor and pass it on the next call. Events stay available for 30 days, then they are deleted; Velacent Bridge does not track which events you pulled, so pull at least daily or use webhooks. An event whose message has passed the 30-day payload retention comes back with "payload_expired": true and no data.
Webhooks
POST {base}/webhooks with {"url": "https://...", "event_types": ["message.received", "test.ping"]}. The URL must use https on port 443 or 8443 and a public address. Velacent Bridge never follows redirects. One webhook per URL: adding the same URL again is 409 webhook_exists (list your webhooks, or rotate the secret if you lost it).
Verification. Before anything else, your endpoint receives {"type": "webhook.verification", "challenge": "..."}. Answer 2xx with {"challenge": "<the same value>"}. Run it again with POST {base}/webhooks/{id}/verify.
Signature. Every request carries X-Velacent-Signature: t=<unix seconds>,v1=<hex>. The v1 value is HMAC-SHA256 of "<t>.<raw body>" with your signing secret (shown once when you create the webhook). Refuse a timestamp more than 5 minutes old, and compare in constant time:
import hmac, hashlib, time
def verify(secret: bytes, header: str, body: bytes, tolerance=300) -> bool:
parts = [p.split("=", 1) for p in header.split(",")]
ts = next(v for k, v in parts if k == "t")
if abs(time.time() - int(ts)) > tolerance:
return False # too old: a replay
want = hmac.new(secret, ts.encode() + b"." + body, hashlib.sha256).hexdigest()
return any(hmac.compare_digest(v, want) for k, v in parts if k == "v1")
import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(secret, header, rawBody, toleranceSec = 300) {
const parts = header.split(",").map((p) => p.split("="));
const ts = parts.find(([k]) => k === "t")?.[1];
if (!ts || Math.abs(Date.now() / 1000 - Number(ts)) > toleranceSec) return false;
const want = Buffer.from(createHmac("sha256", secret).update(ts + ".").update(rawBody).digest("hex"));
return parts.some(([k, v]) => k === "v1" && v.length === want.length && timingSafeEqual(Buffer.from(v), want));
}
Rotating the secret. POST {base}/webhooks/{id}/rotate-secret returns the new secret once. For 24 hours each request carries two v1 values, one for each secret, so you can deploy the new secret without missing an event.
Retries, the delivery log and redelivery
Answer 2xx within 10 seconds. Otherwise Velacent Bridge retries after 30 seconds, 2, 10 and 30 minutes, then 1, 3, 6, 12, 24 and 24 hours. After that the webhook is marked failing, and the event waits for you to pull it or redeliver it. GET {base}/webhooks/{id}/deliveries shows every attempt with its status code and outcome. POST {base}/events/{id}/redeliver sends an event to your webhooks again.
Ordering and duplicates
Event IDs and cursors are in the order events were recorded. Webhooks are sent in that order, but a failing event does not hold back later ones. Order by event ID, not by arrival time. If you get the same event ID twice, it is a redelivery: process it once.
When a route skips a preliminary result that a newer one replaces before delivery, you receive only the newer one. No event is created for the skipped draft.
Something unclear or missing? Ask Help in the Velacent Bridge console; answers link to the right screen. How support works.