JSON 편집 모드

Prev Next

Classic/VPC 환경에서 이용 가능합니다.

CLOVA Chatbot에서 구현 가능한 JSON 입력 양식에 대해 설명합니다. JSON 편집 모드는 연속 답변 및 여러 필수 입력 사항을 채워야 하는 복잡한 답변 유형을 다른 대화로 복사할 때 활용할 수 있습니다.
[JSON 편집 모드] 버튼을 클릭하면 JSON 구조의 데이터를 복사할 수 있고, 복사한 데이터를 다른 대화에 적용하면 복잡하게 설정된 답변 유형을 쉽게 복사할 수 있습니다.

JSON Structure 예시는 다음과 같습니다.

[
  {
    "component": {
      "type": "text",
      "data": {
        "description": "the answer of this query is test",
        "url": "http://www.example.com"
      }
    },
    "answerType": "TEXT"
  }
]
Plain text
필드 타입 필수여부 설명
component object true support Text Component in the chatbot custom api specification v2
component.type string true text
component.data.description string true answer
component.data.url string false the hyperlink jump url
(http://www.example.com )
answerType string true TEXT, means default answer

JSON Structure 예시는 다음과 같습니다.

[
  {
    "component": {
      "type": "template",
      "data": {
        "cover": {
          "type": "text",
          "data": {
            "description": "멀티링크의 답변 부분입니다."
          }
        },
        "contentTable": [
          [
            {
              "colSpan": 1,
              "rowSpan": 1,
              "data": {
                "type": "button",
                "title": "naver",
                "data": {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data": {
                      "url": "https://www.naver.com/"
                    }
                  }
                }
              }
            }
          ],
          [
            {
              "colSpan": 1,
              "rowSpan": 1,
              "data": {
                "type": "button",
                "title": "google",
                "data": {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data": {
                      "url": "https://www.google.com/"
                    }
                  }
                }
              }
            }
          ]
        ]
      }
    },
    "answerType": "MULTILINKS"
  }
]
Plain text
필드 타입 필수여부 설명
answerType string true MULTILINKS, means multilink answer
component jsonObject true support Template Component in the chatbot custom api specification v2, and template type only support Text + Buttons

JSON Structure 예시는 다음과 같습니다

[
  {
    "component": {
      "type": "carousel",
      "data": {
        "cards": [
          {
            "type": "image",
            "title": "첫 번째 캐로셀의 이미지 제목입니다.",
            "data": {
              "imageUrl": "https://www.image.com/image.png",
              "description": "첫 번째 캐로셀의 이미지 설명입니다."
            }
          },
          {
            "type": "image",
            "title": "두 번째 캐로셀의 이미지 제목입니다.",
            "data": {
              "imageUrl": "https://www.image.com/image.png",
              "description": "두 번째 캐로셀의 이미지 설명입니다."
            }
          }
        ]
      }
    },
    "answerType": "IMAGECARD"
  }
]
Plain text

Field Introduce

필드 타입 Required 설명
answerType string true IMAGECARD, means image answer
component jsonObject true support Image Component, Template Component, Carousel Component in the chatbot custom api specification v2.
It depends on the number of Image Card and Button:
1. one image card, no button: Image Component;
2. one image card, with button: Template Component, and template type only support Image Component + Buttons;
3. multiple image card: Carousel Component, and carouse type support only images and template with image + buttons

Image Field Introduce

필드 타입 필수여부 설명
type string true image
title string true short bold text
data.imageUrl string true image url, must be https url
data.description string false details info of image

JSON Structure 예시는 다음과 같습니다.

[
  {
    "component": {
      "type": "text",
      "data": {
        "description": "#{객관식폼이름}"
      }
    },
    "answerType": "SINGLEFORM"
  }
]
Plain text
필드 타입 필수여부 설명
answerType string true SINGLEFORM, means multiple choice answer
component object true support Text Component in the chatbot custom api specification v2
component.type string true Text
component.data.description string true String1 true form name,wrap with # and {}
#{formName}

연속 답변의 경우 최대 5개의 말풍선을 추가할 수 있습니다.
JSON Structure 예시는 다음과 같습니다.

 [
  {
    "component": {
      "type": "text",
      "data": {
        "description": "답변 예시입니다.",
        "url": "http://www.example.com"
      }
    },
    "answerType": "TEXT"
  },
  {
    "component": {
      "type": "text",
      "data": {
        "description": "#{객관식 폼 이름}"
      }
    },
    "answerType": "SINGLEFORM"
  }
]
Plain text

Field Introduce
In the array data( array[jsonObject] ),each json object represents a bubble, multiple bubbles correspond to multiple json objects.

메신저를 LINE으로 설정한 경우, Flex 메시지 답변을 지원합니다.
JSON Structure 예시는 다음과 같습니다.

[
  {
    "component": {
      "type": "flex",
      "title": "Flex 답변입니다.",
      "data": {
        "type": "bubble",
        "hero": {
          "type": "image",
          "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png",
          "size": "full",
          "aspectRatio": "20:13",
          "aspectMode": "cover"
        },
        "body": {
          "type": "box",
          "layout": "vertical",
          "contents": [
            {
              "type": "text",
              "text": "Brown Cafe",
              "weight": "bold",
              "size": "xl"
            }
          ]
        },
        "footer": {
          "type": "box",
          "layout": "vertical",
          "spacing": "sm",
          "contents": [
            {
              "type": "button",
              "style": "link",
              "height": "sm",
              "action": {
                "type": "uri",
                "label": "CALL",
                "uri": "https://linecorp.com"
              }
            },
            {
              "type": "spacer",
              "size": "sm"
            }
          ],
          "flex": 0
        }
      }
    },
    "answerType": "FLEXMESSAGE"
  }
]
Plain text

Field Introduce

필드 타입 Required 설명
answerType string true FLEXMESSAGE, means flex message answer
component object true support LINE Flex in the chatbot custom api specification v2

메신저를 LINE으로 설정한 경우, LINE 스티커 답변을 지원합니다.
JSON Structure 예시는 다음과 같습니다.

[
  {
    "component": {
      "type": "line_sticker",
      "data": {
        "packageId": "11537",
        "stickerId": "52002734"
      }
    },
    "answerType": "STICKER"
  }
]
Plain text

Field Introduce

필드 타입 Required 설명
answerType string true STICKER, means LINE sticker answer
component object true support Line Sticker in the chatbot custom api specification v2