Web Campaigns

Configuring real-time WebRTC and WebSocket sessions for browser and app integrations.

View as Markdown

Web Campaigns allow you to embed Voice AI directly into your websites, mobile applications, or custom hardware.

Unlike Telephony campaigns (which rely on old phone networks), Web Campaigns use WebRTC or WebSockets. This results in:

  • Higher Audio Quality: HD Voice (44.1kHz) instead of phone quality (8kHz).
  • Lower Latency: Direct internet connection without carrier routing.
  • Zero Telephony Costs: No per-minute fees to Twilio/Telnyx.

Creating a Campaign

Navigate to Business Dashboard -> Routing & Campaigns -> Web Campaigns.

Configuration

  • Max Duration: Limit the session length to control compute costs.
  • Silence Detection: Configure how the agent handles user silence (usually more lenient in web sessions than phone calls).

Dynamic Variables

Define what data you expect the frontend to pass to the agent.

  • Example: If your website has a logged-in user, you can pass their name and account_id as metadata when the session starts.
  • Usage: The Agent can then greet them personally: "Welcome back, {{ name }}."

Client Integration

Once saved, the campaign generates a Web Campaign ID (e.g., camp_web_123...).

SDKs

Use this ID with our client libraries. Check the Web Widget SDK and .NET Middleware guides for implementation details.


Post-Analysis

Configure how the system analyzes the conversation after the session closes.

  1. Navigate to the Post Analysis tab.
  2. Select a Template defined in the Post Analysis Module.
  3. Context Variables: The LLM will receive the following data:
VariableTypeDescription
web_session_idStringUnique ID for the web session.
web_session_created_atDatetimeWhen the connection was established.
web_session_statusStringStatus (e.g., completed).
web_session_web_campaign_idStringThe Campaign ID.
web_session_client_identifierStringThe unique user ID passed from the frontend.
web_session_dynamic_variablesObjectJSON of variables passed from frontend.
web_session_metadataObjectJSON of metadata passed from frontend.
conversation_idStringUnique UUID for the conversation logic.
conversation_start_timeDatetimeStart of audio stream.
conversation_end_timeDatetimeEnd of audio stream.
conversation_end_typeStringagent_hangup, user_hangup, timeout.
conversation_turnsObjectRaw JSON array of speaker turns.
conversation_turns_simplifiedStringHuman-readable transcript.

Actions (Webhooks)

Sync digital conversation events to your backend.

Configuration

  1. Create a Custom Tool first.
  2. Select that tool in the Action dropdown.
  3. Map the Available Variables (below) to the Tool's Input Schema.

1. On Conversation Initiation Failure

Triggered if the connection is rejected (e.g., Invalid Token, Geo-blocked, or Concurrency Limit reached).

VariableTypeDescription
web_session_idStringUnique ID for the attempted session.
web_session_created_atDatetimeTime of attempt.
web_session_statusStringfailed.
web_session_web_campaign_idStringThe Campaign ID.
web_session_client_identifierStringThe unique user ID passed.
web_session_dynamic_variablesObjectJSON variables.
web_session_metadataObjectJSON metadata.
web_session_initiation_errorStringError details (e.g., concurrency_limit).

2. On Conversation Initiated

Triggered when the WebSocket/WebRTC connection is established and audio is ready.

VariableTypeDescription
web_session_idStringUnique ID for the active session.
web_session_created_atDatetimeConnection time.
web_session_statusStringactive.
web_session_web_campaign_idStringThe Campaign ID.
web_session_client_identifierStringThe unique user ID passed.
web_session_dynamic_variablesObjectJSON variables.
web_session_metadataObjectJSON metadata.
conversation_idStringUnique UUID for the conversation logic.
conversation_start_timeDatetimeStart of audio stream.

3. On Conversation Ended

Triggered when the user closes the tab or clicks "End Call".

VariableTypeDescription
web_session_idStringUnique ID for the session.
web_session_created_atDatetimeConnection time.
web_session_statusStringcompleted.
web_session_web_campaign_idStringThe Campaign ID.
web_session_client_identifierStringThe unique user ID passed.
web_session_dynamic_variablesObjectJSON variables.
web_session_metadataObjectJSON metadata.
conversation_idStringUnique UUID for the conversation logic.
conversation_start_timeDatetimeStart of audio stream.
conversation_end_typeStringReason for termination.
conversation_end_timeDatetimeEnd of audio stream.
conversation_turnsObjectRaw JSON array of speaker turns.
conversation_turns_simplifiedStringHuman-readable transcript.

On this page