createTwilioClient
function createTwilioClient(options): Twilio;Defined in: lib/utils/twilio.utils.ts:174
Build a Twilio SDK client from module options.
The SDK constructor is new Twilio(username, password, opts). Which values
those are depends on the authentication mode:
- Auth token: username is the Account SID, password the auth token.
- API key: username is the API Key SID (
SK…), password is the key’s secret, and the Account SID is supplied throughopts.accountSid.
Module-level keys the SDK has no concept of are stripped; everything else is
forwarded as ClientOpts.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
TwilioModuleOptions & Partial<{ }> |
Returns
Section titled “Returns”Twilio
Throws
Section titled “Throws”BadRequestException When required credentials are missing or malformed.
Examples
Section titled “Examples”Auth token
createTwilioClient({ accountSid: 'ACxxx', authToken: 'token', region: 'ie1' });API key, which is also what access tokens are signed with
createTwilioClient({ accountSid: 'ACxxx', apiKey: 'SKxxx', apiSecret: 'secret' });