View Source SmsUp.Delivery.LoggerDelivery (sms_up v1.2.1)

Print the sms to the console and do not send it to any API. Usefull for dev environment and testing.

Link to this section Summary

Functions

Deliver the SMS to the console. Provide a valid international number, the body of the message and a optional list of options (mostly used by real sms api). It is also possible to pass force_error to simulate a delivery failure

Link to this section Functions

Link to this function

deliver(to, body, options \\ [])

View Source
@spec deliver(String.t(), String.t(), Keyword.t()) ::
  {:ok, %{body: String.t(), to: String.t(), options: Keyword.t()}}
  | {:error, String.t()}

Deliver the SMS to the console. Provide a valid international number, the body of the message and a optional list of options (mostly used by real sms api). It is also possible to pass force_error to simulate a delivery failure

examples

Examples

iex> SmsUp.Delivery.LoggerDelivery.deliver("+41765556677", "Hello")
{:ok, %{to: "+41765556677", body: "Hello", options: []}}

iex> SmsUp.Delivery.LoggerDelivery.deliver("+41765556677", "Hello", option: 1)
{:ok, %{to: "+41765556677", body: "Hello", options: [option: 1]}}

iex> SmsUp.Delivery.LoggerDelivery.deliver("+41765556677", "Hello", force_error: "Ooops")
{:error, "Ooops"}