Webhooks
Récupérer le secret de signature webhook
Renvoie le secret de signature des webhooks sortants de votre organisation (généré au premier appel).
Chaque webhook envoyé sur votre callbackUrl porte un en-tête de signature X-Listar-Signature: t=<timestamp>,v1=<hmac_sha256>. La signature = HMAC-SHA256 de timestamp + "." + corps brut, avec votre secret comme clé :
const crypto = require('crypto');
function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
if (!parts.v1) return false;
const expected = crypto
.createHmac('sha256', secret)
.update(parts.t + '.' + rawBody)
.digest('hex');
const a = Buffer.from(expected);
const b = Buffer.from(parts.v1);
return a.length === b.length && crypto.timingSafeEqual(a, b);
}
getWebhook/webhooks/signing-secret
Response
Secret de signature.
Example response
{
"secret": "whsec_…"
}Changes
Webhooks have no change history: a webhook is keyed by its event name rather than a path and method, so no recorded change can name it.