View as Markdown
Webhooks

Wire

Wire your app to a service. Programmatically registers webhook subscriptions via the source service's API (Stripe, Linear, Pollinate). Backend tracks state in your DB and always points subscriptions at the catch-all route `/api/khotan/webhook/:plugName`, where Catch and Pass handlers fan out internally.

api + ui
Active
Setup
register
service api

Install

terminal
$ npx khotan add wire <source>

Modes

Backend only

Set and forget. Call the same API routes the UI uses, or use the CLI to connect and disconnect wires from your terminal.

ts
# CLI — connect a wire using KHOTAN_WEBHOOK_URL
npx khotan wire pollinate connect

# CLI — inspect current wire state
npx khotan wire pollinate --info

# CLI — disconnect the current wire
npx khotan wire pollinate disconnect

// Under the hood this registers Pollinate against:
//   https://<public-url>/api/khotan/webhook/pollinate
//
// The catch-all route verifies the signature, then fans out
// to any registered catches and passes for that plug.

With UI (--with-ui)

A React panel that shows current status, callback URL, subscribed events, and connect/disconnect actions. Same backend routes as the CLI.

ts
import { WirePanel } from '@/components/khotan/wire-panel'

// Reads /api/khotan/wires/pollinate
// Creates via POST /api/khotan/wires/pollinate
// Disconnects via DELETE /api/khotan/wires/pollinate
<WirePanel
  plugName="pollinate"
  webhookUrl={process.env.NEXT_PUBLIC_WEBHOOK_URL}
/>

// Default callback shape:
//   <origin>/api/khotan/webhook/pollinate

What to expect from add

Running npx khotan add wire <source> scaffolds one or more files into your khotan runtime, React component directory, or app routes depending on the component. khotan may also prompt to install dependent components, npm packages, shadcn pieces, or Workflow integration when this component needs them.

Usage

Use the generated builder or UI inside your khotan setup and operational surfaces. For live runtime inspection, pair this component with the CLI and the built-in docs markdown routes.

Next steps