Developer Platform

TrimLynk Developer Hub

Integrate programmatic URL shortening, dynamic QR code generation, AI analytics, and webhooks into your applications.

TrimLynk Real-Time Click Webhooks

TrimLynk delivers HTTP POST notifications to your endpoint whenever a user clicks one of your links. Each request carries an HMAC-SHA256 signature so your backend can verify authenticity.

Signature Header:X-Trimlynk-SignatureFormat: v1=<hex>
Timestamp Header:X-Trimlynk-TimestampUnix epoch milliseconds
Event Type:X-Trimlynk-Event-Typee.g. click.created

TrimLynk Webhook Signature Verification in Node.js

const crypto = require('crypto');

function verifyWebhook(secret, signature, timestamp, rawBody) {
    if (!signature || !timestamp || !secret) return false;
    const cleanSig = signature.startsWith('v1=') ? signature.slice(3) : signature;
    const expected = crypto
        .createHmac('sha256', secret)
        .update(`${timestamp}.${rawBody}`)
        .digest('hex');
    const sigBuf = Buffer.from(cleanSig, 'utf8');
    const expBuf = Buffer.from(expected, 'utf8');
    return sigBuf.length === expBuf.length && crypto.timingSafeEqual(sigBuf, expBuf);
}