I need to send audio message for a client. I'm using the API like in this link:
<?php
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library
$sid = "ACf2a000728962e9b8135bf456d89cfd7a";
$token = "{{ auth_token }}";
$client = new Services_Twilio($sid, $token);
$client->account->messages->sendMessage("+14158141829", "+15558675309", "Jenny please?! I love you <3", "http://www.example.com/love_words.wav");
The message does not get delivered and I don't get any error message. It works if I'm using text and/or image but not with audio.
How can I send an audio message with Twilio?
Try to set the correct MIME type header in the server where file is allocated Please take a look at this URL https://www.twilio.com/docs/api/rest/accepted-mime-types
If Content is invalid you will see in Twilio portal SMS/MMS logs the following:
Error: 12300 - Invalid Content-Type
For example:
curl -v -O http://www.schiffert.me/select1.wav
Returns:
Content-Type: audio/x-wav
which is invalid
But
curl -v -O http://www.schiffert.me/feedback.mp3
Returns:
Content-Type: audio/mpeg