parseWebhook
parseWebhook(
body,options?):WebhookPayload
Defined in: src/resources/webhook-core.ts:120
Validates the top-level envelope and returns it typed as a
WebhookPayload. Accepts a parsed object or a JSON string (parsed
internally). Only the top-level shape is validated (object is
whatsapp_business_account and entry is an array); per-message narrowing
happens lazily in extractMessages/extractStatuses so new Meta
message types never break parsing.
String and byte bodies larger than options.maxBodyBytes (default 3 MiB,
Meta’s documented maximum) are rejected before parsing.
Parameters
Section titled “Parameters”unknown
A parsed webhook object, or its JSON as a string, Uint8Array
(including Node byte buffers) or ArrayBuffer. Byte bodies are decoded as UTF-8.
options?
Section titled “options?”ParseWebhookOptions = {}
Optional size limit override.
Returns
Section titled “Returns”Throws
Section titled “Throws”WhatsAppWebhookError when the body is unparseable or malformed.
Independent open-source project. Not affiliated with, endorsed by or sponsored by Meta or WhatsApp. Released under the MIT licence. Source on GitHub.