CLOVA Chatbot Custom API Example

Prev Next

개요

  • CLOVA Chatbot의 다양한 응답 형식에 대해서 예제 형식을 통해 알기 쉽게 설명합니다.

CLOVA Chatbot 응답 예시

Text 응답

only normal text

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "text",
      "data" : {
        "description" : "description, optional: only description"
      }
    }
  ],
  "event": "send"
}

full style with postback action

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "text",
      "title": "title, optional",
      "subTitle": "subTitle, optional",
      "data" : {
        "description" : "description, optional: full style, optional",
        "url" : "http://www.ncloud.com",
        "urlAlias" : "urlAlias, optional",
        "action" : {
          "type": "postback",
          "data" : {
            "postback" : "Hello"
          }
        }
      }
    }
  ],
  "event": "send"
}

Image 응답

only image at the bottom, with description

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "image",
      "data" : {
        "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
        "imagePosition" : "bottom",
        "description" : "description, optional: imagePosition is bottom,only have description"
      }
    }
  ],
  "event": "send"
}

full style image on the top with link action

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "image",
      "title": "title, optional",
      "subTitle": "subTitle, optional",
      "data" : {
        "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
        "alt" : "alt, hover, optional",
        "description" : "description, optional: imagePosition is top, full style",
        "url" : "http://www.ncloud.com",
        "urlAlias" : "urlAlias, optional",
        "action" : {
          "type": "link",
          "data" : {
            "url" : "http://www.ncloud.com",
            "mobileUrl" : "http://m.ncloud.com"
          }
        }
      }
    }
  ],
  "event": "send"
}

Template 응답

1. Text + Buttons

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "template",
      "data" : {
        "cover": {
          "type" : "text",
          "title" : "title, optional",
          "subTitle" : "subTitle, optional",
          "data" : {
            "description" : "description, optional: text full style",
            "url" : "http://www.ncloud.com",
            "urlAlias" : "urlAlias, optional"
          }
        },
        "contentTable":[
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "basic button, a link",
                "data" : {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ],
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "basic button, a link",
                "data" : {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ]
        ]
      }
    }
  ],
  "event": "send"
}

2. Image + Buttons

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "template",
      "data" : {
        "cover": {
          "type": "image",
          "title": "title, optional",
          "subTitle": "subTitle, optional",
          "data" : {
            "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
            "alt" : "alt, hover, optional",
            "description" : "description, optional: imagePosition is top full style",
            "url" : "http://www.ncloud.com",
            "urlAlias" : "urlAlias, optional"
          }
        },
        "contentTable":[
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "basic button, a link",
                "data" : {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ],
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "basic button, a link",
                "data" : {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ]
        ]
      }
    }
  ],
  "event": "send"
}

3. Image List

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "template",
      "data" : {
        "cover": {
          "type": "text",
          "data" : {
            "description" : "description, optional: only text style"
          }
        },
        "contentTableShowRows" : 3,
        "contentTable":[
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "image",
                "title": "title, optional",
                "subTitle": "subTitle, optional, no description",
                "data" : {
                  "imagePosition" : "left",
                  "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ],
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "image",
                "title": "title, optional",
                "subTitle": "subTitle, optional, no description",
                "data" : {
                  "imagePosition" : "left",
                  "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ],
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "image",
                "title": "title, optional",
                "subTitle": "subTitle, optional, no description",
                "data" : {
                  "imagePosition" : "left",
                  "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ],
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "image",
                "title": "title, optional",
                "subTitle": "subTitle, optional, no description",
                "data" : {
                  "imagePosition" : "left",
                  "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ]
        ]
      }
    }
  ],
  "event": "send"
}

MiniButtons

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "template",
      "data" : {
        "cover": {
          "type": "text",
          "title" : "title, optional",
          "subTitle" : "subTitle, optional",
          "data" : {
            "description" : "description, optional: text full style",
            "url" : "http://www.ncloud.com",
            "urlAlias" : "urlAlias, optional"
          }
        },
        "contentTable":[
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "basic button, a link",
                "data" : {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            },
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "basic button, a link",
                "data" : {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ],
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "basic button, a link",
                "data" : {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            },
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "basic button, a link",
                "data" : {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ],
          [
            {
              "colSpan" : 2,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "basic button, a link",
                "data" : {
                  "type": "basic",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ]
        ]
      }
    }
  ],
  "event": "send"
}

ImageButtons

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "template",
      "data" : {
        "cover": {
          "type": "image",
          "data" : {
            "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
            "imagePosition" : "bottom",
            "description" : "description, optional: imagePosition is bottom, no title",
            "url" : "http://www.ncloud.com",
            "urlAlias" : "urlAlias, optional"
          }
        },
        "contentTable":[
          [
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "action is link",
                "data" : {
                  "type": "imageButton",
                  "iconUrl": "https://ssl.pstatic.net/CloudFunctions.png",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            },
            {
              "colSpan" : 1,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "data" : {
                  "type": "imageButton",
                  "iconUrl": "https://ssl.pstatic.net/CloudFunctions.png",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            },
            {
              "colSpan" : 1,
              "rowSpan" : 2,
              "data" : {
                "type": "button",
                "data" : {
                  "type": "imageButton",
                  "iconUrl": "https://ssl.pstatic.net/CloudFunctions.png",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ],
          [
            {
              "colSpan" : 2,
              "rowSpan" : 1,
              "data" : {
                "type": "button",
                "title": "action is link",
                "data" : {
                  "type": "imageButton",
                  "iconUrl": "https://ssl.pstatic.net/CloudFunctions.png",
                  "action": {
                    "type": "link",
                    "data" : {
                      "url" : "http://www.ncloud.com"
                    }
                  }
                }
              }
            }
          ]
        ]
      }
    }
  ],
  "event": "send"
}

Carousel

only images

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "carousel",
      "data" : {
         "cards": [
            {
              "type": "image",
              "title": "title, optional",
              "subTitle": "subTitle, optional",
              "data" : {
                "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
                "description" : "description, optional: imagePosition is top full style",
                "url" : "http://www.ncloud.com",
                "urlAlias" : "urlAlias, optional"
              }
            },
            {
              "type": "image",
              "title": "title, optional",
              "subTitle": "subTitle, optional",
              "data" : {
                "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
                "description" : "description, optional: imagePosition is top full style",
                "url" : "http://www.ncloud.com",
                "urlAlias" : "urlAlias, optional"
              }
            }
         ]
      }
    }
  ],
  "event": "send"
}

template with image + buttons

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "carousel",
      "data" : {
         "cards": [
            {
              "type": "template",
              "data" : {
                "cover": {
                  "type": "image",
                  "title": "title, optional",
                  "subTitle": "subTitle, optional",
                  "data" : {
                    "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
                    "description" : "description, optional: imagePosition is top full style",
                    "url" : "http://www.ncloud.com",
                    "urlAlias" : "urlAlias, optional"
                  }
                },
                "contentTable":[
                  [
                    {
                      "colSpan" : 1,
                      "rowSpan" : 1,
                      "data" : {
                        "type": "button",
                        "title": "basic button, a link",
                        "data" : {
                          "type": "basic",
                          "action": {
                            "type": "link",
                            "data" : {
                              "url" : "http://www.ncloud.com"
                            }
                          }
                        }
                      }
                    }
                  ],
                  [
                    {
                      "colSpan" : 1,
                      "rowSpan" : 1,
                      "data" : {
                        "type": "button",
                        "title": "basic button, a link",
                        "data" : {
                          "type": "basic",
                          "action": {
                            "type": "link",
                            "data" : {
                              "url" : "http://www.ncloud.com"
                            }
                          }
                        }
                      }
                    }
                  ]
                ]
              }
            },
            {
              "type": "template",
              "data" : {
                "cover": {
                  "type": "image",
                  "title": "title, optional",
                  "subTitle": "subTitle, optional",
                  "data" : {
                    "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
                    "alt" : "alt, hover, optional",
                    "description" : "description, optional: imagePosition is top full style",
                    "url" : "http://www.ncloud.com",
                    "urlAlias" : "urlAlias, optional"
                  }
                },
                "contentTable":[
                  [
                    {
                      "colSpan" : 1,
                      "rowSpan" : 1,
                      "data" : {
                        "type": "button",
                        "title": "basic button, a link",
                        "data" : {
                          "type": "basic",
                          "action": {
                            "type": "link",
                            "data" : {
                              "url" : "http://www.ncloud.com"
                            }
                          }
                        }
                      }
                    }
                  ],
                  [
                    {
                      "colSpan" : 1,
                      "rowSpan" : 1,
                      "data" : {
                        "type": "button",
                        "title": "basic button, a link",
                        "data" : {
                          "type": "basic",
                          "action": {
                            "type": "link",
                            "data" : {
                              "url" : "http://www.ncloud.com"
                            }
                          }
                        }
                      }
                    }
                  ]
                ]
              }
            }
         ]
      }
    }
  ],
  "event": "send"
}

LINE Flex

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "bubbles": [
    {
      "type": "flex",
      "title": "this is a flex message",
      "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
        }
      }
    }
  ],
  "event": "send"
}

Quick Buttons

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
  "timestamp": 12345678,
  "quickButtons": [
    {
      "type": "button",
      "title": "no icon",
      "data" : {
        "type": "basic",
        "action": {
          "type": "postback",
          "data" : {
            "postback" : "hello"
          }
        }
      }
    },
    {
      "type": "button",
      "title": "phone",
      "data" : {
        "type": "basic",
        "iconUrl" : "https://ssl.pstatic.net/phone.png",
        "action": {
          "type": "phone",
          "data" : {
            "number" : "400-1111-1111"
          }
        }
      }
    },
    {
      "type": "button",
      "title": "pay",
      "data" : {
        "type": "basic",
        "iconUrl" : "https://ssl.pstatic.net/pay.png",
        "action": {
          "type": "link",
          "data" : {
            "url" : "http://www.ncloud.com"
          }
        }
      }
    }
  ],
  "event": "send"
}

Persistent Menu

text buttons

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "timestamp": 12345678,
  "persistentMenu": {
    "type": "template",
    "title": "Tap to hide the text menu",
    "data" : {
      "contentTable":[
        [
          {
            "colSpan" : 1,
            "rowSpan" : 1,
            "data" : {
              "type": "button",
              "title": "basic button, only title",
              "data" : {
                "type": "basic",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          }
        ],
        [
          {
            "colSpan" : 1,
            "rowSpan" : 1,
            "data" : {
              "type": "button",
              "title": "basic button, only title",
              "data" : {
                "type": "basic",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          }
        ],
        [
          {
            "colSpan" : 1,
            "rowSpan" : 1,
            "data" : {
              "type": "button",
              "title": "basic button, only title",
              "data" : {
                "type": "basic",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          }
        ]
      ]
    }
  },
  "event": "send"
}

image buttons use small icons

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "timestamp": 12345678,
  "persistentMenu": {
    "type": "template",
    "title": "Tap to hide the image menu",
    "data" : {
      "contentTable":[
        [
          {
            "colSpan" : 2,
            "rowSpan" : 2,
            "data" : {
              "type": "button",
              "title": "action is link",
              "data" : {
                "type": "imageButton",
                "iconUrl": "https://ssl.pstatic.net/CloudFunctions.png",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          },
          {
            "colSpan" : 1,
            "rowSpan" : 1,
            "data" : {
              "type": "button",
              "data" : {
                "type": "imageButton",
                "iconUrl": "https://ssl.pstatic.net/CloudFunctions.png",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          }
        ],
        [
          {
            "colSpan" : 1,
            "rowSpan" : 1,
            "data" : {
              "type": "button",
              "data" : {
                "type": "imageButton",
                "iconUrl": "https://ssl.pstatic.net/CloudFunctions.png",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          }
        ]
      ]
    }
  },
  "event": "send"
}

buttons use one background image

image

{
  "version": "v2",
  "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
  "timestamp": 12345678,
  "persistentMenu": {
    "type": "template",
    "title": "Use one background image",
    "data" : {
      "contentTable":[
        [
          {
            "colSpan" : 1,
            "rowSpan" : 1,
            "data" : {
              "type": "button",
              "data" : {
                "type": "basic",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          },
          {
            "colSpan" : 1,
            "rowSpan" : 1,
            "data" : {
              "type": "button",
              "data" : {
                "type": "basic",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          }
        ],
        [
          {
            "colSpan" : 1,
            "rowSpan" : 1,
            "data" : {
              "type": "button",
              "data" : {
                "type": "basic",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          },
          {
            "colSpan" : 1,
            "rowSpan" : 1,
            "data" : {
              "type": "button",
              "data" : {
                "type": "basic",
                "action": {
                  "type": "link",
                  "data" : {
                    "url" : "http://www.ncloud.com"
                  }
                }
              }
            }
          }
        ]
      ]
    }
  },
  "event": "send"
}