ANTS API SPECIFICATION
English v1.0.0
English v1.0.0
  • INTRODUCTION
  • ACCOUNT
  • SMS
    • Send Message
    • Callback Delivery Report
    • Message Logs
    • Preview Message
    • Sender List
    • Status and Error codes
  • OTP (One Time Password)
  • SMS 2 WAY Interactive
Powered by GitBook
On this page

Was this helpful?

  1. SMS

Send Message

Send advanced SMS with all available features and parameters. 99% of all use cases can be achieved by using this API method :)

PreviousSMSNextCallback Delivery Report

Last updated 4 years ago

Was this helpful?

Everything from sending a simple single message to a single destination, up to batch sending of personalized messages to the thousands of recipients with a single API request. Language, transliteration, scheduling and every advanced feature you can think of is supported.

Sequence Diagram

You can start creating HTTP request as this following:

Name

Description

HTTP Request (URL):

HTTP Headers

Content-Type: application/json

Authorization: (Basic Auth) Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

HTTP Methods

POST

Request body requires Parameters as these following

Parameters

Type

Description

bulkId

(optional)

String (50)

The ID which uniquely identifies the request. Bulk ID will be received only when you send a message to more than one destination address.

messages

Array (11)

Set of information of sending messages

from

String (11)

Represents a sender ID which can be alphanumeric or numeric (maximum 11 characters, space is not allowed. Example: from = ANTS

destinations

Array (500)

The array of message destination addresses. If you want to send a message to one destination, a single String is supported instead of an Array (recommend up to 500 numbers per 1 bulk request). Destination addresses must be in international format Example: to = 6698336789

to

Strings

The destination mobile number for your message. It must be international format. Example: to = 6698336789

messageId

(optional)

String (200)

The ID that uniquely identifies the message sent.

text

String(1600)

Text of the message that will be sent

Example: text = Hello, ANTS world :)

shorturl

(optional)

String(y or n)

Use URL shorten function

Example : shorturl = "y"

notifyUrl

(optional)

String (150)

Example: notifyUrl=https//www.example.com

notifyContentType

(optional)

String (50)

Preferred Delivery report content type of delivery report to application/json Example: notifyContentType=application/json

sendAt

(optional)

DateTime

Date and time when the message is to be sent, used for scheduling SMS in the future

Format: 01/01/2020 09:00

callbackData

(optional)

String(1000)

Specifies the value to return. When specified, notifyUrl will also return this callbackData.

The JSON request will look like:

{
    "bulkId": "75108ada-ffa3-4577-8ff1-db2a4690ccbd",
    "messages": [
        {
            "from": "ANTS",
            "destinations": [
                {
                    "to": "66123456789",
                    "messageId": "25501288135972440649"
                }
            ],
            "text": "สวัสดี Hello ANTS Word",
            "shorturl" : "n",
            "notifyUrl": "https://www.callback.ants.co.th",
            "notifyContentType": "application/json",
            "sendAt": "01/01/2020 09:00",
            "callbackData": "ANTS Data"
        }
    ]
 }

SMS Response

Parameter

type

description

bulkId

String

The ID which uniquely identifies the request. Bulk ID will be received only when you send a message to more than one destination address.

detail

Array

Set of information from the response

messageId

String

The ID that uniquely identifies the sent message.

to

String

The destination mobile number for your message

from

String

Represents a sender ID which can be alphanumeric or numeric (maximum 11 characters, space is not allowed. Example: from = ANTS

credit

Decimal

SMS credit usage.

shorturl

String

Use URL shorten function

status

Array

Indicates whether the message is successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.

code

String

The code ID of return status

name

String

The name of return status

description

String

Description of return status

The response will look like:

{
    "bulkid": "75108ada-ffa3-4577-8ff1-db2a4690ccbd",
    "detail": [
        {
            "messageId": "25501288135972440649",
            "to": "66123456789",
            "from": "ANTS",
            "credit": 1.00,
            "shorturl": "N"
            "status": {
                "code": "101",
                "name": "PENDING",
                "description": "Pending -Message has been accepted by the system"
            }
        }
    ]
}

Defending URL on callback server to get Delivery report according to link

https://api-service.ants.co.th/sms/send
Send Callback