README
November 29, 2010 · View on GitHub
This sample application uses Erlang and Webmachine to send SMS via Tropo.
You can start a web server and make a post request that contains phone number and the message. This can be done via a web page that contains a post form or a commandline utility such as curl. Note that to use this application, you need to have a free developer account available at http://www.tropo.com/
Create a Tropo script application which contains this line: message msg, { :to => 'tel:+' + to, :network => 'SMS'}
Then add a messaging token to you Tropo app. That's all you need on the Tropo front. Now let's talk about Erlang and Webmachine.
README : this file Makefile : simple make commands rebar : the Rebar build tool for Erlang applications rebar.config : configuration for Rebar start.sh : simple startup script for running sendsms /ebin /sendsms.app : the Erlang app specification /src /sendsms_app.erl : base module for the Erlang application /sendsms_sup.erl : OTP supervisor for the application /sendsms_resource.erl : a simple example Webmachine resource /priv /dispatch.conf : the Webmachine URL-dispatching table /www : a convenient place to put your static web content
You probably want to do one of a couple of things at this point:
Now proceed to the Erlang app. 0. Build the skeleton application: $ make
- or - $ ./rebar compile
-
Start up the skeleton application: $ ./start.sh
-
Change the basic application: edit src/sendsms_resource.erl This file is responsible for process post request and create a get resquest for Tropo.
-
Add some new resources: edit src/YOUR_NEW_RESOURCE.erl edit priv/dispatch.conf For this application, I have added the following path: {["sendsms"], sendsms_resource, []}.
-
Run curl "http://localhost:8000/sendsms?to=1650898xxxx&msg=foobar"
This will send the message foobar to the phone number 1650898xxxx, notice you need to use the country code "1" as it is required by Tropo.