java.lang.Object
com.irurueta.authserver.authorization.infrastructure.sms.TwilioMessageClient

public final class TwilioMessageClient extends Object
Thin wrapper over the Twilio SDK, so the sender can be unit-tested with a mock.
  • Field Details

    • restClient

      private final com.twilio.http.TwilioRestClient restClient
      Client holding the credentials.
    • from

      private final String from
      Sender number, or null when a messaging service is used.
    • messagingServiceSid

      private final String messagingServiceSid
      Messaging service SID, or null when a sender number is used.
  • Constructor Details

    • TwilioMessageClient

      public TwilioMessageClient(TwilioProperties properties)
      Creates the client.
      Parameters:
      properties - credentials and sender.
      Throws:
      IllegalStateException - if the credentials or the sender are not configured.
  • Method Details

    • send

      public void send(String to, String text)
      Sends a message.
      Parameters:
      to - recipient in E.164.
      text - text of the message.