CreateWebhookHandlerOptions
Defined in: src/resources/webhook-handler-core.ts:71
Options for createWebhookHandler.
Extends
Section titled “Extends”Properties
Section titled “Properties”ackMode?
Section titled “ackMode?”
optionalackMode?:"after"|"before"
Defined in: src/resources/webhook-handler-core.ts:94
'after' (default) runs the handlers before answering. 'before' answers
once the delivery is verified and parsed, and runs the handlers in the background.
allowUnsigned?
Section titled “allowUnsigned?”
optionalallowUnsigned?:boolean
Defined in: src/resources/webhook-handler-core.ts:81
Accept unsigned deliveries without the one-time warning. Only matters when no secret is set.
appSecrets?
Section titled “appSecrets?”
optionalappSecrets?:string| readonlystring[]
Defined in: src/resources/webhook-handler-core.ts:28
App Secret, or several to accept during rotation.
Inherited from
Section titled “Inherited from”concurrency?
Section titled “concurrency?”
optionalconcurrency?:number
Defined in: src/resources/webhook-handler-core.ts:100
Events handled at the same time within one delivery. Defaults to 8.
dedupe?
Section titled “dedupe?”
optionaldedupe?:WebhookDedupe
Defined in: src/resources/webhook-handler-core.ts:87
Store used to skip events delivered more than once.
dedupeKey?
Section titled “dedupeKey?”
optionaldedupeKey?: (event) =>string|undefined
Defined in: src/resources/webhook-handler-core.ts:89
Builds the dedupe key. Return undefined to skip dedupe for that event.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string | undefined
maxBodyBytes?
Section titled “maxBodyBytes?”
optionalmaxBodyBytes?:number|false
Defined in: src/resources/webhook-handler-core.ts:83
Largest accepted body in bytes. Defaults to 3 MiB; false disables the check.
maxEventAgeSeconds?
Section titled “maxEventAgeSeconds?”
optionalmaxEventAgeSeconds?:number
Defined in: src/resources/webhook-handler-core.ts:85
Skip message and status events older than this many seconds.
onError?
Section titled “onError?”
optionalonError?: (error,info) =>void
Defined in: src/resources/webhook-handler-core.ts:102
Receives handler errors and invalid envelopes. Defaults to console.error.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”void
resolveTenant?
Section titled “resolveTenant?”
optionalresolveTenant?: (request) =>WebhookTenant|Promise<WebhookTenant|undefined> |undefined
Defined in: src/resources/webhook-handler-core.ts:77
Picks the tenant for a request, for apps that serve several WhatsApp apps.
Used by handleRequest. Returning undefined rejects the request (401 on
POST, 403 on GET).
Parameters
Section titled “Parameters”request
Section titled “request”Request
Returns
Section titled “Returns”WebhookTenant | Promise<WebhookTenant | undefined> | undefined
retryOnHandlerError?
Section titled “retryOnHandlerError?”
optionalretryOnHandlerError?:boolean
Defined in: src/resources/webhook-handler-core.ts:98
With ackMode: 'after', answer 500 when a handler throws so Meta redelivers.
verifyToken?
Section titled “verifyToken?”
optionalverifyToken?:string
Defined in: src/resources/webhook-handler-core.ts:30
Verify token for the GET handshake.
Inherited from
Section titled “Inherited from”waitUntil?
Section titled “waitUntil?”
optionalwaitUntil?: (promise) =>void
Defined in: src/resources/webhook-handler-core.ts:96
Default waitUntil for ackMode: 'before'.
Parameters
Section titled “Parameters”promise
Section titled “promise”Promise<unknown>
Returns
Section titled “Returns”void
Independent open-source project. Not affiliated with, endorsed by or sponsored by Meta or WhatsApp. Released under the MIT licence. Source on GitHub.