fix: prevent premature webhook auto-disable and allow re-enable (#364)

* fix: prevent premature webhook auto-disable and allow re-enable

Use persisted failure counters when deciding auto-disable status and restore dashboard re-enable flow so webhooks are not deactivated unexpectedly after reset.

* fix: count webhook failures per failed call

Only increment consecutive failure counters after a call exhausts retries, while keeping the 30-call auto-disable threshold and stale-state protection.

* fix(docs): correct webhook SDK package name (#363)

* test: isolate webhook unit suite from mailer deps

Mock limit service in webhook unit tests so Vitest does not resolve team-service and mailer paths requiring usesend-js during CI.
This commit is contained in:
KM Koushik
2026-02-28 07:40:26 +11:00
committed by GitHub
parent 1c644740f2
commit edcd32a4ea
5 changed files with 437 additions and 37 deletions
+21 -20
View File
@@ -35,20 +35,21 @@ Webhooks allow you to receive HTTP POST requests to your server when events occu
### Email events
| Event | Description |
| ------------------------ | ---------------------------------------------------- |
| `email.queued` | Email has been queued for sending |
| `email.sent` | Email has been sent to the recipient's mail server |
| `email.delivered` | Email was successfully delivered |
| `email.delivery_delayed` | Email delivery is being retried |
| `email.bounced` | Email bounced (permanent or temporary) |
| `email.rejected` | Email was rejected |
| `email.complained` | Recipient marked email as spam |
| `email.failed` | Email failed to send |
| `email.cancelled` | Scheduled email was cancelled |
| `email.suppressed` | Email was suppressed (recipient on suppression list) |
| `email.opened` | Recipient opened the email |
| `email.clicked` | Recipient clicked a link in the email |
| Event | Description |
| ------------------------- | ---------------------------------------------------- |
| `email.queued` | Email has been queued for sending |
| `email.sent` | Email has been sent to the recipient's mail server |
| `email.delivered` | Email was successfully delivered |
| `email.delivery_delayed` | Email delivery is being retried |
| `email.bounced` | Email bounced (permanent or temporary) |
| `email.rejected` | Email was rejected |
| `email.rendering_failure` | Email failed during template rendering |
| `email.complained` | Recipient marked email as spam |
| `email.failed` | Email failed to send |
| `email.cancelled` | Scheduled email was cancelled |
| `email.suppressed` | Email was suppressed (recipient on suppression list) |
| `email.opened` | Recipient opened the email |
| `email.clicked` | Recipient clicked a link in the email |
### Contact events
@@ -276,9 +277,9 @@ If your endpoint doesn't return a 2xx response, useSend will retry delivery with
After 6 failed attempts, the webhook call is marked as failed.
<Warning>
If your webhook endpoint fails 30 consecutive times across any calls, the
webhook will be automatically disabled to prevent continued failures. You can
re-enable it from the dashboard.
If your webhook endpoint fails 30 consecutive calls, the webhook will be
automatically disabled to prevent continued failures. You can re-enable it
from the dashboard.
</Warning>
## Best practices
@@ -339,9 +340,9 @@ The test event will have type `webhook.test` with the following payload:
"${timestamp}.${rawBody}")`
</Accordion>
<Accordion title="Webhook auto-disabled">
After 30 consecutive failures, webhooks are automatically disabled. Fix the
issue with your endpoint, then re-enable the webhook from the dashboard. The
failure counter resets on the next successful delivery.
After 30 consecutive failed calls, webhooks are automatically disabled. Fix
the issue with your endpoint, then re-enable the webhook from the dashboard.
The failure counter resets on the next successful delivery.
</Accordion>
</AccordionGroup>