Webhook Payload Örnekleri

Her webhook olayı için detaylı payload örnekleri ve açıklamaları

Genel Bakış

Bu sayfada, Wespoke webhook'larının gönderdiği tüm payload yapılarının detaylı örneklerini bulabilirsiniz. Her örnek, olayın tetiklenme koşullarını ve döndürülen verileri içerir.

call.started

Bir asistan araması başlatıldığında tetiklenir.

call.started Payload
{
  "event": "call.started",
  "timestamp": "2025-10-08T12:34:56.789Z",
  "data": {
    "id": "call_abc123xyz",
    "assistantId": "asst_def456uvw",
    "assistantName": "Müşteri Destek Asistanı",
    "phoneNumberId": "phone_ghi789rst",
    "phoneNumber": "+905551234567",
    "direction": "inbound",
    "from": "+905559876543",
    "to": "+905551234567",
    "status": "in-progress",
    "startedAt": "2025-10-08T12:34:56.789Z",
    "metadata": {
      "callerId": "customer_123",
      "source": "mobile"
    }
  },
  "webhookId": "webhook_123abc",
  "attemptNumber": 1
}

call.ended

Bir asistan araması sonlandırıldığında tetiklenir.

call.ended Payload
{
  "event": "call.ended",
  "timestamp": "2025-10-08T12:38:23.456Z",
  "data": {
    "id": "call_abc123xyz",
    "assistantId": "asst_def456uvw",
    "assistantName": "Müşteri Destek Asistanı",
    "phoneNumberId": "phone_ghi789rst",
    "phoneNumber": "+905551234567",
    "direction": "inbound",
    "from": "+905559876543",
    "to": "+905551234567",
    "status": "completed",
    "startedAt": "2025-10-08T12:34:56.789Z",
    "endedAt": "2025-10-08T12:38:23.456Z",
    "duration": 206,
    "endReason": "customer-hangup",
    "cost": {
      "total": 0.85,
      "currency": "USD",
      "breakdown": {
        "transcription": 0.15,
        "llm": 0.35,
        "tts": 0.25,
        "livekit": 0.10
      }
    },
    "summary": {
      "totalMessages": 12,
      "userMessages": 6,
      "assistantMessages": 6,
      "toolsExecuted": 2,
      "interrupted": 1
    },
    "metadata": {
      "callerId": "customer_123",
      "source": "mobile"
    }
  },
  "webhookId": "webhook_123abc",
  "attemptNumber": 1
}

call.failed

Bir arama başarısız olduğunda tetiklenir.

call.failed Payload
{
  "event": "call.failed",
  "timestamp": "2025-10-08T12:35:30.123Z",
  "data": {
    "id": "call_xyz789abc",
    "assistantId": "asst_def456uvw",
    "assistantName": "Müşteri Destek Asistanı",
    "phoneNumberId": "phone_ghi789rst",
    "phoneNumber": "+905551234567",
    "direction": "inbound",
    "from": "+905559876543",
    "to": "+905551234567",
    "status": "failed",
    "startedAt": "2025-10-08T12:35:10.000Z",
    "endedAt": "2025-10-08T12:35:30.123Z",
    "duration": 20,
    "error": {
      "code": "ASSISTANT_ERROR",
      "message": "Assistant configuration error: Missing API key",
      "details": {
        "component": "llm",
        "provider": "openrouter"
      }
    },
    "metadata": {
      "callerId": "customer_456",
      "source": "web"
    }
  },
  "webhookId": "webhook_123abc",
  "attemptNumber": 1
}

tool.executed

Bir araç başarıyla çalıştırıldığında tetiklenir.

tool.executed Payload
{
  "event": "tool.executed",
  "timestamp": "2025-10-08T12:36:15.789Z",
  "data": {
    "id": "tool_exec_123xyz",
    "callId": "call_abc123xyz",
    "toolId": "tool_customer_lookup",
    "toolName": "Müşteri Bilgisi Sorgula",
    "toolType": "api_request",
    "executedAt": "2025-10-08T12:36:15.789Z",
    "duration": 234,
    "input": {
      "customerId": "customer_123",
      "fields": ["name", "email", "orderHistory"]
    },
    "output": {
      "success": true,
      "data": {
        "name": "Ahmet Yılmaz",
        "email": "ahmet@example.com",
        "orderHistory": [
          {
            "orderId": "order_789",
            "date": "2025-09-15",
            "total": 150.00
          }
        ]
      }
    },
    "status": "success"
  },
  "webhookId": "webhook_123abc",
  "attemptNumber": 1
}

tool.failed

Bir araç çalıştırması başarısız olduğunda tetiklenir.

tool.failed Payload
{
  "event": "tool.failed",
  "timestamp": "2025-10-08T12:37:45.234Z",
  "data": {
    "id": "tool_exec_456abc",
    "callId": "call_abc123xyz",
    "toolId": "tool_database_query",
    "toolName": "Veritabanı Sorgula",
    "toolType": "database_query",
    "executedAt": "2025-10-08T12:37:45.000Z",
    "duration": 234,
    "input": {
      "query": "SELECT * FROM customers WHERE id = ?",
      "params": [999]
    },
    "error": {
      "code": "DATABASE_ERROR",
      "message": "Connection timeout",
      "details": {
        "timeout": 5000,
        "host": "db.example.com"
      }
    },
    "status": "failed"
  },
  "webhookId": "webhook_123abc",
  "attemptNumber": 1
}

assistant.updated

Bir asistan yapılandırması güncellendiğinde tetiklenir.

assistant.updated Payload
{
  "event": "assistant.updated",
  "timestamp": "2025-10-08T14:20:30.456Z",
  "data": {
    "id": "asst_def456uvw",
    "name": "Müşteri Destek Asistanı",
    "description": "7/24 müşteri destek hizmeti sunar",
    "model": "gpt-4-turbo",
    "voice": "elevenlabs-turkish-female",
    "systemPrompt": "Sen yardımsever bir müşteri destek asistanısın...",
    "tools": [
      {
        "id": "tool_customer_lookup",
        "name": "Müşteri Bilgisi Sorgula",
        "enabled": true
      },
      {
        "id": "tool_create_ticket",
        "name": "Destek Talebi Oluştur",
        "enabled": true
      }
    ],
    "settings": {
      "temperature": 0.7,
      "maxDuration": 600,
      "voicemail": {
        "enabled": true,
        "message": "Lütfen mesaj bırakın..."
      }
    },
    "updatedAt": "2025-10-08T14:20:30.456Z",
    "updatedBy": {
      "userId": "user_789",
      "email": "admin@example.com"
    }
  },
  "webhookId": "webhook_123abc",
  "attemptNumber": 1
}

Ortak Alanlar

Tüm webhook payload'ları aşağıdaki ortak alanları içerir:

event

Webhook olayının türü (örn: "call.started", "tool.executed")

timestamp

Olayın gerçekleştiği zaman (ISO 8601 formatında)

data

Olaya özgü veri nesnesi (her olay türü için farklıdır)

webhookId

Webhook yapılandırmasının benzersiz kimliği

attemptNumber

Bu webhook gönderimi için deneme numarası (1-5 arası)

Yanıt Gereksinimleri

Webhook endpoint'iniz aşağıdaki gereksinimleri karşılamalıdır:

  • 5 saniye içinde yanıt vermeli
  • 2xx HTTP durum kodu döndürmeli (200, 201, 204, vb.)
  • Yanıt gövdesi isteğe bağlıdır (göz ardı edilir)
  • İmza doğrulaması başarısız olursa 401 döndürmeli
Örnek Başarılı Yanıt
HTTP/1.1 200 OK
Content-Type: application/json

{
  "received": true
}

Test Etme

Webhook entegrasyonunuzu test etmek için kontrol panelinde bulunan webhook test aracını kullanabilirsiniz. Bu araç, gerçek webhook payload'larını simüle eder ve endpoint'inizin doğru yanıt verdiğini doğrular.

Webhook Test Aracına Git