Message


Click here for a complete list of operations.

Send


Sends a text message or email.

Parameter
Notes
Username: 
Password: 
MessageType:Provide an array of strings containing message types. There must be one message type per destination. MessageType can be set to the following:
  • 1 = Email.
  • 2 = Text.
  • 3 = Email and Text.
Message type Email and Text can only be used with a corresponding DestinationType of Group.
DestinationType:Provide an array of strings containing destination types. There must be one destination type per destination. DestinationType can be set to the following:
  • 1 = Individual.
  • 2 = Group.
Destination:Provide an array of strings containing destinations. Destination can be set to a valid mobile device number, an email address or a group name. This value must correspond to the value of the DestinationType parameter in order to be valid.
Message:This message can be as long as you want. However for every message up to 145 characters, for messages longer than 160 characters, you will be charged one credit if you send it using a MessageType of Text.
DateToSend:Provide a date/time object that represents the date/time that you want the message to be sent. If you want your message to be sent immediately set this parameter to null.
Header:Provide a string header that represents the destination that the end user will recieve on there phone once the SMS has been received.
Reference:Provide a unique string reference. This can be used later to find a batch of messages you have sent. The maximum length of this parameter is 64 characters. If you do not want to have a reference set this parameter to null.
EmailSubject:This is optional if you are sending an email. If you do not set this parameter your email will not have a subject. If you do not need this set the parameter to null.
MessagesSent:Provide an integer data type output parameter. This will be populated with the number of messages sent.
AnyTimeBalance:Provide a decimal data type output parameter. This will be populated with the account's current anytime balance after the messages have been sent.
OffPeakBalance:Provide a decimal data type output parameter. This will be populated with the account's current off peak balance after the messages have been sent.
ResultText:E.g. 2 messages were sent. You have 98.0 credits, 10.0 off peak credits remaining.
Code: 

Test

The test form is only available for methods with primitive types as parameters.

SOAP 1.1

The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.

POST /WebServices/2.2/Complex/Message.asmx HTTP/1.1
Host: www.2sms.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.2sms.com/WebServices/2.2/Complex/Send"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Send xmlns="http://www.2sms.com/WebServices/2.2/Complex/">
      <Username>string</Username>
      <Password>string</Password>
      <MessageType>
        <string>string</string>
        <string>string</string>
      </MessageType>
      <DestinationType>
        <string>string</string>
        <string>string</string>
      </DestinationType>
      <Destination>
        <string>string</string>
        <string>string</string>
      </Destination>
      <Message>string</Message>
      <DateToSend>dateTime</DateToSend>
      <Header>string</Header>
      <GUID>string</GUID>
      <emailSubject>string</emailSubject>
      <MessagesSent>int</MessagesSent>
      <AnyTimeBalance>decimal</AnyTimeBalance>
      <OffPeakBalance>decimal</OffPeakBalance>
      <ResultText>string</ResultText>
      <Code>string</Code>
    </Send>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SendResponse xmlns="http://www.2sms.com/WebServices/2.2/Complex/">
      <SendResult>string</SendResult>
      <MessagesSent>int</MessagesSent>
      <AnyTimeBalance>decimal</AnyTimeBalance>
      <OffPeakBalance>decimal</OffPeakBalance>
      <ResultText>string</ResultText>
      <Code>string</Code>
    </SendResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.

POST /WebServices/2.2/Complex/Message.asmx HTTP/1.1
Host: www.2sms.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?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>
    <Send xmlns="http://www.2sms.com/WebServices/2.2/Complex/">
      <Username>string</Username>
      <Password>string</Password>
      <MessageType>
        <string>string</string>
        <string>string</string>
      </MessageType>
      <DestinationType>
        <string>string</string>
        <string>string</string>
      </DestinationType>
      <Destination>
        <string>string</string>
        <string>string</string>
      </Destination>
      <Message>string</Message>
      <DateToSend>dateTime</DateToSend>
      <Header>string</Header>
      <GUID>string</GUID>
      <emailSubject>string</emailSubject>
      <MessagesSent>int</MessagesSent>
      <AnyTimeBalance>decimal</AnyTimeBalance>
      <OffPeakBalance>decimal</OffPeakBalance>
      <ResultText>string</ResultText>
      <Code>string</Code>
    </Send>
  </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?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>
    <SendResponse xmlns="http://www.2sms.com/WebServices/2.2/Complex/">
      <SendResult>string</SendResult>
      <MessagesSent>int</MessagesSent>
      <AnyTimeBalance>decimal</AnyTimeBalance>
      <OffPeakBalance>decimal</OffPeakBalance>
      <ResultText>string</ResultText>
      <Code>string</Code>
    </SendResponse>
  </soap12:Body>
</soap12:Envelope>