Konfigurasi Webhook
Atur URL webhook secara programatik — sama seperti popup Configure Webhook di halaman API Keys dashboard. Autentikasi dengan API key itu sendiri — tanpa login owner. Cocok saat pihak ketiga menyimpan key lalu mendaftarkan callback-nya dalam satu langkah.
Terkait: menerima webhook
Setelah URL diset, Aksita mengirim POST balasan human agent ke URL itu. Lihat Webhook Human Agent.
Alur integrasi tipikal
- User membuat API key di dashboard Aksita (tab API Keys).
- User menempelkan key tersebut ke produk Anda.
- Backend Anda memanggil PUT /api/webhook dengan X-API-Key dan URL callback HTTPS Anda.
- Selesai — balasan human agent untuk percakapan yang memakai key itu dikirim ke webhook Anda.
Endpoint
https://api.aksita.ai/api/webhookHeader & body
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
| X-API-Key | header | Yes | API key yang webhook-nya ingin dikonfigurasi |
| webhook_url | string | Yes* | Harus diawali https://. Kirim string kosong "" untuk menonaktifkan webhook. |
| webhook_secret | string | No | Secret HMAC opsional. String kosong menghapus secret. Diverifikasi via X-Webhook-Signature saat pengiriman. |
* Field sebaiknya ada; nilai kosong menonaktifkan webhook (sama seperti mengosongkan URL di dashboard).
Contoh request
curl -X PUT https://api.aksita.ai/api/webhook \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"webhook_url": "https://your-domain.com/aksita/webhook",
"webhook_secret": "optional-hmac-secret"
}'Response sukses
{
"status": true,
"data": {
"api_key_id": "019d5da6-....",
"api_key_name": "Fonnte",
"agent_id": "019d5da6-....",
"webhook_url": "https://your-domain.com/aksita/webhook",
"webhook_secret_configured": true
},
"detail": "Webhook configured successfully"
}Nilai secret tidak pernah dikembalikan — hanya apakah secret sudah dikonfigurasi.
Response error
401
X-API-Key hilang atau tidak valid
400
webhook_url harus memakai HTTPS (http:// ditolak)
403
Agent tidak aktif
Menonaktifkan webhook: Kirim "webhook_url": "" (dan opsional "webhook_secret": "") dengan PUT yang sama.