Form-Data Array Value Bubble API Connector to Twilio API

I’m working with the Twilio API and need to send an array of URLs in the value of the “MediaUrl” parameter. The API is not accepting the value no matter how I structure the array though. I thought it was a Twilio problem, but now I’m thinking it might be an issue with how I’m setting up the API Connector.

I’ve tried the following:

Key: MediaUrl
Value: [‘’,'’]

I’ve also tried just dynamically putting an array directly into the field from my database.

No matter what I do I always get this error:

If I just put in a plain URL the call works fine, I just can’t seem to figure out how to send the array. This is what the Twilio API docs say on it:

Any ideas on what I’m doing wrong?

I may be wrong but what I read and understand from the doc is not to send an array but to send the mediaurl parameter multiple time (one for each file)

Do you have link to doc?

Here is the doc:

That is what I though first as well, and so I initially set up the call that way, but it only accepted the first “MediaUrl” parameter it found and simply ignored the rest. From what I understand they want a single MediaUrl “parameter” with multiple “values”. I assumed multiple values means an array, but maybe I’m wrong.

Try this: Body type = json
In the json body do that


Fill the field created under the body part with the same value you currently have in form-data

So weird thing about Twilio API, it does not accept a json body in a call. If you send a json body, you get a 400 response saying it is missing required parameters (Because it doesn’t recognize them in the json). So all all API calls have to be sent with the form-data body type.

You are not sending a JSON body the way I tell you.
Be sure to add the Content-type for url encoded in header

Ok so this is sooo close!

I got Twilio to accept the call, but turns out you were right and according to Twilio support (and the tests I ran) the multiple Urls need to be sent in separate parameters (not as a list).

So taking this into account, the body looks like this:


This call WORKS, but only if ALL the MediaUrl parameters have a URL in them. If I want to send a message with just one piece of media (instead of 10) I get a error response that the values are null and therefore invalid.

Now, I could create 11 different calls in API connector and call the one with the right number of parameters depending on the number of images being sent from my app, but that’s a bit of a mess. Is there anyway to set up the body so that the MediaUrl parameters are optional the way that you can make them if they are a regular parameter in API connector?

Here’s what you can try:
MediaUrl= only once
Fill this field with: image’s file url:join with
And for the with you use &MediaUrl=

1 Like

Genius. I went with “Format as list” instead of “Join With” but same idea.

So to summarize:

  1. Set a header with key: Content-Type and value: application/x-www-form-urlencoded

  2. Use “json” body type

  3. Use following in body (I added status callback since previous messages, it is unrelated to solution):

> Body=<body>&From=<from>&To=<to>&StatusCallback=<callbackurl>&MediaUrl=<mediaurl>

  1. In workflow when adding dynamic content to the variable, use “Format as Text” as follows:

The way this works, if there is more than 1 Url in the list than “&MediaUrl=” will get added in front of each entry.

I still have to have a seperate call for texts only without images, but that is a minor inconvenience.

Thanks for all the help!

1 Like

Followup problem I’m facing.

The above works for a file with no spaces, but if the uploaded file contains a space then the API hits an error. I tried finding and replacing any spaces in the URL with %20 or + but Twilio still doesn’t accept it, I get a 400 response that the URL is invalid.

According to their support team sending an encoded URL should work, but somehow the encoded URL I’m sending is get decoded before it gets process by the API.

Any ideas?

Has anyone had any luck on dealing with the spaces?

I found another post with a possible workaround and I wanted to share it with all of you because it works!

If you do a find and replace on the file URLs replacing %20 with %2520 (the %25 is the percent sign in URL encoding land) and then do the delimiter change per AJ’s response, it works like a champ.

1 Like