Stitch / docs
Webhook Triggers

General

Connect a signed webhook integration and subscribe workflow triggers to its events.


In Integrations, add a webhook with a display name, a unique integration key, and a signing secret. Copy the returned URL into your sender: /api/webhooks/custom/<integration-id>. The signing secret is encrypted at rest and is not returned by list or inspection APIs.

Set provider: webhook and reference the key with integration. Configuration sync resolves the key within your organization to an active webhook integration. One integration can serve several triggers across factories. Each trigger runs against its own connected repository. Inspect the endpoint with stitch webhooks get <integration-id>.

Schema

Webhook trigger JSON Schema · Factory schema

key: external-bug
name: Handle external bug
provider: webhook
integration: support-events
harness: coding-agent
sandbox: workspace
agentId: build
initialPrompt: Investigate the incoming bug report.
events: [ticket.created]
payloadFilter:
  priority: [high, urgent]
enabled: false

Send a JSON object with meta and data. meta.id and meta.event are required non-empty strings (at most 128 characters). Reuse the same ID on retries. data must be a JSON object.

{
  "meta": { "id": "ticket-123-created", "event": "ticket.created" },
  "data": { "priority": "high", "title": "Checkout fails" }
}
stitch webhooks send <integration-id> --event ticket.created --idempotency-key ticket-123-created --data-file payload.json

For this command, payload.json contains only the data object; the CLI builds meta. The CLI uses your signed-in organization session, not the webhook signing secret.

Signed HTTP delivery

Send the full envelope as a POST to the integration URL. Set these headers:

HeaderValue
Content-Typeapplication/json
x-stitch-timestampCurrent Unix time in seconds
x-stitch-signaturesha256= followed by the hex HMAC-SHA256 signature

Sign the timestamp, a period, and the exact raw JSON body bytes. Do not parse or reformat the body between signing and sending it. The timestamp must be within five minutes of server time.

import { createHmac } from 'node:crypto';

const body = JSON.stringify({
  meta: { id: 'ticket-123-created', event: 'ticket.created' },
  data: { priority: 'high', title: 'Checkout fails' },
});
const timestamp = String(Math.floor(Date.now() / 1000));
const signature = createHmac('sha256', process.env.WEBHOOK_SIGNING_SECRET!)
  .update(`${timestamp}.`)
  .update(body)
  .digest('hex');
await fetch(process.env.WEBHOOK_URL!, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-stitch-timestamp': timestamp,
    'x-stitch-signature': `sha256=${signature}`,
  },
  body,
});

Accepted deliveries return 202 with a delivery ID. Matching and runs happen asynchronously. Use stitch webhooks deliveries <integration-id> or the integration's Deliveries view to inspect results. Bodies are limited to 32 KiB. Valid requests are limited to 60 per minute per integration; invalid signatures have a separate limit of 120 per minute.

Retries must reuse meta.id and the same payload, but use a fresh signing timestamp. Sender IDs are deduplicated within the integration for seven days. The same sender ID with different content is rejected during background processing. This endpoint uses Stitch's signing contract, not arbitrary providers' native webhook formats.

Keep the signing secret private. Replace it in Integrations to rotate it; the old secret stops working immediately. The integration key cannot be changed. Disconnecting the integration blocks new deliveries and new run admissions without deleting workflow definitions or history.

Use Filters to select matching events and payloads.

Concurrency

Add top-level concurrency to limit active runs per trigger and execution repository. Webhook triggers support only scope: repository. Set an integer limit from 1 to 100. Runs wait in the queue when capacity is full. Omit the setting for no trigger-specific limit.

concurrency:
  scope: repository
  limit: 1

On this page