Twilio Client Project

by: burt rosenberg
at: university of miami

Objectives


Twilio is an example of a REST API
using SSL/TCP/IP for secure transport.
This project will familiarize you with the TCP communication protocol, SSL programming, and a modern REST API for web services. Special thanks to Twilio for creating a Promo Code for the students in this class.

Man Page

NAME
   twilio --- manages a twilio SMS interaction.
      
SYNOPSIS

   twilio [-v] -S twilio-sid  -T twilio-token [-R twilio-number] action [arguments ... ]

DESCRIPTION

   Interface to the twilio service API to send and receive SMS messages.
   The actions are: list, send, delete.
   
OPTIONS
    -v verbose
    -R Twilio number. Manditory for send action
    -S Twilio account SID
    -T Twilio account Authentication Token
     
ARGUMENTS

   The action and any arguments need to the action.
   
OUTPUT

    
HISTORY
 
    New in csc424-162.

Specific Steps

You first must sign up for Twilio at twilio.com. You will have to provide a cell phone number. You will have a trial account, however Twilio has gifted the class a promotion code that provides $20 in credit. Without the code you have 30 days to use your account. After upgrade the $20 will be used for a $1/month charge and a per message charge.

You can immediately test the account with your phone, to see if it works.

Then please read the API information:

   https://www.twilio.com/docs/api/rest
   https://www.twilio.com/docs/api/rest/message
I have provided two entry places. You can read background on REST on wiki, and let's read the original paper by Fielding and here is a tutorial that might help ease in the reading:
   http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
   http://www.restapitutorial.com/lessons/whatisrest.html

Once you have an account, with a SID and an Authorization string (like you password) you can try the API Explorer (Twilio login required):

   https://www.twilio.com/user/account/messaging/dev-tools/api-explorer/message?expanded=0
You can then experiment with command line Twilio using the standard unix tool "curl", see class/proj5/makefile.twilio, after adapting to your account SID, TOK, Twilio number, and a target number (which you might have to register using your Twilio Dashboard).

Curl is also a library, that can be called from inside a C program. See the test program in class/https.c and the Makefile target, and the resources:

  https://curl.haxx.se/libcurl/c/libcurl-tutorial.html
  https://curl.haxx.se/libcurl/c/https.html (this program is in the class directory)
  https://github.com/laurentluce/twilio-cplusplus/blob/master/Rest.cpp (this program is in C++, and Twilio referenced it)

The class/proj5 has sample code for a GNU regex library and a Base64 encoder/decoder. References:

   http://www.gnu.org/software/libc/manual/html_node/Regular-Expressions.html#Regular-Expressions
   https://gist.github.com/barrysteyn/7308212
It might be useful to use these libraries.

Deliverable

Deliver either a C code and subroutines.

The actions should include at least:

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Author: Burton Rosenberg
Created: April 10, 2016
Last Update: April 12, 2016