TagoIO SDK for JavaScript and TypeScript
    Preparing search index...

    Class Twilio

    Hierarchy

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Send SMS to a phone number using Twilio Integration

      Parameters

      • sms: TwilioData

        The SMS object containing all necessary information

      Returns Promise<string>

      A promise that resolves to a success message

      This method requires a Twilio account with valid credentials (SID and Token). For enhanced security, it's strongly recommended to store these credentials using TagoIO Secrets rather than hardcoding them.

      const environment = Utils.envToJson(context.environment);
      const twilioService = new Services({ token: context.token }).twilio;
      const result = await twilioService.send({
      to: "+1234567890",
      message: "Hello from TagoIO!",
      from: "+0987654321",
      twilio_sid: environment.TWILIO_SID,
      twilio_token: environment.TWILIO_TOKEN,
      });
      console.log(result);
      const environment = Utils.envToJson(context.environment);
      const twilioService = new Services({ token: context.token }).twilio;
      const result = await twilioService.send({
      to: "+1234567890",
      message: "Hello from TagoIO!",
      from: "MYFROMID",
      twilio_sid: environment.TWILIO_SID,
      twilio_token: environment.TWILIO_TOKEN,
      });
      console.log(result);
      const environment = Utils.envToJson(context.environment);
      const twilioService = new Services({ token: context.token }).twilio;
      const result = await twilioService.send({
      to: "+1234567890",
      message: "Hello from TagoIO!",
      from: "MGXXXXXXXXXXXXXXXX",
      twilio_sid: environment.TWILIO_SID,
      twilio_token: environment.TWILIO_TOKEN,
      });
      console.log(result);