챗봇 Custom API Spec.

Status: finished v2.5

version date update
v2.5 2019-08-22 Improve guide for Signature Header, add example.
v2.5 2019-04-22 split flex to Special Messenger Component.
add LineSticker and LineWorksSticker.
modify Action.Postback define.
add keywords in success response.
v2.4 2019-03-12 improve entities specification in Response Status. Attention: entities array model changes from v2.3.
v2.3 2019-02-27 add get Persistent Menu event add scenario, entities in success response.
v2.2 2019-01-04 support Flex Message(LINE)&[Persistent Menu. add persistent Menu in success response. add persistent menu examples. Template Component add background image, cover not required. add new action: Utterance. improve some descriptions.
v2.1 2018-11-16 add new action: Welcome, open event support one text bubble
v2.0 2018-11-07 new structure, add signature
v1.2 2018-08-08 version 1.2

Table of Contents

Summary

Please setting APIGW first, reference APIGW Integration Document.

  • Request Path: API Gateway -> Stages -> root path '/' -> 'Invoke URL' clip_image001.png

Request

  • Custom Messenger -> Chatbot
  • Http Method: POST
  • Headers

    | name | value | | ----------------------- | ------------------------- | | Content-Type | "application/json;UTF-8" | | X-NCP-CHATBOT_SIGNATURE | signature of request body |

Signature Header

  • Signature Define
    • Algorithm: HmacSHA256
    • SecretKey: Chatbot Custom SecretKey.
    • Sign content: Reqeust body.
  • X-NCP-CHATBOT_SIGNATURE: Use Base64 encode signature bytes, and put base64 string in request header X-NCP-CHATBOT_SIGNATURE

How to Generate Signature

  1. Prepare http request body.
  2. Get secret key from Chatbot->Setting->Messenger Connection->Custom page.
  3. Sign request body with secret key.
  4. Use base64 encode result.
  5. js code sample
const HmacSHA256 = require('crypto-js/hmac-sha256');
const EncBase64 = require('crypto-js/enc-base64');
signatureHeader = HmacSHA256(requestBodyString, secretKey).toString(EncBase64);
  • java code sample
byte[] secretKeyBytes = secretKey.getBytes(StandardCharsets.UTF_8);
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKeyBytes, "HmacSHA256");
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(secretKeySpec);
byte[] signature = mac.doFinal(body.getBytes(StandardCharsets.UTF_8));
String signatureHeader = Base64.getEncoder().encodeToString(signature);

Request Event

open

  • trigger when open messenger, will response welcome message if have set in "Messenger Connection" -> "Custom"
  • Body Example

      {
        "version": "v2",
        "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
        "userIp": "8.8.8.8",
        "timestamp": 12345678,
        "bubbles": [
          {
            "type": "text",
            "data" : {
              "description" : "postback text of welcome action"
            }
          }
        ],
        "event": "open"
      }
    
  • Body Introduce

    | Field | Type | Required | Description | | --------- | ------ | -------- | ---------------------------------------- | | version | string | false | 'v2', protocol version, if not set, default process as 'v1' | | userId | string | true | unique id for user who chat with bot, no longer than 256 charactor. Please use different userId for different user to improve history | | userIp | string | false | user ip address, not required | | timestamp | long | true | current milliseconds since January 1, 1970, 00:00:00 GMT | | bubbles | array | true | empty array "[]" or only one Text component caused by welcome action | | event | string | true | fixed string value "open" |

send

  • send user chat message
  • Body Example
      {
        "version": "v2",
        "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
        "userIp": "8.8.8.8",
        "timestamp": 12345678,
        "bubbles": [
          {
            "type": "text",
            "data" : {
              "description" : "text content which is user input"
            }
          }
        ],
        "event": "send"
      }
    
  • Body Introduce

    | Field | Type | Required | Description | | --------- | -------------------- | -------- | ---------------------------------------- | | version | string | false | 'v2', protocol version, if not set, default process as 'v1' | | userId | string | true | unique id for user who chat with bot, no longer than 256 charactor. Please use different userId for different user to improve history | | userIp | string | false | user ip address, not required | | timestamp | long | true | current milliseconds since January 1, 1970, 00:00:00 GMT | | bubbles | array[Text] | true | only support one Text component, if there are more than one Text content, will use the last one as user request | | event | string | true | fixed string value "send" |

Back to Table of Contents

getPersistentMenu

  • if need show persistent menu but local cache not exists, could request PersistentMenu, will response persistentMenu field if fixed menu have set in messengers custom tab.

  • Body Example

      {
        "version": "v2",
        "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
        "userIp": "8.8.8.8",
        "timestamp": 12345678,
        "bubbles": [],
        "event": "getPersistentMenu"
      }
    
  • Body Introduce

    | Field | Type | Required | Description | | --------- | ------ | -------- | ---------------------------------------- | | version | string | false | 'v2', protocol version, if not set, default process as 'v1' | | userId | string | true | unique id for user who chat with bot, no longer than 256 charactor. Please use different userId for different user to improve history | | userIp | string | false | user ip address, not required | | timestamp | long | true | current milliseconds since January 1, 1970, 00:00:00 GMT | | bubbles | array | true | empty array "[]" | | event | string | true | fixed string value "getPersistentMenu" |

Back to Table of Contents

Response

  • Chatbot -> Custom Messenger
  • Headers

    | name | value | | ------------ | ------------------------ | | Content-Type | "application/json;UTF-8" |

Response Status

Success

  • Http Status Code: 200
  • Body Example
      {
        "version": "v2",
        "userId": "U47b00b58c90f8e47428af8b7bddcda3d",
        "sessionId": "34a59946-5dcb-4b72-9b63-a773c659702e",
        "timestamp": 12345678,
        "bubbles": [
          // each component is a bubble
        ],
        "quickButtons": [
          // some buttons
        ],
        "scenario": {
          "name": "analyzedScenarioName",
          "intent": [
            // some scenario intent
          ]
        },
        "entities": [
          {
            "word": "userInputWord",
            "name": "analyzedEntityName"
          }
        ],
        "keywords": [
          {
            "keyword": "userInputKeyword",
            "group": "analyzedKeywordGroupName",
            "type": "analyzedKeywordType"
          }
        ],
        "persistentMenu": {
          // one template component
        },
        "event": "send"
      }
    
  • Body Introduce

    | Field | Type | Must Exists | Description | | -------------- | ------------------------------- | ----------- | ---------------------------------------- | | version | string | false | 'v2', protocol version, if not set, default process as 'v1' | | userId | string | true | same with Request userId | | sessionId | string | false | current session id, managed by chatbot | | timestamp | long | true | response time milliseconds since January 1, 1970, 00:00:00 GMT | | bubbles | array[Component] | false | array of any Component, each component is a bubble | | quickButtons | array[Component] | false | array of Basic Button, show at the bottom of chat window | | scenario | jsonObject | false | the analyzed result of user's chat matches scenario, contains scenario name and intent | | entities | array[jsonObject] | false | the words that match entities in user's chat | | keywords | array[jsonObject] | false | the words that match keyword in user's chat. Keyword have 2 types: "exactMatch" or "contain", "exactMatch" means user input full matches the keyword, "contain" means user input contains the keyword | | persistentMenu | Template Component | false | set persistent menu, introduction reference PersistentMenu | | event | string | true | fixed string value "send" |

new general

Error

  • Http Status Code: 500
  • Body Example
      {
        "code": "1001",
        "message": "domain code 'test' not found",
        "timestamp": 12345678
      }
    
  • details introduce go to Error Define

Back to Table of Contents

Component

all component use same json structure

{
  "type": "...",
  "title": "optional, short bold text",
  "subTitle": "optional, short gray text",
  "data" : {
    ...
  }
}

Basic Component

Text

new text

  • Type: text
  • Json Structure
      {
        "type": "text",
        "title": "optional, short bold text",
        "subTitle": "optional, short gray text",
        "data" : {
          "description" : "optional, a long text content",
          "url" : "optional, a hyperlink at the bottom of description",
          "urlAlias" : "optional, hyperlink show this alias",
          "action": {[Action Data](#action)}
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | ---------------- | ----------------- | ----------- | ------------------------------------ | | type | string | true | text | | title | string | false | short bold text | | subTitle | string | false | short gray text | | data.description | string | false | a long text content | | data.url | string | false | the hyperlink jump url | | data.urlAlias | string | false | the hyperlink show text | | data.action | Action | false | the action of click on text or title |

  • You can reference to some Text Examples.

Image

new image

  • Type: image
  • Json Structure
      {
        "type": "image",
        "title": "optional, short bold text",
        "subTitle": "optional, short gray text",
        "data" : {
          "imageUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
          "alt" : "optional, short hint show when hover on image",
          "imagePosition" : "top",
          "description" : "optional, details info of image",
          "url" : "optional, a hyperlink at the bottom of description",
          "urlAlias" : "optional, hyperlink show this alias",
          "action": {[Action Data](#action)}
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | ------------------ | ----------------- | ----------- | ---------------------------------------- | | type | string | true | image | | title | string | false | short bold text | | subTitle | string | false | short gray text | | data.imageUrl | string | true | image url, must be https url | | data.alt | string | false | short hint text show hover on image | | data.imagePosition | string | false | top / bottom / left / right, default is top | | data.description | string | false | details info of image | | data.url | string | false | the hyperlink jump url | | data.urlAlias | string | false | the hyperlink show text | | data.action | Action | false | the action of click on image or title |

  • You can reference to some Image Examples.

Button

new button

  • Type: button
  • Json Structure
    • basic button
      {
        "type": "button",
        "title": "optional, text show on button",
        "subTitle": "optional, short gray text",
        "data" : {
          "type": "basic",
          "iconUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
          "action": {[Action Data](#action)}
        }
      }
      
    • image button
      {
        "type": "button",
        "title": "optional, text show on button",
        "subTitle": "optional, short gray text",
        "data" : {
          "type": "imageButton",
          "iconUrl" : "https://ssl.pstatic.net/CloudFunctions.png",
          "action": {[Action Data](#action)}
        }
      }
      
  • Introduce

    | Field | Type | Must Exists | Description | | ------------ | ----------------- | ----------- | ---------------------------------- | | type | string | true | button | | title | string | false | text show on button | | subTitle | string | false | short gray text | | data.type | string | true | basic or imageButton | | data.iconUrl | string | false | button icon url, must be https url | | data.action | Action | true | the action of click on button |

Back to Table of Contents

Composite Component

Template

new template general

Template is made up by basic components. Template have three part: cover, contentTable, footTable. cover is the major content. contentTable, footTable are table layout.

  • Type: template
  • Json Structure
      {
        "type": "template",
        "title": "optional, short bold text",
        "subTitle": "optional, short gray text",
        "data":{
          "cover":{
            // any basic component
          },
          "contentTableShowRows": 3, // if row count more than 3, should be fold
          "contentBackgroundImage":"https://ssl.pstatic.net/CloudFunctions.png", // optinal
          "contentTable":[ // table layout
            [ // first row
              {
                "colSpan": 1,
                "rowSpan": 2,
                "data":{
                  // any basic component type
                }
              },
              // other cells in first row
            ],
            // another rows
          ],
          "footTableShowRows":3, // if row count more than 3, should be fold
          "footBackgroundImage":"https://ssl.pstatic.net/CloudFunctions.png", // optinal
          "footTable":[
            // table layout same as contentTable
          ]
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | --------------------------- | ----------------------------------- | ----------- | ---------------------------------------- | | type | string | true | template | | title | string | false | short bold text | | subTitle | string | false | short gray text | | data.cover | Basic Component | false | one Text / Image / Button | | data.contentTableShowRows | integer | false | show max rows, if row count more than max, should be fold, and plus an expand button. if not set, will show all rows | | data.contentBackgroundImage | string | false | show background image at the content table area | | data.contentTable | array[][Cell] | false | table layout, two-dimensional array of cell, cell data is any basic component | | data.footTableShowRows | integer | false | show max rows, if row count more than max, should be fold, and plus an expand button. if not set, will show all rows | | data.footBackgroundImage | string | false | show background image at the foot table area | | data.footTable | array[][Cell] | false | same as contentTable, always not exists, unless contentTable can't support |

  • Introduce of cell in table layout

    | Field | Type | Must Exists | Description | | ------- | ----------------------------------- | ----------- | ------------------------- | | rowSpan | integer | true | span row count | | colSpan | integer | true | span column count | | data | Basic Component | true | one Text / Image / Button |

  • You can reference to some Template Examples.

new carousel general

  • Type: carousel
  • Json Structure
      {
        "type": "carousel",
        "title": "optional, short bold text",
        "subTitle": "optional, short gray text",
        "data" : {
           "cards": [
             {
               // any component except carousel self and line flex
             },
             // more components
           ]
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | ---------- | ------------------------------ | ----------- | ---------------------------------------- | | type | string | true | carousel | | title | string | false | short bold text | | subTitle | string | false | short gray text | | data.cards | array[Component] | true | array of any component, but not carousel and line flex |

  • You can reference to some Carousel Examples.

Back to Table of Contents

Special Messenger Component

LINE Flex

To support LINE Flex Message json.

  • Type: flex
  • Json Structure
      {
        "type": "flex",
        "title": "not used",
        "subTitle": "required, alternative text",
        "data" : {
          // LINE Flex Message container object
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | -------- | ---------------------------------------- | ----------- | ---------------------------------------- | | type | string | true | flex | | title | string | true | alternative text, show in chat list and push alert | | subTitle | string | false | not used | | data | FlexMessageContainerObject | true | Flex Message container object, could copy json from Flex Message Simulator |

  • You can reference to some Line Flex Examples.

Line Sticker

To support LINE Sitcker Message.

  • Type: line_sticker
  • Json Structure
      {
        "type": "line_sticker",
        "data" : {
           "packageId": "packageId of LINE",
           "stickerId": "stickerId of LINE"
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | -------------- | ------ | ----------- | ---------------------------------------- | | type | string | true | line_sticker | | data.packageId | string | true | sticker's packageId of LINE, refer to sticker list | | data.stickerId | string | true | sticker's stickerId of LINE, refer to sticker list |

LineWorks Sticker

To support LINEWORKS Sitcker Message.

  • Type: lineworks_sticker
  • Json Structure
      {
        "type": "lineworks_sticker",
        "data" : {
           "packageId": "packageId of LINEWORKS",
           "stickerId": "stickerId of LINEWORKS"
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | -------------- | ------ | ----------- | ---------------------------------------- | | type | string | true | lineworks_sticker | | data.packageId | string | true | sticker's packageId of LINEWORKS, refer to sticker list | | data.stickerId | string | true | sticker's stickerId of LINEWORKS, refer to sticker list |

Back to Table of Contents

Action

Action is a common data for all basic components. define what will do when click on component.

Postback

When click on component, will postback the postbackText to chatbot and show postback as user chat.

  • Type: postback
  • Json Structure
      {
        "type": "postback",
        "data" : {
          "postback" : "text to show as user chat in messenger chat window"
          "postbackFull" : "full postback content send to chatbot"
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | ----------------- | ------ | ----------- | ---------------------------------------- | | type | string | true | postback | | data.postback | string | true | text show as user chat, if send this field to chatbot, not affect previous features, but will not support some new features | | data.postbackFull | string | true | postback full content send to chatbot |

Utterance

When click on component, will postback a text to chatbot and show text as user chat.

  • Type: utterance
  • Json Structure
      {
        "type": "utterance",
        "data" : {
          "utteranceId" : 1,
          "text" : "text show in chat window",
          "postback" : "postback text"
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | ---------------- | ------ | ----------- | -------------------------------------- | | type | string | true | utterance | | data.utteranceId | string | true | | | data.text | string | true | text show in chat window as user input | | data.postback | string | true | postback text send to chatbot |

When click on component, will jump to a url.

  • Type: link
  • Json Structure
      {
        "type": "link",
        "data" : {
          "url" : "http://www.ncloud.com",
          "mobileUrl" : "http://m.ncloud.com"
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | -------------- | ------ | ----------- | --------------------- | | type | string | true | postback | | data.url | string | true | open url | | data.mobileUrl | string | false | url for mobile device |

Phone

When click on component, will jump dial page. Maybe only support on mobile.

  • Type: link
  • Json Structure
      {
        "type": "phone",
        "data" : {
          "number" : "400-1111-1111",
          "name" : "Customer service"
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | ----------- | ------ | ----------- | ------------ | | type | string | true | phone | | data.number | string | true | phone number | | data.name | string | false | contact name |

Back to Table of Contents

Welcome

When click on component, will send an open event.

  • Type: welcome
  • Json Structure
      {
        "type": "welcome",
        "data" : {
          "postback" : "postback text, optional"
        }
      }
    
  • Introduce

    | Field | Type | Must Exists | Description | | ------------- | ------ | ----------- | ---------------------------------------- | | type | string | true | welcome | | data.postback | string | false | postback text send to chatbot in open event |

Back to Table of Contents

Quick Button

A group fixed buttons at the bottom of the chat window.

Persistent Menu

The fixed menu, show when user touch menu button on chat bar. Always contains in welcome response. Not changes utils another response contains persistentMenu content.

image

Persistent menu is a Template Component, with these definition:

  • title will show on the chat bar.
  • no cover, cover should be discard.
  • no foot table, fields relate to foot area should be discard.
  • contentBackgroundImage is the background, if the components in the contentTable have image, will cover the background.

Response Examples

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"
}

Back to Table of Contents

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"
}

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"
}

Back to Table of Contents

Template

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"
}

Back to Table of Contents

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"
}

Back to Table of Contents

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"
}

Back to Table of Contents

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"
}

Back to Table of Contents

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"
}

Back to Table of Contents

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"
}

Back to Table of Contents

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"
}

Back to Table of Contents

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"
}

Back to Table of Contents

Error Define

  • Http Status Code: 500
  • Body Example
      {
        "code": "1001",
        "message": "domain code test not found",
        "timestamp": 12345678
      }
    
  • Body Introduce

    | Field | Type | Must Exists | Description | | --------- | ------ | ----------- | ---------------------------------------- | | code | string | true | error code | | event | string | true | fixed string value "send" | | timestamp | long | true | response time milliseconds since January 1, 1970, 00:00:00 GMT |

  • Error Code Define

    | code | Description | | ---- | ---------------------------------------- | | 4000 | request param invalid | | 4010 | Unauthorized | | 4030 | Forbidden to access | | 4031 | Signature validate failed | | 4032 | timestamp exceeded time window(10000ms) | | 1000 | version not support | | 1001 | Not found domain code | | 1002 | check url param is invalid | | 5000 | Unknown service error | | 5010 | Current protocol version not support this reply structure |

""에 대한 건이 검색되었습니다.

    ""에 대한 검색 결과가 없습니다.

    처리중...