Elixir wrapper for delivering and managing your Elibom's API.
ElibomEx can be installed from Hex:
def deps do
[{:elibom_ex, "~> 0.1.0"}]
end
Or from Github
def deps do
[{:elibom_ex, github: "liftitapp/elibom_ex"}]
end
In one of your configuration files, include your Elibom API key, for example:
config :elibom_ex, username: {:system, "ELIBOM_USERNAME"},
password: {:system, "ELIBOM_USERNAME"}
For security, I recommend that you use environment variables rather than hard
coding your account credentials. If you don't already have an environment
variable manager, you can create a .env
file in your project with the
following content:
export ELIBOM_USERNAME=<account email here>
export ELIBOM_PASSWORD=<api token>
Then, just be sure to run source .env
in your shell before compiling your
project.
If you want to use different Twilio credentials for different environments, then
create separate Mix configuration files for each environment. To do this, change
config/config.exs
to look like this:
# config/config.exs
use Mix.Config
# shared configuration for all environments here ...
import_config "#{Mix.env}.exs"
Then, create a config/#{environment_name}.exs
file for each environment. You
can then set the config :elibom_ex
variables differently in each file.
Check the docs for complete usage.
# Dispatch a new SMS
ElibomEx.send_sms(%{to: "573140000000", text: "Hi from Elibom"})
# You can also schedule SMS that will be dispatched in the exact date/time specified,
# format must be provided in the yyyy-mm-dd hh:mm format (e.g: 2014-02-1818 19:10)
ElibomEx.send_sms(%{to: "573140000000", text: "Hi from Elibom", scheduleDate: "2014-02-18 19:10"})
# Shows the status of provided SMS
ElibomEx.show_sms("sms_id")
# Show the state of a scheduled SMS
ElibomEx.show_scheduled_sms("scheduled_sms_id")
# Cancel a scheduled SMS
ElibomEx.cancel_scheduled_sms("scheduled_sms_id")
# Consult your account details
ElibomEx.show_account
# Show all the users related with your account. If you need to fetch a specific user data,
# just provide it's Elibom user id.
ElibomEx.show_users