BlackBox
Installation
If available in Hex, the package can be installed
by adding black_box to your list of dependencies in mix.exs:
def deps do
[
{:black_box, "~> 0.1.0"}
]
endAdd your API keys to your config
config :black_box,
api_key: "",
api_signature: ""Usage
create new message
BlackBox.Message.new("+254723XXXXXX", "Message 1.", "Shortcode", "Keyword")
You can create a list of BlackBox.Message and then build_messages so that you can send them to the API.
send a single message
alias BlackBox.Message
Message.new("+254723XXXXXX", "Message 1.", "Shortcode", "Keyword")
|> Message.build_messages()
|> Message.send()sending multiple messages
alias BlackBox.Message
messages =
|> Enum.map(fn sms ->
Message.new(sms.eg_number, sms.eg_message, sms.eg_shortcode, sms.eg_keywor)
end)
|> Message.build_messages()
|> Message.send()Check your account balance
BlackBox.Message.balance()The expected response
{:ok, map, HTTPotion.Response.t()} | {integer, any, HTTPotion.Response.t()}Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/black_box.