JSON 編集モード
    • PDF

    JSON 編集モード

    • PDF

    Article Summary

    Classic/VPC環境で利用できます。

    CLOVA Chatbotで実装可能なJSON入力様式について説明します。JSON編集モードは、連続返答やあらゆる必須項目を入力しなければならない複雑な返答タイプを他の会話にコピーする際に役立ちます。
    [JSON編集モード] ボタンをクリックすると、JSON構造のデータをコピーできます。そのコピーしたデータを他の会話に適用すると、複雑に設定された返答タイプを簡単にコピーできます。

    基本返答

    JSONストラクチャーの例は以下のとおりです。

    [
      {
        "component": {
          "type": "text",
          "data": {
            "description": "the answer of this query is test",
            "url": "http://www.example.com"
          }
        },
        "answerType": "TEXT"
      }
    ]
    
    フィールドタイプ必須の有無説明
    componentobjecttruesupport Text Component in the chatbot custom api specification v2
    component.typestringtruetext
    component.data.descriptionstringtrueanswer
    component.data.urlstringfalsethe hyperlink jump url
    (http://www.example.com )
    answerTypestringtrueTEXT, means default answer

    マルチリンク返答

    JSONストラクチャーの例は以下のとおりです。

    [
      {
        "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"
      }
    ]
    
    フィールドタイプ必須の有無説明
    answerTypestringtrueMULTILINKS, means multilink answer
    componentjsonObjecttruesupport Template Component in the chatbot custom api specification v2, and template type only support Text + Buttons

    画像返答

    JSONストラクチャーの例は以下のとおりです。

    [
      {
        "component": {
          "type": "carousel",
          "data": {
            "cards": [
              {
                "type": "image",
                "title": "1番目のカルーセルの画像のタイトルです。",
                "data": {
                  "imageUrl": "https://www.image.com/image.png",
                  "description": "1番目のカルーセルの画像の説明です。"
                }
              },
              {
                "type": "image",
                "title": "2番目のカルーセルの画像のタイトルです。",
                "data": {
                  "imageUrl": "https://www.image.com/image.png",
                  "description": "2番目のカルーセルの画像の説明です。"
                }
              }
            ]
          }
        },
        "answerType": "IMAGECARD"
      }
    ]
    

    Field Introduce

    フィールドタイプ必須の有無説明
    answerTypestringtrueIMAGECARD, means image answer
    componentjsonObjecttruesupport 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

    フィールドタイプ必須の有無説明
    typestringtrueimage
    titlestringtrueshort bold text
    data.imageUrlstringtrueimage url, must be https url
    data.descriptionstringfalsedetails info of image

    選択肢型返答

    JSONストラクチャーの例は以下のとおりです。

    [
      {
        "component": {
          "type": "text",
          "data": {
            "description": "#{選択肢型フォーム名}"
          }
        },
        "answerType": "SINGLEFORM"
      }
    ]
    
    フィールドタイプ必須の有無説明
    answerTypestringtrueSINGLEFORM, means multiple choice answer
    componentobjecttruesupport Text Component in the chatbot custom api specification v2
    component.typestringtrueText
    component.data.descriptionstringtrueString1 true form name,wrap with # and {}
    #{formName}

    連続返答

    連続返答は最大5個まで吹き出しを追加できます。
    JSONストラクチャーの例は以下のとおりです。

     [
      {
        "component": {
          "type": "text",
          "data": {
            "description": "返答例です。",
            "url": "http://www.example.com"
          }
        },
        "answerType": "TEXT"
      },
      {
        "component": {
          "type": "text",
          "data": {
            "description": "#{選択肢型フォーム名}"
          }
        },
        "answerType": "SINGLEFORM"
      }
    ]
    

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

    Flexメッセージ返答

    メッセンジャーをLINEに設定した場合は、Flexメッセージ返答をサポートします。
    JSONストラクチャーの例は以下のとおりです。

    [
      {
        "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"
      }
    ]
    
    フィールドタイプ必須の有無説明
    answerTypestringtrueFLEXMESSAGE, means flex message answer
    componentobjecttruesupport LINE Flex in the chatbot custom api specification v2

    LINEスタンプ返答

    メッセンジャーをLINEに設定した場合は、LINEスタンプ返答をサポートします。
    JSONストラクチャーの例は以下のとおりです。

    [
      {
        "component": {
          "type": "line_sticker",
          "data": {
            "packageId": "11537",
            "stickerId": "52002734"
          }
        },
        "answerType": "STICKER"
      }
    ]
    
    フィールドタイプ必須の有無説明
    answerTypestringtrueSTICKER, means LINE sticker answer
    componentobjecttruesupport Line Sticker in the chatbot custom api specification v2

    この記事は役に立ちましたか?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.