Skip to content

Events and webhooks

An event says what changed: its type, the objects, who changed them and which fields. It never holds the content: read the objects with their own operations, with your own current access.

{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"type": "team.updated",
"createdAt": "2026-11-16T10:00:00.000Z",
"workspaceId": "…",
"actor": { "memberId": "…", "source": "app" },
"object": { "kind": "team", "id": "…" },
"context": {},
"changed": ["description"]
}

A change to many objects is one event, or a few. Then object is the first of them, and objects lists all of them that the member you act as may see (at most 50). You get an event only when that member may see its objects, and when your scopes cover its area.

events.list returns the events of the last 30 days, oldest first. Every page with events has a nextCursor: poll with the last one you got to get only what is new. The feed has no last page, so this cursor works differently from other lists: an empty page has no nextCursor, so keep the one you sent and poll with it again later. Filter by types, objectId or actorId.

A webhook POSTs each event to your HTTPS address as it happens. It belongs to an agent member: the agent’s access decides which events it gets.

  1. In the agent’s Manage access dialog, under Webhooks, select Add webhook.
  2. Enter an https:// address on the default port, and the event types you want, or leave them out for all.
  3. Copy the signing secret. Sort shows it only once.

Sort delivers each event at least once, and not always in order: drop repeats by the event id. A delivery that fails is tried again after 30 seconds, then after waits that double up to 6 hours, for 3 days. While your address fails, Sort also waits that way before it sends the next event. A webhook that fails for 3 days stops until someone starts it again; so do the webhooks of an agent that is suspended or removed. Send test event sends a webhook.test event at once.

Each request has Sort-Signature: t=<unix time>,v1=<signature>. The signature is the HMAC-SHA256 of <t>.<raw body> with your secret, in hex. After you make a new secret, the old one also signs for 24 hours, so the header has two v1 values.

import { verifyWebhook } from '@sortdo/sdk'
export async function handle(request: Request) {
const body = await request.text()
if (!await verifyWebhook(body, request.headers.get('Sort-Signature'), process.env.SORT_WEBHOOK_SECRET!)) {
return new Response('Invalid signature', { status: 401 })
}
const event = JSON.parse(body)
// …
return new Response(null, { status: 204 })
}

Answer with any 2xx status within 10 seconds. Check the signature on the raw body: parsing and writing the JSON again changes the bytes.