In this tutorial we will show how to and SMS sending capabilities to your project. We will add a button to one of List page and that button will send record info via SMS to the current logged user.
Note that Twilio is not free. Their rates depend on number of messages you going to send and many other things.
[size="4"][font="Trebuchet MS"]2. Download Twilio PHP client code and unzip Services folder to your output directory.[/size]
This will create Services folder with one file (Twilio.php) and one folder (Twilio) in there.
Assuming that cell_phone is a field in the login table we can use AfterSuccessfulLogin event. That's the phone number where we will be sending SMSs.
[size="4"][font="Trebuchet MS"]4. Add button to the List page grid.[/size]
Proceed to Twilio control panel and note your phone number, Account SID and Auth Token. You are going to need them soon.
Button Server event code
$AccountSid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$AuthToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$http = new Services_Twilio_TinyHttp('https://api.twilio.com', array('curlopts' => array(
CURLOPT_SSL_VERIFYPEER => false
$client = new Services_Twilio($AccountSid, $AuthToken, null, $http);
$record = $button->getCurrentRecord();
$sms = $client->account->messages->sendMessage(