Webhooks
Millis AI Webhooks Documentation
Millis AI offers two primary webhooks for enhancing and customizing your voice agent interactions. These webhooks allow you to integrate external systems and processes seamlessly with your Millis AI implementation.
Prefetch Data Webhook
The Prefetch Data Webhook allows you to provide the voice agent with necessary data before the conversation starts. This can help personalize interactions and improve the efficiency of your voice agent.
How It Works
- Webhook Invocation: The webhook is invoked before the conversation begins.
- Data Retrieval: Your server retrieves and processes the required data.
- Response to Millis AI: The retrieved data is sent back to Millis AI, where it can be used during the conversation.
Parameters
The following parameters will be forwarded to the webhook:
agent_id
: The ID of the agent handling the conversation.session_id
: The ID of the session.from
(optional): The agent’s associated phone number, included only if the conversation is through a phone call.to
(optional): The receiver’s phone number, included only if the conversation is through a phone call.- Any key-value data that you added to the call’s metadata (via the outbound API or Web SDK)
Implementation Steps
- Setup the Webhook Endpoint: Create a GET HTTP endpoint on your server that will handle the webhook requests.
- Configure Millis AI:
- In your Millis AI dashboard under Webhook setting, configure the webhook URL to point to your endpoint.
- If you use Web SDK or APIs, set the webhook URL to parameter
extra_prompt_webhook
in Agent Config.
- Data Handling: Ensure your endpoint can handle the incoming request, process it, and return the necessary data.
Request Example
Given you start a call with metadata: {name: "John"}
, Millis AI will send a GET request to your webhook URL with the following parameters:
Response Example
Your server should respond with a JSON object containing the data to be prefetched. For example:
End of Call Webhook
The End of Call Webhook is triggered when a call or conversation ends. It allows you to log conversation details and cost breakdown on your side.
How It Works
- Webhook Invocation: The webhook is invoked after the conversation ends.
- Data Logging: Your server receives the conversation details and can log or process this data.
Parameters
The End-of-Call Webhook will be triggered as a POST request with the following body:
Implementation Steps
- Setup the Webhook Endpoint: Create an endpoint on your server to handle the webhook requests.
- Configure Millis AI:
- In your Millis AI dashboard under Webhook setting, configure the webhook URL to point to your endpoint.
- If you use Web SDK or APIs, set the webhook URL to parameter
session_data_webhook
in Agent Config.
- Data Handling: Ensure your endpoint can handle the incoming request, process the data, and perform necessary actions.
Request Example
Millis AI will send a POST request to your webhook URL with the following structure: