useWebhookAppSession
The useWebhookAppSession hook loads webhook app portal session data, exchanges optional tickets, and exposes helper actions for endpoint and replay operations.
Parameters
Optional session ticket to exchange before loading webhook app session data.
Return Value
Whether the current request has an active session.
Whether ticket exchange or session fetch is in progress.
Whether ticket exchange succeeded.
Whether ticket exchange is in progress.
createEndpoint
(options) => Promise<EndpointWithSubscriptions>
Create a webhook endpoint.
updateEndpoint
(endpointId, options) => Promise<EndpointWithSubscriptions>
Update an endpoint.
deleteEndpoint
(endpointId) => Promise<void>
Delete an endpoint.
testEndpoint
(endpointId, options) => Promise<void>
Trigger endpoint test delivery.
rotateSecret
() => Promise<RotateSecretResponse>
Rotate app signing secret.
replayDelivery
(options) => Promise<ReplayResponse>
Replay a delivery.
fetchReplayTaskStatus
(options) => Promise<ReplayTaskStatus>
Fetch replay task status.
fetchReplayTasks
(options?) => Promise<ReplayTaskList>
List replay tasks.
cancelReplayTask
(options) => Promise<void>
Cancel replay task.
fetchDeliveryDetail
(deliveryId: string) => Promise<WebhookDeliveryDetail>
Fetch delivery detail.
Example
import { useWebhookAppSession } from "@wacht/react-router";
function WebhookPortal({ ticket }: { ticket?: string }) {
const { sessionLoading, webhookApp, createEndpoint } = useWebhookAppSession(ticket);
if (sessionLoading) return <div>Loading...</div>;
return (
<button
onClick={() =>
void createEndpoint({
url: "https://example.com/webhooks",
subscribed_events: ["user.created"],
})
}
>
Create endpoint for {webhookApp?.name}
</button>
);
}