@venturekit/notify API
Client
Section titled “Client”| Function | Description |
|---|---|
createNotifyClient(options) | Build the notify client (store, defaultFrom, providers, addressResolver) |
NotifyClient interface (selected methods):
| Method | Description |
|---|---|
enqueue(input: EnqueueInput) | Write a notification to the outbox (the 99% case); returns EnqueueResult |
sendNow(input: SendNowInput) | Render + send immediately, bypassing the outbox/cron; returns SendNowResult |
registerTemplate(template: NotifyTemplate) | Register an in-code template (generic over the payload type) |
registerTemplates(templates: NotifyTemplate[]) | Register many templates at once |
registerProvider(provider: NotifyProvider) | Register / override a channel provider |
The client also exposes the configured store, templates, providers, defaultFrom, and addressResolver for use in admin handlers.
| Function | Description |
|---|---|
createPostgresNotifyStore(options?) | Postgres-backed outbox store implementing NotifyStore |
Providers
Section titled “Providers”| Function | Description |
|---|---|
createSesEmailProvider(config) | AWS SESv2 email provider |
createMetaWhatsAppProvider(config) | Meta Cloud API WhatsApp provider |
createSecretsTokenResolver(options) | Resolve a provider token from Secrets Manager |
createEmailNoopProvider(options?) | Log-only email provider (dev) |
createMailHogProvider(config) | SMTP provider targeting MailHog (local dev) |
createSmsNoopProvider() / createPushNoopProvider() | Placeholder providers |
Errors: ProviderHardError, ProviderSendError.
Dispatcher & Bounce Handler
Section titled “Dispatcher & Bounce Handler”| Function | Description |
|---|---|
dispatchOnce(options) | Drain pending outbox rows once (used by the cron Lambda) |
makeDispatchHandler(options?) | Build the EventBridge cron dispatcher handler |
makeBounceHandler(options?) | Build the SNS bounce/complaint handler |
Imported from @venturekit/notify/dispatcher and @venturekit/notify/bounce-handler.
Admin Helpers
Section titled “Admin Helpers”Exported from @venturekit/notify/admin — wire into your own handlers:
| Function | Description |
|---|---|
adminListNotifications(client, options) | Paginated list with status/channel/template/search filters |
adminGetNotification(client, id) | Fetch one notification |
adminSendNotification(client, input) | Enqueue (separate name for audit logging) |
adminRetryNotification(client, id) | Flip failed/bounced back to pending |
adminCancelNotification(client, id) | Cancel a pending row before dispatch |
adminClearSuppression(client, channel, address) | Lift a bounce/complaint suppression |
listUserPreferences(client, userId) / upsertUserPreference(client, ...) | Per-user opt-in management |
listNotificationsForUser(client, userId, options) | Buyer-portal inbox view |
Templates
Section titled “Templates”| Function | Description |
|---|---|
createTemplateRegistry() | In-memory template registry (TemplateRegistry) |
Errors: TemplateNotFoundError.
NotifyChannel, NotificationStatus, NotifyAddress, NotificationRow, NotificationPreferenceRow, NotificationEventLogRow, EnqueueInput, EnqueueResult, SendNowInput, SendNowResult, RenderedMessage, NotifyTemplate, NotifyClient, CreateNotifyClientOptions, AddressResolver, NotifyStore, NotifyProvider.