1. Prefetch Data Webhook
Configuration Key in Agent Config:extra_prompt_webhook
The Prefetch Data Webhook is called before the conversation begins. It enables real-time customization and event notifications.
Configuration
The configuration can be provided in one of the following formats:- String: The URL of the webhook endpoint.
- Object:
Use Cases
- Call Notification: Notify your system about an incoming call by receiving a webhook event.
- Metadata Override: Dynamically override or add session metadata based on external systems.
- Extra Prompt: Provide additional context to the agent’s system prompt.
Request
- Method:
GET - Query Parameters:
session_id(string): Unique session identifier.agent_id(string): ID of the agent handling the session.from(string): Caller’s phone number (if applicable).to(string): Receiver’s phone number (if applicable).- Additional session metadata as key-value pairs (if available).
Expected Response
- Content-Type:
application/json. - Response Fields:
metadata(object): Overrides or extends the current session metadata. Existing keys are updated, and new keys are added.extra_prompt(string): Additional text appended to the agent’s system prompt.
Response Example
2. End-of-Call Webhook
Configuration Key in Agent Config:session_data_webhook
The End-of-Call Webhook is triggered after a session concludes. It provides detailed information about the session for logging, analytics, or post-call processing.
Configuration
The configuration can be provided in one of the following formats:- String: The URL of the webhook endpoint.
- Object:
Request
- Method:
POST - Payload (JSON):
chat(string): JSON string representing the chat history (user and agent messages).function_calls(array): List of external functions invoked during the session.ts(timestamp): Session start time.duration(integer): Session duration in seconds.agent_config(object): Serialized agent configuration.agent_id(string): ID of the agent managing the session.call_id(string): Unique identifier for the call session.chars_used(integer): Number of characters processed during the session.session_id(string): Unique session identifier.cost_breakdown(array): List of cost components for different services.voip(object): Telephony details.recording(object): Call recording details.metadata(object): Final metadata for the session.call_status(string): Status of the call. Possible values:user-endedapi-endedvoicemail-messagevoicemail-hangupagent-endedtimeouterrorchat_completion
error_message(string): Description of any errors encountered during the session.
Example
Request URL:Notes
- Prefetch Webhook:
- Use this webhook to notify your system about calls, adjust metadata dynamically, or provide extra prompts to enhance conversational context.
- End-of-Call Webhook:
- Designed for detailed post-call analytics and tracking.
- Ensure secure storage of sensitive information like call recordings and metadata.
- Security:
- Use HTTPS for all webhooks.
- Authenticate requests with headers or API keys as needed.