@rewritetoday/elysia is the Rewrite adapter for Elysia applications that want a native webhook route with minimal ceremony.
Repository: github.com/RewriteToday/adapters
When to use it
- Your backend already uses Elysia routing and handler patterns.
- You want a framework-first adapter instead of wiring request verification manually.
- You prefer typed event callbacks over custom webhook parsing code.
- You want a clean route-level boundary for inbound Rewrite events.
Key capabilities
Elysia-native route
Register a webhook endpoint with the same
app.post(...) style you already use in Elysia.Verified before dispatch
Signature validation runs before the payload reaches your business logic.
Typed event hooks
Handle specific webhook families with named callbacks or process everything through
onPayload.No extra glue
The package is ready to use with Elysia without extra webhook-specific dependencies.
Install
Basic example
Best practices
Keep the webhook secret server-side
Keep the webhook secret server-side
Load the signing secret from environment variables and keep it separate from any client-exposed configuration.
Treat the route as an ingress boundary
Treat the route as an ingress boundary
Keep business logic outside the route callback when possible so verification, logging, and downstream processing stay easy to reason about.
Deduplicate retry deliveries
Deduplicate retry deliveries
Rewrite webhooks can be retried. Store the event id and make side effects idempotent.
Available event callbacks
Available event callbacks
The adapter supports
onSMSOTP, onMessageSent, onMessageBatch, onMessageQueued, onMessageDelivered, onMessageScheduled, onMessageFailed, onMessageCanceled, and the generic onPayload hook.Related docs
Adapters overview
Compare the official adapters and choose the right integration point for your stack.
Webhook overview
Delivery format, signature validation, retry semantics, and registration guidance.
Webhook event types
Payload guides for
sms.otp and message lifecycle events.