Send alerts to a webhook
Updated Oct 2026 · 3 min read- 1
- 2
- 3
- 4
- 5
What a request looks like
Verify the signature
- 1
- 2
- 3
- 4
import crypto from 'node:crypto';
export function verify(rawBody, headers, secret) {
const timestamp = headers['x-lapsentry-timestamp'];
const signature = headers['x-lapsentry-signature'];
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const expected = crypto
.createHmac('sha256', secret)
.update(`${timestamp}.${rawBody}`)
.digest('hex');
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}Failures and duplicates
Good to know
Was this article helpful?