Webhooks
How Wire2Air calls your server when a message arrives or a delivery report comes in, and how to build a receiver that is safe to expose.
A webhook is a URL on your server that Wire2Air calls. Wire2Air sends three kinds:
| Webhook | When | Page |
|---|---|---|
| Inbound SMS | Someone texts your short code | Inbound SMS |
| Inbound SMS and MMS | Someone sends a message, including picture messages, to your short code | Inbound SMS and MMS |
| Delivery report | A sent message's status changes | Delivery reports |
All three are plain HTTP GET requests with the data in the query string.
Registering your URL
The documentation names three places a callback URL is set:
ProcessorURLon a Developer API campaign or a registered keyword: where that keyword's incoming messages go.Replypath(REST) orReplyPath(HTTP API) on a send request: where replies to that message go. The HTTP API docs say this is available "case by case", with the advanced developer API only.- Delivery reports need an Advanced Developer API account, according to the HTTP API send page.
Build a safe receiver
Until those answers are published, build every receiver like this:
- Answer quickly with
200. Store the request and process it afterwards, so a slow database does not cause a timeout. - Expect duplicates. Make processing idempotent, for example by remembering the message ID or the
smsoutboxidyou have already handled. - Validate every value. Treat each parameter as untrusted input; never put it into SQL or HTML unescaped.
- Use a URL that is hard to guess, for example one with a long random path segment, and change it if it leaks. Because requests are not signed, the URL is the only secret.
- Prefer an
https://URL if your account accepts one, so message content is encrypted on the way to you.

