Documentation
Developers
Webhooks

Webhooks

Webhooks tell your systems when a contact joins or leaves a segment, whatever caused it:

  • the app, including a tag change;
  • an import;
  • a workflow step;
  • HubSpot sync;
  • the Public API.

Add an endpoint

Open the Webhooks tab

Go to Developers → Webhooks and click Add webhook.

Enter your URL

It must be https and publicly reachable. Private network addresses are rejected.

Choose events

EventSent when
segment.contact_joinedA contact becomes a member of a segment
segment.contact_leftA contact stops being a member (removed, tag no longer matches, or deleted)

Copy the signing secret

The secret (whsec_…) is shown once. Store it with your receiver. You'll use it to verify every delivery.

Each endpoint's row has these actions:

  • Send test ping: delivers a signed ping event.
  • Edit: change its URL and events.
  • Rotate secret.
  • Disable or Enable.
  • Delete. A workspace can have up to 10 endpoints. The same actions are available through the API with the webhooks:manage scope.

Payload

Changes are batched: one delivery covers up to 500 contacts and can list several segments. Moving 90,000 contacts sends roughly 180 deliveries per endpoint, not 90,000.

{
  "id": "wh-6abb…-c-segment.contact_joined-6abc…",
  "type": "segment.contact_joined",
  "createdAt": "2026-09-29T10:21:04.512Z",
  "workspaceId": "6aba20af440805d8bfd91959",
  "data": {
    "changes": [
      {
        "segment": { "id": "6abb8f14…", "name": "Paid customers" },
        "contacts": [
          { "id": "6abb8f145d5c0515687d34be", "externalId": "user_42",
            "email": "ann@example.com", "phone": "+14155550101" }
        ]
      }
    ]
  }
}

Each request carries these headers:

HeaderValue
X-Botphonic-EventThe event type
X-Botphonic-DeliveryUnique delivery id, the same across retries. Use it to ignore duplicates
X-Botphonic-Signaturet=<unix seconds>,v1=<hex signature>

Verify the signature

v1 is HMAC-SHA256(secret, "<t>.<raw request body>"). Compute it over the raw body bytes, before any JSON parsing, and reject requests older than about 5 minutes.

// Express: app.post("/webhooks/botphonic", express.raw({ type: "application/json" }), handler)
const crypto = require("crypto");
 
function verify(rawBody, header, secret, toleranceSec = 300) {
  const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(t)) > toleranceSec) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}

Delivery and retries

  • Respond with any 2xx status within 10 seconds. Redirects are not followed.
  • Retries: a failed delivery is tried up to 8 times, with the wait doubling each time from 15 seconds, for about 30 minutes in total.
  • Auto-disable: after 20 deliveries in a row fail completely, the endpoint is disabled and you get an in-app notification. The row shows the last error. Fix your receiver and use Enable to resume. Enabling resets the failure count.
  • Ordering: deliveries can arrive out of order. Use createdAt, or look the contact up with the API, if order matters.
⚠️

Rotating the secret takes effect immediately: deliveries after that are signed with the new secret. Update your receiver right away.