NewWacht Bench is live — AI-assisted development for Wacht

getWebhookAnalytics()

Returns aggregated delivery analytics for one webhook app, including totals, latency metrics, top events, endpoint performance, and failure reasons.

Usage

The following example shows a basic usage of the backend client from @wacht/nextjs/server.

import { wachtClient } from '@wacht/nextjs/server';export async function getWebhookAnalytics(appSlug: string) {  const client = await wachtClient();  return client.webhooks.getWebhookAnalytics(appSlug, {    endpoint_id: 123,    start_date: '2026-04-01T00:00:00Z',    end_date: '2026-04-17T23:59:59Z',  });}

Signature

function getWebhookAnalytics(  appSlug: string,  options?: {    endpoint_id?: number;    start_date?: string;    end_date?: string;  },): Promise<WebhookAnalytics>

Parameters

appSlug?: string | undefined;
Webhook app slug to scope analytics.
endpoint_id?: number | undefined;
Optional endpoint id filter.
start_date?: string | undefined;
Optional analytics start timestamp (ISO-8601 string).
end_date?: string | undefined;
Optional analytics end timestamp (ISO-8601 string).

Return value

total_events?: number | undefined;
Total event count in the selected range.
total_deliveries?: number | undefined;
Total delivery attempts in the selected range.
successful_deliveries?: number | undefined;
Count of successful deliveries.
failed_deliveries?: number | undefined;
Count of failed deliveries.
filtered_deliveries?: number | undefined;
Count of filtered deliveries.
avg_response_time_ms?: number | null | undefined;
Average response time in milliseconds.
p50_response_time_ms?: number | null | undefined;
P50 response time in milliseconds.
p95_response_time_ms?: number | null | undefined;
P95 response time in milliseconds.
p99_response_time_ms?: number | null | undefined;
P99 response time in milliseconds.
success_rate?: number | undefined;
Success rate percentage.
top_events?: WebhookAnalyticsEventCount[] | undefined;
Top events by volume.
endpoint_performance?: WebhookAnalyticsEndpointPerformance[] | undefined;
Per-endpoint performance rollups.
failure_reasons?: WebhookAnalyticsFailureReason[] | undefined;
Failure reason breakdown.

Behavior

  • Fetches a single resource by identifier or query context.
  • Use this result as the source of truth before update, replay, or delete flows.

Examples

Read overall app analytics

import { wachtClient } from '@wacht/nextjs/server';export async function loadAppAnalytics(appSlug: string) {  const client = await wachtClient();  return client.webhooks.getWebhookAnalytics(appSlug);}

Filter analytics to one endpoint

import { wachtClient } from '@wacht/nextjs/server';export async function loadEndpointAnalytics(appSlug: string, endpointId: number) {  const client = await wachtClient();  return client.webhooks.getWebhookAnalytics(appSlug, {    endpoint_id: endpointId,  });}

On this page