Json 入力ガイド

Json 編集モードで応答を作成する場合、以下のjson入力様式に従って作成します。

基本応答

JSON Structure:

[
  {
    "component": {
      "type": "text",
      "data": {
        "description": "the answer of this query is test"
      }
    },
    "answerType": "TEXT"
  }
]

Fields Introduce:

Field Type Required Description
answerType string true TEXT, means default answer
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 ( e.g http://www.example.com) ). The CLOVA does not support it.
component.data.urlAlias string false the hyperlink show text ( e.g This is the example. ). Only you set the messenger to custom, it's supported. If you enter urlAlias, you must also enter url.

マルチリンク応答

JSON Structure:

[
  {
    "component": {
      "type": "template",
      "data": {
        "cover": {
          "type": "text",
          "data": {
            "description": "The answer is part of the multilink."
          }
        },
        "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"
  }
]

Fields Introduce:

Field Type Required Description
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

Image Answer

JSON Structure:

[
  {
    "component": {
      "type": "carousel",
      "data": {
        "cards": [
          {
            "type": "image",
            "title": "Image title of the first carousel.",
            "data": {
              "imageUrl": "https://www.image.xxx/image.png",
              "description": "Image description of the first carousel."
            }
          },
          {
            "type": "image",
            "title": "Image title of the second carousel.",
            "data": {
              "imageUrl": "https://www.image.xxx/image.png",
              "description": "Image description of the second carousel."
            }
          }
        ]
      }
    },
    "answerType": "IMAGECARD"
  }
]

Fields Introduce:

Field Type Required Description
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

The image field is somewhat different from the image + text type.

Field Type Required Description
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

The task dose not support image answer.

Multiple choice answers

JSON Structure:

[
  {
    "component": {
      "type": "text",
      "data": {
        "description": "#{Multiple choice form name}"
      }
    },
    "answerType": "SINGLEFORM"
  }
]

Fields Introduce:

Field Type Required Description
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 form name,wrap with # and {} ( e.g #{formName} ). Unsupported the type is Open-ended.

Flex message answers

If you set the messenger to LINE or Custom, Flex supports message reply. Support any json object. You could define self json spec. JSON Structure:

[
  {
    "component": {
      "type": "flex",
      "title": "Flex answer.",
      "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"
  }
]

Fields Introduce:

Field Type Required Description
answerType string true FLEXMESSAGE, means flex message answer
component object true support LINE Flex in the chatbot custom api specification v2

The task dose not support flex message answer.

LINE Stickers Answers

If you set the messenger to LINE, LINE stickers are supported.

JSON Structure:

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

Fields Introduce:

Field Type Required Description
answerType string true STICKER, means LINE sticker answer
component object true support Line Sticker in the chatbot custom api specification v2

The task dose not support LINE Stickers answer.

Audio Answer

If you set the messenger to CLOVA, audio Answer is supported.

JSON Structure:

[
  {
    "component": {
      "type": "audio",
      "data": {
        "name": "demoAudio",
        "url": "https://www.audio.source.xxx/demo.mp3"
      }
    },
    "answerType": "AUDIO"
  }
]

Fields Introduce:

Field Type Required Description
answerType string true AUDIO, means audio answer
component object true a json object, contains two fields: type and data
component.type string true audio
component.data object true a json object, contains two fields: name and url
component.data.name string true the name of audio
component.data.url string true audio url, support mp3,m3u8,wav ( e.g https://www.audio.source.xxx/demo.mp3 )

Continuous answers

For continuous answers, up to five speech bubbles can be added.

JSON Structure:

[
  {
    "component": {
      "type": "text",
      "data": {
        "description": "Answer is an example.",
        "url": "http://www.example.com"
      }
    },
    "answerType": "TEXT"
  },
  {
    "component": {
      "type": "text",
      "data": {
        "description": "#{Multiple choice form name}"
      }
    },
    "answerType": "SINGLEFORM"
  }
]

Fields Introduce:

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

The messenger supported

ALL LINE LINE WORKS Talk Talk Facebook Custom CLOVA Kakao (Deprecated)
Primary Answer
Multilink Answer -
Image Answer -
Multiple choice answer -
Flex message answer - - - - - -
LINE Stickers Answer - - - - - - -
Audio Answer - - - - - - -

に対する検索結果は~件です。 ""

    に対する検索結果がありません。 ""

    処理中...