Webhooks

Webhook digunakan untuk batch / long-running jobs (mis. batch TTS > 100 item). Untuk request normal, gunakan response sinkron.

Konfigurasi

Dashboard → Settings → Webhooks → tambahkan URL HTTPS.

Format payload

POST /your/webhook HTTP/1.1
Content-Type: application/json
X-Vonip-Signature: t=1715,v1=abcd…
{
  "event": "audio.ready",
  "data": {
    "id": "01h…",
    "kind": "tts",
    "audio_url": "https://cdn.vonip.ai/tts/abc.mp3",
    "voice": "anime_voice",
    "created_at": "2026-05-14T07:01:23Z"
  }
}

Daftar event

Event Kapan dipicu
audio.ready Audio batch selesai dibuat.
audio.failed Job gagal setelah retry.
key.revoked API key dicabut.

Verifikasi tanda tangan

import crypto from "crypto";

function verify(sig: string, body: string, secret: string): boolean {
  const [, t, v1] = sig.match(/t=(\d+),v1=(.+)/) || [];
  const expected = crypto.createHmac("sha256", secret).update(`${t}.${body}`).digest("hex");
  return v1 === expected;
}

Retry

Vonip retry 5x dengan backoff 30s → 5m → 30m → 2h → 6h.