Good Webhooks

API reference

Every public entry point, what it exports, and where its contract is documented.

The package has eight code entry points and three SQL assets; this section holds the exact contract for each.

import { createWebhooks, generateEncryptionKey, WebhookError } from 'good-webhooks'
import { createDelivery } from 'good-webhooks/delivery'
import { createManagement } from 'good-webhooks/management'
import {
  createPostgresManagement,
  createPostgresManagementRepository,
} from 'good-webhooks/management/postgres'
import { goodWebhooks, createBetterAuthManagement } from 'good-webhooks/better-auth'
import { goodWebhooksClient } from 'good-webhooks/better-auth/client'
import { parseWebhook, verifyWebhook } from 'good-webhooks/verify'
import { getPostgresMigration } from 'good-webhooks/migrations'

Better Auth is an optional peer; only the two better-auth entry points import it.

Which process imports what

ProcessImports
Producer and workergood-webhooks, or good-webhooks/delivery with a separate management provider
Endpoint management onlygood-webhooks/management/postgres or good-webhooks/better-auth
Browser (Better Auth client)good-webhooks/better-auth/client
Receivergood-webhooks/verify. It loads no database or worker code
Migration toolinggood-webhooks/migrations or the .sql assets

Conventions

  • Constructors validate options and return. They never open connections, apply migrations, or start workers.
  • Expected failures throw WebhookError with a stable code. Database and provider failures can propagate as other error types.
  • Trusted provider results use Date values. Better Auth route responses use ISO strings.
  • Scope arguments are null for application scope or { type, id } for a named scope. Selecting a scope never authorizes the caller. See scopes.

SQL assets

ExportCreates
good-webhooks/migrations/001-initial.sqlManagement and delivery tables in public
good-webhooks/migrations/management.sqlwebhook_endpoints only
good-webhooks/migrations/delivery.sqlDelivery tables only

Generate the same SQL for another schema with getPostgresMigration().

On this page