Textex
Elixir wrapper for the EZ Texting SMS API.
Installation
The package can be installed as:
Add
textexto your list of dependencies inmix.exs:def deps do [{:textex, "~> 0.2.2"}] endEnsure
textexis started before your application:def application do [applications: [:textex]] end
Usage
Configuration
Put the following in config/config.exs or the appropriate environment config file:
config :textex,
sends_username: "replace_me",
password: "and_me_too!",
base_sends_uri: "https://app.grouptexting.com/api", # optional; uses the eztexting API url by default
mode: :production # optional; specifying :test will not make any actual API calls
Sending a single SMS message
sms_message = %Textex.SmsMessage{
phone_number: "5555555555", # must be 10 digits
message: "Fire in the hole!",
},
Textex.SmsMessage.send!(sms_message)
# => {:ok, "Message sent"}
Sending multiple SMS messages
sms_messages = [
%Textex.SmsMessage{
phone_number: "5555555555", # must be 10 digits
message: "Fire in the hole!",
},
%Textex.SmsMessage{
phone_number: "5555555555", # must be 10 digits
message: "I've got you in my sights.",
},
]
Textex.SmsMessage.send!(sms_messages)
# => [{:ok, "Message sent"}, {:ok, "Message sent"}]
TODO
- [X] Support sending single and multiple SMS messages
- [ ] Full support for the sending API
- [ ] Support checking credit count
- [ ] Support checking whether a keyword is available
- [ ] Support voice broadcast