Kal
Posts: 0
Joined: Thu May 22, 2014 11:03 pm

Problems using Twilio in Server Code

Ahh! Makes a lot of sense. Thanks so much, Yurii!

Jon Haider
Posts: 0
Joined: Thu Oct 16, 2014 2:53 pm

Problems using Twilio in Server Code

Yurii,
The code that you provided works great, but I've been unable to figure out how to add a mediaURL to this method.

I've tried appending your coderequestBody/code, to where it looks like:
pre
var mediaURL = "https://www.google.com/images/nav_logo242.png";
var requestBody = "From=" + encodeURIComponent(myPhoneNumber) + "&To=" + encodeURIComponent(toPhone) + "&Body=" + encodeURIComponent(body) + "&MediaUrl=" + encodeURIComponent(mediaURL);
/pre

This media url works fine when using the Twilio tester interface.

Any advice?

UPDATE: As always, as soon as I post the question and continue to mess around with things, I got it to work...

The mistake I had was using the sendURL:
pre
var sendURL = "https://api.twilio.com/2010-04-01/Accounts/" + accountSid + "/SMS/Messages.json";
/pre

but you have to remove codeSMS//code from the url to become:
pre
var sendURL = "https://api.twilio.com/2010-04-01/Accounts/" + accountSid + "/Messages.json";
/pre
and it works fine.

Hope this helps the next lad...

Thanks!

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Problems using Twilio in Server Code

Hello Jon,

Thank you for the post and for the update.

Return to “Issues”