useCreateWebhookEndpoint
The useCreateWebhookEndpoint hook exposes a single helper to create webhook endpoints.
Return Value
createEndpoint
(options: CreateEndpointOptions) => Promise<EndpointWithSubscriptions>
Create an endpoint with URL, optional description, and subscribed events.
Current loading state (always false in this implementation).
Current error state (always null in this implementation).
Example
import { useCreateWebhookEndpoint } from "@wacht/react-router";
function CreateEndpoint() {
const { createEndpoint } = useCreateWebhookEndpoint();
return (
<button
onClick={() =>
void createEndpoint({
url: "https://example.com/hooks",
description: "Primary endpoint",
subscribed_events: ["user.created", "organization.created"],
})
}
>
Create endpoint
</button>
);
}