> For the complete documentation index, see [llms.txt](https://apidoc.ants.co.th/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidoc.ants.co.th/thai-v1.0.0/api-sms-1/callback.md).

# Callback Delivery Report

&#x20;       ใช้สำหรับผู้ใช้งานต้องการทราบข้อมูลสถานะการส่งผ่าน (Delivery Report) จาก Operator โดยผู้ใช้ทำการระบุ Parameter ( **notifyUrl** และ **notifyContentType**) ที่การ request API [Send](/thai-v1.0.0/api-sms-1/api-sms.md) ระบบจะทำการส่งข้อมูล ดังนี้

### Sequence Diagram

![](/files/-M2D9DFjJILpdb1Yj-Rd)

{% tabs %}
{% tab title="Request" %}
**ผู้ใช้งานสามารถเริ่มสร้าง HTTP ตามรายละเอียดดังนี้**

| **หัวข้อ**         | **รายละเอียด**                                                                                                                  |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| HTTP Request (URL) | <https://api-service.ants.co.th/sms/callback>                                                                                   |
| HTTP Headers       | <p>Content-Type: application/json หรือ application/xml</p><p>Authorization: (Basic Auth) Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==</p> |
| HTTP Methods       | POST                                                                                                                            |

**ผู้ใช้งานต้องระบุ Request body ด้วย Parameter ดังนี้**

| **ตัวแปร Parameter** | **ประเภทข้อมูล** | **รายละเอียด**                                |
| -------------------- | ---------------- | --------------------------------------------- |
| bulkId               | String           | รหัสการส่งในแต่ละครั้ง                        |
| details              | Array            | ชุดข้อมูลกการตอบกลับ                          |
| messageId            | String           | รหัสอ้างอิงของแต่ละหมายเลข ในการส่งแต่ละครั้ง |
| to                   | String           | หมายเลขที่ได้รับข้อความ                       |
| from                 | String           | Sender Name ที่ส่ง                            |
| text                 | String           | ข้อความที่ส่งหาหมายเลขผู้รับ                  |
| credit               | Decimal          | จำนวน credit ที่ใช้                           |
| sendDate             | String           | วันที่ระบบส่ง SMS                             |
| doneDate             | String           | วันที่ข้อความส่งถึงหมายเลขปลายทาง             |
| status               | Array            | ชุดข้อมูลสถานะ                                |
| code                 | String           | รหัสสถานะการตอบกลับ                           |
| name                 | String           | ชื่อสถานะการตอบกลับ                           |
| description          | String           | รายละเอียดสถานะการตอบกลับ                     |
| callbackData         | String           | ค่าที่ต้องการให้ส่งกลับ                       |

**ตัวอย่าง Request JSON**

```
 {
        "bulkId": "898319fa-34f0-49b7-a3b0-4235cc716a1f",
        "details": [
                {
                    "messageId": "25501288135972440649",
                    "to": "66123456789",
                    "from": "ANTS",
                    "text": "เชิญชวนร่วมกิจกรรม วิ่งการกุศล ANTS มาราธอน",
                    "credit": 1.00,
                    "sendDate": "2019-05-27T14:39:40.273",
                    "doneDate": "2019-05-27T14:40:09.44",
                    "status": {
                        "code": "000",
                        "name": "DELIVERED",
                        "description": "Successfully sent to phone"
                    },
                    "callbackData":"ANTS Data"
                },
                {
                    "messageId": "25501288135972440650",
                    "to": "66112233445",
                    "from": "Verify",
                    "text": "เชิญชวนร่วมกิจกรรม วิ่งการกุศล ANTS มาราธอน",
                    "credit": 1.00,
                    "sendDate": "2019-05-27T14:39:49.383",
                    "doneDate": "2019-05-27T14:40:09.66",
                    "status": {
                        "code": "000",
                        "name": "DELIVERED",
                        "description": "Successfully sent to phone"
                    },
                     "callbackData":"ANTS Data"
                }
        ]
} 

```

**ตัวอย่าง Request XML**

```
<?xml version="1.0" encoding="utf-16"?>
<CALLBACK xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <bulkId>9f4b72ca-0e28-4a7f-a6ff-d6483a17f3fa</bulkId>
    <details>
        <detail>
            <messageId>25501288135972440649</messageId>
            <to>66123456789</to>
            <from>Verify</from>
            <text>เชิญชวนร่วมกิจกรรม วิ่งการกุศล ANTS มาราธอน</text>
            <credit>1.00</credit>
            <sendDate>2019-05-27T14:39:40.273</sendDate>
            <doneDate>2019-05-27T14:40:09.44</doneDate>
            <status>
                <code>000</code>
                <name>DELIVERED</name>
                <description>Successfully sent to phone</description>
            </status>
            <callbackData>ANTS Data</callbackData>
        </detail>
        <detail>
            <messageId>25501288135972440650</messageId>
            <to>66112233445</to>
            <from>Verify</from>
            <text>เชิญชวนร่วมกิจกรรม วิ่งการกุศล ANTS มาราธอน</text>
            <credit>1.00</credit>
            <sendDate>2019-05-27T14:39:49.383</sendDate>
            <doneDate>2019-05-27T14:40:09.66</doneDate>
            <status>
                <code>000</code>
                <name>DELIVERED</name>
                <description>Successfully sent to phone</description>
            </status>
            <callbackData>ANTS Data</callbackData>
        </detail>
    </details>
</CALLBACK>
```

{% endtab %}

{% tab title="Response" %}
Response ตอบกลับผู้ใช้งาน เป็น HTTP Status Code ซึ่งส่วนใหญ่สถานะ จะแสดงเป็น 200 OK และ 404 Not Found ถ้าค่าเป็น 200 OK แสดงว่าข้อมูลส่งถูกต้อง

**ตัวอย่าง Response JSON**

```http
200 OK
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://apidoc.ants.co.th/thai-v1.0.0/api-sms-1/callback.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
