View as Markdown
Webhooks

Pass

Catch a webhook event and pass it through to another service. Verified inbound, durable Vercel Workflow delivery, destination variables auto-injected from the target plug's encrypted vars. Tracked in `khotan_webhook_handlers` and `khotan_runs` with the Workflow run ID. Tracked in the standard `khotan_runs` table — status, durations, batch counts, create/update/delete/fail tallies, plus a metadata JSON for component-specific stats. Toggle off with --no-runs.

stripe
signed
/api/hook
forward
slack

Install

terminal
$ npx khotan add pass <source> <destination>

Variants

A flow declares a variants map of named run modes, each with its own optional cron schedule and onError/onComplete hooks. The variant name is the mode — your flow code branches on ctx.variant. Click a tag above the preview to see the flow change. Select a variant when triggering:

ts
await khotanData.flow('pass').start({ variant: 'normal' })
terminal
$ npx khotan flows trigger pass normal

Variants with a schedule are dispatched independently by the cron dispatcher; variants without one are manual-only. Every run records its variant and source (scheduled | manual | webhook). What each variant actually does is up to your flow code and what the source API allows.

import { pass, type PassContext } from "./pass";
import { plug } from "../plugs/plug";
async function stripeToSlackWorkflow(ctx: PassContext) {
"use workflow";
async function forwardEvent() {
"use step";
// destVars are auto-injected from the destination plug's encrypted vars
const slackPlug = plug({
name: "slack",
baseUrl: "https://hooks.slack.com",
authType: "bearer",
auth: { bearer: { token: ctx.destVars["token"] ?? "" } },
});
await slackPlug.post("/services/webhook", {
body: {
text: `Received ${ctx.eventType} from stripe`,
event: ctx.event,
},
});
}
await forwardEvent();
}
export const stripeToSlack = pass({
name: "stripe-to-slack",
to: "slack", // ← name of the destination plug
workflow: stripeToSlackWorkflow,
});

Highlights

  • runs

What to expect from add

Running npx khotan add pass <source> <destination> 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