Skip Navigation Links.
展开 最小化

SpreadWebServcie.SendMMS Method

Send transactional/marketing MMS. It creates a MMS campaign.

Parameters

Parameter Type Description Transactional Promotional
loginEmail String The login email of your Spread account Required Required
apiKey String The API Key of your Spread account (see: How to get API account and key in Spread?) Required Required
subject String The subject of MMS. Required Required
mmsContent String The content of MMS. Required Required
imageBase64String Base64String The image of MMS. Format: base64 string. Optional Optional
sender String The sender of MMS.
Keep this parameter null unless your account is configured with a sender.
Optional Optional
schedule DateTime Scheduled delivery time for MMS campaigns. The past time will be sent immediately.
Format: yyyy-MM-ddTHH:mm:ss. Timezone: UTC +08:00.
Promotional MMS will be sent according to this time, and transactional MMS will be sent immediately.
Required Required
campaignStatus CampaignStatus The status of MMS campaign. (Waiting or Draft for promotional MMS) Required Required
phoneSubscribers String[] The phone number of Subscribers.
Transactional MMS fills in this parameter value, otherwise it is null.
Required Null
category String[] The names of target subscriptions.
Promotional MMS fills in this parameter value, otherwise it is null.
Null Required

Fill in only one of the parameters phoneSubscribers and category, and leave the other null.

Return Value

Integer or Exception. If it success, it will return the campaign Id (more than 0), otherwise it will return Exception.

Please find the details for the return message in the following table.

HTTP status code Retrun Message Status/Situation
200 The campaign Id. It should be more than 0. Send MMS successfully or create the MMS campaign successfully.
200 Return a number equals or less than 0. Fail to send MMS.
500 Parameters loginEmail, apiKey, subject and mmsContent cannot be empty! Parameters loginEmail, apiKey, subject or mmsContent, one or more is empty, please fill in all required parameters.
500 Parameters phoneSubscribers and category cannot all be empty! Fill in one of the parameters phoneSubscribers and category.
500 Spreader Email and Password not match! Please check if the parameters loginEmail and apiKey are filled in incorrectly, and check the API Url (FAQ)
500 This user has expired! The account is expired, please activate it.
500 Error Sender! xxxx Leave this parameter empty, unless your account is configured with sender. Or, the sender in the account does not contain xxxx, please change it to the correct one.
500 Please contact us at spread@reasonables.com to get SMS service. MMS service is not set up for this account, please contact the administrator to set it up.
500 Invalid phone number 00000 in phoneSubscribers! Parameter phoneSubscribers value 00000 is invalid format.
500 Spread MMS only supports 852 and 853 MMS service only supports phone numbers with area codes 852 and 853
500 No MMS message credit! There is no MMS credit in the account.
500 Image Upload to Access You Failed! Failed to upload image
500 Create MMS campaign fail! failInformation
500 The service comes error! Other error, please contact a technician.
500 Return a exception. Other Exception

Example

string loginEmail = "Spread@reasonables.com";
string apiKey = "TEST0000-TEST-0000-TEST-0000TEST0000";
string subject = "Test MMS 6";
string mmsContent = "Test MMS 6";
string imageLocalPath = @"D:\Documents\test.png";
string imgBase64String = Convert.ToBase64String(System.IO.File.ReadAllBytes(imageLocalPath));
string imageBase64String = System.Web.HttpUtility.UrlEncode(imgBase64String);
string sender = "";
string[] phoneSubscribers = new string[] { "85212341234", "85298769876" };
string[] category = { "" };
string campaingId = spreadAPI.SendMMS(loginEmail, apiKey, subject, mmsContent, imageBase64String, sender, DateTime.Now, CampaignStatus.Waiting, phoneSubscribers, category);
Dim loginEmail As String = "Spread@reasonables.com"
Dim apiKey As String = "TEST0000-TEST-0000-TEST-0000TEST0000"
Dim subject As String = "Test MMS 6" 
Dim mmsContent As String = "Test MMS 6" 
Dim imgBase64String As String = Convert.ToBase64String(IO.File.ReadAllBytes(imageLocalPath))
Dim imageBase64String As String = System.Web.HttpUtility.UrlEncode(imgBase64String) 
Dim sender As String = "Spread" 
Dim schedule As String = "2022-06-15T14:50:50" 
Dim campaignStatus As String = "Waiting" 
Dim phoneSubscribers As String() = { "85212341234" } 
Dim category As String() = {""} 
Dim postData As String = "loginEmail=" & loginEmail 
postData &= "&apiKey=" & apiKey 
postData &= "&subject=" & subject 
postData &= "&mmsContent=" & mmsContent 
postData &= "&imageBase64String=" & imageBase64String 
postData &= "&sender=" & sender 
postData &= "&schedule=" & schedule 
postData &= "&campaignStatus=" & campaignStatus 

For Each phone In phoneSubscribers 
    postData &= "&phoneSubscribers=" & phone 
Next 

For Each c In category 
    postData &= "&category=" & c 
Next 

Dim webRequest As WebRequest = WebRequest.Create("{{YOUR_API_URL}}/SendMMS") 
webRequest.ContentType = "application/x-www-form-urlencoded" 
webRequest.Method = "POST" 
Dim bytes() As Byte = Encoding.UTF8.GetBytes(postData) 
Dim os As Stream = Nothing 
webRequest.ContentLength = bytes.Length 
os = webRequest.GetRequestStream() 
os.Write(bytes, 0, bytes.Length) 
os.Close() 

Dim webResponse As WebResponse 
webResponse = webRequest.GetResponse() 
Dim sr As StreamReader = New StreamReader(webResponse.GetResponseStream()) 
Return sr.ReadToEnd().Trim()
No sample for PHP.
POST {{YOUR_API_URL}}/service.asmx 

Content-Type: application/soap+xml; charset=utf-8
Content-Length: {{length}}

<!-- Send Transactional MMS HTTP Body -->
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <SendMMS xmlns="http://service.reasonablespread.com/">
      <loginEmail>Spread@reasonables.com</loginEmail>
      <apiKey>TEST0000-TEST-0000-TEST-0000TEST0000</apiKey>
      <subject>Test</subject>
      <mmsContent>Test</mmsContent>
      <imageBase64String>iVBORw0KGgoAAAANSUhEUgAA</imageBase64String>
      <sender></sender>
      <schedule>2022-12-20T14:50:50</schedule>
      <campaignStatus>Waiting</campaignStatus>
      <phoneSubscribers>
        <string>85212345678</string>
        <string>85212345679</string>
      </phoneSubscribers>
      <category></category>
    </SendMMS>
  </soap12:Body>
</soap12:Envelope>

<!-- Send Promotional SMS HTTP Body -->
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <SendMMS xmlns="http://service.reasonablespread.com/">
      <loginEmail>Spread@reasonables.com</loginEmail>
      <apiKey>TEST0000-TEST-0000-TEST-0000TEST0000</apiKey>
      <subject>Test</subject>
      <mmsContent>Test</mmsContent>
      <imageBase64String>iVBORw0KGgoAAAANSUhEUgAA</imageBase64String>
      <sender></sender>
      <schedule>2022-12-20T14:50:50</schedule>
      <campaignStatus>Waiting</campaignStatus>
      <phoneSubscribers></phoneSubscribers>
      <category>
          <string>subscriptionName</string>
          <string>contactListName</string>
      </category>
    </SendMMS>
  </soap12:Body>
</soap12:Envelope>
        

See Also