Enzo Matrix Posted March 30, 2021 Report Share Posted March 30, 2021 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. Quote Link to comment Share on other sites More sharing options...
Enzo Matrix Posted March 30, 2021 Author Report Share Posted March 30, 2021 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. Quote Link to comment Share on other sites More sharing options...
Enzo Matrix Posted March 30, 2021 Author Report Share Posted March 30, 2021 Just want to point out that I don't specifically think this was now an issue with upgrading - I think Twilio may have changed their API. Quote Link to comment Share on other sites More sharing options...
Vodia PBX Posted March 31, 2021 Report Share Posted March 31, 2021 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.