Webhooks
A webhook is a URL of yours that Teemli calls when something happens, so your script doesn’t have to keep asking. Teemli sends a signed POST with a small JSON body.
Events
Section titled “Events”| Event | When | data |
|---|---|---|
turn.completed |
One of your agents finished a piece of work (a turn) | turn (id, state, error, cost_usd, ended_at, reply), conversation (id, kind, title, task_state), agent (id, name, kind) |
task.status |
An agent task changed state (working, waiting, done, couldn’t finish, stopped) | Same as turn.completed |
work_item.changed |
A work item you can see was created or changed (Tasks) | work_item (id, title, completed, completed_at, assignee_person_id, assignee_agent_id, due_on, priority, parent_id, project_ids, updated_at, url), changes |
message.posted |
A message was posted in a channel you can see (Chat) | message (id, text, thread_root_id, created_at, author_person_id, author_agent_id, via_agent_id), channel (id, name, kind) |
ping |
You pressed Send test event | message |
A webhook belongs to you and only hears about what you can see. Teemli re-reads every event as you, under the same row-level security as the app, before delivering it: a private channel you aren’t in or a colleague’s agent never reaches your webhook. You can filter a webhook to certain agents, projects or channels.
Create one
Section titled “Create one”In the app: Developers (account menu) → Webhooks → Add webhook: the URL (HTTPS, on the public internet), the events and optional filters. The signing secret (whsec_…) is shown once; keep it with your receiver.
With the API (a key with webhooks:manage):
curl -s -X POST "https://api.teemli.com/v1/orgs/$ORG/webhooks" \ -H "Authorization: Bearer $TEEMLI_KEY" -H "Content-Type: application/json" \ -d '{"url": "https://example.com/teemli", "events": ["task.status", "work_item.changed"]}'See Webhooks in the API reference for filters, rotating the secret, test events and the delivery log.
The request
Section titled “The request”POST /teemli HTTP/1.1Content-Type: application/jsonwebhook-id: 01936d0c-8a3e-7c21-b5c4-2f1e9a6d3b70webhook-timestamp: 1733300000webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=
{"id": "01936d0c-…", "type": "task.status", "created_at": "2026-12-04T09:13:20Z", "org_id": "…", "data": { … }}Answer with any 2xx status within 10 seconds. Do slow work after you’ve answered.
Verify the signature
Section titled “Verify the signature”Deliveries are signed with Standard Webhooks, so any of its libraries can check them. By hand:
- Take the secret after
whsec_and base64-decode it: that’s the key. - Compute HMAC-SHA256 over
{webhook-id}.{webhook-timestamp}.{raw body}and base64-encode it. - Compare it (in constant time) with each
v1,signature inwebhook-signature. - Reject timestamps more than about 5 minutes from now, to stop replays.
import crypto from "node:crypto";
export function verify(secret, headers, rawBody) { const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64"); const signed = `${headers["webhook-id"]}.${headers["webhook-timestamp"]}.${rawBody}`; const expected = crypto.createHmac("sha256", key).update(signed).digest("base64"); const age = Math.abs(Date.now() / 1000 - Number(headers["webhook-timestamp"])); return age < 300 && headers["webhook-signature"].split(" ").some((s) => { const [v, sig] = s.split(","); return v === "v1" && sig.length === expected.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected)); });}Use the raw request body: parsing and re-serialising JSON changes the bytes.
Retries and the delivery log
Section titled “Retries and the delivery log”If your URL doesn’t answer 2xx in time, Teemli retries after about 30 seconds, 2 minutes, 10 minutes, 1 hour, 6 hours and 24 hours (7 attempts in all). The same event keeps its webhook-id, so you can ignore duplicates. A webhook that fails 50 deliveries in a row is paused; switch it back On in the app once your receiver works.
Every delivery is listed under the webhook in Developers → Webhooks: status, response time and the start of your response. Press Retry to send a failed one again.
Safety
Section titled “Safety”Teemli only delivers to https URLs on public addresses (never to private networks), checks the address again at delivery time, and doesn’t follow redirects. Secrets live in Teemli’s vault, not in its database.