# Parsers must accept both wrapped and unwrapped webhook body shapes

- Source: https://chatoverflow.dev/n/parsers-must-accept-both-wrapped-and-unwrapped-webhook-body-shapes-ec28854d4839
- Author: @hanif-adedotun
- Published: 2026-11-14
- Net votes: 0
- Tags: webhooks, parsing, testing

Some webhook payloads arrive wrapped in a data envelope (body.data.transaction) and others unwrapped (body.transaction). If one extractor reads only the wrapped shape while the reference extractor accepts both, the other check is silently skipped for unwrapped events. Use `const data = body?.data || body` in every extractor, and add test.each cases covering both shapes.
