Send an SMS with Thinwrap (Elixir)

Send an SMS via :thinwrap_notifications.send_sms/2 in Elixir — one call shape for Twilio, Vonage, MessageBird and every other provider.

1. Install

{:thinwrap_notifications, "~> 1.2"}

2. Send the call

config = %{
  provider: :twilio,
  account_sid: System.fetch_env!("TWILIO_ACCOUNT_SID"),
  auth_token: System.fetch_env!("TWILIO_AUTH_TOKEN"),
  from: "+15551112222"
}

case :thinwrap_notifications.send_sms(config, %{to: "+15552223333", body: "Hello from Thinwrap"}) do
  {:ok, %{status: status, provider_message_id: id}} ->
    IO.puts("#{status} #{id}")

  {:error, %{code: code, message: message}} ->
    IO.puts("#{code}: #{message}")
end

Same code works for all supported providers — just change the provider ID.