POST/bots/{botId}/persistentmenu

Adds persistent menus to be used by the client software.

A persistent menu is added as a button, for which you can set a message and uri as the callback type.

You can use the button to add the postback parameter to a message, which then the server can receive as a callback. For the postback type, see Receive messages (callback).

The structure of a persistent menu is as follows:

Note

  • You can add up to 4 buttons.
  • A new line character in text is substituted with a blank space.

Caution

  • A persistent menu is deleted if a rich menu is added.
  • A persistent menu cannot be added to a bot with rich menus added.

Authorization

oauth2

OAuth 2.0 authentication.
For more information, see Authentication and Authorization.

Scope

bot.message
bot

HTTP Request

POSThttps://www.worksapis.com/v1.0/bots/{botId}/persistentmenu

Path Parameters

ParameterTypeDescription
botId integer 

Bot ID


required
example : 2000001
format : int64 

Header Parameters

HeadertypeDescription
Authorization string 

Bearer {token}


required 
Content-Type string 

application/json


required
example : application/json 

Request Body

PropertyTypeDescription
content object (content) 

Persistent menu to add


required 

content

PropertyTypeDescription
actions array (PersistentMenuActionStruct) 

List of buttons to be added to the persistent menu


required
maxItems : 4 

PersistentMenuActionStruct

PropertyTypeDescription
type string 

Action type


required
Allowed values : message, uri, copy 
label string 

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.

  • Maximum length for an image carousel: 12 characters
  • Maximum length for a persistent menu: 1,000 characters
  • Maximum length for other types: 20 characters
 
postback string 

Text string returned through the message.postback property


maxLength : 1000 
text string 

Text message sent when an element is pressed. It is required for a carousel, image carousel, rich menu and quick reply, and is replaced with the label value for a button template, list template, and persistent menu.


maxLength : 300 
uri string 

URI that opens when an element is pressed. The "http" and "https" schemas are supported.


maxLength : 1000 
copyText string 

Text string copied to the clipboard when an element is pressed.


maxLength : 1000 
i18nLabels array (i18nLabels) 

List of multilingual labels


minItems : 0 
i18nTexts array (i18nTexts) 

List of text messages sent when an element is pressed.


minItems : 0 

i18nLabels

PropertyTypeDescription
language string 

Language code


required
Allowed values : ko_KR, ja_JP, en_US, zh_CN, zh_TW 
label string 

Label displayed on an element

  • Maximum length for an image carousel: 12 characters
  • Maximum length for a persistent menu: 1,000 characters
  • Maximum length for other types: 20 characters

required 

i18nTexts

PropertyTypeDescription
language string 

Language code


required
Allowed values : ko_KR, ja_JP, en_US, zh_CN, zh_TW 
text string 

Text message sent when an element is pressed. It is required for a carousel, image carousel, rich menu and quick reply, and is replaced with the label value for a button template, list template, and persistent menu.


required
maxLength : 300 

Request Example

example

1{2  "content": {3    "actions": [4      {5        "type": "message",6        "label": "Example label",7        "text": "Example text",8        "postback": "Example postback",9        "i18nLabels": [10          {11            "language": "en_US",12            "label": "Example label"13          }14        ],15        "i18nTexts": [16          {17            "language": "en_US",18            "text": "Example text"19          }20        ]21      },22      {23        "type": "uri",24        "label": "Example Homepage",25        "uri": "https://example.com",26        "i18nLabels": [27          {28            "language": "en_US",29            "label": "Example label"30          }31        ]32      }33    ]34  }35}

Response

HTTP 201

OK

PropertyTypeDescription
content object (content) 

Persistent menu to add


required 

content

PropertyTypeDescription
actions array (PersistentMenuActionStruct) 

List of buttons to be added to the persistent menu


required
maxItems : 4 

PersistentMenuActionStruct

PropertyTypeDescription
type string 

Action type


required
Allowed values : message, uri, copy 
label string 

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.

  • Maximum length for an image carousel: 12 characters
  • Maximum length for a persistent menu: 1,000 characters
  • Maximum length for other types: 20 characters
 
postback string 

Text string returned through the message.postback property


maxLength : 1000 
text string 

Text message sent when an element is pressed. It is required for a carousel, image carousel, rich menu and quick reply, and is replaced with the label value for a button template, list template, and persistent menu.


maxLength : 300 
uri string 

URI that opens when an element is pressed. The "http" and "https" schemas are supported.


maxLength : 1000 
copyText string 

Text string copied to the clipboard when an element is pressed.


maxLength : 1000 
i18nLabels array (i18nLabels) 

List of multilingual labels


minItems : 0 
i18nTexts array (i18nTexts) 

List of text messages sent when an element is pressed.


minItems : 0 

i18nLabels

PropertyTypeDescription
language string 

Language code


required
Allowed values : ko_KR, ja_JP, en_US, zh_CN, zh_TW 
label string 

Label displayed on an element

  • Maximum length for an image carousel: 12 characters
  • Maximum length for a persistent menu: 1,000 characters
  • Maximum length for other types: 20 characters

required 

i18nTexts

PropertyTypeDescription
language string 

Language code


required
Allowed values : ko_KR, ja_JP, en_US, zh_CN, zh_TW 
text string 

Text message sent when an element is pressed. It is required for a carousel, image carousel, rich menu and quick reply, and is replaced with the label value for a button template, list template, and persistent menu.


required
maxLength : 300 

Response Example

example

1{2  "content": {3    "actions": [4      {5        "type": "message",6        "label": "Example label",7        "text": "Example text",8        "postback": "Example postback",9        "i18nLabels": [10          {11            "language": "en_US",12            "label": "Example label"13          }14        ],15        "i18nTexts": [16          {17            "language": "en_US",18            "text": "Example text"19          }20        ]21      },22      {23        "type": "uri",24        "label": "Example Homepage",25        "uri": "https://example.com",26        "i18nLabels": [27          {28            "language": "en_US",29            "label": "Example label"30          }31        ]32      }33    ]34  }35}