database-designelixirelixir-poison

Need an elixir function that sends a message to a phone number


I am new to programming in general and currently learning Elixir.

How do I write a function that sends message to a phone number? I would love to see the syntax. I'm using the Phoenix framework.

I saw this, but its not exactly what I want:

def tell(receiver, message) do
  IO.puts "[#{inspect self}] Sending #{message} to #{inspect receiver}"
  send receiver, {:ok, self, message}
end

Solution

  • Assuming you are talking about SMS, the easiest way to do that is to first subscribe to a messaging provider like Twilio and get yourself an API key. Then you can utilize their REST API for sending text messages.