Skip to main content
Rewrite adapters are framework-aware and runtime-aware webhook handlers maintained by the Rewrite team. They verify webhook signatures, parse the payload safely, and expose typed callbacks that match the way your stack already handles inbound requests.

Why adapters?

Framework-native

Mount webhook handlers directly in Express, Fastify, Elysia, Hono, or standard edge runtimes.

Secure by default

Signature verification happens before the payload reaches your business logic.

Typed events

Handle sms.otp and message lifecycle events with named callbacks or a generic payload hook.

Less boilerplate

Skip raw-body parsing, route glue, and repetitive webhook validation code.

Adapter catalog

Edge

Standard Request and Response handling for workers and edge-native runtimes.

Elysia

Native webhook routes for Elysia applications with minimal setup.

Express

Express middleware wiring with the raw-body handling required for signature validation.

Fastify

Plugin-based registration for Fastify services that want a clean webhook boundary.

Hono

Lightweight webhook handlers for Hono apps running on edge or Node-compatible runtimes.

Adapter, SDK, or package?

Start with the adapter that matches your HTTP stack. It gives you the smallest integration surface and the least webhook-specific boilerplate.
Use an official SDK or @rewritetoday/rest instead. Adapters focus on inbound webhook verification and event dispatch.
Use the base ecosystem packages directly when you only need contracts, validation, or transport primitives and prefer to build the route integration yourself.

Common flow

  1. Install the adapter that matches your framework or runtime.
  2. Read the webhook secret from environment variables or platform bindings.
  3. Register a POST handler for your Rewrite webhook endpoint.
  4. Handle specific events with named callbacks or use onPayload for generic routing.
  5. Return 2xx quickly and offload long-running work to a queue or background task.

Available callbacks

All official adapters expose the same event callback surface:
  • onSMSOTP
  • onMessageSent
  • onMessageBatch
  • onMessageQueued
  • onMessageDelivered
  • onMessageScheduled
  • onMessageFailed
  • onMessageCanceled
  • onPayload
Adapters are for webhook consumers. Keep REWRITE_API_KEY out of your webhook endpoint and store only the webhook signing secret there.

Webhook overview

Delivery format, signature validation, retries, and webhook registration basics.

Webhook event types

Payload families and event-specific pages for sms.otp and message lifecycle events.

Adapters repository

Package source code, examples, and release history for every official adapter.