Outbound Events
Webhooks & HMAC-SHA256
Receive real-time HTTP POST notifications when indicators are published, scripts compiled, or new versions deployed.
Webhook Architecture
TTX dispatches webhook payloads as JSON HTTP POST requests with exponential backoff retries on failure (up to 3 attempts).
Signature Header & Verification
Every webhook includes an X-TTX-Signature header containing an epoch millisecond timestamp and an HMAC-SHA256 signature:
X-TTX-Signature: t=1732789500000,v1=a1b2c3d4e5f60718293a4b5c6d7e8f90...
The signature is calculated over ${timestamp}.${rawPayload} using your webhook signing secret.
Replay Protection (5-Minute Ceiling)
To prevent replay attacks, the receiver must verify that the timestamp is within 300,000 ms (5 minutes) of current time:
const isFresh = Math.abs(Date.now() - timestamp) <= 300000;
Node.js Verification Example
import { verifyWebhookSignature } from '@ttx/sdk'; app.post('/webhook', (req, res) => { const signature = req.headers['x-ttx-signature']; const isValid = verifyWebhookSignature( req.rawBody, signature, process.env.TTX_WEBHOOK_SECRET, 300000 // 5-min tolerance ); if (!isValid) { return res.status(401).send('Invalid signature'); } console.log('Verified Webhook Event:', req.body.event); res.status(200).send('OK'); });