
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Esta biblioteca -não oficial- segue as diretivas da documentação API REST da Zenvia.
Adicione esta linha ao seu Gemfile
gem 'zenvia-rb', '~> 0.1.0'
E depois execute:
$ bundle
Ou instale através do "gem install":
$ gem install zenvia-rb
A única dependência desta Gem é o HTTParty.
Para usar esta biblioteca, você vai precisar informar alguns dados, que são obtidos através da própria Zenvia.
require 'zenvia'
Zenvia.configure {|config|
config.account = 'SUA-CONTA'
config.code = 'SEU-CODIGO'
config.from = 'NOME-DA-EMPRESA-OU-PESSOA' # opcional
}
Se você pretende usar esta Gem com Rails, insira o snippet acima em config/initializers.
Feito isso, para enviar uma mensagem, será preciso apenas chamar a função "send_message":
options = {from: config.from, id: 'SEU-ID', schedule: '2017-07-18T02:01:23'}
Zenvia.send_message(number, message, options)
# no hash 'options', você ainda pode inserir o aggregateId. Todos esses valores são opcionais
# Exemplo de resposta:
{"sendSmsResponse"=>{"statusCode"=>"00", "statusDescription"=>"Ok", "detailCode"=>"000", "detailDescription"=>"Message Sent"}}
Se preferir, você pode definir um array de números e enviar a mesma mensagem a eles:
numbers = ['DDNNNNNNNNN', 'DDNNNNNNNNM']
Zenvia.send_message(numbers, message)
# Exemplo de resposta
[
{"sendSmsResponse"=>{"statusCode"=>"00", "statusDescription"=>"Ok", "detailCode"=>"000", "detailDescription"=>"Message Sent"}},
{"sendSmsResponse"=>{"statusCode"=>"00", "statusDescription"=>"Ok", "detailCode"=>"000", "detailDescription"=>"Message Sent"}}
]
Ou usar a função nativa do Zenvia, de enviar múltiplos SMSs:
list = [
{
from: "remetente",
to: "555192551015",
msg: "uma mensagem",
callbackOption: "NONE"
},
{
from: "remetente",
to: "555199668010",
schedule: "2014-07-18T02:01:23",
msg: "outra mensagem",
callbackOption: "NONE",
id: "004"
}
]
Zenvia.send_multiple_messages list
Caso tenha definido o ID no envio de uma mensagem, poderá buscar seu status chamando a função "lookup":
id = 'SEU-ID'
Zenvia.lookup(id)
# Exemplo de resposta
{"sendSmsResponse": {"statusCode": "00", "statusDescription": "Ok", "detailCode": "000", "detailDescription": "Message Sent" }}
Isso é tudo, pessoal!
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that zenvia-rb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.