Receive call events
Hear about every call within seconds, and check that each event really came from TRAKI.
Webhooks send an event to your server when a call starts, ends or becomes billable. You do not need to keep asking the API.
1. Add an endpoint
In the portal, open Webhooks, add your endpoint's address (HTTPS) and tick the events you want: call.started, call.ended and call.billable. Copy the endpoint's secret. It starts whsec_.
Managing endpoints from the API arrives in release 2.
2. Verify, then answer quickly
import express from 'express';
import { verifyWebhook } from './verify-webhook.js'; // from the webhooks page
const app = express();
// Keep the raw body: the signature covers it exactly as sent.
app.post('/traki/events', express.text({ type: 'application/json' }), (req, res) => {
if (!verifyWebhook(req.headers, req.body, process.env.TRAKI_WEBHOOK_SECRET)) {
return res.sendStatus(400);
}
const event = JSON.parse(req.body);
res.sendStatus(204); // answer within 10 seconds
queue.add(event); // do the slow work afterwards
});The verification code for Node, Python and PHP is on the webhooks page.
3. Handle each event once
A failed delivery is retried, with the same id. Store the IDs you handled and skip repeats.
{
"id": "evt_mi7x2k9a3f8c1d0e7b",
"type": "call.ended",
"createdAt": "2026-12-01T14:03:22.418Z",
"data": {
"call": "C-7Q2M9K",
"campaign": "ROOF-01",
"buyerId": "0b6c3d1e-9a4f-4e2b-8d7c-5f1a2e3b4c6d",
"stage": "ENDED",
"outcome": "BRIDGED",
"startedAt": "2026-12-01T14:01:02.000Z",
"endedAt": "2026-12-01T14:03:21.000Z",
"durationSec": 139,
"connectedSec": 121,
"billable": true
}
}data.call is the call's code, the same as the code field in the calls list. The event carries no money; read the call from the API when you need charges and payouts.
4. Fill in the details
Events can arrive out of order. When you need the full, latest record, read recent calls and match on code:
curl 'https://api.traki.io/v1/account/calls?updatedSince=2026-12-01T14:00:00Z&limit=100' \
-H "Authorization: Bearer $TRAKI_KEY"5. Catch up after downtime
Deliveries are retried for 3 days. After a longer outage, read the calls list with updatedSince set to the last time you were sure your copy was complete.