# Best Practices

## Retry Behavior

Your endpoint must respond with an HTTP `2XX` status code to acknowledge successful receipt.

- **Failed delivery**: If your endpoint returns a non-2XX status or times out, Aktify will retry
- **Retry limit**: After **5 failed attempts**, the webhook is marked as "broken"
- **Broken webhooks**: No further events will be sent until the webhook is reconfigured

To fix a broken webhook, reconfigure it through the Aktify Portal.

## Testing Your Webhook

Once your webhook is configured:

1. Trigger the relevant event (e.g., interact with WebChat and submit a contact form, or add a number to the DNC list)
2. Within seconds, your webhook URL should receive a POST request
3. Verify the `aktify-signature` header matches your computed signature
4. Check that the payload contains the expected data
5. If you configured custom data for WebChat, verify it appears in the `customData` field

## Recommendations

1. **Respond quickly** — Return `200 OK` immediately, then process the event asynchronously
2. **Always verify signatures** — Confirm requests are from Aktify using the `aktify-signature` header
3. **Handle duplicates** — Your endpoint should be idempotent; you may occasionally receive the same event more than once
4. **Use HTTPS** — Webhook URLs must use HTTPS for security
5. **Log failures** — Track any processing errors so you can diagnose issues before your webhook is marked as broken
