Pular para o conteúdo principal
POST
/
api
/
v1
/
agents
/
{agent_id}
/
webhooks
curl -X POST \
  'https://app.talkover.ai/api/v1/agents/9fbef0b7-8d4e-4a08-9207-66c22155721d/webhooks' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "My Webhook",
    "webhook_url": "https://example.com/webhook",
    "webhook_secret": "optional_secret_for_hmac",
    "events": ["event_phone_call_started", "event_phone_call_ended"],
    "timeout": 30,
    "max_retries": 3,
    "enabled": true
  }'
{
  "success": true,
  "message": "Webhook created successfully",
  "data": {
    "id": "9fcafbf2-7593-44d6-8cd7-1b221beba62a",
    "agent_id": "9fbef0b7-8d4e-4a08-9207-66c22155721d",
    "name": "My Webhook",
    "webhook_url": "https://example.com/webhook",
    "events": ["event_phone_call_started", "event_phone_call_ended"],
    "timeout": 30,
    "max_retries": 3,
    "enabled": true,
    "created_at": "2025-09-03T23:19:51.000000Z",
    "updated_at": "2025-09-03T23:19:51.000000Z",
    "events_count": 2,
    "status": "active"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.talkover.ai/llms.txt

Use this file to discover all available pages before exploring further.

Visão Geral

Cria uma nova configuração de webhook para um agente. Webhooks permitem receber notificações em tempo real quando eventos específicos ocorrem durante as chamadas.

Endpoint

agent_id
string
obrigatório
UUID do agente

Requisição

curl -X POST \
  'https://app.talkover.ai/api/v1/agents/9fbef0b7-8d4e-4a08-9207-66c22155721d/webhooks' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "My Webhook",
    "webhook_url": "https://example.com/webhook",
    "webhook_secret": "optional_secret_for_hmac",
    "events": ["event_phone_call_started", "event_phone_call_ended"],
    "timeout": 30,
    "max_retries": 3,
    "enabled": true
  }'

Resposta

success
boolean
Indica se o webhook foi criado com sucesso
message
string
Mensagem de sucesso
data
object
Objeto do webhook criado
data.id
string
Identificador único do webhook
data.agent_id
string
UUID do agente ao qual este webhook pertence
data.name
string
Nome do webhook
data.webhook_url
string
URL do webhook
data.events
array
Array de tipos de evento configurados
data.timeout
integer
Timeout da requisição em segundos
data.max_retries
integer
Tentativas máximas de retry
data.enabled
boolean
Se o webhook está ativo
data.created_at
string
Timestamp ISO 8601 quando o webhook foi criado
data.updated_at
string
Timestamp ISO 8601 quando o webhook foi atualizado pela última vez
data.events_count
integer
Número de eventos configurados para este webhook
data.status
string
Status atual do webhook
{
  "success": true,
  "message": "Webhook created successfully",
  "data": {
    "id": "9fcafbf2-7593-44d6-8cd7-1b221beba62a",
    "agent_id": "9fbef0b7-8d4e-4a08-9207-66c22155721d",
    "name": "My Webhook",
    "webhook_url": "https://example.com/webhook",
    "events": ["event_phone_call_started", "event_phone_call_ended"],
    "timeout": 30,
    "max_retries": 3,
    "enabled": true,
    "created_at": "2025-09-03T23:19:51.000000Z",
    "updated_at": "2025-09-03T23:19:51.000000Z",
    "events_count": 2,
    "status": "active"
  }
}

Respostas de Erro

{
  "message": "Missing Bearer Token"
}
{
  "success": false,
  "message": "Agent not found in this environment."
}
{
  "message": "The given data was invalid.",
  "errors": {
    "webhook_url": ["The webhook url field is required."],
    "events": ["The events field must contain at least 1 items."]
  }
}

Regras de Validação

  • name: Obrigatório, string, máximo de 255 caracteres
  • webhook_url: Obrigatório, URL válida, máximo de 500 caracteres
  • webhook_secret: Opcional, string, máximo de 255 caracteres
  • events: Obrigatório, array com mínimo de 1 evento, cada evento deve estar na lista de eventos disponíveis
  • timeout: Opcional, inteiro entre 5-120 segundos (padrão: 30)
  • max_retries: Opcional, inteiro entre 0-10 (padrão: 3)
  • enabled: Opcional, booleano (padrão: true)

Observações Importantes

  • Operações de webhook limpam automaticamente o cache do agente para efeito imediato
  • Use endpoints HTTPS para URLs de webhook em produção
  • Implemente verificação adequada de assinatura usando o webhook secret para segurança
  • Teste seu endpoint de webhook antes de entrar em produção usando o endpoint de teste

Endpoints Relacionados