-7

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
Ronan Boiteau
  • 9,608
  • 6
  • 34
  • 56
udehben
  • 11
  • 4

1 Answers1

0

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.

Lee
  • 3,044
  • 1
  • 12
  • 25
  • thanks Lee. my confusion now is that twilio don't support elixir so how do i go about it – udehben Mar 08 '18 at 09:24
  • They have RESTful API which means you can call them using HTTPoison or HTTPotion thru HTTP. – Lee Mar 08 '18 at 09:32