Skip to main content
POST
/
api
/
agents
/
{agentId}
/
tools
/
post-call-webhook
/
assign
curl -X POST "https://api.zudu.ai/api/agents/agent_1234567890abcdef/tools/post-call-webhook/assign" \
  -H "X-API-KEY: sk_Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234Yz" \
  -H "X-API-SECRET: s3cr3t_Xyz789Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234" \
  -d '{
    "webhook_id": "webhook_abc123def456"
  }'
{
  "message": "Post-call webhook assigned successfully",
  "status": "success",
  "error": null,
  "data": {
    "agent_id": "agent_1234567890abcdef",
    "webhook_id": "webhook_abc123def456",
    "webhook_name": "Call Analytics Webhook",
    "webhook_url": "https://your-server.com/webhooks/call-complete",
    "webhook_tool": {
      "name": "Call Analytics Webhook",
      "url": "https://your-server.com/webhooks/call-complete",
      "description": "Receives call data after completion",
      "trigger": "post_call"
    },
    "total_tools": 3
  }
Assign an existing post-call webhook to an agent. When a call completes for that agent, the webhook will be triggered with call data, transcripts, and analysis results.
curl -X POST "https://api.zudu.ai/api/agents/agent_1234567890abcdef/tools/post-call-webhook/assign" \
  -H "X-API-KEY: sk_Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234Yz" \
  -H "X-API-SECRET: s3cr3t_Xyz789Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234" \
  -d '{
    "webhook_id": "webhook_abc123def456"
  }'
{
  "message": "Post-call webhook assigned successfully",
  "status": "success",
  "error": null,
  "data": {
    "agent_id": "agent_1234567890abcdef",
    "webhook_id": "webhook_abc123def456",
    "webhook_name": "Call Analytics Webhook",
    "webhook_url": "https://your-server.com/webhooks/call-complete",
    "webhook_tool": {
      "name": "Call Analytics Webhook",
      "url": "https://your-server.com/webhooks/call-complete",
      "description": "Receives call data after completion",
      "trigger": "post_call"
    },
    "total_tools": 3
  }

Path Parameters

agentId
string
required
The ID of the agent to assign the webhook to (format: agent_...)Example: agent_1234567890abcdefNote: The agent_ prefix is optional - it will be added automatically if not provided

Headers

X-API-KEY
string
required
Your API key (format: sk_...)
X-API-SECRET
string
required
Your API secret (format: s3cr3t_...)

Request Body

webhook_id
string
required
The ID of the webhook to assign (format: webhook_...)The webhook must:
  • Exist in your organization
  • Be active (is_active: true)
Example: "webhook_abc123def456"

Response Fields

agent_id
string
The agent ID the webhook was assigned to
webhook_id
string
The webhook ID that was assigned
webhook_name
string
The name of the assigned webhook
webhook_url
string
The URL of the assigned webhook
webhook_tool
object
The webhook tool object added to the agent’s tools listContains:
  • name: Webhook name
  • url: Webhook URL
  • description: Webhook description
  • trigger: Always "post_call" for post-call webhooks
total_tools
integer
Total number of tools the agent now has

Error Responses

error
string
Bad Request - Validation error
{
  "message": "Validation error",
  "status": "error",
  "error": "webhook_id is required"
}
Or:
{
  "message": "Webhook inactive",
  "status": "error",
  "error": "Cannot assign inactive webhook"
}
error
string
Unauthorized - Missing or invalid API key/secret
error
string
Not Found - Agent or webhook does not exist
{
  "message": "Agent not found",
  "status": "error",
  "error": "Agent not found in organization"
}
Or:
{
  "message": "Webhook not found",
  "status": "error",
  "error": "Webhook not found in organization"
}
error
string
Internal Server Error - Failed to assign webhook
{
  "message": "Failed to assign webhook",
  "status": "error",
  "error": "Database connection failed"
}

Notes

  • Only active webhooks can be assigned to agents
  • An agent can have only one post-call webhook at a time (assigning a new one will replace the existing one)
  • The webhook must belong to the same organization as the agent
  • The webhook tool is automatically added to the agent’s tools list for backward compatibility
  • Any existing post-call webhook tools are automatically removed before adding the new one
  • The webhook will be triggered automatically after each call completes for this agent