Skip to content

SendMessage

Sends an SMS message to the given phone number. Returns Message queued successfully on success, or an error message on fail.

// uses JQuery library
var postUrl =
'https://secure.smsgateway.ca/services/message.svc/' +
accountKey +
'/' +
destinationNumber;
var body = JSON.stringify({
MessageBody: 'Message Body',
});
$.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);
});

HTTP Request


POST:

https://secure.smsgateway.ca/services/message.svc/:accountKey/:destinationNumber

GET:

/SendSMS.aspx?CellNumber=[destinationNumber]&AccountKey=[accountKey]&MessageBody=[messageBody]

ParameterDescriptionLocation
AccountKeyYour Swift SMS Gateway account keyURL
DestinationNumberCell number to receive the text messageURL
MessageBodyBody of the message to sendBODY

Returns

string
MessageDescription
Message queued successfullyYour message has been queued and will be sent.
Cell number is invalidThe cell number was not supplied or was too short.
The account key parameter was not validThe account key was not supplied or or was less than 9 characters.
This account is disabledThe specified account has been disabled by our administrator for violating one or more of our policies.
Account key not foundThe specified account key cannot be found. Please verify the key and try again.
There are no messages remaining on this accountYou will need to purchase additional messages.
No authorized credit plan found to match this phone number. Please check the number, and ensure you are authorized to send messages to this regionBy default, accounts are authorized to send to certain countries only. Please contact us to find out how to send to other regions.
Credit rule not foundYou attempted to send a message to a region you do not have permission to. Please contact your account manager to check regions. - Message will not be sent
Message content is not acceptable, message not sentPlease contact us for details
Time of day at destination falls outside the established time restrictions for your account, message not sent.For Enterprise level accounts only - optional time-of-day windows can be created to restrict sending.