Action Objects

An action object defines an action of the bot when a button in a message or menu is pressed.

Action types {#actions}

The available action types are as follows:

  • Postback action
  • Message action
  • URI action
  • Camera action
  • Camera roll action
  • Location action
  • Copy action

The available positions for each action type are as follows:

Action typeAvailable positions
Postback actionCarousel
Image Carousel
Quick Reply
Rich Menu
Message actionButton Template
List Template
Carousel
Image Carousel
Quick Reply
Persistent Menu
Rich Menu
URI actionButton Template
List Template
Carousel
Image Carousel
Quick Reply
Persistent Menu
Rich Menu
Camera actionQuick Reply
Camera roll actionQuick Reply
Location actionQuick Reply
Copy actionButton Template
List Template
Carousel
Image Carousel
Quick Reply
Persistent Menu
Rich Menu

Postback action {#postback}

When an element associated with this action is pressed, a Postback Event containing the text string specified in the data parameter is returned through the callback.

Note

  • The available positions are limited for each action type. For more information, see the table in Action types .

common {#postback-common}

ParameterTypeRequiredDescription
typestringYSet this parameter to "postback".
labelstringSee the description.Label displayed on an element. It is required, except for "defaultAction" of a rich menu and carousel. If it is not specified for a rich menu, the default message is displayed in the desktop environment.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
datastringYText string returned through the callback of the postback.data property.
Maximum length: 300 characters
displayTextstringSee the description.Chat message sent by a user. If it is not specified, no text is displayed.
Note that it is required for a quick reply.
Maximum length: 300 characters

multi language {#postback-multilang}

ParameterTypeRequiredDescription
i18nLabelsarrayNList of multilingual labels
i18nLabels[].languagestringYLanguage code
• ko_KR • ja_JP • zh_CN • zh_TW • en_US
i18nLabels[].labelstringYLabel displayed on an element.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
i18nDisplayTextsarrayNList of multilingual display texts
i18nDisplayTexts[].languagestringYLanguage code
• ko_KR • ja_JP • zh_CN • zh_TW • en_US
i18nDisplayTexts[].displayTextstringYChat message sent by a user.
Maximum length: 300 characters

Request example {#postback-example}

{  "type": "postback",  "label": "Buy",  "data": "action=buy&itemid=111",  "displayText": "Buy"

Message action {#message}

When an element associated with this action is pressed, a text string is sent as a message and a Message Event is returned through the callback.

Note

  • The available positions are limited for each action type. For more information, see the table in Action types .

common {#message-common}

ParameterTypeRequiredDescription
typestringYSet this parameter to "message".
labelstringSee the description.Label displayed on an element. It is required, except for "defaultAction" of a rich menu and carousel. If it is not specified for a rich menu, the default message is displayed in the desktop environment.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
• Maximum length for persistent menu: 1,000 characters
TextstringSee the description.Text message sent when an element is pressed. It is required for a carousel, image carousel, rich menu and quick reply, and replaced with the label value for a button template, list template and persistent menu.
Maximum length: 300 characters
postbackstringNText string returned through the message.postback property
Maximum length: 1,000 characters

multi language {#message-multilang}

ParameterTypeRequiredDescription
i18nLabelsarrayNList of multilingual labels
i18nLabels[].languagestringYLanguage code
• ko_KR • ja_JP • zh_CN • zh_TW • en_US
i18nLabels[].labelstringYLabel displayed on an element.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
• Maximum length for a persistent menu: 1,000 characters
i18nTextsarrayNList of multilingual texts
i18nTexts[].languagestringYLanguage code
• ko_KR • ja_JP • zh_CN • zh_TW • en_US
i18nTexts[].textstringYText message sent when an element is pressed. It is required for a carousel, image carousel, rich menu and quick reply, and replaced with the label value for a button template, list template and persistent menu.
Maximum length: 300 characters

Request example {#message-example}

{  "type": "message",  "label": "Yes",  "text": "Yes"}

URI action {#uri}

When an element associated with this action is pressed, the URI set in the uri property opens.

Note

  • The available positions are limited for each action type. For more information, see the table in Action types .

common {#uri-common}

ParameterTypeRequiredDescription
typestringYSet this parameter to "uri".
labelstringSee the description.Label displayed on an element. It is required, except for "defaultAction" of a rich menu and carousel. If it is not specified for a rich menu, the default message is displayed in the desktop environment.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
• Maximum length for a persistent menu: 1,000 characters
uristringYURI that opens when an element is pressed. The "http" and "https" schemas are supported.
Maximum length: 1,000 characters

multi language {#uri-multilang}

ParameterTypeRequiredDescription
i18nLabelsarrayNList of multilingual labels
i18nLabels[].languagestringYLanguage code
• ko_KR • ja_JP • zh_CN • zh_TW • en_US
i18nLabels[].labelstringYLabel displayed on an element.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
• Maximum length for a persistent menu: 1,000 characters

Request example {#uri-example}

{  "type": "uri",  "label": "View details",  "uri": "http://example.com"}

Camera action {#camera}

When a button associated with this action is pressed, the camera screen opens.

Note

  • The available positions are limited for each action type. For more information, see the table in Action types .
  • It is available only on mobile.

common {#camera-common}

ParameterTypeRequiredDescription
typestringYSet this parameter to "camera".
labelstringYButton label
Maximum length: 20 characters

multi language {#camera-multilang}

ParameterTypeRequiredDescription
i18nLabelsarrayNList of multilingual labels
i18nLabels[].languagestringYLanguage code
• ko_KR • ja_JP • zh_CN • zh_TW • en_US
i18nLabels[].labelstringYLabel displayed on an element.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
• Maximum length for a persistent menu: 1,000 characters

Request example {#camera-example}

{  "type": "camera",  "label": "Camera"}

Camera roll action {#cameraroll}

When a button associated with this action is pressed, the camera roll opens.

Note

  • The available positions are limited for each action type. For more information, see the table in Action types .
  • It is available only on mobile.

common {#cameraroll-common}

ParameterTypeRequiredDescription
typestringYSet this parameter to "cameraRoll".
labelstringYButton label
Maximum length: 20 characters

multi language {#cameraroll-multilang}

ParameterTypeRequiredDescription
i18nLabelsarrayNList of multilingual labels
i18nLabels[].languagestringYLanguage code
• ko_KR • ja_JP • zh_CN • zh_TW • en_US
i18nLabels[].labelstringYLabel displayed on an element.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
• Maximum length for a persistent menu: 1,000 characters

Request example {#cameraroll-example}

{  "type": "cameraRoll",  "label": "Camera roll"}

Location action {#location}

When a button associated with this action is pressed, the location information screen opens.

Note

  • The available positions are limited for each action type. For more information, see the table in Action types .
  • It is available only on mobile.

common {#location-common}

ParameterTypeRequiredDescription
typestringYSet this parameter to "location".
labelstringYButton label
Maximum length: 20 characters

multi language {#location-multilang}

ParameterTypeRequiredDescription
i18nLabelsarrayNList of multilingual labels
i18nLabels[].languagestringYLanguage code
• ko_KR • ja_JP • zh_CN • zh_TW • en_US
i18nLabels[].labelstringYLabel displayed on an element.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
• Maximum length for a persistent menu: 1,000 characters

Request example {#location-example}

{  "type": "location",  "label": "Location"}

Copy action {#copy}

When a button associated with this action is pressed, the text specified in the copyText parameter is copied to the clipboard.

Note

  • The available positions are limited for each action type. For more information, see the table in Action types .

Caution

  • This action is available in v3.6 or later.

common {#copy-common}

ParameterTypeRequiredDescription
typestringYSet this parameter to "copy".
labelstringSee the description.Label displayed on an element. It is required, except for "defaultAction" of a rich menu and carousel. If it is not specified for a rich menu, the default message is displayed in the desktop environment.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
• Maximum length for a persistent menu: 1,000 characters
copyTextstringYText string copied to the clipboard when an element is pressed.
Maximum length: 1,000 characters

multi language {#copy-multilang}

ParameterTypeRequiredDescription
i18nLabelsarrayNList of multilingual labels
i18nLabels[].languagestringYLanguage code
• ko_KR • ja_JP • zh_CN • zh_TW • en_US
i18nLabels[].labelstringYLabel displayed on an element.
• Default maximum length: 20 characters
• Maximum length for an image carousel: 12 characters
• Maximum length for a persistent menu: 1,000 characters

Request example {#copy-example}

{"type": "copy","label": "Copy This","copyText": "This is a copied text."}