Skip to main content

Webhook Payloads

This page documents the structure of webhook payloads sent by Vocobase when events occur.

Event: session.completed

Sent when a call session ends — whether it completed normally, failed, or was disconnected.

Headers

Every webhook request includes these headers:
HeaderDescription
Content-Typeapplication/json
X-Webhook-SignatureHMAC-SHA256 signature: sha256=<hex>
X-Webhook-TimestampISO 8601 timestamp when the event was sent

Payload structure

{
  "event": "session.completed",
  "timestamp": "2026-03-15T14:32:08.000Z",
  "data": {
    "session_id": "s1234567-abcd-1234-abcd-123456789012",
    "agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "agent_name": "Sales Assistant",
    "duration_seconds": 127,
    "credits_used": 2.12,
    "transcript": [
      {
        "role": "bot",
        "content": "Hello! Thanks for taking my call. How can I help you today?",
        "timestamp": "2026-03-15T14:30:01.000Z"
      },
      {
        "role": "user",
        "content": "Hi, I'm interested in your enterprise plan.",
        "timestamp": "2026-03-15T14:30:04.500Z",
        "latency_ms": null
      },
      {
        "role": "bot",
        "content": "Great choice! Our enterprise plan includes unlimited agents, priority support, and custom voice training.",
        "timestamp": "2026-03-15T14:30:05.200Z",
        "latency_ms": 700
      }
    ],
    "recording_url": "https://vocobase-recordings.s3.amazonaws.com/rec_abc123.wav?X-Amz-Signature=...",
    "latency": {
      "min_ms": 450,
      "max_ms": 1200,
      "avg_ms": 680
    },
    "call": {
      "call_id": "c1234567-abcd-1234-abcd-123456789012",
      "from_number": "+14155551234",
      "to_number": "+919876543210",
      "direction": "outbound",
      "status": "completed"
    }
  }
}

Field reference

FieldTypeDescription
eventstringAlways "session.completed"
timestampstring (ISO 8601)When the webhook was sent
dataobjectEvent data (see below)

Data object fields

FieldTypeDescription
session_idstring (UUID)Unique session identifier
agent_idstring (UUID)The agent that handled the call
agent_namestringAgent display name at time of call
duration_secondsintegerCall duration in seconds
credits_usednumberCredits deducted for this call
transcriptarrayOrdered list of conversation turns (see below)
recording_urlstring or nullPresigned S3 URL for the call recording. null if recording was not enabled. URL expires in 24 hours.
latencyobjectResponse latency statistics across all bot turns
latency.min_msintegerFastest bot response time (milliseconds)
latency.max_msintegerSlowest bot response time (milliseconds)
latency.avg_msintegerAverage bot response time (milliseconds)
callobject or nullCall metadata (present only for telephony calls)
call.call_idstring (UUID)Unique call identifier
call.from_numberstringCaller phone number (E.164)
call.to_numberstringDestination phone number (E.164)
call.directionstring"outbound"
call.statusstringFinal call status: completed, failed, no_answer, busy, canceled

Transcript entry format

Each entry in the transcript array has:
FieldTypeDescription
rolestring"user" or "bot"
contentstringWhat was said
timestampstring (ISO 8601)When this turn occurred
latency_msinteger or nullTime between user finishing speaking and bot starting to respond. Only present on bot turns. null on user turns.
The recording_url is a presigned S3 URL that expires after 24 hours. Download the recording promptly if you need to store it permanently.

Call status values

StatusDescription
completedCall connected and ended normally
failedCall could not be placed (provider error)
no_answerRecipient did not answer
busyRecipient’s line was busy
canceledCall was canceled before connecting

Next steps

Webhook Setup

Configure your webhook URL and verify signatures.

Error Handling

Understand retry behavior and failure handling.