Skip to main content
@rewritetoday/express is the Rewrite adapter for Express applications that need a framework-native webhook endpoint with minimal setup. Repository: github.com/RewriteToday/adapters

When to use it

  • Your application already uses Express routing and middleware.
  • You want the adapter to handle the raw-body middleware required for webhook verification.
  • You prefer named event callbacks instead of manual request parsing.
  • You need a dedicated, verified ingress route for Rewrite webhooks.

Key capabilities

Express-native middleware

Mount the webhook handler directly in app.post(...) with the middleware shape Express expects.

Raw body handling

The adapter already manages the raw request body needed for signature verification.

Typed callbacks

Handle supported Rewrite events with named hooks or use onPayload for generic routing.

Verified before business logic

Signature validation runs before your application code sees the payload.

Install

Basic example

Best practices

Keep the Rewrite webhook endpoint isolated from generic JSON middleware so raw-body handling stays predictable.
Acknowledge delivery as soon as possible and push long-running work into a queue, job runner, or background processor.
Store the webhook event id and make side effects idempotent so retry deliveries stay safe.
The adapter supports onSMSOTP, onMessageSent, onMessageBatch, onMessageQueued, onMessageDelivered, onMessageScheduled, onMessageFailed, onMessageCanceled, and the generic onPayload hook.

Adapters overview

Compare the official adapters and choose the right integration surface.

Webhook overview

Delivery format, signature validation, retries, and operational guidance.

Webhook event types

Payload guides for every supported Rewrite webhook event.