โ01-28-2025 01:28 PM
I'm trying to request a Twilio recording file using Workato's HTTP request. But, I'm getting the following error:
400 Bad Request
<?xml version='1.0' encoding='UTF-8'?>
<TwilioResponse><RestException><Code>20001</Code><Message>Bad request</Message><MoreInfo>https://www.twilio.com/docs/errors/20001</MoreInfo><Status>400</Status></RestException></TwilioResponse>
Below is my request:
{
"request_name": "Request recording file",
"request": {
"method": "GET",
"content_type": "application/json",
"url": "https://api.twilio.com/2010-04-01/Accounts/A_______________________0/Recordings/R___________________..."
},
"response": {
"output_type": "rawdata",
"ignore_http_errors": "false"
}
"wait_for_response": "false"
}
I've got the "Response content type" set to Binary and the Encoding to UTF-8. What am I missing?
Thank you in advance.
BK
Solved! Go to Solution.
a month ago
My issue was that I didn't include in the Request Header the Header name = Content-Type and Value = audio/mpeg. Dumb.
So, for others to get this to work using the HTTP action I used the following settings for our recording which are dual channel:
Request
Method = Get
Request URL = https://api.twilio.com/2010-04-01/Accounts/{accountID}/Recordings/{mediaID}.mp3
Parameter = RequestedChannels: 2
Request Header = Content-Type: audio/mpeg
Response
Response content type: Binary
Encoding: UTF-8
Hope this helps
โ01-28-2025 02:42 PM
I'm not sure if the response is the problem. The 400 error is coming from Twilio, not from Workato, so it seems like the URL is bad.
Some thoughts:
โ01-28-2025 08:49 PM
Hi gary1. Good to "see" you once again. It is a GET from Twilio https://www.twilio.com/docs/voice/api/recording#mp3 it says..
Appending ".mp3" to the URI returns a binary MP3 audio file with mime-type type "audio/mpeg". For example:
โ01-28-2025 09:09 PM - edited โ01-28-2025 09:10 PM
Always happy to help!
I took a look at the documentation and the only thing that sticks out to me is the warning about audio channel availability. Try adding this param to your URL:
?RequestedChannels=1
Like this:
https://api.twilio.com/2010-04-01/Accounts/AC../Recordings/RE...mp3?RequestedChannels=1
Here's a link the warning in the documentation. It reads very much like the issue you're having.
a month ago
gary1,
I used the following since these recordings are dual channel and got the same error message.: