가이드
Webhook
배치 작업 완료 알림 수신
1분 이상 걸리는 배치 작업에서는 Webhook이 폴링보다 저렴하고 빠릅니다. 작업이 종료 상태에 도달하면 Thunderbit가 당신의 URL로 POST합니다.
제출 시 설정
{
"urls": ["https://example.com/page1"],
"webhook": {
"url": "https://your-server.com/api/webhook/distill",
"secret": "whsec_your_secret_key",
"headers": { "X-Custom-Auth": "your-token" }
}
}페이로드
{
"id": "batch_abc123",
"status": "COMPLETED",
"total": 50,
"completed": 49,
"failed": 1,
"completedAt": "2026-04-26T10:00:00Z"
}페이로드는 의도적으로 작게 설계되어 있습니다 —— 콜백 수신 후 GET /batch/distill/{id}로 전체 결과를 가져오세요.
서명 검증
secret이 설정되면 모든 전송에 X-Webhook-Signature: sha256=<hex>가 포함됩니다. HMAC-SHA256으로 검증하세요.
import hmac, hashlib
def verify(raw_body: bytes, signature: str, secret: str) -> bool:
expected = "sha256=" + hmac.new(
secret.encode(), raw_body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, signature)프로덕션에서 서명 없는 Webhook을 절대 신뢰하지 마세요.
재시도 동작
- Non-2xx → 5회 재시도, 지수 백오프: 10초, 30초, 2분, 10분, 30분
- 전송당 타임아웃: 15초
- 모든 재시도가 실패해도 우리 측에서는 작업이 완료된 상태입니다 —— 당신의 endpoint는 idempotent해야 합니다
이 페이지는 디버깅 팁으로 확장 중입니다 —— 곧 다시 확인하세요.