SendMultimediaMessage
An MMS message is a multimedia message such as an image, video or audio file. If the recipient’s phone supports MMS, this rich content will appear in line with other text messages.
For us to send MMS, the content must be hosted on the Internet and you must supply a URL to retrieve the content. Please confirm the validity of the content before sending. If the content cannot be downloaded, the recipient will not receive the message. We are unable to determine this upon sending and will still need to charge for the message.
Swift recommends keeping your media sizes to no larger than 3 MB. This helps ensure compatibility with most carriers. MMS also supports a wide variety of media types, including (but not limited to):
- JPG
- GIF
- HEIC
- VCARD
// uses JQuery libraryvar postUrl = "https://secure.smsgateway.ca/services/message.svc/" + accountKey + "/" + destinationNumber = "/MMS";var body = JSON.stringify({ URLOfContent = "http://location.of/mms_image.jpg"});$.ajax({ url: postUrl, method: "POST", contentType: "application/json;charset=UTF-8", data: body}).done(function(response) { alert(response);}).error(function (xhr, textStatus, errorThrown) { alert (xhr.responseText);});<?php// using SOAP Module - http://ca3.php.net/soap
class SMSParam { public $CellNumber; public $AccountKey; public $ContentURL;}
$client = new SoapClient('https://secure.smsgateway.ca/sendsms.asmx?WSDL');$parameters = new SMSParam;
$parameters -> CellNumber = destinationNumber;$parameters -> AccountKey = accountKey;$parameters -> ContentURL = "http://location.of/mms_image.jpg";
$Result = $client->SendMultimediaMessage($parameters);?>' Service Reference (SOAP)Using client = New SwiftSMS.SendSMSSoapClient Dim response = client.SendMultimediaMessage(destinationNumber, "http://location.of/mms_image.jpg", accountKey)End Using
' WebClient (REST)Dim url = String.Format("https://secure.smsgateway.ca/services/message.svc/{0}/{1}/MMS", accountKey, destinationNumber)Dim body = String.Format("{{ ""URLOfContent"": ""http://location.of/mms_image.jpg"" }}")
Using wClient = New Net.WebClient wClient.Encoding = New UTF8Encoding() wClient.Headers.Add("content-type", "application/json")
Dim wResponse = wClient.UploadString(url, body)End UsingHTTP POST:curl -H "Content-Type: application/json" -X POST \ "https://secure.smsgateway.ca/services/message.svc/[accountKey]/[destination]/MMS" \ --data "{ \"URLOfContent\": \"http://location.of/mms_image.jpg\" }"// Service Reference / SOAPusing (var client = new SwiftSMS.SendSMSSoapClient()){ var response = var response = client.SendMultimediaMessage(destinationNumber, "http://location.of/mms_image.jpg", accountKey);}
// Web Client / RESTdynamic body = new ExpandoObject();body.URLOfContent = "http://location.of/mms_image.jpg";
var url = string.Format("https://secure.smsgateway.ca/services/message.svc/{0}/{1}/MMS", accountKey, destinationNumber);
using (var wClient = new System.Net.WebClient()){ wClient.Encoding = Encoding.UTF8; wClient.Headers.Add("content-type", "application/json");
var response = wClient.UploadString(url, Newtonsoft.Json.JsonConvert.SerializeObject(body));}HTTP Request
POST:
/services/message.svc/:accountKey/:destinationNumber/MMS| Parameter | Description | Location |
|---|---|---|
| AccountKey | Your Swift SMS Gateway account key | URL |
| DestinationNumber | Cell number to receive the text message | URL |
| URLOfContent | Fully qualified URL to the image to send via MMS | BODY |
Returns
string
See (SendMessage) for more details.
This method may also return
| Response | Description | >
|---|---|
| Cannot send MMS outside Canada and US | At this time, we only support sending MMS to Canada and the United States |