Great intro! We use Twilio to send SMS notifications to our users.
Question - I set up the Twilio client in an initializer. Is there any advantage to this over setting it up in the Twilio service object? I know global variables are generally frowned upon but they seem ok for clients like this.
# config/initializers/twilio.rb require 'twilio-ruby' Twilio.configure do |config| config.account_sid = ENV['TWILIO_ACCOUNT_SID'] config.auth_token = ENV['TWILIO_AUTH_TOKEN'] end $twilio = Twilio::REST::Client.new
And thanks for the tip on the Google phone number gem. I've been using Twilio's Lookup REST API to validate phone numbers. It's likely more accurate but makes an API for every validation. Not so great. I think I'll be switching to
phonelib soon 👍
when i run this
EDITOR="mate --wait" bin/rails credentials:edit
For editors that fork and exit immediately, it's important to pass a wait flag,
otherwise the credentials will be saved immediately with no chance to edit.
Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.