Skip to content

Webhooks

Tested on 28 November 2026 against a local build of the current Simline API with a simulated test phone. The three receivers below (Node 22 with built-in modules only, Python 3.13 with Flask 3.1, PHP 8.3) each accepted real events and rejected a forged signature with 401.

Give Simline a URL and every new text, delivery report and phone going on or offline becomes a signed POST to it. Deliveries are retried for about 22 hours, logged, and can be replayed.

In the dashboard: Developers → Webhooks → Add endpoint. Pick the events (default: all) and the phones (default: every phone, including ones you pair later).

Or with an API key that has both the send and read scopes:

Terminal window
curl https://api.simline.dev/v1/webhooks \
-H "Authorization: Bearer $SIMLINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/simline/hook", "events": ["message.received", "message.failed"]}'

The answer includes secret (whsec_…). It’s shown once: store it with your app’s other secrets.

  • https:// only, on a public host: no IP addresses, no localhost, no internal names (.local, .internal, single-label hosts). Simline also checks the address the host resolves to, at save time and before every attempt, and never calls private, loopback or reserved addresses.
  • Up to 20 endpoints per workspace.
  • deviceIds limits an endpoint to events from some phones.
Event When
message.received A new text arrived on one of your phones.
message.sent Every part of an outbound text left the phone.
message.delivered The carrier confirmed delivery of every part.
message.failed An outbound text failed; data.errorCode says why.
device.online A phone connected for the first time, or came back after being reported offline.
device.offline A phone became unreachable (it didn’t answer a wake-up within 5 minutes, or missed two check-ins in a row), or was unpaired.
webhook.test Only from the Send test event button or POST /v1/webhooks/{id}/test.

There’s one event per message, attempt and state: a text that fails and then succeeds on a second attempt gives you both. A phone that merely sleeps (Android paused the app, but Simline can wake it) sends nothing; see Phone reliability.

POST /simline/hook HTTP/1.1
Content-Type: application/json
Simline-Event-Id: evt_cbb3ca99be3d5358e027f561a3c72896
Simline-Event-Type: message.received
Simline-Delivery-Id: whd_AuER0XoaWoMaTw3bPa7KoQ
Simline-Attempt: 1
Simline-Signature: t=1795857276,v1=5f2c…
{
"id": "evt_cbb3ca99be3d5358e027f561a3c72896",
"type": "message.received",
"createdAt": "2026-11-28T09:14:36.438Z",
"data": {
"id": "msg_74e559d6d3b39531c3b4e054955a8461",
"direction": "inbound",
"status": "received",
"finalStatus": true,
"channel": "sms",
"contact": "+33600000042",
"body": "Bonjour, est-ce que la tarte aux pommes est prête ?",
"deviceId": "dev_local",
"simSlot": 1,
"parts": null,
"attempt": 1,
"errorCode": null,
"idempotencyKey": null,
"apiKeyId": null,
"userId": null,
"agentId": null,
"createdAt": "2026-11-28T09:14:35.414Z",
"updatedAt": "2026-11-28T09:14:36.438Z",
"sentAt": null,
"deliveredAt": null,
"readAt": null
}
}

For message.* events, data is the message as GET /v1/messages/{id} returns it (without events) at the time of the event. For device.* events it’s smaller:

{"deviceId": "dev_local", "name": "Pixel 8", "status": "offline", "presence": "unreachable", "at": "2026-11-28T09:44:39.415Z"}

presence is connected for online, and unreachable or unpaired for offline. The body is frozen per event, so retries and replays send identical bytes.

Simline-Signature is t=<unix seconds>,v1=<hex>. The hex is HMAC-SHA256 of the timestamp, a dot and the raw request body, keyed with the whole secret string, whsec_ included.

  1. Read the raw body bytes. Don’t parse and re-serialize the JSON first: one changed space breaks the signature.
  2. Reject a timestamp more than 5 minutes from your clock, so an old request can’t be replayed at you.
  3. Compute the HMAC and compare in constant time.
  4. Accept if any v1= matches: during a secret rotation there are two.
// receiver.mjs — Node 18+, no dependencies. SIMLINE_WEBHOOK_SECRET=whsec_… node receiver.mjs
import { createHmac, timingSafeEqual } from "node:crypto"
import { createServer } from "node:http"
const SECRET = process.env.SIMLINE_WEBHOOK_SECRET // whsec_…, shown once when you create the endpoint
const seen = new Set() // use your database in production
export function verifySimline(secret, header, rawBody, toleranceSeconds = 300) {
const parts = header.split(",").map((p) => p.trim().split("="))
const t = Number(parts.find(([k]) => k === "t")?.[1])
if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex")
return parts
.filter(([k]) => k === "v1")
.some(([, v]) => v.length === expected.length && timingSafeEqual(Buffer.from(v), Buffer.from(expected)))
}
createServer((req, res) => {
const chunks = []
req.on("data", (c) => chunks.push(c))
req.on("end", () => {
const raw = Buffer.concat(chunks).toString("utf8")
if (!verifySimline(SECRET, req.headers["simline-signature"] ?? "", raw)) {
res.writeHead(401).end()
return
}
const event = JSON.parse(raw)
res.writeHead(204).end() // answer fast; do the work after
if (seen.has(event.id)) return // a retry or replay of an event you already handled
seen.add(event.id)
if (event.type === "message.received") {
console.log(`${event.data.contact} wrote: ${event.data.body}`)
} else {
console.log(event.type, event.id)
}
})
}).listen(Number(process.env.PORT ?? 8788))

With Express, use express.raw({ type: "application/json" }) on the route and pass req.body.toString("utf8") to verifySimline.

In our test all three printed +33600000042 wrote: Bonjour, est-ce que la tarte aux pommes est prête ? (accents intact), then message.sent and message.delivered for an outbound text, and answered 401 to a request signed with a made-up v1=.

  • Success is any 2xx within 10 seconds. Redirects aren’t followed.
  • Retries: attempt 1 right away, then after 30 seconds, 2 minutes, 10 minutes, 1 hour, 3 hours, 6 hours and 12 hours: 8 attempts over about 22 hours.
  • Dead letters: after the 8th failure the delivery is failed. Replay it from the endpoint’s delivery log in the dashboard or with POST /v1/webhook-deliveries/{id}/replay.
  • Auto-disable: an endpoint whose attempts have failed continuously for 3 days is turned off (disabledReason: "failing"), its pending deliveries are marked failed, and the workspace owners get an email. Re-enable it in the dashboard or with PATCH /v1/webhooks/{id} and {"enabled": true}.
  • Never lost: the event is recorded in the same database transaction as the status change or the incoming text, so a crash in between can’t drop it.

Each attempt’s status code, timing, error and the first 500 characters of your response are in the Delivery log (and GET /v1/webhooks/{id}/attempts). Attempt errors are explained in Errors.

Delivery is at least once: a retry after a timeout, a replay or a rare race can deliver the same event again, always with the same id.

  • Dedupe on the event id (Simline-Event-Id, or id in the body), with a unique constraint in your database. In our test, a replayed message.received reached all three receivers, which answered 204 and did nothing.
  • Answer first, work after. Slow handlers cause timeouts, and timeouts cause duplicates.
  • Don’t rely on order. message.delivered can in principle arrive before message.sent. Move your own status forward only (never replace delivered with sent), or fetch GET /v1/messages/{id} and store what it says.

A replay sends the same event again (same evt_ id, identical body) as a new delivery, for example after you’ve fixed a bug in your handler:

Terminal window
curl -X POST https://api.simline.dev/v1/webhook-deliveries/whd_AuER0XoaWoMaTw3bPa7KoQ/replay \
-H "Authorization: Bearer $SIMLINE_API_KEY"
# 202 {"id": "whd_…", "eventId": "evt_…", "replayOf": "whd_AuER0XoaWoMaTw3bPa7KoQ", "status": "pending", …}
Terminal window
curl -X POST https://api.simline.dev/v1/webhooks/whe_Vb3nq0x5cE1h2kF8sYp4Tg/rotate-secret \
-H "Authorization: Bearer $SIMLINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"graceSeconds": 86400}'

You get the new secret. For graceSeconds (default a day, 0 to stop at once, at most 7 days) Simline signs with both, so Simline-Signature carries two v1= values. Deploy the new secret within the grace period; the verifiers above already accept either.

Send test event in the dashboard (or POST /v1/webhooks/{id}/test) sends a webhook.test event right away, once, ignoring the endpoint’s filters, and returns the attempt’s result.

The live service only calls public https:// URLs. To try your handler on your laptop, expose it with a tunnel, or deploy it and use test events. Simline never sends texts from before the phone was paired.