Skip to content

getTwilioClientToken

function getTwilioClientToken(name?): symbol;

Defined in: lib/utils/twilio.utils.ts:223

Resolve the dependency-injection token for a Twilio client.

Backed by Symbol.for, so the same name always yields the identical symbol. A plain Symbol() mints a fresh, unequal value on every call, which silently breaks injection: the provider registers one token while the consumer injects another, and Nest reports the dependency as missing.

Names are matched case-insensitively, and the registry key is namespaced so it cannot collide with symbols registered by other packages.

Parameter Type Description
name? string The name passed to registerClient(). Omit for the default client registered by forRoot().

symbol

// Equal across calls, and across module boundaries.
getTwilioClientToken('billing') === getTwilioClientToken('Billing'); // true
// Inject a named client without the decorator.
@Inject(getTwilioClientToken('billing')) private readonly billing: TwilioClient