Webhooks

Push, don't poll. When a ticket flips status, a customer signs up, or a boss falls, cStar fires a signed HTTP POST at the URL you registered. Stripe-style signature scheme, exponential retries, and a CLI that forwards live events to localhost without an ngrok tunnel. Imports stay quiet, so moving a few thousand rows over will not flood your endpoint.

How it works

  1. Register a webhook URL via the API or team settings.
  2. Pick the events you care about, or a wildcard: ticket.* for every ticket event, * for all of them.
  3. cStar fires a signed HTTP POST when those events happen.
  4. Your server verifies the signature, parses the payload, returns 2xx. Done.

Event Types

Events follow the pattern resource.action. Subscribe to specific events, or to resource.* (such as ticket.* or customer.*) for every event of that resource, or to * for everything. A wildcard also picks up events added later.

Tickets

Customers

Articles

Team

Gamification

Community

Surveys

Automations

Payload format

Same envelope every time. Field names are snake_case on the wire.

Webhook payload
{
  "id": "evt_ticket_created_3f9a1c2b7d4e8a6f0b5c9d1e",
  "type": "ticket.created",
  "created_at": "2026-04-27T18:42:11.000Z",
  "team_id": "550e8400-e29b-41d4-a716-446655440000",
  "data": {
    "ticket": {
      "id": "tkt_UR8A3OR3Vshq",
      "title": "Cannot reset password",
      "status": "new",
      "priority": "normal",
      "channel": "widget",
      "tags": [
        "billing"
      ],
      "customer_id": "cus_no9EfYa0dg5O",
      "assigned_to": "550e8400-e29b-41d4-a716-446655440001",
      "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108",
      "created_at": "2026-04-27T18:42:11.000Z",
      "updated_at": "2026-04-27T18:50:02.000Z"
    },
    "customer": {
      "id": "cus_no9EfYa0dg5O",
      "name": "Casey Patel",
      "email": "casey@example.com"
    },
    "sender_verified": true
  }
}

  • Records go by their public ids (tkt_, cus_, msg_, art_), the same ids the REST API returns. Posts, comments, surveys and groups use their UUID.
  • Times are ISO 8601 strings.
  • Ticket events carry dashboard_url, a link to the ticket in the cStar dashboard for Slack messages, emails or other one-click links.
  • message.message_type is internal for a note only your team sees. Skip those if you forward replies to customers.
  • changes names only the documented fields that changed, each as { from, to }.
  • A test delivery (cstar trigger, the dashboard's Test button) carries "test": true and sample records. Never act on it.

Signature verification

Every delivery carries an X-Signature header in Stripe-style format: t=<unix_timestamp>,v1=<hex_hmac>. The HMAC is computed over {ts}.{rawBody} with your webhook secret. Verify before you parse.

Easiest path: import the verifier from @cstar.help/js. /webhook/node uses synchronous node:crypto; /webhook uses Web Crypto and works in Edge runtimes, Cloudflare Workers, Bun, and Deno.

Express (Node)
import express from 'express';
import { constructEvent } from '@cstar.help/js/webhook/node';

const app = express();

// Capture the RAW body (required for HMAC verification)
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  try {
    const event = constructEvent(
      req.body.toString('utf8'),         // raw body, not JSON.parse'd
      req.headers['x-signature'],        // Stripe-style: t=...,v1=...
      process.env.CSTAR_WEBHOOK_SECRET
    );

    console.log('Verified event:', event.type, event.data);
    res.status(200).json({ received: true });
  } catch (err) {
    // Throws WebhookSignatureVerificationError on bad/expired signatures
    res.status(401).json({ error: err.message });
  }
});

Edge / Workers / Bun (Web Crypto)
import { constructEventAsync } from '@cstar.help/js/webhook';

export async function POST(request) {
  const body = await request.text();         // raw body
  const signature = request.headers.get('x-signature');

  try {
    const event = await constructEventAsync(
      body,
      signature,
      process.env.CSTAR_WEBHOOK_SECRET
    );
    return new Response(JSON.stringify({ received: true }), { status: 200 });
  } catch (err) {
    return new Response(err.message, { status: 401 });
  }
}

Replay protection: Stripe-style signatures enforce a 300-second tolerance by default. Pass { tolerance: <seconds> } as a fourth argument to override. Legacy sha256=<hex> signatures (no timestamp) are still accepted by the verifier for backward compatibility, but are no longer emitted by the cStar dispatcher.

Request Headers

X-Signature Stripe-style HMAC-SHA256 signature: t=<unix>,v1=<hex>. Legacy sha256=<hex> is still accepted by verifySignature for backward compatibility. The cstar listen CLI also forwards a cstar-signature alias header for local-development receivers; production deliveries only set X-Signature.
X-Event-Type Event type (e.g., ticket.created)
X-Event-ID Unique event ID for idempotency
X-Webhook-ID The whk_ ID of the webhook that received this delivery
X-Timestamp ISO 8601 timestamp of when the delivery was sent. (Distinct from the unix t= value embedded inside X-Signature. The unix one is what's HMAC'd.)
X-Delivery-Attempt Attempt number (starts at 1)
User-Agent cStar-Webhooks/1.0
Content-Type application/json

Timeouts & failures

Respond within 10 seconds or the delivery times out. Anything outside the 2xx range counts as a failure. Every attempt, successful or otherwise, lands in the webhook logs under team settings. Consecutive failures pile up per endpoint; if the count climbs, your receiver probably needs attention.

A failed delivery is retried six more times, 30 seconds, 2 minutes, 10 minutes, 1 hour, 6 hours and 24 hours after the attempt before it, each give or take a fifth so retries don't all land at once. That's seven tries over about 31 hours (25 to 37). Each try carries an X-Delivery-Attempt header, and the event's id stays the same, so dedupe on it. After the seventh failure cStar stops trying that event. If deliveries keep dying, cStar turns the endpoint off and marks it Auto-disabled in team settings. Press Enable once your receiver is fixed.

Each endpoint gets its own queue. Its events go out one at a time, oldest first, and your automations never wait on webhooks. Up to two of your endpoints send at once, so if two hang, a third can wait up to 10 seconds (one timeout). When a delivery times out, that endpoint's other waiting events pause for about a minute, without using up a try. A retry can arrive after a newer event, so order by the event's created_at if order matters to you.

Local Testing with the CLI

Use the cStar CLI to forward webhook events to your local development server.

bash
# Forward events to your local server
cstar listen --forward-to http://localhost:3000/webhook

# In another terminal, trigger a test event
cstar trigger ticket.created