Skip to main content

Webhooks

Get a call to your server when something happens.

About 20 minutesYou need: an https address on your server
On this page

Make one in Automations, or with POST /automations. The secret shows once.

What we send
{
  "id": "evt_...",
  "type": "sale.created",
  "created_at": "2026-12-03T20:00:00Z",
  "workspace_id": "6f1d2c9a-3b47-4c0e-9a55-1f2e3d4c5b6a",
  "data": { "id": "0b8a7c65-1d2e-4f30-8a9b-7c6d5e4f3a2b", "amount_cents": 200000, "currency": "USD" }
}

Check the signature

HeaderHolds
X-Totems-IdThe event id
X-Totems-TimeTime in seconds
X-Totems-Signaturev1= and an HMAC SHA-256 of time, a dot, and the raw body

Use the raw body, before any JSON parser changes it. Turn away anything older than 5 minutes.

verify.ts
import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(rawBody: string, headers: Headers, secret: string, now = Date.now()): boolean {
  const time = Number(headers.get("x-totems-time"));
  if (!Number.isFinite(time) || Math.abs(now / 1000 - time) > 300) return false;
  const want = Buffer.from("v1=" + createHmac("sha256", secret).update(`${time}.${rawBody}`).digest("hex"));
  const got = Buffer.from(headers.get("x-totems-signature") ?? "");
  return want.length === got.length && timingSafeEqual(want, got);
}

Answer fast

Send any 2xx status within 8 seconds, then do your work. Save the event id, and skip one you have seen. The same event can arrive twice.

Retries

We try again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 24 hours. Redirects are not followed. Private network addresses are blocked.

The trigger names are the same as the event types.

Was this useful?

Your answer stays in this browser.