Integrations
Receive Call Events
Get ringing, answered and ended events for your calls on your backend, and check they came from TryVox.
Have TryVox tell your backend when a call rings, is answered, and ends, so you can update your database.
How it works
TryVox ── POST (JSON, signed) ──▶ your /webhooks/tryvox ──▶ check signature ──▶ update database ──▶ 200There are two ways to receive events. Both send the same JSON and are signed the same way, so one handler serves both.
| Per call / per application | Account-wide subscription | |
|---|---|---|
| Set up | status_callback_url, hangup_url, webhook_secret on Make a Call or a Voice Application | POST /v1/notifications/webhooks with events: ["call.ended"] |
| Events | ringing, answered, hung up, and the final result | the final result of every call on the account, AI-agent and SIP-trunk calls included |
| Good for | following one call live | keeping call history in sync |
Before you start
- A public HTTPS URL for your server, for example
ngrok http 3000. - A secret you choose, such as
openssl rand -hex 32. Send it aswebhook_secreton the call or application. For a subscription, TryVox returns thesecretonce when you create it.
Try it
This uses isFromTryVox() from the shared tryvox.js, placed in the same folder.
npm install express
TRYVOX_WEBHOOK_SECRET=your-secret node webhooks-express.js// Receive TryVox call events with Express. Run: npm run webhooks
import express from 'express';
import { isFromTryVox } from './tryvox.js';
const app = express();
// Replace with your database. Keyed on CallUUID (= request_uuid from Make a Call).
async function saveCall(callUUID, fields) {
console.log('save', callUUID, fields);
}
// express.raw keeps the exact bytes TryVox signed. Don't use express.json() here.
app.post('/webhooks/tryvox', express.raw({ type: '*/*' }), async (req, res) => {
if (!isFromTryVox(req.get('X-TryVox-Signature'), req.body)) return res.sendStatus(401);
const event = JSON.parse(req.body);
res.sendStatus(200); // answer fast, then do the work
if (event.Event === 'Hangup') {
// The call has ended. Status: completed | busy | no-answer | cancelled | failed
await saveCall(event.CallUUID, {
status: event.Status,
reason: event.Reason,
seconds: event.Billsec ?? 0,
endedAt: event.EndTime,
});
} else {
// Event "Status" (ringing | answered | hangup) or "Ring"
await saveCall(event.CallUUID, { liveStatus: event.Status });
}
});
const port = Number(process.env.PORT ?? 3000);
app.listen(port, () => console.log(`Listening on :${port}/webhooks/tryvox`));Then place a call that reports to it:
curl -X POST https://api.tryvox.io/v1/voice/accounts/$TRYVOX_AUTH_ID/calls \
-u $TRYVOX_AUTH_ID:$TRYVOX_AUTH_TOKEN \
-H "Content-Type: application/json" \
-d '{
"from": "+918045671234",
"to": "+919812345678",
"answer_url": "https://api.tryvox.io/voice-test",
"status_callback_url": "https://abc123.ngrok.app/webhooks/tryvox",
"hangup_url": "https://abc123.ngrok.app/webhooks/tryvox",
"webhook_secret": "your-secret"
}'Expected result
Your server logs the call progressing, then its result:
save 550e8400-… { liveStatus: 'ringing' }
save 550e8400-… { liveStatus: 'answered' }
save 550e8400-… { liveStatus: 'hangup' }
save 550e8400-… { status: 'completed', reason: 'NORMAL_CLEARING', seconds: 6, … }The final event looks like this:
{
"Event": "Hangup",
"CallUUID": "550e8400-e29b-41d4-a716-446655440000",
"RequestID": "550e8400-e29b-41d4-a716-446655440000",
"Timestamp": "2026-10-30T10:35:12Z",
"From": "+918045671234",
"To": "+919812345678",
"Direction": "outbound",
"Status": "completed",
"Reason": "NORMAL_CLEARING",
"AccountId": "TJab12cd34",
"StartTime": "2026-10-30T10:35:00Z",
"EndTime": "2026-10-30T10:35:12Z",
"Duration": 12,
"Billsec": 6
}The events
Event | Sent to | Status |
|---|---|---|
Ring | ring_url | ringing |
Status | status_callback_url | ringing, answered, hangup |
Hangup | hangup_url, and call.ended subscriptions | completed, busy, no-answer, cancelled, failed |
CallUUID is the request_uuid you got from Make a Call. For inbound calls, it's the call_uuid your answer_url received. To get the audio, look the call up in Recordings with ?call_uuid=.
Only these call events are sent today. Event names you may see listed elsewhere, such as call.started or call.answered subscriptions, are not emitted.
Rules that save you a bug
- Verify the raw body. The signature covers the exact bytes TryVox sent. Parse the JSON only after checking it.
- Answer
200quickly (within 10 seconds), then do your work. Per-call events are retried after about 2, 8 and 25 seconds on a timeout, a5xx,408or429. Other4xxresponses are not retried. - Expect duplicates. A retry, or a call you hung up through the API, can deliver the same
Hanguptwice. Write the result idempotently, keyed onCallUUID. - Without a
webhook_secretthe events are not signed. Always set one.
Next step
- Use it in a full app: Use TryVox with Your Platform.
- Payload details and VoxML responses: Webhooks.
Troubleshooting
| Problem | Fix |
|---|---|
| Every request fails the signature check | Use express.raw, not express.json(), on this route. Check the secret matches what you sent, and that your server clock is correct. |
| No events arrive | The URL must be public HTTPS. Set the URL on the call or application before the call starts. |
Hangup arrives twice | Expected. Make the update idempotent. |