# Send Message

&#x20;    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. &#x20;

### Sequence Diagram

![](/files/-M27YBmjuu2aLSyFPJdX)

{% tabs %}
{% tab title="Request" %}
**You can start creating HTTP request as this following:**

| Name                | Description                                                                                                |
| ------------------- | ---------------------------------------------------------------------------------------------------------- |
| HTTP Request (URL): | <https://api-service.ants.co.th/sms/send>                                                                  |
| HTTP Headers        | <p>Content-Type: application/json</p><p>Authorization: (Basic Auth) Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==</p> |
| HTTP Methods        | POST                                                                                                       |

#### Request body requires Parameters as these following

| **Parameters**                                     | Type           | Description                                                                                                                                                                                                                                                                       |
| -------------------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>bulkId</p><p><em>(optional)</em></p>            | 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` |
| <p>to</p><p>               </p>                    | Strings        | <p>The destination mobile number for your message. <br>It must be international format.<br><code>Example: to = 6698336789</code></p>                                                                                                                                              |
| <p>messageId</p><p><em>(optional)</em></p>         | String (200)   | The ID that uniquely identifies the message sent.                                                                                                                                                                                                                                 |
| text                                               | String(1600)   | <p>Text of the message that will be sent</p><p><code>Example: text = Hello, ANTS world :)</code></p>                                                                                                                                                                              |
| <p>shorturl</p><p><em>(optional)</em></p>          | String(y or n) | <p>Use URL shorten function</p><p><code>Example : shorturl = "y"</code> </p>                                                                                                                                                                                                      |
| <p>notifyUrl</p><p><em>(optional)</em></p>         | String (150)   | <p>Defending  URL on callback server to get Delivery report according to <a href="/pages/-M1dmGmrI7GQBcR_K6Tn"><em><strong>Send Callback</strong></em></a> link </p><p><code>Example: notifyUrl=https//[www.example.com](http://www.example.com)</code></p>                       |
| <p>notifyContentType</p><p><em>(optional)</em></p> | String (50)    | <p>Preferred Delivery report content type of delivery report to <code>application/json</code> <br><code>Example: notifyContentType=application/json</code></p>                                                                                                                    |
| <p>sendAt</p><p><em>(optional)</em></p>            | DateTime       | <p>Date and time when the message is to be sent, used for scheduling SMS in the future</p><p><code>Format: 01/01/2020 09:00</code></p>                                                                                                                                            |
| <p>callbackData</p><p><em>(optional)</em></p>      | 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"
        }
    ]
 }

```

{% endtab %}

{% tab title="Response" %}
**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"
            }
        }
    ]
}

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidoc.ants.co.th/api-sms-1/api-sms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
