SMS Messaging API

Send text messages to one or more recipients. Please read API General Reference before reading this document.

Definitions

  • Action: sms.message.send
  • HTTP Method: POST
  • Content-Type: application/json

Request Parameters

NameTypeRequiredDescriptionExample
tostring | string[]YesRecipient's phone number, using E.164 format+8618658000123
signaturestringYesSMS sender, 2-16 charactersUnimatrix
contentstringNoSMS body text, either templateId or content is required701522 is your verification code, valid for 10 minutes.
templateIdstringNoSMS template ID or custom template code, either templateId or content is requiredpub_verif_en_ttl
templateDataJSONNoTemplate variables{"code": "701522", "ttl": "10"}

* Note: To help developers migrate quickly, Unimatrix supports passing text directly using the content parameter, and new integrate users are recommended to use templateId to pass the parameter.

Request Example

curl -X POST 'https://api.unimtx.com/?action=sms.message.send&accessKeyId=YOUR_ACCESS_KEY_ID' \
-H 'Content-Type: application/json' \
-d '{
  "to": "1865800xxxx",
  "signature": "Unimatrix",
  "templateId": "pub_verif_basic",
  "templateData": {"code": "3241", "ttl": "10"}
}'

Response Parameters

NameTypeDescriptionExample
codestringReturn code105400
messagestringReturn messageInsufficientFunds
dataJSONResults

Results data

NameTypeDescriptionExample
recipientsintegerNumber of recipients1
messageCountintegerTotal number of billing messages1
totalAmountstringTotal consumption amount0.045000
messagesJSON[]Sent messages details

Messages data.messages

NameTypeDescriptionExample
idstringMessage IDc9159d19f394833327e43c8e7285a6b3
tostringRecipient's phone number (E.164)+8618658000123
isostringCountry code (iso2)CN
ccstringCountry code (International call prefix)86
countintegerBilling message count1
pricestringConsumption amount0.040000

Response Examples

Successful response example

Status Code: 200, Response Body:

{
  "code": "0",
  "message": "Success",
  "data": {
    "recipients": 2,
    "messageCount": 2,
    "totalAmount": "0.187500",
    "messages": [
      {
        "id": "4e88293e50aac21d027a9d6c0f33661e",
        "to": "+8618658000123",
        "iso": "CN",
        "cc": "86",
        "count": 1,
        "price": "0.050000"
      },
      {
        "id": "ce02a6c4195c6f8c4b6a7250ccb3b0a1",
        "to": "+12894260331",
        "iso": "CA",
        "cc": "1",
        "count": 1,
        "price": "0.137500"
      }
    ]
  }
}

Failure response example

Status Code: 400, Response Body:

{
  "code": "105400",
  "message": "InsufficientFunds"
}