Beignet API reference
    Preparing search index...

    Type Alias CreateWebhookRouteOptions<Ctx, Webhook, AllowUnknownEvents>

    Options for creating a generic inbound webhook route.

    type CreateWebhookRouteOptions<
        Ctx extends WebhookRouteContext,
        Webhook extends WebhookDef<string, WebhookEventSchemas>,
        AllowUnknownEvents extends boolean = false,
    > = {
        allowUnknownEvents?: AllowUnknownEvents;
        handle?: (
            args: WebhookRouteHandlerArgs<Ctx, Webhook, AllowUnknownEvents>,
        ) => Promise<WebhookRouteHandlerResult> | WebhookRouteHandlerResult;
        headers?: HeadersInit | ((req: Request) => HeadersInit | undefined);
        pipeline?: {
            metadata?: RawRouteInit["metadata"];
            name?: string;
            path?: string;
        };
        server: ServerSource<NextRouteServer<Ctx>>;
        verify?: (
            args: WebhookRouteVerifyArgs<Ctx>,
        ) => Promise<WebhookEvent> | WebhookEvent;
        webhook: Webhook;
    }

    Type Parameters

    Index
    allowUnknownEvents?: AllowUnknownEvents

    Whether unknown event types should pass through without payload parsing.

    false
    

    App-owned fulfillment handler. The webhook is verified before this runs.

    Omit to acknowledge verified events with { ok: true }.

    headers?: HeadersInit | ((req: Request) => HeadersInit | undefined)

    Additional response headers.

    pipeline?: { metadata?: RawRouteInit["metadata"]; name?: string; path?: string }

    Identity and metadata for the hooks pipeline when the server exposes rawRoute(...). metadata feeds metadata-driven hooks such as rate limiting and idempotency; name and path identify the route to hooks, instrumentation, and devtools.

    server: ServerSource<NextRouteServer<Ctx>>

    Beignet server that owns app context and ports.

    Any object exposing createRequestContext works: a NextServer, a core ServerInstance, or a test fake driven from a standard test runner.

    verify?: (
        args: WebhookRouteVerifyArgs<Ctx>,
    ) => Promise<WebhookEvent> | WebhookEvent

    Optional context-aware verifier. Use this when verification depends on app ports, such as ctx.ports.payments.verifyWebhook(...).

    webhook: Webhook

    Inbound webhook definition.