Account webhooks
Account webhooks send an event to your server each time a transcription job or a live session of your workspace starts, ends or fails, without a setting on each request. Add an endpoint once, in Gladia Connect, and every job and session of the workspace, or of the API keys you choose, reaches it. Your firewall filters by address? The calls leave from your cluster’s IP addresses.
Account webhooks are part of the Enterprise plan: ask your Gladia account manager to turn them on for your workspace. Need every message of one session or one job instead? Use live callbacks or pre-recorded callbacks, set on each request.
Add an endpoint
Section titled “Add an endpoint”The workspace’s Owner, Billing Admins and Admins manage its endpoints in Gladia Connect, Webhooks:
- Add endpoint, and give its URL:
https, on a public address. - Choose its events: all of them, or some.
- Choose its API keys: every key of the workspace (and the keys created later), or some. Only the jobs and sessions of the chosen keys send events to it.
- Copy its signing secret (
whsec_…) to your receiver. You can reveal it again on the endpoint’s page, or rotate it there: the previous secret stops signing at once.
A workspace has up to 50 endpoints. Each endpoint can be edited, disabled (its events wait) and enabled again, or deleted with its delivery log.
Events
Section titled “Events”| Event | Sent when |
|---|---|
transcription.created |
A pre-recorded job was accepted (201 to POST /v2/pre-recorded) |
transcription.success |
A pre-recorded job is done and its result can be read |
transcription.error |
A pre-recorded job failed |
live.start_session |
A live session was initiated (201 to POST /v2/live) |
live.start_recording |
The first audio of a live session was received, once per session |
live.end_recording |
A live session’s recording ended |
live.end_session |
A live session’s post-processing ended and its results can be read |
Each event is sent once per job or session. The transcription a live session’s finalization
runs once it ended sends no transcription.* event: the session’s live.* events tell its end.
Payload
Section titled “Payload”Each event is a POST with an application/json body that names the event and the job’s or the session’s id:
{ "event": "transcription.success", "payload": { "id": "0199d7a2-6a10-7c22-8d4e-5f6a7b8c9d0e" }}Read the result with the id: GET /v2/pre-recorded/{id} for a job,
GET /v2/live/{id} for a session. The event never carries the transcript nor the
request’s custom metadata.
Verify the signature
Section titled “Verify the signature”Each request is signed the Standard Webhooks way, with three headers:
| Header | Value |
|---|---|
webhook-id |
The message’s id (msg_…): the same on every attempt of the same event |
webhook-timestamp |
When this attempt was signed, in Unix seconds |
webhook-signature |
v1, and the base64 HMAC-SHA256 of <webhook-id>.<webhook-timestamp>.<raw body>, keyed with the bytes of the secret: the base64 after whsec_ |
The same three values are also sent as svix-id, svix-timestamp and svix-signature, so a receiver written for
Gladia’s cloud API keeps working. Any Standard Webhooks library verifies them; without one:
import base64, hashlib, hmac, time
def verify(secret: str, headers: dict[str, str], raw_body: bytes, window_s: int = 300) -> bool: msg_id, ts = headers.get("webhook-id", ""), headers.get("webhook-timestamp", "") if not ts.isdigit() or abs(time.time() - int(ts)) > window_s: return False key = base64.b64decode(secret.removeprefix("whsec_")) mac = hmac.new(key, f"{msg_id}.{ts}.".encode() + raw_body, hashlib.sha256).digest() expected = "v1," + base64.b64encode(mac).decode() return any(hmac.compare_digest(expected, s) for s in headers.get("webhook-signature", "").split())import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(secret, headers, rawBody, windowS = 300) { const id = headers["webhook-id"] ?? ""; const ts = headers["webhook-timestamp"] ?? ""; if (!/^\d+$/.test(ts) || Math.abs(Date.now() / 1000 - Number(ts)) > windowS) return false; const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64"); const mac = createHmac("sha256", key).update(`${id}.${ts}.`).update(rawBody).digest("base64"); const expected = Buffer.from(`v1,${mac}`); return (headers["webhook-signature"] ?? "") .split(" ") .some((s) => s.length === expected.length && timingSafeEqual(Buffer.from(s), expected));}- Sign the raw body, the bytes as received, before any JSON parsing.
webhook-signaturemay hold several signatures, separated by spaces: accept the request when one matches.- Refuse a
webhook-timestampolder than your replay window (5 minutes is a good default).
Delivery
Section titled “Delivery”- A delivery succeeds when your server answers
2xxwithin 30 seconds. Answer quickly and process the event afterwards. - Any other answer, a timeout or a network error is retried: 8 attempts in all, after 5 seconds, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours and 10 hours, about 28 hours in all.
- To stop the retries of an event, answer with the header
webhook-delivery: abort-message. - An endpoint whose deliveries keep failing for 5 days is disabled. Its events wait: they are sent once you enable it again in Gladia Connect.
- Delivery is at least once, and events of different jobs and sessions may arrive in any order: deduplicate on
webhook-id.
Delivery log and replay
Section titled “Delivery log and replay”Each endpoint’s page in Gladia Connect lists its deliveries of the last 90 days, by state (succeeded, retrying, failed), with each attempt: when, your server’s answer, and how long it took.
- Replay sends one delivery again, or every failed delivery of the endpoint.
- Send test event sends one signed example of an event to the endpoint, whatever events it takes, about the id
00000000-0000-0000-0000-000000000000: use it to check your receiver.
Coming from Gladia’s cloud API
Section titled “Coming from Gladia’s cloud API”A receiver written for the account webhooks of Gladia’s cloud API reads these unchanged: the same 7 events, the same
{event, payload: {id}} body, the same signature scheme, and the svix-* headers it reads. Endpoints are set per
workspace, where Gladia’s cloud API set them per API key: limit an endpoint to some API keys to keep that split.