Skip to main content
TruGen sends an HTTP POST request to your configured callback_url whenever something important happens in a conversation — a user starts speaking, the agent is interrupted, a call ends, and more.

Enabling Webhooks

Webhooks are configured at the agent level using two fields:
  • callback_url — your publicly reachable HTTPS endpoint
  • callback_events — the list of event names you want to receive
Replace <api-key> with your API key and callback_url with your HTTPS endpoint.

Webhook Request Format

Every webhook uses the same base structure:

Handling Webhooks

Keep your webhook handler fast. Acknowledge immediately and offload heavy work to background jobs.

Event Reference

agent.interrupted

Triggered when the user starts speaking before the agent finishes. Use cases: cut off TTS visual indicators, log interruptions for conversational analytics.

agent.started_speaking

Triggered when the agent starts speaking (TTS + avatar rendering begins). Use cases: show a speaking indicator, animate visual elements, log when the agent begins its response.
  • payload.text — the text the agent is about to speak.

agent.stopped_speaking

Triggered when the agent finishes its current utterance. Use cases: hide speaking indicators, re-enable user input, measure speaking duration.
  • payload.text — the text that was just spoken.

call_ended

Triggered when the call with the agent ends cleanly. Use cases: trigger post-call workflows (summaries, surveys, CRM updates), log session completion.

max_call_duration_timeout

Triggered when a conversation reaches its configured maximum duration. Use cases: automatically end calls, show a “session ended” UI, enforce usage limits.
  • payload.call_duration — actual call duration in seconds.
  • payload.max_call_duration — configured maximum duration in seconds.

max_call_duration_warning

Triggered shortly before a conversation reaches its configured maximum duration — a heads-up before the session is cut off. Use cases: show a “session ending soon” warning in your UI, prompt the user to wrap up.
  • payload.call_duration — current call duration in seconds.
  • payload.max_call_duration — configured maximum duration in seconds.

participant_left

Triggered when a participant disconnects from the conversation. Use cases: clean up rooms, timers, and state; mark conversation as ended in your backend.
  • payload.id — identifier of the participant who left.

tool_call

Triggered when the agent invokes a tool during a conversation. Use cases: log tool usage for analytics, trigger side effects in your backend, audit agent actions.
  • payload.tool_name — the name of the tool that was called.
  • payload.parameters — the inputs passed to the tool by the agent.
  • payload.result — the response returned by the tool.

utterance_committed

Triggered when the user’s utterance has been fully captured and finalised by speech-to-text. Use cases: store transcripts, trigger NLP analysis, display final transcript in your UI.
  • payload.text — the final committed text of the utterance.

user.started_speaking

Triggered when the system detects the user has started speaking. Use cases: update UI to show a listening/recording state, trigger analytics on user turn count.

user.stopped_speaking

Triggered when the user stops speaking (end of an utterance). Use cases: mark turn boundaries for transcription, measure speech duration and turn-taking patterns.

Best Practices

  • Always return 2xx quickly — acknowledge webhooks immediately and offload heavy work to background jobs.
  • Design for idempotency — handlers should safely process the same event more than once.
  • Log by conversation_id — makes debugging and analytics far easier.
  • Use HTTPS — restrict your endpoint by IP or signing secret where your infrastructure supports it.

What’s Next?

Templates

Configure callback_url and callback_events as part of a reusable template.

API Reference

Full agent creation endpoint with all webhook options.