TwilioService (provider/twilio.provider.ts)

sms-server-template · voice, Voice / Speech

Module exposing: TwilioService, TwilioPackage

// Source: https://github.com/mperkins0155/sms-server-template | License: MIT | Copyright 2020 Open Template Hub
// Provided via justclaw.it.com; keep this notice with the code.
import { SmsService } from '../interface/sms-service.interface';
import { Sms } from '../interface/sms.interface';

class TwilioPackage {
  static Twilio: any;

  public static getInstance() {
    if ( !this.Twilio ) {
      const { Twilio } = require( 'twilio' );
      this.Twilio = Twilio;
      console.info( 'Initializing Twilio Package. Config: ', this.Twilio );
    }

    return this.Twilio;
  }
}

export class TwilioService implements SmsService {

  /**
   * initializes client
   * @param providerConfig provider config
   */
  async initializeClient( providerConfig: any ): Promise<any> {
    const Twilio: an

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key