I am building a chatbot on whatsapp using twilio. One step is to send an .ogg (or other audio format such as mpeg) file to whatsapp as a reply. However, it fails to receive the message on whatsapp. When I change the .ogg file to an image file (such as .png) it is successful. One twilio documents (https://www.twilio.com/docs/sms/accepted-mime-types), it says .ogg (or .mpeg) is accepted. So what is the problem?
to_num = request.values.get('From', '')
from_num = request.values.get('To', '')
message = client.messages.create(
from_= from_num,
body= "test",
media_url= "https://the_file_link.ogg",
to= to_num
)
expecting to receive audio in whatsapp. When sending text and image, it is ok. When sending text and audio, it fails.
I had the same error sending an ogg file! I went into twilio console to check the logs and I saw this error/warning:
Didn't have luck trying with that error code. But then reading the documentation I saw this;
Since I was using pydub, specifying the desired codec solved the issue;