# Webhook manager

Configure event endpoints and inspect delivery results with explicit test and retry actions.

Access: pro. Category: Blocks. Kind: composite.

## When to use

- Use it when a page needs configure event endpoints and inspect delivery results with explicit test and retry actions.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose empty-state instead when empty collections, search results and errors with a clear next action is the actual interface need, rather than webhook manager.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Webhook manager

```sh
npx shadcn@latest add @tidal-pro/webhook-manager
```

Stylesheets: `components/ui/tidal.css`, `components/ui/webhook-manager.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/webhook-manager.css";
import{TidalWebhookManager}from"./components/ui/webhook-manager";
export default(p:Parameters<typeof TidalWebhookManager>[0])=><div className="tidal-scope"><TidalWebhookManager {...p}/></div>;
```

## Structured props

- `TidalWebhookManager.endpoints: ReadonlyArray<TidalWebhookEndpoint>`: Required endpoints value accepted by this exported component.
- `TidalWebhookManager.title: ReactNode`: Required title value accepted by this exported component.
- `TidalWebhookManager.createButtonProps?: ButtonProps | undefined`: Optional create button props value accepted by this exported component.
- `TidalWebhookManager.createButtonRef?: Ref<HTMLButtonElement> | undefined`: Optional create button ref value accepted by this exported component.
- `TidalWebhookManager.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalWebhookManager.editor?: ReactNode`: Optional editor value accepted by this exported component.
- `TidalWebhookManager.emptyContent?: ReactNode` (default "No endpoints configured."): Optional empty content value accepted by this exported component.
- `TidalWebhookManager.headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6" | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalWebhookManager.labels?: Partial<Record<"pending" | "paused" | "failed" | "create" | "events" | "enabled" | "enableEndpoint" | "edit" | "test" | "testing" | "retry" | "retrying" | "signingConfigured" | "signingMissing" | "noEvents" | "deliveries" | "noDeliveries" | "delivered", string>> | undefined` (default {}): Optional labels value accepted by this exported component.
- `TidalWebhookManager.onCreateRequest?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the create request interaction is proposed.
- `TidalWebhookManager.onDeliveriesOpenChange?: ((endpoint: TidalWebhookEndpoint, open: boolean, event: MouseEvent<HTMLElement>) => void) | undefined`: Callback invoked when the deliveries open change interaction is proposed.
- `TidalWebhookManager.onEditRequest?: ((endpoint: TidalWebhookEndpoint, event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the edit request interaction is proposed.
- `TidalWebhookManager.onEnabledChange?: ((endpoint: TidalWebhookEndpoint, enabled: boolean) => void) | undefined`: Callback invoked when the enabled change interaction is proposed.
- `TidalWebhookManager.onRetryRequest?: ((endpoint: TidalWebhookEndpoint, delivery: TidalWebhookDelivery, event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the retry request interaction is proposed.
- `TidalWebhookManager.onTestRequest?: ((endpoint: TidalWebhookEndpoint, event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the test request interaction is proposed.
- `TidalWebhookManager.pendingDeliveryId?: string | undefined`: Optional pending delivery id value accepted by this exported component.
- `TidalWebhookManager.pendingEndpointId?: string | undefined`: Optional pending endpoint id value accepted by this exported component.
- `TidalWebhookEndpointForm.eventOptions: ReadonlyArray<{ value: string; label: string; disabled?: boolean; }>`: Required event options value accepted by this exported component.
- `TidalWebhookEndpointForm.nameValue: string`: Required name value value accepted by this exported component.
- `TidalWebhookEndpointForm.onValueChange: (value: { name: string; url: string; events: readonly string[]; }) => void`: Callback invoked when the value change interaction is proposed.
- `TidalWebhookEndpointForm.selectedEvents: ReadonlyArray<string>`: Required selected events value accepted by this exported component.
- `TidalWebhookEndpointForm.urlValue: string`: Required url value value accepted by this exported component.
- `TidalWebhookEndpointForm.busy?: boolean | undefined` (default false): Optional busy value accepted by this exported component.
- `TidalWebhookEndpointForm.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalWebhookEndpointForm.labels?: Partial<Record<"name" | "url" | "cancel" | "events" | "save", string>> | undefined` (default {}): Optional labels value accepted by this exported component.
- `TidalWebhookEndpointForm.nameInputRef?: Ref<HTMLInputElement> | undefined`: Optional name input ref value accepted by this exported component.
- `TidalWebhookEndpointForm.onCancel?: (() => void) | undefined`: Callback invoked when the cancel interaction is proposed.

## Complete usage example

[Source](https://tidalui.com/examples/webhook-manager.tsx) | [Manifest](https://tidalui.com/examples/webhook-manager.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useLayoutEffect, useRef, useState } from "react";

import { TidalWebhookManager, TidalWebhookEndpointForm, type TidalWebhookEndpoint } from "./components/ui/webhook-manager";

import "./components/ui/webhook-manager.css";

import "./components/ui/status-badge.css";

import "./components/ui/toggle-switch.css";

import "./components/ui/collapsible-panel.css";



const tidalExampleStyles = ".tidal-scope .webhook-manager-demo {\n  width: 100%;\n  max-width: 740px;\n  min-width: 0;\n}\n.webhook-manager-demo > p {\n  font-size: 11px;\n  line-height: 1.6;\n  color: var(--t-muted);\n  margin: 14px 4px 0;\n  overflow-wrap: anywhere;\n}";

const initial: TidalWebhookEndpoint[] = [
  {
    id: "billing",
    name: "Billing events",
    url: "https://example.com/webhooks/billing",
    enabled: true,
    signing: "configured",
    events: ["invoice.paid", "subscription.updated"],
    deliveriesOpen: false,
    deliveries: [
      {
        id: "delivery-1",
        event: "invoice.paid",
        outcome: "delivered",
        time: { label: "Today, 10:42 AM" },
        response: "HTTP 200",
        duration: "84 ms",
      },
      {
        id: "delivery-2",
        event: "subscription.updated",
        outcome: "failed",
        time: { label: "Today, 10:31 AM" },
        response: "HTTP 503",
        duration: "1.2 s",
      },
    ],
  },
];

const events = [
  { value: "invoice.paid", label: "Invoice paid" },
  { value: "subscription.updated", label: "Subscription updated" },
  { value: "customer.created", label: "Customer created" },
];

export function WebhookManagerDemo() {
  const [endpoints, setEndpoints] = useState(initial),
    [editing, setEditing] = useState<string | null>(null),
    [values, setValues] = useState({
      name: "",
      url: "",
      events: [] as readonly string[],
    }),
    [message, setMessage] = useState(
      "Sample endpoints and deliveries. No requests are sent.",
    );
  const createRef = useRef<HTMLButtonElement>(null),
    opener = useRef<HTMLButtonElement | null>(null),
    count = useRef(1);
  const nameRef = useRef<HTMLInputElement>(null);
  useLayoutEffect(() => {
    if (editing !== null) nameRef.current?.focus();
  }, [editing]);
  const closeEditor = () => {
    setEditing(null);
    (opener.current ?? createRef.current)?.focus({ preventScroll: true });
  };
  return (
    <div className="webhook-manager-demo">
      <TidalWebhookManager
        title="Webhooks"
        description="Send product events to your application."
        endpoints={endpoints}
        createButtonRef={createRef}
        onCreateRequest={(e) => {
          opener.current = e.currentTarget;
          setValues({ name: "", url: "", events: [] });
          setEditing("new");
        }}
        onEditRequest={(endpoint, e) => {
          opener.current = e.currentTarget;
          setValues({
            name: endpoint.name,
            url: endpoint.url,
            events: endpoint.events,
          });
          setEditing(endpoint.id);
        }}
        onEnabledChange={(endpoint, enabled) => {
          setEndpoints((v) =>
            v.map((x) => (x.id === endpoint.id ? { ...x, enabled } : x)),
          );
          setMessage(
            `${endpoint.name} ${enabled ? "enabled" : "paused"} in this preview.`,
          );
        }}
        onDeliveriesOpenChange={(endpoint, open) =>
          setEndpoints((v) =>
            v.map((x) =>
              x.id === endpoint.id ? { ...x, deliveriesOpen: open } : x,
            ),
          )
        }
        onTestRequest={(endpoint) => {
          const deliveryId = `test-${count.current++}`;
          setEndpoints((v) =>
            v.map((x) =>
              x.id === endpoint.id
                ? {
                    ...x,
                    deliveriesOpen: true,
                    deliveries: [
                      {
                        id: deliveryId,
                        event: "webhook.test",
                        outcome: "delivered",
                        time: { label: "Just now · sample" },
                        response: "HTTP 200",
                        duration: "75 ms",
                      },
                      ...x.deliveries,
                    ],
                  }
                : x,
            ),
          );
          setMessage("Added a sample test delivery. No request was sent.");
        }}
        onRetryRequest={(endpoint, delivery) => {
          setEndpoints((v) =>
            v.map((x) =>
              x.id === endpoint.id
                ? {
                    ...x,
                    deliveries: x.deliveries.map((d) =>
                      d.id === delivery.id
                        ? {
                            ...d,
                            outcome: "delivered",
                            response: "HTTP 200",
                            duration: "91 ms",
                          }
                        : d,
                    ),
                  }
                : x,
            ),
          );
          setMessage(
            "The sample retry is marked delivered. No request was sent.",
          );
        }}
        editor={
          editing !== null ? (
            <TidalWebhookEndpointForm
              nameInputRef={nameRef}
              nameValue={values.name}
              urlValue={values.url}
              selectedEvents={values.events}
              eventOptions={events}
              onValueChange={setValues}
              onCancel={closeEditor}
              onSubmit={(e) => {
                e.preventDefault();
                if (!values.name.trim()) return;
                const name = values.name.trim();
                const endpointId =
                  editing === "new" ? `endpoint-${count.current++}` : editing;
                setEndpoints((v) =>
                  editing === "new"
                    ? [
                        ...v,
                        {
                          id: endpointId,
                          name,
                          url: values.url,
                          events: values.events,
                          enabled: false,
                          signing: "not-configured",
                          deliveries: [],
                          deliveriesOpen: false,
                        },
                      ]
                    : v.map((x) =>
                        x.id === editing
                          ? {
                              ...x,
                              name,
                              url: values.url,
                              events: values.events,
                            }
                          : x,
                      ),
                );
                setMessage(`${name} saved in this preview.`);
                closeEditor();
              }}
            />
          ) : undefined
        }
      />
      <p role="status">{message}</p>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <WebhookManagerDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Consumer-owned unique-id endpoints include display name/URL, enabled state, signing configuration, event names and exact delivery history. Native root/action refs and props, pending endpoint/delivery IDs, controlled or uncontrolled delivery disclosures, optional editor and signing-detail slots, labels and empty content are supported. The exported TidalWebhookEndpointForm supplies controlled native name/URL/event controls, native submission and reset callbacks, error content, busy fieldset and name input ref. Consumer owns server authorization, URL/event policy, form state/reset, signing secrets, delivery ordering and actual test/retry/configuration requests. The component performs no network, signing, polling, secret generation, or persistence. Delivery IDs must be globally unique when using pendingDeliveryId. Sample actions only update local records.
