Skip to content

Hooks API

Every block below is compared character by character with the source files named above. If they drift apart, the documentation build fails.

export function defineHooks(
name: string,
register: (context: HookRegistrationContext) => undefined,
): ExportedHookDefinition {
export function createHookTestHost(): HookTestHost {

defineHooks(name, register) returns a hook definition you export. Your register function receives the hook context and runs once, at host startup — never during workflow replay. That’s what keeps hooks out of the event stream and safe to change while runs are in flight.

Two registration points: hooks.identity.provider() for turning an account into principals, and hooks.assignees.resolver() for looking up who is currently in a group. The local provider also registers an authenticated HTTP webhook that turns a validated source-change event into a command.

Hooks and origin routing explains how to use these; Testing Workflows has the runnable test.