Go back to dialerseat.comsales@dialerseat.com
Free tool

Verify a webhook signature

Paste the signing secret, the signature header and the raw body. The checker computes HMAC-SHA256 of the timestamp, a dot and the body, compares it with v1, and tells you whether the delivery is inside the five-minute window. It runs in your browser with Web Crypto: nothing you paste is sent anywhere, so you can check it with your network tab open.

How the signature is made

The header reads t=<unix seconds>,v1=<hex>. The sender takes the timestamp, a dot and the raw request body, signs that string with HMAC-SHA256 and the endpoint's signing secret, and sends the hex digest as v1. To verify, rebuild the same string from the body exactly as it arrived, sign it with your copy of the secret, compare the two in constant time, and reject anything more than five minutes old so a captured delivery cannot be replayed later.

Why a correct secret still fails

  • The body was parsed and re-serialized before checking. Key order and spacing change, so the bytes no longer match. Verify the raw body first, then parse it.
  • The secret was rotated. After a rotation the old secret stops at once.
  • The comparison uses the wrong case or trims whitespace from the body.
  • The server's clock is off, so a fresh delivery looks older than five minutes.

For other senders, with their headers and encodings, see webhook signature verification failed. To compute a bare HMAC of any message, use the HMAC generator.

Code

Node.js
import crypto from 'node:crypto'

// rawBody: the request body as received, before JSON.parse
function verify(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(',').map(p => p.split('=')))
  if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false
  const expected = crypto.createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex')
  const a = Buffer.from(expected), b = Buffer.from(parts.v1 || '')
  return a.length === b.length && crypto.timingSafeEqual(a, b)
}
Python
import hashlib, hmac, time

def verify(raw_body: bytes, header: str, secret: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    if abs(time.time() - int(parts["t"])) > 300:
        return False
    signed = parts["t"].encode() + b"." + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts.get("v1", ""))
PHP
function verify(string $rawBody, string $header, string $secret): bool {
    $parts = [];
    foreach (explode(',', $header) as $p) {
        [$k, $v] = array_pad(explode('=', $p, 2), 2, '');
        $parts[$k] = $v;
    }
    if (abs(time() - (int) ($parts['t'] ?? 0)) > 300) return false;
    $expected = hash_hmac('sha256', ($parts['t'] ?? '') . '.' . $rawBody, $secret);
    return hash_equals($expected, $parts['v1'] ?? '');
}

This is the scheme DialerSeat for Developers signs its webhooks with: call.started through call.dispositioned, seat and billing events, retried for 72 hours. Read the webhooks docs, or get sandbox keys and send yourself a signed test event.