SMSHook sends asynchronous SMS event notifications to your endpoint as application/x-www-form-urlencoded POST requests.
SMSHook
Overview
Receive asynchronous SMS event notifications from SMSHook at your webhook endpoint.
Current implementation details:
- Sends callbacks only by
POST. - Sends form fields, not a JSON request body.
- Treats HTTP status codes
200through209as success. - Ignores the response body.
- Retries failed deliveries according to the configured retry schedule.
- Currently forwards only these event types:
1,20,4,5,8.
Delivery Flow
The callback flow is:
- An SMS event occurs.
- SendCloud builds callback parameters from the internal event payload.
- SendCloud sends an
application/x-www-form-urlencodedPOSTrequest to your configured URL. - Your server parses the form fields and returns an HTTP success status.
- If the callback fails or times out, SendCloud retries according to the retry policy below.
Supported Events
SMSHook currently forwards these events:
| Event | Code | Description |
|---|---|---|
Requested | 1 | SMS request accepted |
Delivered | 20 | SMS delivered successfully |
Suppressed | 4 | SMS suppressed or blocked |
Failed | 5 | SMS delivery failed |
Template Verify | 8 | Template review result |
Delivery Format and Endpoint Requirements
Configure your endpoint to meet these requirements:
- Accept
POSTrequests. - Parse
application/x-www-form-urlencodedrequest bodies. - Return HTTP
200 OKon success. - Respond quickly.
The current implementation also applies these rules:
- The current sender implementation treats any HTTP status in the range
200-209as success. - The response body is not used by the sender.
- The sender timeout is configured by retry sequence:
- First attempt: about
5s - Second attempt: about
10s - Later attempts: up to
15s
- First attempt: about
- The current sender implementation does not include a GET probe flow.
Signature Verification
Each callback includes:
token: a random 50-character string.timestamp: the event timestamp.signature: a lowercase hex HMAC-SHA256 value.
Generate the signature with:
signature = HMAC_SHA256(appKey, timestamp + token)Use your SMSHook APP KEY / API key as appKey.
Retry Behavior
Current retry configuration:
- Initial delivery + 7 retries
- Retry intervals:
3m10m30m1h6h12h24h
Field Conventions
Use these field conventions when you parse callback data:
- All callback values are sent as form field strings.
smsIdsandphonesare JSON-array text values inside form fields.custom_argsis the actual callback field name.- Template-review fields are spelled exactly as:
verfiyResultverfiyComment
Event Reference
Event Reference
Fields marked as optional may be omitted or be empty, depending on source data.
Requested (eventType = 1)
eventType = 1)Triggered when an SMS request is accepted.
| Field | Type | Required | Notes |
|---|---|---|---|
event | string | Yes | Always Requested |
eventType | int | Yes | Always 1 |
userId | int | Yes | User ID |
timestamp | long | Yes | Event timestamp |
token | string | Yes | Random 50-character token |
signature | string | Yes | HMAC-SHA256 signature |
templateId | int | Yes | Defaults to 0 if source value is absent |
smsUser | string | No | SMS user |
msgCount | int | No | Present only when source value exists |
message | string | Yes | Defaults to request |
smsIds | string | No | JSON array text, for example ["msgid$13800000000"] |
phones | string | No | JSON array text, for example ["13800000000"] |
custom_args | string | No | JSON text or plain string |
Delivered (eventType = 20)
eventType = 20)Triggered when an SMS is delivered.
| Field | Type | Required | Notes |
|---|---|---|---|
event | string | Yes | Always Delivered |
eventType | int | Yes | Always 20 |
userId | int | Yes | User ID |
timestamp | long | Yes | Event timestamp |
token | string | Yes | Random 50-character token |
signature | string | Yes | HMAC-SHA256 signature |
templateId | int | Yes | Defaults to 0 if source value is absent |
smsUser | string | No | SMS user |
msgCount | int | No | Present only when source value exists |
phone | string | No | Recipient phone number |
smsId | string | No | SMS ID |
message | string | No | Delivery message |
receiptTime | string | Yes | Generated from timestamp, format yyyy-MM-dd HH:mm:ss |
outboundTime | string | No | Loaded from status data when available |
custom_args | string | No | JSON text or plain string |
Suppressed (eventType = 4)
eventType = 4)Triggered when an SMS is suppressed.
| Field | Type | Required | Notes |
|---|---|---|---|
event | string | Yes | Always Suppressed |
eventType | int | Yes | Always 4 |
userId | int | Yes | User ID |
timestamp | long | Yes | Event timestamp |
token | string | Yes | Random 50-character token |
signature | string | Yes | HMAC-SHA256 signature |
templateId | int | Yes | Defaults to 0 if source value is absent |
smsUser | string | No | SMS user |
msgCount | int | No | Present only when source value exists |
phone | string | No | Recipient phone number |
smsId | string | No | SMS ID |
statusCode | int | No | May be empty if no mapping is found |
message | string | No | Suppression message |
encodeMessage | string | No | Base64-encoded message |
outboundTime | string | Yes | Generated from timestamp, format yyyy-MM-dd HH:mm:ss |
custom_args | string | No | JSON text or plain string |
Failed (eventType = 5)
eventType = 5)Triggered when SMS delivery fails.
| Field | Type | Required | Notes |
|---|---|---|---|
event | string | Yes | Always Failed |
eventType | int | Yes | Always 5 |
userId | int | Yes | User ID |
timestamp | long | Yes | Event timestamp |
token | string | Yes | Random 50-character token |
signature | string | Yes | HMAC-SHA256 signature |
templateId | int | Yes | Defaults to 0 if source value is absent |
smsUser | string | No | SMS user |
msgCount | int | No | Present only when source value exists |
phone | string | No | Recipient phone number |
smsId | string | No | SMS ID |
statusCode | int | No | May be empty if no mapping is found |
message | string | No | Failure message |
encodeMessage | string | No | Base64-encoded message |
receiptTime | string | Yes | Generated from timestamp, format yyyy-MM-dd HH:mm:ss |
outboundTime | string | No | Loaded from status data when available |
custom_args | string | No | JSON text or plain string |
Template Verify (eventType = 8)
eventType = 8)Triggered when template review finishes.
| Field | Type | Required | Notes |
|---|---|---|---|
event | string | Yes | Always Template Verify |
eventType | int | Yes | Always 8 |
userId | int | Yes | User ID |
timestamp | long | Yes | Event timestamp |
token | string | Yes | Random 50-character token |
signature | string | Yes | HMAC-SHA256 signature |
templateId | int | Yes | Template ID |
name | string | Yes | Template name |
verfiyResult | int | No | Current implementation commonly uses 0 reviewing, 1 approved, -1 rejected |
verfiyComment | string | No | Present for rejected cases when available |
Integration Notes
- Parse the callback body as form data, not JSON.
- If you need structured values from
smsIds,phones, orcustom_args, parse the field value as JSON in your application. - Use the exact callback field names shown above.
- Return
200 OKfor successful processing.
