Webhook Tools
When a Webhook tool (custom_webhook) is called, Phonic makes an HTTP request to the endpoint you configured. Webhook tools work whether you run a conversation via Webhook or via WebSocket.
See Tool Definition for the shared name, description, and parameters fields, and Tool Behavior Configuration for the behavior toggles.
Endpoint
In the dashboard, under Endpoint you set:
- Method (
endpoint_method) —GETorPOST. - URL (
endpoint_url) — must be a publicly routable URL. - Headers (
endpoint_headers) — optional, e.g. anAuthorizationheader. - Timeout (
endpoint_timeout_ms) — default 5000 ms, between 1000 and 180000 ms.
All parameters of a GET Webhook tool go in the query string. For POST Webhook tools, each parameter has a location (request_body or query_string).
Call Context Information
When a Webhook tool is used with an Agent making calls on Phonic’s infrastructure, call context (call_info) is automatically included in the request:
conversation_id: The unique identifier for the current conversationfrom_phone_number: The caller’s phone number (when available)to_phone_number: The destination phone number (when available)
GET Webhook Request Format
For GET Webhook tools, call context and parameters are included as query string parameters:
- Tool parameters: query string parameters (e.g.,
city,temperature_unit) - Call context: individual query string parameters (
conversation_id,from_phone_number,to_phone_number)
POST Webhook Request Format
For POST Webhook tools, the request body includes a call_info object along with your tool parameters:
- Tool parameters: at the root level of the JSON body (e.g.,
city,temperature_unit) - Call context: in a nested
call_infoobject
TypeScript Interface Examples
For GET Webhooks:
For POST Webhooks: