Skip to main content
@rewritetoday/fastify is the Rewrite adapter for Fastify services that prefer plugin-based webhook registration. Repository: github.com/RewriteToday/adapters

When to use it

  • Your service already uses Fastify and its plugin model.
  • You want webhook registration to live inside Fastify’s encapsulation boundaries.
  • You prefer typed event callbacks over manual signature verification and payload parsing.
  • You want the adapter to register the parser behavior needed for webhook verification.

Key capabilities

Plugin-based registration

Register the webhook endpoint through app.register(...) with adapter options.

Signature verification

Reject invalid webhook requests before application handlers run.

Typed event hooks

Handle named Rewrite events directly or use onPayload to dispatch generically.

Parser support

The adapter can register the JSON content parser required for verified webhook handling.

Install

Basic example

Best practices

Let the adapter own the Rewrite webhook route so request parsing and signature verification stay predictable.
Return success quickly and hand off slow work to queues or background workers so retries stay rare.
Persist the webhook event id and guard downstream writes against duplicate retry deliveries.
The adapter supports onSMSOTP, onMessageSent, onMessageBatch, onMessageQueued, onMessageDelivered, onMessageScheduled, onMessageFailed, onMessageCanceled, and the generic onPayload hook.

Adapters overview

Compare the official adapters and understand when they fit better than base packages.

Webhook overview

Delivery semantics, retries, and signature verification details.

Webhook event types

Event families and payload references for supported Rewrite webhooks.