diff --git a/docs/hub/jobs-webhooks.md b/docs/hub/jobs-webhooks.md index a1bdf31f9..04dc474b6 100644 --- a/docs/hub/jobs-webhooks.md +++ b/docs/hub/jobs-webhooks.md @@ -22,6 +22,7 @@ The webhook triggers the Job with the following environment variables: - `WEBHOOK_REPO_ID`: the repository name (e.g., `user/repo-name`) - `WEBHOOK_REPO_TYPE`: the repository type (`model`, `dataset`, or `space`) - `WEBHOOK_SECRET`: the webhook secret, if one was configured +- `WEBHOOK_ID`: a unique identifier for the delivery, stable across retries of that delivery The webhook payload contains multiple fields, here are a few useful ones: diff --git a/docs/hub/webhooks.md b/docs/hub/webhooks.md index 9e96a2c86..fa4d596f9 100644 --- a/docs/hub/webhooks.md +++ b/docs/hub/webhooks.md @@ -274,6 +274,8 @@ If you set a secret for your Webhook, it will be sent along as an `X-Webhook-Sec Webhook payloads are delivered asynchronously, shortly after the event happens on the Hub. Order is not guaranteed: if several events occur close together, they may arrive out of sequence. +Each delivery has a unique `Webhook-Id` HTTP header. Retries of a failed delivery reuse the same ID, so you can treat it as an idempotency key and process each event once. + When deliveries to a Webhook keep failing, the Webhook is automatically suspended and its owner is notified by email. You can troubleshoot it and re-enable it from your Webhooks [settings](https://huggingface.co/settings/webhooks). ## Rate limiting @@ -298,6 +300,8 @@ Here you can review the HTTP status code and the payload of the generated events Note: When changing the target URL or secret of a Webhook, replaying an event will send the payload to the updated URL. +Note: A replayed event is sent with the same `Webhook-Id` as the original delivery. + ## FAQ ##### Can I define webhooks on my organization vs my user account?