TwilioService
Defined in: lib/module/twilio.service.ts:27
Service providing access to the Twilio SDK client.
Example
Section titled “Example”@Injectable()export class SmsService { constructor(private readonly twilio: TwilioService) {}
async sendSms(to: string, body: string) { return this.twilio.client.messages.create({ from: process.env.TWILIO_PHONE_NUMBER, to, body, }); }}Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TwilioService(options): TwilioService;Defined in: lib/module/twilio.service.ts:33
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options |
TwilioModuleOptions & Partial<{ }> |
Module options containing account credentials |
Returns
Section titled “Returns”TwilioService
Accessors
Section titled “Accessors”client
Section titled “client”Get Signature
Section titled “Get Signature”get client(): Twilio;Defined in: lib/module/twilio.service.ts:50
Access the underlying Twilio SDK client. Use this to call any Twilio API method.
Example
Section titled “Example”const message = await this.twilioService.client.messages.create({ from: '+1234567890', to: '+0987654321', body: 'Hello!',});Returns
Section titled “Returns”Twilio