verifyWebhook
verifyWebhook(
params,expectedToken):WebhookVerificationResult
Defined in: src/resources/webhooks.ts:75
Verifies the GET verification handshake Meta performs when a webhook is
configured. Returns { statusCode: 200, body: challenge } when mode is
subscribe and the token matches expectedToken (compared in constant
time); otherwise { statusCode: 403, body: 'Forbidden' }.
On success the body is the RAW challenge string and MUST be returned as the
raw response body — do NOT wrap it in JSON. Missing params are handled safely
(a missing challenge yields an empty-string body on an otherwise valid
request).
Fails closed: an expectedToken that is empty or not a string always yields
403, so an unset environment variable can never accept a request.
Parameters
Section titled “Parameters”params
Section titled “params”The decoded hub.mode, hub.verify_token, hub.challenge.
challenge?
Section titled “challenge?”string
string
token?
Section titled “token?”string
expectedToken
Section titled “expectedToken”string
The verify token configured for this endpoint.
Returns
Section titled “Returns”Independent open-source project. Not affiliated with, endorsed by or sponsored by Meta or WhatsApp. Released under the MIT licence. Source on GitHub.