An Elixir client for communicating with Exotel APIs
- Add exotel_ex to your list of dependencies in
mix.exs
:
def deps do
[{:exotel_ex, "~> 0.0.1"}]
end
- Ensure exotel_ex is started before your application:
def application do
[applications: [:exotel_ex]]
end
Add the following to your config.exs
file:
config :exotel_ex,
sid: "YOUR_EXOTEL_SID",
token: "YOUR_EXOTEL_TOKEN"
- For Development/Test environments
Add the following to your config/dev.exs
/config/test.exs
file:
config :telex, :exotel_ex_api, ExotelEx.InMemoryMessenger
- For Staging/Production environments
Add the following to your config/staging.exs
/config/production.exs
file:
config :telex, :exotel_ex_api, ExotelEx.HttpMessenger
- Set the messenger to use at the top level
@exotel_api_client Application.get_env(:telex, :exotel_ex_api)
- Send SMS
- The
send_sms/4
function sends an sms to a given phone number from a given phone number.
# @exotel_api_client.send_sms("from_number", "to_number", "body_text", "optional_media_url")
iex(1)> @exotel_api_client.send_sms("15005550006", "15005550001", "test text", "https://github.com")
- Get SMS Details
- The
sms_details/1
function gets an sms details.
# @exotel_api_client.sms_details("sms_sid")
iex(1)> @exotel_api_client.sms_details("sms_sid")