JSON editing mode
    • PDF

    JSON editing mode

    • PDF

    Article Summary

    Available in Classic and VPC

    This guide explains about JSON input templates that can be implemented in CLOVA Chatbot. JSON editing mode can be used for copying consecutive answers and complex answer types that require filling in multiple mandatory input fields to another conversation.
    Click the [JSON editing mode] button to copy data in the JSON structure and easily copy answer types configured in a complicated way by applying the copied data to another conversation.

    Default answer

    See below for an example of JSON structure.

    [
      {
        "component": {
          "type": "text",
          "data": {
            "description": "the answer of this query is test",
            "url": "http://www.example.com"
          }
        },
        "answerType": "TEXT"
      }
    ]
    
    FieldTypeRequirement statusDescription
    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

    See below for an example of JSON structure.

    [
      {
        "component": {
          "type": "template",
          "data": {
            "cover": {
              "type": "text",
              "data": {
                "description": "Multi-link answer section."
              }
            },
            "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"
      }
    ]
    
    FieldTypeRequirement statusDescription
    answerTypestringtrueMULTILINKS, means multilink answer
    componentjsonObjecttruesupport Template Component in the chatbot custom api specification v2, and template type only support Text + Buttons

    Image answer

    The following is an example of JSON structure.

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

    Field Introduce

    FieldTypeRequirement statusDescription
    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

    FieldTypeRequirement statusDescription
    typestringtrueimage
    titlestringtrueshort bold text
    data.imageUrlstringtrueimage url, must be https url
    data.descriptionstringfalsedetails info of image

    Multiple choice answer

    See below for an example of JSON structure.

    [
      {
        "component": {
          "type": "text",
          "data": {
            "description": "#{multiplechoiceformname}"
          }
        },
        "answerType": "SINGLEFORM"
      }
    ]
    
    FieldTypeRequirement statusDescription
    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}

    Consecutive answer

    Up to 5 speech bubbles can be added for consecutive answers.
    See below for an example of JSON structure.

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

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

    Flex message answer

    Flex message answers are supported if LINE has been set as the messenger.
    See below for an example of 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"
      }
    ]
    
    FieldTypeRequirement statusDescription
    answerTypestringtrueFLEXMESSAGE, means flex message answer
    componentobjecttruesupport LINE Flex in the chatbot custom api specification v2

    LINE sticker answer

    LINE sticker answers are supported if LINE has been set as the messenger.
    See below for an example of JSON structure.

    [
      {
        "component": {
          "type": "line_sticker",
          "data": {
            "packageId": "11537",
            "stickerId": "52002734"
          }
        },
        "answerType": "STICKER"
      }
    ]
    
    FieldTypeRequirement statusDescription
    answerTypestringtrueSTICKER, means LINE sticker answer
    componentobjecttruesupport Line Sticker in the chatbot custom api specification v2

    Was this article helpful?

    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.