backend for AnySMS to work with sms.ru
Add this line to your application's Gemfile:
gem "any_sms-backend-smsru", "~> 0.1.0"
Then somewhere in your initialization code:
require "any_sms-backend-smsru"
AnySMS.configure do |c|
c.register_backend :my_main_backend,
AnySMS::Backend::Smsru,
api_id: ENV["SMSRU_TOKEN"]
c.default_backend = :my_main_backend
end
Now, whenever you need to send SMS, just do:
phone = "799999999"
text = "My sms text"
# Should actually send sms
AnySMS.send_sms("79999999999", "text")
For more advanced usage please go to AnySMS documentation
Don't forget, you need to put real api_id in SMSRU_TOKEN environment variable. In bash you would do it like that:
export SMSRU_TOKEN "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
Read below how to receive own token to work with sms.ru.
First of all, you should register on https://sms.ru/ . Then, when you are registered, make sure you have some small amount of balance to actually send sms. On your main page (when you are logged) you should see:
instead of XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX you should see your actual api_id key.
Bug reports and pull requests are welcome on GitHub at https://github.com/Fedcomp/any_sms-backend-smsru
The gem is available as open source under the terms of the MIT License.