Agent configuration endpoint
The agent configuration endpoint lets you dynamically configure a conversation at the moment it
starts. When an agent has a configuration_endpoint set, Phonic sends a POST request to your
URL at the start of every conversation, and your endpoint returns configuration overrides for that
specific conversation.
This is primarily useful for inbound calls — for example, your endpoint can look up the inbound caller in your CRM and populate the welcome message with the caller’s information.
Setup
Add a configuration_endpoint to your agent (via the dashboard or the
Update Agent endpoint):
Request payload
Phonic sends a JSON body with the following fields:
The project the conversation belongs to. Contains name (string).
A subset of the Agent for this conversation. Contains name,
welcome_message, system_prompt, tools (tool names as strings), and boosted_keywords.
Unique ID for the conversation.
Caller’s phone number in E.164 format. Present for inbound phone calls.
Phone number that was called in E.164 format. Present for inbound phone calls.
Present when using SIP trunking with a custom phone number — the Twilio Call SID in your Twilio environment.
Response payload
Your endpoint returns a JSON object. Every field is optional — any field you return
overrides the agent’s configured value for that conversation, and any field you omit falls back to
the agent’s default. Return {} to make no changes.
The response accepts the same configuration fields as the Create Agent endpoint — see it for descriptions of each field. The most commonly used fields are:
Message to play when the conversation starts. Can contain template variables. Ignored when
generate_welcome_message is true.
Instructions for the conversation. Can contain template variables.
Key-value pairs of template variables used in the welcome message and system prompt.
The voice ID to use for the agent.
Built-in or custom tool names to make available to the assistant.
ISO 639-1 language code that sets the agent’s default language.
Additional ISO 639-1 language codes the agent should recognize and speak.
Arbitrary key-value metadata to associate with the conversation.
The following fields are not accepted in the response, since they don’t apply once a
conversation is starting: agent, project, outbound_number_pool, and configuration_endpoint.
Example usage
Here’s an example of how to implement the endpoint: