cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to get Twilio recording file via Workato HTTP action

JayMappus
Deputy Chef III
Deputy Chef III

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

1 ACCEPTED SOLUTION

JayMappus
Deputy Chef III
Deputy Chef III

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 

View solution in original post

6 REPLIES 6

gary1
Executive Chef III
Executive Chef III

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:

  • Are you sure it's GET and not POST?
  • What should the response be? JSON, XML, data?

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:

gary1
Executive Chef III
Executive Chef III

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.

https://www.twilio.com/docs/voice/api/recording#download-dual-channel-media-file:~:text=Attempting%2... 

gary1,

I used the following since these recordings are dual channel and got the same error message.:

https://api.twilio.com/2010-04-01/Accounts/ACf7bffe0d0ff5ad95892183c895dca950/Recordings/RE28337a199...