Webhooks
Get a signed HTTP POST to your endpoint when a call finishes or a campaign changes state.
When a call completes or an outbound campaign changes state, we POST a signed JSON body to your HTTPS endpoint, retry on failure, and let you inspect and replay every delivery.
curl -X POST https://api.kejue.co/v1/webhooks \
-H "Authorization: Bearer $KEJUE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 018f4d7a-create-crm-webhook" \
--data '{
"name": "CRM sync",
"url": "https://example.com/hooks/kejue",
"events": ["call.completed", "campaign.completed"]
}'The 201 returns the whsec_... signing secret once — store it to
verify every delivery.
Events
A configuration subscribes to 1–10 events from this closed set:
| Event | Fires when |
|---|---|
call.completed | A call on a subscribed agent finishes. |
campaign.started | Calling begins. |
campaign.paused | Call feeding stops — by an operator or by us. |
campaign.resumed | A paused campaign resumes. |
campaign.completed | Every recipient finished, or the end time passed. |
campaign.stopped | Ended permanently. |
Campaign events go to every active subscribed webhook in the workspace.
call.completed is scoped to agents: attach the webhook in after-call
settings (PATCH /v1/agents/{id}/after-call, field webhook_config_ids)
and promote the draft.
The envelope
Deliveries follow the WebhookOutboundEvent schema
(API reference): canonical JSON (sorted keys, compact,
UTF-8), at most 2 MiB. Every top-level and call key shown below is present.
Nullables are explicit null; arrays stay arrays even when empty.
| Key | Meaning |
|---|---|
api_version | 2026-07-01. |
event | The event name. |
delivery_id | Unique per delivery — your deduplication key. |
delivered_at | When this attempt's payload was assembled. |
test | true for test deliveries. |
replayed_from_id | Source delivery ID on replays, else null. |
call / campaign | The event payload. Both keys are always present; whichever doesn't apply is null — campaign on call.completed, call on campaign.*. |
Field-by-field call/campaign payload reference and examples:
event payloads.
pathway_state is the persisted pathway snapshot and can contain captured
slots — not runtime context. We never copy outbound variables, the
system template scope, raw SIP headers/participant attributes, room
metadata, credentials, or tool request/response bodies; put approved
business output in an extraction object
or a captured slot.
Test deliveries use the same seven top-level keys with test: true and a
null payload.
Manage configurations
| Operation | Purpose |
|---|---|
POST /v1/webhooks | Create; returns the signing secret once. |
GET /v1/webhooks | List; filter by q, active, event, archived. |
GET /v1/webhooks/{id} | Metadata and has_secret — never the secret. |
PATCH /v1/webhooks/{id} | Update name, url, events, active; use If-Match. |
POST /v1/webhooks/{id}/rotate-secret | New one-time secret; the old one stops signing. |
DELETE /v1/webhooks/{id} | Archive; pending deliveries become failed_permanent. 409 webhook_in_use while an active agent version references it. |
URLs must be public HTTPS — credentials, fragments, and private/internal targets are rejected.
Test deliveries
POST /v1/webhooks/{id}/test (send If-Match and an Idempotency-Key)
creates a real signed delivery with a null payload. Poll the 202's
Location (GET /v1/webhook-deliveries/{id}) after Retry-After.
Observe and replay deliveries
GET /v1/webhook-deliveries— list attempts; filter bywebhook_id,call_id,event,status,is_test.GET /v1/webhook-deliveries/{id}— adds the body's SHA-256 and a sanitized 2,048-byte response preview; statuses and the retry schedule are on the security page.POST /v1/webhook-deliveries/{id}/replay— a new delivery from a finished one: current URL and secret,replayed_from_idset.mode: snapshot(default) resends the stored payload;mode: rebuildreassembles current call results.
Needs webhooks:read / webhooks:create / webhooks:update /
webhooks:delete; test, rotation, and replay use update.