Project

sms_center

0.01
Low commit activity in last 3 years
No release in over a year
A simple tool to using SMS third party
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

sms_center

The sms_center gem. A ruby interface to use SMS platform.
Support: Twilio, Nexmo, Telerivet, Infobip Require: Ruby >= 2.5.0, HttpClient

Installation

gem install sms_center

Add file sms_center.rb to /config/initializers, example below:

SmsCenter.configure do |config|
  config.platform_by_country = {
    th: 'Infobip',
    id: 'Twilio',
    ph: 'Telerivet',
    vn: {
      MobiFone: 'Nexmo',
      Viettel: 'Plivo',
      default: 'Twilio',
    }
    default: 'Nexmo'
  }

  config.root_number_by_platform = {
    Nexmo: ENV['NEXMO_ROOT_NUMBER'],
    Twilio: ENV['TWILIO_ROOT_NUMBER']
  }

  config.keys = {
      # Keys for Telerivet
      TELERIVET_API_KEY: ENV['TELERIVET_API_KEY'],
      TELERIVET_PROJECT_ID: ENV['TELERIVET_PROJECT_ID'],
      # Key for Infobip
      INFOBIP_API_KEY:  ENV['INFOBIP_API_KEY'],
      #Keys for Nexmo
      NEXMO_API_KEY: ENV['NEXMO_API_KEY'],
      NEXMO_API_SECRET: ENV['NEXMO_API_SECRET'],
      # Keys for twilio
      TWILIO_ACCOUNT_SID: ENV['TWILIO_ACCOUNT_SID'],
      TWILIO_AUTH_TOKEN: ENV['TWILIO_AUTH_TOKEN'],
      TWILIO_FROM: ENV['TWILIO_FROM']
  }
end

Where to get the carrier names?

Get the carrier names from this https://github.com/google/libphonenumber/blob/master/resources/carrier/en/

Using

  • options = {contry: 'th'} || {platform: 'Nexmo'}
  • SmsCenter.new(content, to_number, options).send