SMS Message with Twilio and media using MediaUrl

I am submitting an SMS via Twilio’s SMS API . Each time I try to send a message with the MediaUrl parameter I get the the following response:

{
“code”: 21620,
“message”: “Invalid media URL(s)”,
“more_info”: “https://www.twilio.com/docs/errors/21620”,
“status”: 400
}

I have tried using PostMan as well with the same results. It doesn’t seem to like the way that the array is formatted even though it follows the same format of the Twilio documentation.

[“https://somesite.com/media/HR/65-652943_banner-stock-cartoon-girls-clipart-cartoon-people-happy.png”,”https://somesite.com/media/HR/android-chrome-192×192.png”]

I have tried a single element array, wrapping the JSON string in single quotes, removing the brackets entirely, but no matter what I try It still tells me that I have an “Invlaid media URL(s)” error.

My Postman configuration is below.

Postman screenshot

I’ve tried using the option for x-www-form-urlencoded instead of form-data as well with the same results.

This should be a simple fix but I am just not seeing it. If anyone else can shed any light on the subject it would be much appreciated. I am using Coldfusion to make the API call but if I can figure this out through Postman I think I can get it going in CF.

  • Is the somesite.com address returning a valid mime-type? A web server might be returning application/octet-stream for binary data which is not support: twilio.com/docs/messaging/guides/accepted-mime-types

    – 

  • Thanks for bringing that to my attention. I have forced it to return the correct content-type and verified but I still get the same error.

    – 

  • Twilio can only do MMS to US or Canada phone numbers. Are you dialing a US or Canada phone number? Next question, can you open the URL in an browser window without authenticating (i.e. in an incognito window)? Is the HTTPS certificate valid? Not sure if you noticed but the first url mixes hyphen – with underscore _ in the url. Should it be 65-652943-banner-stock …

    – 

  • Yes, the number I am testing with is a US number. All other texts that I send are received, it is only when I add the MediaUrl that I get the error. Yes, the URL is a public URL and I can access both of the images without authenticating. Here are the actual URLs to the images: [ “portal.lindsey.edu/apps/raiderText/media/HR/…“, “portal.lindsey.edu/apps/raiderText/media/HR/…” ]

    – 

Leave a Comment