Reputation: 213
I am facing a problem when I try to send multiple images in a single MMS. Even their documentation is not clear. I couldn't find an example online showing the same.
Upvotes: 0
Views: 1836
Reputation: 732
According to their documentation about MMS
Up to 10 images that together total no more than 5mb can be sent at one time. MMS is also only available in the US and Canada.
You can pass the images by using an array like so.
URL method: (urls have to be publicly accessible)
<?php
// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once '/path/to/vendor/autoload.php';
use Twilio\Rest\Client;
// Find your Account Sid and Auth Token at twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$twilio = new Client($sid, $token);
$mediaUrls = array("https://demo.twilio.com/owl.png", "url2", "url3", "url4");
$message = $twilio->messages
->create("+12316851234", // to
array(
"body" => "Hello there!",
"from" => "+15555555555",
"mediaUrl" => $mediaUrls
)
);
print($message->sid);
Documentation:
https://www.twilio.com/docs/sms/api/media-resource
More information about this here https://www.twilio.com/docs/sms/tutorials/how-to-send-sms-messages-php
Upvotes: 2