The SDK includes type guards for runtime type checking:
Copy
import { isInboundWebhook } from '@inboundemail/sdk'// In your webhook handlerexport async function POST(request: Request) { const payload = await request.json() if (!isInboundWebhook(payload)) { return new Response('Invalid webhook payload', { status: 400 }) } // payload is now typed as InboundWebhookPayload console.log(payload.email.subject)}