Receive and verify identification webhooks in Node.js and Express. Add visitor identification, bot detection, and smart signals to your Node.js application in minutes.
Add the SDK to your project with your preferred package manager.
npm install expressyarn add expresspnpm add expressGet up and running with the minimal setup.
import express from 'express'const app = express()// Capture the raw body so the signature can be verified byte-for-byte.app.use(express.json({ verify: (req, _res, buf) => ((req as any).rawBody = buf) }))// Identification events are pushed here in real timeapp.post('/webhook/tracio', (req, res) => { const event = req.body console.log(event.visitorId, event.bot.result) res.status(200).send('OK')})app.listen(3000)Production-ready patterns with error handling, loading states, and advanced configuration.
import express from 'express'import crypto from 'crypto'const app = express()app.use(express.json({ verify: (req, _res, buf) => ((req as any).rawBody = buf) }))// Recompute the HMAC-SHA256 over "<t>.<rawBody>" and compare it.function verify(rawBody: Buffer, header: string, secret: string): boolean { const p = Object.fromEntries(header.split(',').map((kv) => kv.split('=') as [string, string])) const signed = Buffer.concat([Buffer.from(`${p.t}.`), rawBody]) const expected = crypto.createHmac('sha256', secret).update(signed).digest('hex') const a = Buffer.from(p.v1, 'hex') const b = Buffer.from(expected, 'hex') return a.length === b.length && crypto.timingSafeEqual(a, b)}app.post('/webhook/tracio', (req, res) => { const sig = req.headers['x-tracio-signature'] as string if (!verify((req as any).rawBody, sig, process.env.TRACIO_WEBHOOK_SECRET!)) { return res.status(401).json({ error: 'Invalid signature' }) } const event = req.body if (event.bot.result === 'bot') { return res.status(200).json({ action: 'blocked', visitorId: event.visitorId }) } if (event.decision.riskScore > 50) { return res.status(200).json({ action: 'review', visitorId: event.visitorId }) } res.status(200).json({ action: 'allow', visitorId: event.visitorId })})app.listen(3000)All available options for initializing and configuring the SDK.
publicKeystringYour public key from the dashboard — safe to ship in the browserendpointstringCustom endpoint URL for proxy-routed deployments — an explicit URL wins over regionregionstringData region: us or eutimeoutMsnumberTimeout for the whole getResult() call, in millisecondslinkedIdstringYour internal account ID for the signed-in user, so visits sharing a device can be linkedtagstringFree-form label attached to the identification request, e.g. checkout or logindebugbooleanLogs the script lifecycle and network activity to the browser consolescriptUrlstringFull override for the agent script URL — for self-hosting or Subresource IntegrityGo deeper with the full API reference, webhook configuration, and advanced guides.
Full API reference, integration guides, and best practices.
Real-time event delivery, payload schema, and signature verification.
Configure real-time event notifications for every device identification.
Add device fingerprinting to your Node.js application in under 5 minutes.