Webhook 通知

配置一個 webhook URL,以便在渲染完成(成功或失敗)時自動接收 POST 回調。您可以在渲染控制台中或以編程方式設置 URL。

設置或更新 Webhook URL

set-webhook.sh
curl -X POST https://render-api.chillin.online/user/webhook \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"url": "https://your-domain.com/webhook"}'

觸發測試交付

test-webhook.sh
curl -X POST https://render-api.chillin.online/user/webhook/test \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"url": "https://your-domain.com/webhook"}'

Webhook 負載

webhook_payload.json
{
"render_id": 123,
"user_id": 456,
"status": "success",
"video_url": "https://cloud.chillin.online/video_xxx.mp4",
"json_url": "https://cloud.chillin.online/project_xxx.json",
"error_message": "",
"error_log_url": "",
"cost": 0.05,
"duration": 10.5,
"finished_at": "2024-01-01T12:00:00Z"
}
  • 回調是一個 JSON POST 請求,在渲染完成後立即發送。
  • 在 5 秒內回應;超時不會重試。
  • 使用 status 欄位(successfailed)以及 error_message/error_log_url 來優雅地處理失敗。