Skip to content
Developers

Verifying webhook signatures

Every iChatUp webhook carries an X-iChatUp-Signature header of the form sha256= followed by a hex HMAC-SHA256 of the raw request body, keyed with your account’s webhook secret. To verify a call, compute the same HMAC over the exact bytes you received, add the prefix, and compare the two in constant time. Reject the request when they differ.

Updated 22 Nov 2026 · by Rahil · Markdown

At a glance

HeaderX-iChatUp-Signature: sha256=…
AlgorithmHMAC-SHA256, hex digest
Signed contentThe raw JSON body, byte for byte
SecretIntegrations page, “For your developer”; starts with whsec_

Node.js

const crypto = require("crypto");

function isFromIchatup(rawBody, header, secret) {
  const expected = "sha256=" +
    crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(header || "");
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

// Express: app.post("/ichatup", express.raw({ type: "application/json" }), ...)
// then isFromIchatup(req.body, req.get("X-iChatUp-Signature"), process.env.ICHATUP_WEBHOOK_SECRET)

PHP

$raw = file_get_contents("php://input");
$expected = "sha256=" . hash_hmac("sha256", $raw, getenv("ICHATUP_WEBHOOK_SECRET"));
$given = $_SERVER["HTTP_X_ICHATUP_SIGNATURE"] ?? "";

if (!hash_equals($expected, $given)) {
    http_response_code(401);
    exit;
}
$event = json_decode($raw, true);

Common mistakes

  • Hashing parsed JSON. Re-encoding the body changes spacing and escaping, so the HMAC will not match. Hash the raw bytes.
  • Forgetting the prefix. The header value includes sha256=.
  • Comparing with ==. Use a constant-time comparison.
  • Trusting old calls. The signature does not cover a timestamp, so also de-duplicate on X-iChatUp-Delivery and ignore events whose occurred_at is far in the past.

Keep the secret on your server, like an API key. Event fields are listed in webhook events.

Questions

When is the secret created?

The first time a webhook address is saved. It then stays the same, and the Integrations page shows it under “For your developer”.

Is the test lead signed too?

Yes. The “Send a test lead” button signs it with the same secret, so you can test verification with it.

See it on your own number

Two minutes to connect, 7 days free, no card. Your AI employee answers, books and follows up on the WhatsApp number your customers already use.