jgorset / facebook-messenger

Definitely the best way to make Bots on Facebook Messenger with Ruby
MIT License
962 stars 211 forks source link

#<Facebook::Messenger::FacebookError: (#546) The type of file you're trying to attach isn't allowed. Please try again with a different format #221

Closed adeprem closed 6 years ago

adeprem commented 6 years ago

Hi, I'm getting this error when I try to upload a video attachment instead of an audio one. Any idea why?

<Facebook::Messenger::FacebookError: (#546) The type of file you're trying to attach isn't allowed. Please try again with a different format

For info, what's in my code is:

message.reply( attachment: { type: 'audio', payload: { url: 'https://clyp.it/42khxiae.mp3' } } )

I also tried it to do it this way (with the file in a folder) and it was unsuccessful as well

capture d ecran 2018-07-29 a 16 04 25
amrutjadhav commented 6 years ago

@adeprem The file URL i.e. https://clyp.it/42khxiae.mp3 is not a actual mp3 file URL. When you access this URL is redirecting to https://clyp.it/announcement/direct-file-access a HTML page which is not allowed as attachment by the API. So give URL of actual file not the redirecting route. I tested with the actual file URL and it works.

Also you don't have to mention the attachment type as audio/mpeg. Only audio will also work. 😃