Docs

Verify the signature

Every webhook request is signed with your webhook secret, which you find in Developers → Webhook. Check the signature before you trust the body: anyone can POST to your URL, but only Telrioz knows the secret.

How the signature is made

  1. Take the x-telrioz-timestamp header (Unix seconds), a dot ., and the raw request body, byte for byte.
  2. Compute HMAC-SHA256 of that string, keyed with your webhook secret, as lowercase hex.
  3. Put v1= in front. That is the x-telrioz-signature header.
x-telrioz-signature = "v1=" + hex(HMAC-SHA256(secret, timestamp + "." + raw_body))

Compare your result with the header in constant time (timingSafeEqual, hash_equals, compare_digest). If they differ, answer 401 and ignore the body.

Use the raw body

Sign the bytes you received, before any JSON parsing. Parsing and printing the JSON again changes spaces and key order, and then the signature does not match. In Express, for example, read the body with express.raw({ type: 'application/json' }).

The timestamp

Each try is signed again with the time it is sent, so a retry has a new timestamp and a new signature, but the same event_id and body. To refuse a replayed request, you can also reject a timestamp that is far from your clock, for example more than 5 minutes; a real retry always has a fresh one.

Worked example

Check your code with these values. It must produce the signature below.

Secret
whsec_example
x-telrioz-timestamp
1764147600
Raw body
{"event_id":"1842","type":"message.status","data":{"id":"96ca0baa-5068-4481-b97a-7aa648dfd6d3","channel":"smpp","status":"delivered","from":"ACME","to":"6281234567890","part":null,"parts":null,"multipart_id":null,"error":null,"done_at":"2025-11-26T08:59:57.123456+00:00"}}
String to sign
1764147600.{"event_id":"1842","type":"message.status","data":{"id":"96ca0baa-5068-4481-b97a-7aa648dfd6d3","channel":"smpp","status":"delivered","from":"ACME","to":"6281234567890","part":null,"parts":null,"multipart_id":null,"error":null,"done_at":"2025-11-26T08:59:57.123456+00:00"}}
x-telrioz-signature
v1=e5bb47e4b38b30732bf3548cceb7a00e07fb8fa8369275424ec9e8c7fbd30078