Jump to content

Twilio SMS not working after 67.0.2 upgrade


Recommended Posts

Hi all,

Is anyone else having issues with Twilio SMS after upgrading to 67.0.2?

We could all use it fine prior to the upgrade, but now nothing is being sent, and there is nothing hitting the Twilio API.

Is there somewhere I can debug this in logs or something in Vodia?

 

Thanks.

Link to post
Share on other sites

It appears that Twilio now requires me to have a 'Message Service' in programmable messaging to send.

The Twilio API service now has 'messagingServiceSid' tag that seems to be required (which you get by creating a 'Messaging Service' under programmable messaging - here is the code from Twilio which I have tested and it works:

// Update the path below to your autoload.php, 
// see https://getcomposer.org/doc/01-basic-usage.md 
require_once '/path/to/vendor/autoload.php'; 
 
use Twilio\Rest\Client; 
 
$sid    = "TWILIO ACCOUNT API KEY HERE"; 
$token  = "[AuthToken]"; 
$twilio = new Client($sid, $token); 
 
$message = $twilio->messages 
                  ->create("+PHONE_NUMBER_HERE", // to 
                           array(  
                               "messagingServiceSid" => "MESSAGING_SERVICE_SID_HERE",      
                               "body" => "This is a test" 
                           ) 
                  ); 
 
print($message->sid);

 

What would be AMAZING would be if Vodia was updated to allow a seperate MessagingServiceID per domain!

I have been able to test this using my own PHP code, and it would be a very simple way for Twilio users to be able to separate out their services for reporting.

From what I can see (and I may be wrong):
PBX Settings need: Twilio API Key and Twilio API Secret
Domain Settings need: Twilio Messaging Service ID

When sending the SMS request to Twilio, Vodia pulls the API information from the PBX, and the service id from the domain - in Twilio, all the SMS's sent are seperated into their service IDs, allowing for me to charge for them accordingly.

Link to post
Share on other sites

This is what we are using for Twilio right now

  Twilio.prototype.send = function(obj) {
    var body = "From=" + encodeURIComponent(obj.from);
    body += "&To=" + encodeURIComponent(obj.to);

    // Do we have an attachment?
    if (obj.url) body += "&MediaUrl=" + encodeURIComponent(obj.url);
    else if (obj.wav) bbody += "&MediaUrl=" + encodeURIComponent(obj.wav);
    else body += "&Body=" + encodeURIComponent(obj.text)
    
    system.http({
      method: 'POST',
      url: this.base + '/Accounts/' + this.username + '/Messages.json',
      header: [
        { name: 'Authorization', value: 'Basic ' + toBase64String(this.username + ':' + this.token), secret: true },
        { name: 'Content-Type', value: 'application/x-www-form-urlencoded' }
      ],
      body: body
    });
  }

The settings are also available on domain level. this.base is 'https://api.twilio.com/2010-04-01' but it can be overwritten if needed.

Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...