HTTP Global SMS API
Sending a Global Message
To send messages globally, create a request that includes:
- End user's number
- Message content
- Whether to receive deliver receipts
You may also need or wish to include your message originator. However, OpenMarket can determine the right originator for your message with automated originator selection.
You do not need to identify the mobile operator in your request — we perform a dynamic operator lookup.
Note: For these specific regions you may need additional XML attributes or JSON name-value pairs in the request: United States, Canada, and India.
Types of message originators you can use
You can use the following message originators:
- Alphanumeric strings
- Short codes
- Virtual mobile numbers (VMNs)
Example message requests
Example using automated originator management
This example relies on OpenMarket to choose the right source address for the message from your available numbers (or alphanumeric strings).
For more information, see Automated Originator Selection.
JSON request
{
"mobileTerminate" : {
"destination": {
"address": "447700900750"
},
"message": {
"content": "This is a text message!",
"type": "text"
},
"delivery": {
"receiptRequested": "final",
"url": "https:my.example.com/receiver.php"
}
}
}
XML request
<?xml version="1.0" encoding="UTF-8"?>
<mobileTerminate xmlns="https://sms.openmarket.com/v4/mt">
<destination address="447700900750" />
<message type="text">
<content>This is a text message!</content>
</message>
<delivery receiptRequested="final" url="https:my.example.com/receiver.php" />
</mobileTerminate>
Example with a short code originator
In this example, a short code is the source address. You must set a value for address, and optionally, a value for ton.
JSON request
{
"mobileTerminate" : {
"destination": {
"address": "447700900750"
},
"source": {
"ton": 3,
"address": "58870"
},
"message": {
"content": "This is a text message!",
"type": "text"
},
"delivery": {
"receiptRequested": "final",
"url": "https:my.example.com/receiver.php"
}
}
}
XML request
<?xml version="1.0" encoding="UTF-8"?>
<mobileTerminate xmlns="https://sms.openmarket.com/v4/mt">
<destination address="447700900750" />
<source ton="3" address="58870" />
<message type="text">
<content>This is a text message!</content>
</message>
<delivery receiptRequested="final" url="https:my.example.com/receiver.php" />
</mobileTerminate>
Example with a VMN originator
In this example, a VMN is the source address. You must set a value for address and interaction (either one-way or two-way), and optionally, a value for ton.
JSON request
{
"mobileTerminate" : {
"interaction": "one-way",
"destination": {
"address": "447700900750"
},
"source": {
"ton": 1,
"address": "447700900999"
},
"message": {
"content": "This is a text message!",
"type": "text"
},
"delivery": {
"receiptRequested": "final",
"url": "https:my.example.com/receiver.php"
}
}
}
XML request
<?xml version="1.0" encoding="UTF-8"?>
<mobileTerminate interaction="one-way" xmlns="https://sms.openmarket.com/v4/mt">
<destination address="447700900750" />
<source ton="1" address="447700900999" />
<message type="text">
<content>This is a text message!</content>
</message>
<delivery receiptRequested="final" url="https:my.example.com/receiver.php" />
</mobileTerminate>
Example with an alphanumeric string
In this example, an alphanumeric string is the source address. You must set a value for address, and optionally, a value for ton.
JSON request
{
"mobileTerminate" : {
"destination": {
"address": "447700900750"
},
"source": {
"ton": 5,
"address": "MyCompanyName"
},
"message": {
"content": "This is a text message!",
"type": "text"
},
"delivery": {
"receiptRequested": "final",
"url": "https:my.example.com/receiver.php"
}
}
}
XML request
<?xml version="1.0" encoding="UTF-8"?>
<mobileTerminate xmlns="https://sms.openmarket.com/v4/mt">
<destination address="447700900750" />
<source ton="5" address="MyCompanyName" />
<message type="text">
<content>This is a text message!</content>
</message>
<delivery receiptRequested="final" url="https:my.example.com/receiver.php" />
</mobileTerminate>