NexaTrack
NexaTrack for developers

Webhooks

A webhook tells your system when something happens in NexaTrack, so you do not have to keep asking. The account owner adds it, and NexaTrack POSTs each chosen event to it as JSON, signed with a secret only you and NexaTrack know. The list of events and what each carries is on Events.

Add a webhook

The owner, in NexaTrack: Settings, AI apps and integrations, Webhooks, Add a webhook. Enter the address, which must start with https://, and tick the events to send. It must be on the public internet: NexaTrack never delivers to an address that resolves to a private or local network. NexaTrack then shows the signing secret once; copy it into your receiver's configuration. Send test posts a test event to check the address works.

An app can ask for one instead: request_webhook with the address and the events waits for the owner, who reads both and approves it in NexaTrack. The signing secret is then shown once, to the owner, on that approval page; it is never returned to the app that asked. request_webhook_change asks to change, resume or send again, the same way, and test_webhook sends a test event to an address already added.

What arrives

One POST per event, Content-Type: application/json, with these headers:

HeaderValue
X-NexaTrack-Signature-V2sha256= and the lowercase hex HMAC-SHA256 of the X-NexaTrack-Timestamp value, a full stop, then the raw request body, keyed with the signing secret. Check this one.
X-NexaTrack-TimestampWhen it was sent, ISO 8601 in UTC, exactly as signed by v2
X-NexaTrack-SignatureThe first version: sha256= and the HMAC of the raw body alone. Still sent, so a receiver that checks it keeps working

The body is the event envelope, for example:

{
  "event_id": "5f0c2a7e-...",
  "type": "task_completed",
  "version": 1,
  "tenant_id": "...",
  "entity_id": "...",
  "job_id": "...",
  "occurred_at": "2026-10-16T14:38:22.098Z",
  "actor_user_id": "...",
  "payload": { "task_id": "...", "title": "Order cabinets", "...": "..." },
  "messages": [],
  "message_count": 0,
  "contact_email": null,
  "contact_phone": null,
  "contact_crm_id": null,
  "summary": "task_completed"
}

messages lists every message NexaTrack itself sent because of the event (an email to a sub, a push to a crew member), so a CRM can file a copy. contact_email, contact_phone and contact_crm_id repeat the first outside recipient's details at the top level, for tools that can only map top-level fields, and summary is the first message's text, or the event type when nothing was sent.

The test from Send test has type webhook.test and payload.message, and no messages.

Check the signature

Check every delivery before you trust it: compute the HMAC over the timestamp header, a full stop and the raw bytes you received, before parsing them; compare in constant time; and refuse a timestamp more than five minutes from your clock, so a copied request cannot be sent again later. Node:

import { createHmac, timingSafeEqual } from 'node:crypto';

export function fromNexaTrackV2(rawBody, signatureHeader, timestampHeader, secret) {
  const sentAt = Date.parse(timestampHeader || '');
  if (Number.isNaN(sentAt) || Math.abs(Date.now() - sentAt) > 5 * 60 * 1000) return false;
  const signed = Buffer.concat([Buffer.from(timestampHeader + '.'), rawBody]);
  const a = Buffer.from('sha256=' + createHmac('sha256', secret).update(signed).digest('hex'));
  const b = Buffer.from(signatureHeader || '');
  return a.length === b.length && timingSafeEqual(a, b);
}

Python:

import hashlib, hmac, time
from datetime import datetime

def from_nexatrack_v2(raw_body: bytes, signature_header: str, timestamp_header: str, secret: str) -> bool:
    try:
        sent_at = datetime.fromisoformat((timestamp_header or "").replace("Z", "+00:00")).timestamp()
    except ValueError:
        return False
    if abs(time.time() - sent_at) > 5 * 60:
        return False
    signed = (timestamp_header + ".").encode() + raw_body
    expected = "sha256=" + hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected.encode(), (signature_header or "").encode())

The first version, X-NexaTrack-Signature, signs the body alone. It is still sent and still checks as before; a receiver built on it keeps working, and moving to v2 is the change above. Node:

import { createHmac, timingSafeEqual } from 'node:crypto';

export function fromNexaTrack(rawBody, signatureHeader, secret) {
  const expected = 'sha256=' + createHmac('sha256', secret).update(rawBody).digest('hex');
  const a = Buffer.from(expected);
  const b = Buffer.from(signatureHeader || '');
  return a.length === b.length && timingSafeEqual(a, b);
}

Python:

import hashlib, hmac

def from_nexatrack(raw_body: bytes, signature_header: str, secret: str) -> bool:
    expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature_header or "")

A complete receiver in Node, with nothing to install. It answers quickly and does the work afterwards:

import { createServer } from 'node:http';
import { createHmac, timingSafeEqual } from 'node:crypto';

const SECRET = process.env.NEXATRACK_WEBHOOK_SECRET;
const seen = new Set(); // use your database in production

createServer((req, res) => {
  const chunks = [];
  req.on('data', (c) => chunks.push(c));
  req.on('end', () => {
    const raw = Buffer.concat(chunks);
    const expected = Buffer.from('sha256=' + createHmac('sha256', SECRET).update(raw).digest('hex'));
    const got = Buffer.from(req.headers['x-nexatrack-signature'] || '');
    if (expected.length !== got.length || !timingSafeEqual(expected, got)) { res.writeHead(401).end(); return; }
    const event = JSON.parse(raw);
    res.writeHead(204).end();                 // answer within 5 seconds
    if (seen.has(event.event_id)) return;     // a retry can repeat an event
    seen.add(event.event_id);
    console.log(event.type, event.payload);   // then do the work
  });
}).listen(8080);

Delivery, retries and order

Pausing, history and sending again

Events that wait for approval

When an AI app or a key asks for something outward, the event it would raise is held with the action. Your webhook receives it only after a person approves it; a declined or expired action sends nothing.

An AI app's own subscription

An app that serves many contractors can be sent their events without anyone copying a secret. It needs to connect with its own client metadata document (a client_id that is an https address), and that document names where its events go:

{ "client_id": "https://app.example/oauth/client.json",
  "client_name": "Sync App",
  "redirect_uris": ["https://app.example/oauth/callback"],
  "nexatrack_events_uri": "https://hooks.app.example/nexatrack" }

The events address must be on the document's own host or below it (app.example or hooks.app.example, never other.example, and alice.github.io's document never bob.github.io), on the default https port, and a name, not an IP address. An app registered dynamically, with no document, cannot subscribe.

  1. The app calls subscribe_events with the events it wants. It waits for the owner, who reads the app's name, its site, the host events go to, the events, and whose view of NexaTrack they follow, and approves it once. NexaTrack reads the document again at that moment. If it now names a different events address, nothing is saved and the approval fails: ask again, and the owner reads the new address.
  2. NexaTrack POSTs a one-time claim to the events address: { "type": "subscription.claim", "subscription_id": ..., "claim_code": "nt_claim_...", "expires_at": ..., "claim_url": ... }. It is not signed, since the app has no key yet.
  3. The app's server POSTs { "claim_code": ... } to claim_url (/api/v1/subscriptions/claim) with the connection's own access token, within 10 minutes. The answer is { "data": { "subscription_id": ..., "signing_key": ... } }, once. A code is good one time only. If the claim did not arrive, POST {} to the same route for a fresh one, posted to the same address. No tool ever returns the key, so an AI model never sees it.
  4. Events start. Each is signed exactly as a webhook is (Check the signature), with the claimed key.

What an app is sent is what list_changes would answer its person, worked out again for every event: only the Businesses and Jobs that person can see, only the Shift, Daily Log and money events their position lets them read, and never the events about keys, AI apps and webhooks. The body is one change, as list_changes gives it, plus the subscription_id: event_id, type, at, entity_id, job_id, record, title, by, via, and payload only when the person is the owner. It never carries message texts or who a message went to.

Writing back from a CRM

A contact.created or contact.updated caused by a CRM writing to NexaTrack (its origin is crm) is not sent to the account's webhooks, so a CRM sync cannot loop. A write that changes nothing raises no event at all.