Skip to content

HTTPS webhooks

Receive signed Theseus events in your own service.

Send guide and review events to your own service over HTTPS. Each request is signed per Standard Webhooks, so your receiver can verify it, store it and answer quickly, then do the work in the background.

Webhooks are one kind of beacon, the workspace setting that sends events out of Theseus; the other is GitHub Actions. The CLI and API call a beacon an integration, with an ID that starts int_.

Before you start

Link to this section
  • Be an owner or admin of a workspace whose plan includes MCP, which covers beacons (Plans and usage). If Settings → Beacons has no Add beacon button, the plan doesn't include them.
  • Have an endpoint on public HTTPS, port 443. Theseus doesn't follow redirects, and won't deliver to private networks, IP addresses or URLs with credentials in them.

1. Create an endpoint

Link to this section

In Settings → Beacons, click Add beacon. Enter a Beacon name, choose HTTPS endpoint (webhook) under Send to, enter the Endpoint URL, choose the Events and Repositories, and click Create beacon.

Or from the CLI:

theseus webhooks create --name "Review notifications" \
  --events guide.ready,guide.failed \
  --repository example/project \
  --url https://hooks.example.com/theseus --json

Theseus shows the signing secret once. Put it in your server's secret store, and keep the command's output out of logs, since it contains the secret.

2. Verify and accept requests

Link to this section

Pass the raw request body, before any JSON parsing, and these headers to a Standard Webhooks library with your secret:

HeaderPurpose
webhook-idThe event ID; the same on every retry
webhook-timestampWhen this delivery was sent; checked when verifying
webhook-signatureProves the body was signed with your secret

Once the signature checks out, save the event durably, keyed by its ID, and return 2xx. Do the work afterwards: Theseus gives up on a request after 15 seconds. Saving only the ID and doing the work in memory loses the event if your process crashes.

A guide.ready body looks like this:

{
  "id": "evt_01K6Z3M4Q8R2T5V7W9X1Y3Z5A8",
  "type": "guide.ready",
  "timestamp": "2026-10-06T18:00:00.000Z",
  "api_version": "v1",
  "schema_version": 1,
  "workspace_id": "wsp_01K6Z3M4Q8R2T5V7W9X1Y3Z5A9",
  "data": {
    "repository": {
      "id": "rep_01K6Z3M4Q8R2T5V7W9X1Y3Z5AD",
      "github_id": 1296269,
      "full_name": "example/project"
    },
    "changeset": {
      "path": "example/project/pr/42",
      "kind": "pr",
      "number": 42
    },
    "requested_by": {
      "id": "usr_01K6Z3M4Q8R2T5V7W9X1Y3Z5A7",
      "login": null
    },
    "guide": {
      "id": "ver_01K6Z3M4Q8R2T5V7W9X1Y3Z5AA",
      "head_sha": "0123456789abcdef0123456789abcdef01234567"
    }
  }
}

timestamp is when the event happened and never changes; retries and resends get a new webhook-timestamp and signature. data.guide.id is the exact guide, and head_sha the commit it describes, or null on guide.failed when generation failed early. There's no link to the guide in the body: resolve the PR from data.repository.id and data.changeset.number to get one.

Deliveries can arrive out of order, including when an older event is retried after a newer one. Deduplicate by event ID, and check the current PR head before acting on a guide event. Do not let the last arrival alone decide which guide is current.

A JavaScript receiver

Link to this section

This Fetch-style handler uses standardwebhooks (npm install standardwebhooks). Your server must hand it the raw body and cap the body size. enqueue is yours: it must save the whole job before resolving, and treat an event ID it has already saved as success.

import { Webhook } from 'standardwebhooks';

export function createReceiver(secret, enqueue) {
  const verifier = new Webhook(secret);
  return async function receive(request) {
    if (request.method !== 'POST') return new Response(null, { status: 405 });
    const body = await request.text();
    let event;
    try {
      event = verifier.verify(body, Object.fromEntries(request.headers));
    } catch {
      return new Response('Invalid signature', { status: 401 });
    }
    if (event.type === 'theseus.ping') return new Response(null, { status: 204 });
    try {
      await enqueue({ id: event.id, event });
    } catch {
      return new Response('Try again', { status: 503 });
    }
    return new Response(null, { status: 202 });
  };
}

A 503 when the queue is unavailable makes Theseus retry. After you've accepted an event, retrying the work is your worker's job.

3. Send a test event

Link to this section

Click Manage on the beacon, then Send test event, or run:

theseus webhooks test int_YOUR_ID

Your endpoint should verify and accept a theseus.ping. It appears in the beacon's Delivery Log marked Test. A test is sent once, even to a disabled endpoint, and isn't recorded in event history.

Then generate a guide and check that guide.ready (or guide.failed) arrives.

ResponseWhat Theseus does
2xxDone
410 GoneDisables the endpoint at once
413Fails that delivery; it won't fit next time either
429Retries, waiting for Retry-After within limits
Anything else, or no answerRetries, up to ten attempts over about 75 hours

After 5 days without a success, Theseus disables the endpoint.

Once you've fixed the endpoint, click Resend on a delivery in the Delivery Log, or:

theseus webhooks deliveries int_YOUR_ID --limit 10
theseus webhooks resend dlv_YOUR_ID

Re-enable a disabled endpoint

Link to this section

Turning an endpoint back on doesn't replay what it missed, unless you ask. In Manage, turn on Enabled, select Resend failed deliveries when enabling, and click Save changes. The option appears only when Theseus disabled the endpoint, and resends what failed, expired or was skipped since it started failing, up to 30 days back. Events recorded while an admin had turned it off are never delivered. From the CLI, give the start of the outage in UTC, within the last 30 days:

since='2026-10-08T12:00:00Z' # replace with when your outage started
theseus webhooks enable int_YOUR_ID --resend-failed-since "$since"

A separate consumer that needs to catch up can read event history instead.

Rotate the signing secret

Link to this section

Click Manage on the beacon, then Rotate secret, or run:

theseus webhooks rotate-secret int_YOUR_ID

For 24 hours, deliveries are signed with both the old and new secrets, so you can deploy the new one to your verifier without dropping events. Remove the old one after that. Rotating again during those 24 hours ends the earlier overlap: only the newest secret and the one it just replaced keep signing.