SendMessageWithPriorityExtended
Sends an SMS message to the given phone number. Queue priority is set based on Priority parameter.
Priority:
0 - Lowest priority
1 - Low priority
2 - Medium priority
3 - High priority
Messages with a higher priority will be preferred over your normal messages.
const HighPriority = 1;const NormalPriority = 2;const LowPriority = 3;
// uses JQuery libraryvar postUrl = 'https://secure.smsgateway.ca/services/message.svc/' + accountKey + '/' + destinationNumber + '/PriorityExtended/' + NormalPriority;var body = JSON.stringify({ MessageBody: 'Message Body', Reference: 'Reference Number',});$.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/soapconst HighPriority = 1;const NormalPriority = 2;const LowPriority = 3;
class SMSParam { public $CellNumber; public $AccountKey; public $MessageBody; public $Priority;}
$client = new SoapClient('https://secure.smsgateway.ca/sendsms.asmx?WSDL');$parameters = new SMSParam;
$parameters -> CellNumber = destinationNumber;$parameters -> AccountKey = accountKey;$parameters -> MessageBody = "This is a demonstration of SMSGateway.ca using PHP5.";$parameters -> Priority = NormalPriority;
$Result = $client->SendMessageWithPriorityExtended($parameters);?>Enum Priorities High = 1 Normal = 2 Low = 3End EnumDim priority = Priorities.Normal
' Service Reference (SOAP)Using client = New SwiftSMS.SendSMSSoapClient Dim response = client.SendMessageWithPriorityExtended(destinationNumber, messageBody, accountKey, reference, Convert.ToInt32(priority))End Using
' WebClient (REST)Dim url = String.Format("https://secure.smsgateway.ca/services/message.svc/{0}/{1}/PriorityExtended/{2}", accountKey, destinationNumber, Convert.ToInt32(priority))Dim body = String.Format("{{ ""MessageBody"": ""{0}"", " & _ " ""Reference"" : ""{1}"", " & _ " ""Priority"" : {2} }}", messageBody, reference, Convert.ToInt32(priority))
Using wClient = New Net.WebClient wClient.Encoding = New UTF8Encoding() wClient.Headers.Add("content-type", "application/json")
Dim wResponse = wClient.UploadString(url, body)End Using
End SubHTTP POST:curl -H "Content-Type: application/json" -X POST \ "https://secure.smsgateway.ca/services/message.svc/[accountKey]/[destination]/PriorityExtended/[priority]" \ --data "{\"MessageBody\": \"[messageBody]\", \"Reference\": \"[reference]\" }"// Priority Enumprivate enum Priorities{ High = 1, Normal = 2, Low = 3}
const Priorities priority = Priorities.Normal;
// Service Reference / SOAPusing (var client = new SwiftNew.SendSMSSoapClient()){ var response = client.SendMessageWithPriorityExtended(destinationNumber, messageBody, accountKey, reference, (int)priority);
}
// Web Client / RESTdynamic body = new ExpandoObject();body.MessageBody = "Message Body";body.Reference = "Reference Number";
var url = string.Format("https://secure.smsgateway.ca/services/message.svc/{0}/{1}/PriorityExtended/{2}", accountKey, destinationNumber, (int)priority);
using (var wClient = new System.Net.WebClient()){ wClient.Encoding = Encoding.UTF8; wClient.Headers.Add("content-type", "application/json");
string response = wClient.UploadString(url, Newtonsoft.Json.JsonConvert.SerializeObject(body));}HTTP Request
POST:
/services/message.svc/:accountKey/:destinationNumber/PriorityExtended/:priority| Parameter | Required | Location |
|---|---|---|
| AccountKey | Your Swift SMS Gateway account key | URL |
| DestinationNumber | Cell number to receive the text message | URL |
| Priority | Priority of message. 1 = High 2 = Normal 3 = Low | URL |
| MessageBody | Body of the message to send | BODY |
| Reference | Internal Reference ID | BODY |
Returns
SMSSendMessageResponse
See (SendMessageExtended) for more details.