Webhook 通知

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

設置或更新 Webhook URL

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

觸發測試交付

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

Webhook 負載

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