Skip to content
Snippets Groups Projects
Unverified Commit ec90665d authored by Effy Elden's avatar Effy Elden
Browse files

Update Twilio library calls to latest version, and use the recommended 'Messages' resource

parent c6f83d85
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,8 @@
*/
// Load the official Twilio library
require_once 'Services/Twilio.php';
require_once 'Services/Twilio/autoload.php';
use Twilio\Rest\Client;
/**
*
......@@ -93,7 +94,7 @@ class org_civicrm_sms_twilio extends CRM_SMS_Provider {
) {
$sid = $this->_providerInfo['username'];
$token = $this->_providerInfo['password'];
$this->_twilioClient = new Services_Twilio($sid, $token);
$this->_twilioClient = new Client($sid, $token);
}
if ($skipAuth) {
......@@ -153,10 +154,12 @@ class org_civicrm_sms_twilio extends CRM_SMS_Provider {
}
try {
$twilioMessage = $this->_twilioClient->account->sms_messages->create(
$from,
$twilioMessage = $this->_twilioClient->messages->create(
$header['To'],
$message
array(
'from' => $from,
'body' => $message
)
);
} catch (Exception $e) {
$errMsg = $e->getMessage()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment