Integrations

Using the Cradle webhook API

Receive real-time call events in your own systems via Cradle webhooks.

Cradle posts a JSON payload to your endpoint when a call starts, ends, or is missed. Configure the URL under Settings → API.

Example payload

{
  "event": "call.ended",
  "call_id": "c_01HXYZ",
  "from": "+64211234567",
  "to": "+6494000000",
  "duration_seconds": 142,
  "recording_url": "https://recordings.cradle.io/c_01HXYZ.mp3"
}

Verifying the signature

Each request includes an X-Cradle-Signature header. Verify it with your shared secret:

import crypto from "node:crypto"

function verify(body: string, signature: string, secret: string) {
  const expected = crypto
    .createHmac("sha256", secret)
    .update(body)
    .digest("hex")
  return crypto.timingSafeEqual(
    Buffer.from(expected),
    Buffer.from(signature),
  )
}