- Print
- PDF
JSON editing mode
- Print
- PDF
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"
}
]
Field | Type | Requirement status | Description |
---|---|---|---|
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 |
Multi-link 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"
}
]
Field | Type | Requirement status | 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
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
Field | Type | Requirement status | 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 |
Image Field Introduce
Field | Type | Requirement status | 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 |
Multiple choice answer
See below for an example of JSON structure.
[
{
"component": {
"type": "text",
"data": {
"description": "#{multiplechoiceformname}"
}
},
"answerType": "SINGLEFORM"
}
]
Field | Type | Requirement status | 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 | String1 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"
}
]
Field | Type | Requirement status | Description |
---|---|---|---|
answerType | string | true | FLEXMESSAGE, means flex message answer |
component | object | true | support 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"
}
]
Field | Type | Requirement status | Description |
---|---|---|---|
answerType | string | true | STICKER, means LINE sticker answer |
component | object | true | support Line Sticker in the chatbot custom api specification v2 |