Webhooks

Webhooks — overview & signing

A webhook lets us push events to your server instead of you polling. When a call ends (or an event tool fires), we POST a signed JSON body to a URL you give us.


Two kinds of webhooks

1. Call Answer webhook (synchronous)

A single URL set on your product. When an inbound call arrives on a number set to Webhook routing, we POST call.answer before answering and your server decides whether to accept the call and which agent runs it. You reply in the same request. See Call answer webhook.

2. Event subscriptions (asynchronous)

URLs you subscribe to specific events on. They fire after the fact with retries — your server just verifies the signature and returns 200. Covered on this page.


How it works

  1. You register a URL — POST /v1/webhooks (see Manage endpoints).
  2. When a matching event happens, we POST your URL.
  3. You verify the signature, do your thing, and return 2xx within 10 seconds.
  4. No 2xx? We retry with backoff (below).

What a delivery looks like

POST https://yourapp.com/webhooks/eureka
Content-Type: application/json
X-Webhook-Timestamp: 1716717168
X-Webhook-Signature: 9f86d081884c7d659a2feaa0c55ad015a267...
X-Event-Type: call.ended
X-Event-Id: 9b6f1a2e-0e3d-4a11-8c2a-1f6e2b6b7b10

IDs are UUIDs, no prefix — see Event reference for the full payload shape.

The body is the event payload itself (no wrapper). Which event it is comes from the X-Event-Type header.

{
  "session_id": "ffd09731-5543-4be8-80aa-a93c677f5599",
  "direction": "inbound",
  "status": "completed",
  "duration_sec": 47,
  "from": "+919812345678",
  "to": "+918008001234"
}

See every field in the Event reference.


Verify the signature — always

Never trust a webhook before checking its signature. X-Webhook-Signature is an HMAC-SHA256 of {timestamp}.{rawBody} using your subscription's signing secret, as hex.

// Node.js — Express
import crypto from 'crypto';

function verify(rawBody, timestamp, signature, secret) {
  const expected = crypto.createHmac('sha256', secret)
    .update(`${timestamp}.${rawBody}`)   // raw body bytes, not parsed JSON
    .digest('hex');
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}

app.post('/webhooks/eureka', express.raw({ type: 'application/json' }), (req, res) => {
  const ts  = req.headers['x-webhook-timestamp'];
  const sig = req.headers['x-webhook-signature'];
  if (!verify(req.body, ts, sig, process.env.EUREKA_WEBHOOK_SECRET)) {
    return res.status(401).send('bad signature');
  }
  const event = JSON.parse(req.body);
  // handle by req.headers['x-event-type'] ...
  res.sendStatus(200);
});

Use the raw body (express.raw), not parsed JSON. The signature is over the exact bytes — re-serializing breaks it.


Retries

If you don't return 2xx, we retry on this schedule:

Attempt Wait
2 30 seconds
3 2 minutes
4 10 minutes
5 1 hour
6 6 hours

After the last attempt the delivery is marked dead. You can see deliveries in your dashboard.


Respond fast

Return 2xx as soon as you've checked the signature, then do the real work in the background. A response slower than 10 seconds counts as a failure and gets retried.


Next