appendWebhookEventCatalogEvents()
Adds one or more event definitions to an existing webhook event catalog.
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 example() { const client = await wachtClient(); const slug: string = 'slug'; const request: AppendWebhookEventCatalogEventsRequest = { events: [ { name: 'user.created', description: 'Triggered when a user is created' }, ], }; return client.webhooks.appendWebhookEventCatalogEvents(slug, request);}Signature
function appendWebhookEventCatalogEvents( slug: string, request: AppendWebhookEventCatalogEventsRequest, client?: WachtClient,): Promise<WebhookEventCatalog>Parameters
›slug: string;
slug: string;Slug identifier for the target resource.
›request: AppendWebhookEventCatalogEventsRequest;
request: AppendWebhookEventCatalogEventsRequest;Request payload object sent to the backend API.
›events?: object[] | undefined;
events?: object[] | undefined;Event definitions appended to the target catalog.
›name?: string | undefined;
name?: string | undefined;Stable event identifier.
›description?: string | undefined;
description?: string | undefined;Human-readable event description.
Return value
›slug?: string | undefined;
slug?: string | undefined;Webhook event catalog slug.
›name?: string | undefined;
name?: string | undefined;Catalog name.
›events?: WebhookEventDefinition[] | undefined;
events?: WebhookEventDefinition[] | undefined;Event definitions in the catalog.
Examples
Append one custom event to a catalog
import { wachtClient } from '@wacht/nextjs/server';export async function appendCatalogEvent(slug: string) { const client = await wachtClient(); return client.webhooks.appendWebhookEventCatalogEvents(slug, { events: [ { name: 'invoice.created', description: 'Triggered when an invoice is created', }, ], });}