Skip to main content

End of Call

Sends an HTTP notification to your endpoint when a call ends, regardless of attempt. The payload contains the full transcript, recording, duration, and analysis of the completed call.

Delivery

  • Method: POST
  • Content-Type: application/json
  • Request timeout: 30 seconds. If your endpoint does not respond in 30s, the attempt is treated as failed and retried.
  • Authorization: If a bearer token is configured for the agent, requests include an Authorization: Bearer <token> header.

Payload

{
"id": "cHYqKdGz25Rq",
"session": {
"id": "sn_8Qd1mTbR"
},
"startedAt": "2024-09-24T18:20:22.724Z",
"endedReason": "customer-ended-call",
"messages": [{
"role": "system",
"message": "You are a helpful assistant"
}, {
"role": "agent",
"message": "Hello"
}, {
"role": "user",
"message": "Hi"
}],
"customer": {
"name": "Jane Doe",
"phoneNumber": "+15551234567"
},
"variableValues": {
"myVariable": "myValue"
},
"durationSeconds": 15,
"detailsURL": "https://fonema.ai/shareable/cHYqKdGz25Rq",
"recordingURL": "https://fonema.ai/api/v1/storage/calls/cHYqKdGz25Rq.mp3",
"analysis": {
"successEvaluation": true,
"structuredData": {
"myData": "myValueFromCall"
},
"summary": "The customer confirmed the appointment."
}
}

Main fields

FieldTypeDescription
idstringUnique call ID, consistent across all webhooks for the same call.
session.idstringSession ID that groups all call attempts to the same customer.
startedAtstringCall start date-time in ISO 8601.
endedReasonstringWhy the call ended (for example customer-ended-call, user-not-contacted).
messagesarrayFull conversation transcript.
customer.namestringOptional. Present when a name was provided when creating the call.
customer.phoneNumberstringDestination phone number in E.164 format.
variableValuesobjectInput variables provided when the call was created.
durationSecondsintegerTotal call duration in seconds.
detailsURLstringURL to view call details in the dashboard.
recordingURLstringOptional. URL to download the audio recording. Present only when a recording is available.
analysis.successEvaluationbooleanWhether the success criteria was met.
analysis.structuredDataobjectOutput variables and extracted values.
analysis.summarystringNatural-language summary of the call.

Message details

The messages field contains the complete call transcript:

  • role: Participant role (system, agent, user)
  • message: Message content

Responding to events

Return any HTTP 2xx status code to acknowledge receipt. Response body is ignored.

Any of the following is treated as failure and triggers a retry:

  • 3xx, 4xx, or 5xx response
  • Network error (connection refused, DNS failure, TLS error)
  • No response within the 30-second timeout

Your endpoint must be idempotent. Since non-2xx responses are retried, the same event may be delivered multiple times. Deduplicate using id.

Respond well under 30 seconds—ideally acknowledge immediately (for example by queueing the event) and do heavy processing asynchronously.

Retry policy

Failed deliveries are retried automatically with exponential backoff (each delay is 3× the previous one):

AttemptDelay after previous attempt
1— (initial delivery)
25 seconds
315 seconds
445 seconds
52 min 15 sec
66 min 45 sec
720 min 15 sec
81 hr 45 sec
93 hr 2 min 15 sec

After nine attempts the event is dropped and won't be resent. If your endpoint was down longer than the retry window, reconcile state using the API instead of waiting for redelivery.