How Webhooks Work
Provide a callback URL
Include a
callback_url in your send request. This is the HTTPS endpoint on your server that Hany will call when an event fires.Hany sends an HTTP POST
When the event occurs (for example, a delivery confirmation arrives from the carrier), Hany sends an HTTP POST request to your
callback_url with a JSON payload describing the event.Acknowledge with HTTP 200
Your server must respond with an HTTP
200 OK status code to confirm receipt. Any response body is ignored — only the status code matters.Automatic retries on failure
If your server does not respond with
200, Hany retries the delivery on a fixed schedule — up to 3 total attempts — before marking the event as undelivered. See the Retry Policy section for the exact schedule.Registering a Webhook URL
Webhook URLs are configured per-request using thecallback_url parameter on any send endpoint. There is no separate webhook registration step — simply include your endpoint URL when you send a message.
https://yourapp.com/webhooks/hany.
Webhook Security
Keep your webhook endpoint secure and resilient by following these best practices:- Use HTTPS only. Hany will not deliver webhooks to plain HTTP endpoints. Always use a valid TLS certificate.
- Validate the payload structure. Check that the incoming payload contains the fields you expect before processing it. Reject malformed requests with a
400status. - Respond within 5 seconds. Hany waits up to 5 seconds for a response. If your handler takes longer, move heavy processing to a background job and return
200immediately. - Return HTTP 200 to acknowledge. Any status code other than
200is treated as a failure and triggers a retry. This includes2xxcodes such as201or204.
Retry Policy
When your endpoint fails to return HTTP200, Hany automatically retries the delivery on the following schedule:
| Attempt | Timing |
|---|---|
| Attempt 1 | Immediately |
| Attempt 2 | 30 seconds after Attempt 1 |
| Attempt 3 | 5 minutes after Attempt 2 |
200 reliably to avoid missed events.
Each retry sends the same payload as the original request. Design your handler to be idempotent — processing the same event more than once should not cause unintended side effects.
Supported Events
The following webhook event types are currently available:| Event | Description |
|---|---|
sms.delivered | SMS successfully delivered to the recipient |
sms.failed | SMS delivery failed after all carrier retries |
sms.sent | SMS dispatched from Hany’s gateway to the carrier network |
Delivery Status Webhook
Full payload reference for
sms.delivered, sms.failed, and sms.sent events, plus a server-side handling example.