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:
| Header | Value |
|---|---|
X-NexaTrack-Signature-V2 | sha256= 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-Timestamp | When it was sent, ISO 8601 in UTC, exactly as signed by v2 |
X-NexaTrack-Signature | The 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
- Events are sent by a job that runs every minute, so one usually arrives within a minute or two of happening.
- Answer with any 2xx within 5 seconds. Redirects are not followed.
- A timeout, a network error, a 5xx, a 408 or a 429 is retried after 1, 5 and 25 minutes, then marked failed.
- Any other 4xx means your endpoint refused the event, and it is not retried.
- Delivery is at least once, and order is not guaranteed: de-duplicate on
event_id, and useoccurred_atwhen order matters. - v2 signs the timestamp, so with the five-minute check a copied request does not verify later. The first version does
not cover the timestamp, so a copied request would still verify against it. Either way, recording the
event_ids you have handled, as above, makes a repeat harmless.
Pausing, history and sending again
- After 20 failed deliveries in a row the webhook pauses, and the owners are told (the
webhook.pausedevent, and a notice). Fix the receiver, then Turn on it again in Settings. - Settings shows the Last 50 deliveries with their results, and Send again for any one.
- Turn off stops deliveries without removing the webhook; Remove deletes it.
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.
- The app calls
subscribe_eventswith 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. - 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. - The app's server POSTs
{ "claim_code": ... }toclaim_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. - 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.
- A failure at your end (a timeout, a non-2xx answer) counts toward the 20-in-a-row pause, as for any webhook, and that
event is not sent to you again: keep a
list_changescursor and catch up from it after an outage. When the fault is NexaTrack's, the event is tried again later, so you may receive it twice: de-duplicate onevent_id. - Your app is never sent any email, phone, cell, mobile or address field, at any depth, a Job's address included,
even when its person is the owner. Read them with the record's own call (
get_contact,get_job) when the person may see them. list_my_subscriptionssays where it stands:waiting_for_claim,claim_expired,sending,paused,switched_offorended(withended_reason). Askingsubscribe_eventsagain replaces the events and the key, and needs the owner and a new claim.unsubscribe_eventsends it.- It ends when the connection ends: when the app is disconnected, or when nobody can sign in through it again (every
refresh token revoked or past its age). While AI apps are switched off in the account, or a sign-in is being renewed,
nothing is sent and the subscription stays.
list_my_subscriptionsshows one that ended, with why, for 30 days. - The owner sees it under Webhooks, named with the app and the person, and can turn it off or remove it. Its address and events are the app's own, so they are not changed there.
- An account may have at most 20 app subscriptions; each connection has one.
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.