Twilio SMS Webhook to Valibot

Paste a twilio sms webhook JSON payload and get a Valibot v.object schema you can run inside your handler. Smaller bundle than Zod, same boundary guarantee — useful for Cloudflare Workers, Vercel Edge, and any runtime where bundle size matters.

JSON input valid
Valibot output

      
    

About this conversion

Twilio sends SMS webhooks as form-encoded — once your framework parses them, the resulting object's keys are PascalCase (MessageSid, From, NumMedia) and a few are conditional (MediaUrl0..MediaUrlN, MessagingServiceSid). A parse at the handler boundary catches a missing required field before you reply with TwiML.

Twilio webhooks are often handled in a Cloudflare Worker (cheap, geographically close to Twilio's PoPs) — Valibot's tree-shaking keeps the receiver under 5 KB, important when the Worker also has TwiML generation, signature verification, and downstream queue logic in the same script. The output is a copy-paste-runnable v.object using the canonical namespace import (import * as v from "valibot"); only the primitives your shape actually uses (v.string, v.number, v.array, v.union, v.optional) get pulled in.

Same shape, other validators

Other JSON shapes