Class: TwilioHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/twilio_helper.rb

Constant Summary collapse

TWILIO_ACCOUNT_SID =
RailsBase.config.mfa.twilio_sid
TWILIO_AUTH_TOKEN =
RailsBase.config.mfa.twilio_auth_token
TWILIO_FROM_NUMBER =
RailsBase.config.mfa.twilio_from_number

Class Method Summary collapse

Class Method Details

.send_sms(message:, to:) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/twilio_helper.rb', line 9

def send_sms(message:, to:)
  Rails.logger.info "Sending Twilio message:[#{message}] to [#{to}]"
  msg = client.messages.create(
    from: TWILIO_FROM_NUMBER,
    to: to,
    body: message
  )

  Rails.logger.info("SID: #{msg.sid}")
end