Skip to main content
A post-call webhook sends an HTTP request to a URL you specify after a call ends, optionally only when the call matches conditions you define.

Enable a webhook

1

Open the Post-call Webhook section

In your agent, open the Post-call Webhook section.
2

Turn it on

Enable the webhook.
3

Set the URL and method

Enter the URL to call, and choose GET or POST.

Set trigger conditions

By default, a webhook fires for every call. You can restrict it to fire only when the call matches specific conditions. Conditions are organized into trigger groups. Each group combines one or more conditions with AND or OR. A condition can compare a state variable or the call outcome against a value using equals or not_equals. You can also add a Call duration condition that matches calls lasting at least a whole-number threshold in seconds. The webhook fires as soon as any one trigger group matches. For example, you could fire a webhook only when call_outcome equals CALLBACK_REQUESTED, when a state variable like escalated equals true, or when a call lasts at least 120 seconds.

Default payload

If you don’t configure a custom payload, AgentCallback sends this JSON body:
call_transcript is the flat transcript, one Speaker: text line per utterance. call_transcript_messages is the same conversation broken into individual utterances, each with the speaker, its zero-based message_index in chronological order, and a voice_start_at UTC timestamp. voice_start_at is null for calls recorded before per-message timing was captured.

Customize the payload

You can define your own payload template using the same {{name}} interpolation and {{#if}}...{{else}}...{{/if}} conditionals available in your agent’s prompt — see Variables for the syntax. Use {{call_duration_seconds}} to include the completed call length in seconds.

Include structured values

When a payload value is nothing but a single placeholder, and that placeholder resolves to an object or a list, it is sent as real JSON rather than as text. This template:
sends transcript as the full array of utterances and customer as the contact object, while city and opener — which resolve to single values — are sent as strings.
This applies only to a value that is exactly one placeholder. Anything with surrounding text or a second placeholder, such as "transcript={{call_transcript_messages}}", is text interpolation and produces a string.
Reference state variables in your custom payload with {{state.variableKey}}, just as you would in your agent’s prompt.

Check delivery results

After a call, the delivery result — whether the webhook was attempted, whether conditions matched, the response status code, and any error — is shown alongside the call’s other details.

Next steps

Add your Twilio credentials or add your SIP trunk to connect a phone number to your agents.