Webhook Rehberi
Webhook Nedir?
Uzun süren AI işlemlerinde sonucu beklemek yerine, işlem tamamlandığında sizin belirlediğiniz URL'ye otomatik bildirim gönderilir.
Webhook Oluşturma
Dashboard → Webhooks bölümünden yeni webhook ekleyebilirsiniz.
Webhook Payload
İşlem tamamlandığında şu formatta POST isteği gönderilir:
``json
{
"event": "request.completed",
"request_id": "req_abc123",
"tool": "clothing-changer",
"status": "success",
"data": {
"output_url": "https://cdn.aihane.com/outputs/abc123.png",
"credits_used": 3,
"processing_time_ms": 4500
},
"timestamp": "2026-03-21T15:30:00Z"
}
`
İmza Doğrulama
Her webhook isteği X-AIHane-Signature header'ı ile imzalanır:
`php
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_AIHANE_SIGNATURE'];
$expected = hash_hmac('sha256', $payload, $webhook_secret);
if (hash_equals($expected, $signature)) {
// Geçerli webhook
}
``
Hata Durumları
Webhook URL'niz 2xx yanıt dönmezse, sistem 3 kez tekrar dener (5sn, 30sn, 5dk arayla).