Skip to content

TwilioWebhookOptions

Defined in: lib/webhook/twilio-webhook.options.ts:30

Per-route configuration accepted by TwilioWebhook and understood by TwilioWebhookGuard.

Every field is optional and, when omitted, falls back to whatever the guard resolves from the incoming request context and, ultimately, from the module-level default supplied via the TWILIO_WEBHOOK_OPTIONS DI token.

// Validate against a subaccount's token and an explicit public URL, which
// is what you need when the app sits behind a proxy that rewrites Host.
@Post('/webhooks/billing')
@TwilioWebhook({
authToken: process.env.TWILIO_BILLING_AUTH_TOKEN,
url: 'https://api.example.com/webhooks/billing',
})
handleBilling() {}
Property Type Description Defined in
authToken? string The Twilio auth token used to compute the expected signature. Overrides any request-context or module-level default for the decorated route. lib/webhook/twilio-webhook.options.ts:35
disableValidation? boolean Skips signature validation entirely for the decorated route/class when true. Intended for local development or endpoints that are intentionally public. lib/webhook/twilio-webhook.options.ts:63
host? string Overrides the host used to reconstruct the webhook URL when url is not supplied. Useful behind proxies that rewrite the Host header. lib/webhook/twilio-webhook.options.ts:56
protocol? "http" | "https" Overrides the protocol used to reconstruct the webhook URL when url is not supplied. Useful behind proxies/load balancers that terminate TLS before the request reaches Nest. lib/webhook/twilio-webhook.options.ts:50
url? string The full public URL (including query string) Twilio was configured to call for this webhook. Required whenever the request reaches your application through a rewrite that the protocol/host overrides cannot describe (e.g. a path rewrite done by a reverse proxy). lib/webhook/twilio-webhook.options.ts:43