Webhooks
A webhook is an address of yours that the server calls when something happens, so your application does not have to keep asking.
Add one
In the dashboard, an owner, admin or developer opens Webhooks, enters the address and picks the events. The address must use https and be reachable from the internet.
The signing secret is shown once, when the webhook is created. Store it with your other secrets. You need it to check each request.
Events
| Event | Sent when |
|---|---|
sms.queued | A message entered the queue |
sms.assigned | A message was handed to a phone |
sms.sent | The mobile network accepted a message |
sms.delivered | The network reported the message delivered |
sms.delivery_failed | The network reported it could not be delivered |
sms.failed | A message was not sent, and will not be tried again by the server |
device.online | A phone came online |
device.offline | A phone stopped reporting in |
incoming_sms.received | One of your SIM cards received a message |
Most applications need sms.delivered and sms.failed, and incoming_sms.received if they handle replies.
What you receive
A POST with a JSON body:
{
"eventId": "5b0f6a7b-8c90-4e2a-9c31-8f2a1c0e4b7d",
"event": "sms.delivered",
"createdAt": "2026-12-01T08:30:14Z",
"data": {
"messageId": "8f2a1c0e-4b7d-4e2a-9c31-5d0f6a7b8c90",
"recipient": "+250788123456",
"status": "DELIVERED",
"reference": "ORDER-10001",
"description": "Delivery confirmed by the mobile network"
}
}data depends on the event:
| Events | Fields in data |
|---|---|
sms.* | messageId, recipient, status, reference, description |
device.* | deviceId, deviceName, status |
incoming_sms.received | incomingSmsId, deviceId, sender, message, receivedAt |
And these headers:
| Header | Value |
|---|---|
X-YourSMS-Event | The event name |
X-YourSMS-Delivery | An identifier of this delivery |
X-YourSMS-Signature | t=<unix seconds>,v1=<signature> |
Answer quickly
Answer with any 2xx status within 10 seconds. Do slow work after answering.
Anything else counts as a failure, and the server tries again after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours. After that it gives up on that event. The Deliveries list on the Webhooks page shows recent attempts and their answers.
Expect repeats
A retried delivery carries the same eventId as the first attempt. Your answer may have been lost on the way, so the same event can arrive twice. Remember the eventIds you have handled and ignore repeats.
Events can also arrive out of order. Trust the status in the newest event by createdAt, or read the message.
Check the signature
Anyone who learns your address can post to it. The signature proves a request came from your server.
- Take
tandv1from theX-YourSMS-Signatureheader. - Compute HMAC-SHA256 of the text
<t>.<raw request body>with your signing secret as the key, written as lower-case hexadecimal. - Compare it with
v1, using a comparison that takes the same time whatever the input. - Refuse the request if
tis more than five minutes old.
Use the body exactly as it arrived. Parsing the JSON and writing it out again changes the bytes, and the signature no longer matches.
import crypto from 'node:crypto'
import express from 'express'
const app = express()
const secret = process.env.YOURSMS_WEBHOOK_SECRET
// express.raw keeps the body as the bytes that were signed.
app.post('/hooks/sms', express.raw({ type: 'application/json' }), (req, res) => {
const header = req.get('X-YourSMS-Signature') ?? ''
const { t, v1 } = Object.fromEntries(header.split(',').map((part) => part.split('=')))
const expected = crypto.createHmac('sha256', secret).update(`${t}.${req.body}`).digest('hex')
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300
const genuine =
v1?.length === expected.length && crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected))
if (!fresh || !genuine) return res.sendStatus(400)
const event = JSON.parse(req.body)
// Hand the event to your own code here, then answer.
res.sendStatus(204)
})import hashlib
import hmac
import os
import time
from flask import Flask, request
app = Flask(__name__)
secret = os.environ["YOURSMS_WEBHOOK_SECRET"].encode()
@app.post("/hooks/sms")
def sms_hook():
header = request.headers.get("X-YourSMS-Signature", "")
parts = dict(part.split("=", 1) for part in header.split(",") if "=" in part)
timestamp, signature = parts.get("t", ""), parts.get("v1", "")
# request.get_data() is the body as the bytes that were signed.
signed = timestamp.encode() + b"." + request.get_data()
expected = hmac.new(secret, signed, hashlib.sha256).hexdigest()
fresh = timestamp.isdigit() and abs(time.time() - int(timestamp)) < 300
if not fresh or not hmac.compare_digest(signature, expected):
return "", 400
event = request.get_json()
# Hand the event to your own code here, then answer.
return "", 204Turn one off
On the Webhooks page, Turn off stops deliveries without losing the webhook, and Delete removes it.
