Example Text, WAP Push and Binary Messages

You can send the following types of SMS messages: text, WAP Push, and binary. The content of your message is set in the message element/object.

Sending plain text messages

To send a text message, you need to specify:

  • type — Set to "text".
  • content — The text of your message. Send this in UTF-8.

In these examples, you can see how text is set in the message.

JSON example for plain text (to UK number)

{
   "mobileTerminate" : {
      "destination": {
         "address": "447700900765"
      },
      "source": {
         "address": "ACME123",
         "ton" : 5
      },
      "message": {
         "type": "text",
         "content": "Remarkable bird, the Norwegian Blue!"
      }
   }
}

XML example for plain text (to US number)

<?xml version="1.0" encoding="UTF-8"?>
<mobileTerminate xmlns="https://sms.openmarket.com/v4/mt">
   <options programId="1234" />
   <destination address="12515550123" mobileOperatorId="383" />
   <source ton="3" address="222111" />
   <message type="text">
      <content>Norwegian Blues stun easily, major.</content>
   </message>
</mobileTerminate>

Hexadecimal-encoding option

Some existing customers may prefer to continue sending hexadecimal-encoded text to us. This supports including your own UDH, which you can use to manually create multipart messages, if desired. To send a request, you need to specify:

  • type — Set to "hexEncodedText" .
  • charset — You must include this to identify the character set/encoding that you have used for the text (GSM, Latin-1, UTF-8, or UTF-16).
  • content — Your hexadecimal-encoded text.
  • udh — Include if your message has a User Data Header.

JSON example for plain text (to UK number)

{
   "mobileTerminate" : {
      "destination": {
         "address": "447700900765"
      },
      "source": {
         "address": "ACME123"
      },
      "message": {
         "type": "hexEncodedText",
         "charset": "UTF-16",
         "content": "5472757374206E6F2D6F6E652E",
         "udh": true
      }
  }
}

XML example for hex-encoded text (to US number)

<?xml version="1.0" encoding="UTF-8"?>
<mobileTerminate xmlns="https://sms.openmarket.com/v4/mt">
   <options programId="1234" />
   <destination address="12515550123" mobileOperatorId="383" />
   <source ton="3" address="222111" />
   <message type="hexEncodedText" charset="UTF-16" udh="true">
      <content>5472757374206E6F2D6F6E652E</content>
   </message>
</mobileTerminate>

Sending WAP Push messages

A WAP Push uses an SMS message to deliver a hyperlink. The message body also contains any text message you'd like to add.

To send a WAP Push message, you need to specify in your request:

  • type — Set to "wapPush"
  • content — Any text you want included in the message. Send this in UTF-8.
  • url — The URL that you want as a hyperlink.

The two examples below deliver this message:

An example WAP Push message

Note that not all mobile operators support WAP Push messages.

JSON example (to UK number)

{
   "mobileTerminate" : {
      "destination": {
         "address": "447700900765"
      },
      "source": {
         "address": "ACME123"
      },
      "message": {
         "type": "wapPush",
         "content": "Claim a free coffee now!",
         "url": "https://www.example.com/coffee"
      }
   }
}

XML example (to US number)

<?xml version="1.0" encoding="UTF-8"?>
<mobileTerminate xmlns="https://sms.openmarket.com/v4/mt">
   <options programId="1234" />
   <destination address="12515550100" mobileOperatorId="383" />
   <source ton="3" address="222111" />
   <message type="wapPush" url="https://www.example.com/coffee">
      <content>Claim a free coffee now!</content>
   </message>
</mobileTerminate>

Sending binary messages

Binary SMS messages enable you to send rich content rather than an SMS message. These are commonly used for "over the air" installation messages or other information to a specific port or application on the end user's mobile phone.

To send a binary message, you need to specify in your request:

  • type — Set to "binary"
  • content — The binary content in hexadecimal
  • udh — Include if your message has a User Data Header

JSON example (to UK number)

{
   "mobileTerminate" : {
      "destination": {
         "address": "447700900765"
      },
      "source": {
         "address": "ACME123"
      },
      "message": {
         "type": "binary",
         "content": "0741524745543a20506c",
         "udh": true
      }
   }
}

XML example (to US number)

<?xml version="1.0" encoding="UTF-8"?>
<mobileTerminate xmlns="https://sms.openmarket.com/v4/mt">
   <options programId="1234" />
   <destination address="12515550123" mobileOperatorId="383" />
   <source ton="3" address="222111" />
   <message type="binary" udh="true">
      <content>0741524745543a20506c</content>
   </message>
</mobileTerminate>