No commit activity in last 3 years
No release in over 3 years
Ruby API for send sms with Zenvia's REST Api
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 1.8.7
~> 3.12
~> 2.8.0
 Project Readme

Zenvia Rest Rails

Ruby API to send sms with Zenvia's REST Api, based on https://github.com/lmorais/zenvia-ruby

create zenvia config initializer

rails g zenvia:install

after config file was created on 'config/initializers/zenvia.rb', you can set your config params:

require 'zenvia'

Zenvia.configure do |config|
  config.account  = ENV['ZENVIA_ACCOUNT']
  config.code     = ENV['ZENVIA_CODE']
  config.from     = 'name of message sender. Ex. MY BUSINESS'
  config.callback_option = 'zenvia callback option. default is NONE'
end

Usage

require 'zenvia'

# Sending a SMS

sms = Zenvia::Sms.new('your-sms-id', 'test message!', '5591999999999')

sms.send

You can also add two more parameters on 'send' method:

  1. schedule_date: String or DateTime
  2. aggregate_id: String
require 'zenvia'

# Sending a SMS with schedule_date and aggregate_id

sms = Zenvia::Sms.new('your-sms-id', 'test message!', '5591999999999', '2016-11-22T18:13:00', '111')

sms.send

#=> {"statusCode"=>"00",
#     "statusDescription"=>"Ok",
#     "detailCode"=>"000",
#     "detailDescription"=>"Message Sent"}

sms.sent? #=> true

Send Return

{"statusCode"=>"00",
 "statusDescription"=>"Ok",
 "detailCode"=>"000",
 "detailDescription"=>"Message Sent"}

For more information about returned codes: http://docs.zenviasmsenus.apiary.io/#introduction/status-table

Contributing to zenvia-rest-rails

  1. Fork the project.
  2. Start a feature/bugfix branch.
  3. Commit and push until you are happy with your contribution.
  4. Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

See LICENSE.txt for further details.