AI Webhooks
AI SWAIG tool webhook
Sent to a tool's web_hook_url (or the SWAIG defaults.web_hook_url) when an ai agent calls one of your functions.
Your endpoint runs the function and replies with a JSON object — the same shape a data_map output produces, because the platform reads both the same way. Every field is optional, so {} is a valid reply and a handler that only steers the call can return action alone:
- response — the result the agent reads next, written to the AI rather than spoken to the caller. A plain string becomes the tool message as-is; the object form {tool_result, tool_prompt} splits the data half from the steering half. Omit it and the agent reads a default result.
- action — a single action object or an array of them, executed on the live call.
- post_process — hold the actions until after the agent has spoken. Default: false.
postWebhookaiSwaigToolWebhook
Payload
Example payload
{
"function": "get_weather",
"argument": {
"parsed": [
{
"city": "San Francisco"
}
],
"raw": "{\"city\":\"San Francisco\"}"
},
"argument_desc": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "Name of the city"
}
},
"required": [
"city"
]
},
"description": "Look up the current weather for a city.",
"call_id": "2e1e66e5-5d07-413d-9668-55542992eec0",
"ai_session_id": "a0d4e6e5-5d07-413d-9668-55542992eec0",
"app_name": "ai",
"global_data": {
"customer_tier": "premium",
"pickup_address": "123 Main St, Springfield"
},
"meta_data_token": "my-token",
"meta_data": {
"order_number": "12345"
},
"caller_id_name": "Jane Doe",
"caller_id_num": "+15555550100",
"channel_active": true,
"channel_offhook": true,
"channel_ready": true,
"content_type": "text/swaig",
"version": "2.0",
"content_disposition": "SWAIG Function",
"conversation_type": "voice",
"project_id": "4d0d6f16-5881-4fcc-92a4-02c51a91954d",
"space_id": "451ed9ff-e568-4222-8af9-4f9ab7428d09",
"call_log": [
{
"role": "assistant",
"content": "Your ride is booked for 6pm.",
"timestamp": 1694541297950440
}
],
"raw_call_log": [
{
"role": "assistant",
"content": "Your ride is booked for 6pm.",
"timestamp": 1694541297950440
}
]
}Response
Webhook received