# Thẻ JSON API

Dữ liệu trả về từ API hỗ trợ các loại sau:\
1\. Tin nhắn văn bản\
2\. Tin nhắn văn bản có nút bấm\
3\. Tin nhắn hình ảnh\
4\. Tin nhắn video\
5\. Tin nhắn audio\
6\. Tin nhắn file\
7\. Tin nhắn slide ảnh\
8\. Tin nhắn phản hồi nhanh\
9\. Kịch bản chuyển tiếp tư vấn viên

Giao diện cấu hình thẻ JSON API trong chatbot

<div align="left"><figure><img src="/files/8mY0WC0GZVePzJuobU1L" alt="" width="563"><figcaption></figcaption></figure></div>

### **1. Tin nhắn văn bản**

```json
{
  "messages": [
    {
      "text": "Xin chào CareSoft!"
    },
    {
      "text": "Yêu cầu của bạn đang được xử lý!"
    }
  ]
}
```

### **2. Tin nhắn văn bản có nút bấm**

```json
{
  "messages":
  [{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"button",
        "text":"What do you want to do next?",
        "buttons":[
          {
            "type":"postback",
            "Payload":"data sample",
            "title":"OK"
          },
          {
            "type":"web_url",
            "url":"https://caresoft.vn",
            "title":"Visit Website"
          },
          {
            "type":"phone_number",
            "title":"Call Now",
            "payload":"+842473048222"
          }
        ]
      }
    }
  }]
}
```

### 3. Tin nhắn hình ảnh

```json
{
  "messages": [
    {
      "attachment": {
        "type": "image",
        "payload": {
          "url": "https://home.caresoft.vn/assets/logo.png"
        }
      }
    }
  ]
}
```

### 4. Tin nhắn video

```json
{
  "messages": [
    {
      "attachment": {
        "type": "video",
        "payload": {
          "url": "https://caresoft.vn/assets/video.mp4"
        }
      }
    }
  ]
}
```

### 5. Tin nhắn audio

```json
{
  "messages": [
    {
      "attachment": {
        "type": "audio",
        "payload": {
          "url": "https://caresoft.vn/assets/audio.mp3"
        }
      }
    }
  ]
}
```

### 6. Tin nhắn file

```json
{
  "messages": [
    {
      "attachment": {
        "type": "file",
        "payload": {
          "url": "https://caresoft.vn/assets/guide.pdf"
        }
      }
    }
  ]
}
```

### 7. Tin nhắn slide ảnh

```json
{
  "messages": [{
      "attachment":{
        "type":"template",
        "payload":{
          "template_type":"generic",
          "image_aspect_ratio": "square",
          "elements":[
            {
              "title":"Sample Image",
              "image_url":"https://home.caresoft.vn/wp-content/themes/3c/img/logo.png",
              "subtitle":"Size: M",
              "buttons":[
                {
                  "type":"web_url",
                  "url":"https://caresoft.vn",
                  "title":"View Item"
                }
              ]
            },
            {
              "title":"Logo CS",
              "image_url":"https://home.caresoft.vn/wp-content/themes/3c/img/logo.png",
              "subtitle":"Size: L",
              "default_action": {
                "type": "web_url",
                "url": "https://caresoft.vn",
                "messenger_extensions": true
              },
              "buttons":[
                {
                  "type":"web_url",
                  "url":"https://caresoft.vn",
                  "title":"View Item"
                }
              ]
            }
          ]
        }
      }
    }]
}
```

### 8. Tin nhắn phản hồi nhanh

```json
{
  "messages": [
    {
      "text": "Chọn 1 đáp án:",
      "quick_replies": [
        {
          "content_type": "text",
          "title": "Call Center",
          "payload": "<POSTBACK_PAYLOAD>",
          "image_url": "http://example.com/img/red.png"
        },
        {
          "content_type": "text",
          "title": "Contact Center",
          "payload": "<POSTBACK_PAYLOAD>",
          "image_url": 'http://example.com/img/green.png"
        }
      ]
    }
  ]
}
```

### 9. Gặp tư vấn viên

{% code overflow="wrap" %}

```
Truyền vào danh sách ip phone của agent hoặc để rỗng nếu muốn gặp tất cả chuyên viên có kỹ năng
```

{% endcode %}

```json
{
  "connect_to_list_agent": []
}
```


---

# 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://docs.caresoft.vn/chatbot/tich-hop-he-thong-khac/the-json-api.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.
