SmsUp.Sender (sms_up v0.3.0) View Source

SMS sender api that can accept a configurable deliver for sending successfull messages.

Link to this section Summary

Functions

Send a sms with the chosen Sender Module. Configuration is available as : config :sms_up, :deliver_module, MODULE MODULE can be SmsUp.Delivery.LoggerDelivery (default) or SmsUp.Delivery.SmsUpDelivery.

Send a sms with the chosen Sender Module. Configuration is available as : config :sms_up, :deliver_module, MODULE MODULE can be SmsUp.Delivery.LoggerDelivery (default) or SmsUp.Delivery.SmsUpDelivery.

Link to this section Functions

Link to this function

send_sms(number, text, options)

View Source

Specs

send_sms(String.t(), String.t(), Keyword.t()) ::
  {:error, String.t()} | {:ok, %{body: String.t(), to: String.t()}}

Send a sms with the chosen Sender Module. Configuration is available as : config :sms_up, :deliver_module, MODULE MODULE can be SmsUp.Delivery.LoggerDelivery (default) or SmsUp.Delivery.SmsUpDelivery.

Returns a ok tuple containing the message body and the number for which it was sent to or an error tuple with the reason.

Examples

iex> SmsUp.send_sms("+41765556677", "message", [])
{:ok, %{to: "+41765556677", body: "message", options: []}}

iex> SmsUp.send_sms("Hello", "FR", [])
{:error, "Hello is not a valid number"}
Link to this function

send_sms(number, country_code, text, options)

View Source

Specs

send_sms(String.t(), String.t(), String.t(), Keyword.t()) ::
  {:error, String.t()} | {:ok, %{body: String.t(), to: String.t()}}

Send a sms with the chosen Sender Module. Configuration is available as : config :sms_up, :deliver_module, MODULE MODULE can be SmsUp.Delivery.LoggerDelivery (default) or SmsUp.Delivery.SmsUpDelivery.

Returns a ok tuple containing the message body and the number for which it was sent to or an error tuple with the reason.

Examples

iex> SmsUp.send_sms("0765556677", "CH", "message", [])
{:ok, %{to: "+41765556677", body: "message", options: []}}

iex> SmsUp.send_sms("0630772288", "ZZ", "message", [])
{:error, "Invalid country calling code"}

iex> SmsUp.send_sms("Hello", "FR", "message", [])
{:error, "The string supplied did not seem to be a phone number"}