Paste a twilio sms webhook JSON payload and get a Zod z.object schema you can run inside your handler. Same shape walker as the TypeScript-mode page, but the output is a runtime-validated schema with .optional() on missing fields and z.union for nullables.
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 handlers are server-side (Express, Next.js Route Handlers, AWS Lambda); Zod's chained .regex() refinements pair naturally with Twilio's specific value formats (E.164 phone numbers, sms_<sid> patterns) so you can validate beyond shape. The output is a copy-paste-runnable z.object using only standard Zod primitives (z.string, z.number, z.array, z.union, .optional). Drop it into your handler, run schema.parse(body), and the rest of your code consumes a strongly typed value with no ambient unknowns.