Webhooks
Signature verification
Every webhook carries a WhatPro-Signature header: t is the time it was sent (Unix seconds) and v1 the HMAC-SHA256 of "t.raw_body" with your signing secret, in hex.
WhatPro-Signature: t=1793782800,v1=5f2b8c0d…e91a Read the raw request body, before parsing the JSON.
Compute HMAC-SHA256(
signing_secret, t + "." +raw_body) in hex.Compare it with v1 in constant time, and refuse a t older than 5 minutes.
import crypto from "node:crypto";
import express from "express";
const app = express();
// Read the RAW body: the signature is over the exact bytes Yudoo sent.
app.post("/yudoo/webhook", express.raw({ type: "application/json" }), (req, res) => {
const header = req.get("WhatPro-Signature") ?? "";
const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const expected = crypto
.createHmac("sha256", process.env.YUDOO_SIGNING_SECRET)
.update(`${t}.${req.body}`)
.digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
if (!fresh || !v1 || !crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1))) {
return res.status(400).send("bad signature");
}
const event = JSON.parse(req.body);
// event.type: "order.confirmed" | "order.cancelled" | "webhook.test"
res.sendStatus(200);
});$raw = file_get_contents("php://input");
$header = $_SERVER["HTTP_WHATPRO_SIGNATURE"] ?? "";
parse_str(str_replace(",", "&", $header), $sig); // ["t" => …, "v1" => …]
$expected = hash_hmac("sha256", $sig["t"] . "." . $raw, getenv("YUDOO_SIGNING_SECRET"));
$fresh = abs(time() - (int) $sig["t"]) < 300;
if (!$fresh || !hash_equals($expected, $sig["v1"] ?? "")) {
http_response_code(400);
exit("bad signature");
}
$event = json_decode($raw, true);
http_response_code(200);import hmac, hashlib, os, time
from flask import Flask, request, abort
app = Flask(__name__)
@app.post("/yudoo/webhook")
def yudoo_webhook():
raw = request.get_data() # the raw bytes, before any JSON parsing
parts = dict(p.split("=", 1) for p in request.headers.get("WhatPro-Signature", "").split(","))
expected = hmac.new(
os.environ["YUDOO_SIGNING_SECRET"].encode(),
f"{parts.get('t')}.".encode() + raw,
hashlib.sha256,
).hexdigest()
fresh = abs(time.time() - int(parts.get("t", 0))) < 300
if not fresh or not hmac.compare_digest(expected, parts.get("v1", "")):
abort(400)
event = request.get_json()
return "", 200 The webhook headers keep the WhatPro- prefix (WhatPro-Signature, WhatPro-Event, WhatPro-Delivery): Yudoo was called WhatPro, and the names stay so existing integrations keep working.
Stuck, or need a field we don't have yet? Our team answers on WhatsApp.