Twilio SMS Webhook to TypeScript

Paste a Twilio inbound SMS webhook payload (the form-encoded body parsed into JSON) and get a TypeScript interface for MessageSid, From, To, Body, geo fields, and media counts.

JSON input valid
TypeScript output

      
    

About this conversion

Twilio sends SMS webhooks as application/x-www-form-urlencoded — but once your framework parses the body, the shape is a flat JSON object with PascalCase keys (MessageSid, AccountSid, From, To, Body, NumMedia, NumSegments, FromCity, FromState, FromZip, FromCountry, ApiVersion, SmsStatus). Hand-typing those keys is tedious, especially the optional MessagingServiceSid, MediaUrl0..MediaUrlN, and ProfileName fields that only appear on certain inbound flows.

Generating a TypeScript interface from one real inbound payload (or one you replay from your Twilio console) gives you a typed handler signature for Express, Next.js API routes, Cloudflare Workers, or AWS Lambda. Combined with X-Twilio-Signature verification, you have a typed and authenticated SMS webhook in well under a hundred lines.

Same shape, other validators

Other JSON shapes