Skip to content

CreateWebhookHandlerOptions

Defined in: src/resources/webhook-handler-core.ts:71

Options for createWebhookHandler.

optional ackMode?: "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.


optional allowUnsigned?: 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.


optional appSecrets?: string | readonly string[]

Defined in: src/resources/webhook-handler-core.ts:28

App Secret, or several to accept during rotation.

WebhookTenant.appSecrets


optional concurrency?: number

Defined in: src/resources/webhook-handler-core.ts:100

Events handled at the same time within one delivery. Defaults to 8.


optional dedupe?: WebhookDedupe

Defined in: src/resources/webhook-handler-core.ts:87

Store used to skip events delivered more than once.


optional dedupeKey?: (event) => string | undefined

Defined in: src/resources/webhook-handler-core.ts:89

Builds the dedupe key. Return undefined to skip dedupe for that event.

WebhookEvent

string | undefined


optional maxBodyBytes?: number | false

Defined in: src/resources/webhook-handler-core.ts:83

Largest accepted body in bytes. Defaults to 3 MiB; false disables the check.


optional maxEventAgeSeconds?: number

Defined in: src/resources/webhook-handler-core.ts:85

Skip message and status events older than this many seconds.


optional onError?: (error, info) => void

Defined in: src/resources/webhook-handler-core.ts:102

Receives handler errors and invalid envelopes. Defaults to console.error.

unknown

WebhookErrorInfo

void


optional resolveTenant?: (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).

Request

WebhookTenant | Promise<WebhookTenant | undefined> | undefined


optional retryOnHandlerError?: boolean

Defined in: src/resources/webhook-handler-core.ts:98

With ackMode: 'after', answer 500 when a handler throws so Meta redelivers.


optional verifyToken?: string

Defined in: src/resources/webhook-handler-core.ts:30

Verify token for the GET handshake.

WebhookTenant.verifyToken


optional waitUntil?: (promise) => void

Defined in: src/resources/webhook-handler-core.ts:96

Default waitUntil for ackMode: 'before'.

Promise<unknown>

void

Independent open-source project. Not affiliated with, endorsed by or sponsored by Meta or WhatsApp. Released under the MIT licence. Source on GitHub.