POST/bots/{botId}/richmenus

Bot のリッチメニューを登録する。

  • 1 つの Bot に対し、最大 1,000 個のリッチメニューを登録できる。
  • 各動作 (action) の label 項目は、PC 版アプリで使用される。指定していない場合は、デフォルトの文章が表示される。

登録したリッチメニューを使用するためには、追加で以下の手順が必要。

  1. コンテンツアップロード でアップロード URL を取得
  2. アップロード URL にリッチメニュー画像を アップロード
  3. アップロードした画像の fileId を指定してリッチメニュー画像を登録
  4. デフォルトリッチメニューの適用、または ユーザー別リッチメニューの適用

デフォルトリッチメニューは、Bot の更新 または Bot の部分更新 の defaultRichMenuId でも指定できます。

Authorization

oauth2

Access Token を指定します。
指定の方法や Access Token の取得方法は 共通仕様 を参照してください。

Scope

bot.message
bot

HTTP Request

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

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
richmenuName string 

リッチメニュー名


required
maxLength : 300 
areas array (RichmenuArea) 

リッチメニューの各動作 (action) のエリア (座標/サイズ)


required
minItems : 1
maxItems : 20 
size object (size) 

リッチメニューの幅と高さ


required 

RichmenuArea

PropertyTypeDescription
action object (action) 

エリアを押した時の動作


required 
bounds object (bounds) 

リッチメニューボタンの範囲モデル


required 

action

PropertyTypeDescription
type string 

Action の種類


required
Allowed values : postback, message, uri, copy 
label string 

項目に表示されるラベル
リッチメニューとカルーセルの defaultAction 項目を除き必須。リッチメニューは、値を指定しない場合、デスクトップ環境でデフォルトメッセージが表示される。

  • 画像カルーセルの最大文字数: 12 字
  • 固定メニューの最大文字数: 1,000 字
  • 上記以外の最大文字数: 20 字
 
data string 

"postback.data" プロパティとして返す文字列


maxLength : 300 
displayText string 

トーク画面に表示されるテキスト
入力しない場合、テキストが表示されない。クイックリプライでは必須。


maxLength : 300 
postback string 

"message.postback" として返される文字列


maxLength : 1000 
text string 

項目を押すと送信されるテキスト
カルーセル、画像カルーセル、リッチメニュー、クイックリプライでは必須値であり、ボタンテンプレート、リストテンプレート、固定メニューでは label に置き換えられる。


maxLength : 300 
uri string 

項目を押すと開く URI
http、https スキーマに対応する。


maxLength : 1000 
copyText string 

項目をクリックするとクリップボードにコピーされる文字列


maxLength : 1000 
i18nDisplayTexts array (i18nDisplayTexts) 

多言語の表示テキストリスト


minItems : 0 
i18nLabels array (i18nLabels) 

多言語のラベルリスト


minItems : 0 
i18nTexts array (i18nTexts) 

多言語のテキストリスト


minItems : 0 

i18nDisplayTexts

PropertyTypeDescription
language string 

多国語言語コード


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

ユーザーが送信したメッセージで、トーク画面に表示されるテキスト


required
maxLength : 300 

i18nLabels

PropertyTypeDescription
language string 

多国語言語コード


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

項目に表示されるラベル

  • 画像カルーセルの最大文字数: 12 字
  • 固定メニューの最大文字数: 1,000 字
  • 上記以外の最大文字数: 20 字

required 

i18nTexts

PropertyTypeDescription
language string 

多国語言語コード


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

項目を押すと送信されるテキスト
カルーセル、画像カルーセル、リッチメニュー、クイックリプライでは必須値として使用され、ボタンテンプレート、リストテンプレート、固定メニューでは label に置き換えられる。


required
maxLength : 300 

bounds

PropertyTypeDescription
x integer 

領域の左側からの水平位置


required
minimum : 0
maximum : 2500
format : int64 
y integer 

領域の上部からの垂直位置


required
minimum : 0
maximum : 1686
format : int64 
width integer 

領域の幅


required
minimum : 0
maximum : 2500
format : int64 
height integer 

領域の高さ


required
minimum : 0
maximum : 1686
format : int64 

size

PropertyTypeDescription
width integer 

リッチメニューの幅


required
Allowed values : 2500
format : int64 
height integer 

リッチメニューの高さ


required
Allowed values : 843, 1686
format : int64 

Request Example

example

1{2  "richmenuName": "Example Richmenu",3  "areas": [4    {5      "action": {6        "type": "postback",7        "label": "Example label",8        "data": "Example data",9        "displayText": "Example displayText",10        "i18nDisplayTexts": [11          {12            "language": "en_US",13            "displayText": "Example display text"14          }15        ],16        "i18nLabels": [17          {18            "language": "en_US",19            "label": "Example label"20          }21        ]22      },23      "bounds": {24        "x": 0,25        "y": 0,26        "width": 2500,27        "height": 84328      }29    }30  ],31  "size": {32    "width": 2500,33    "height": 84334  }35}

Response

HTTP 201

OK

PropertyTypeDescription
richmenuId string 

リッチメニュー ID


readOnly : true 
richmenuName string 

リッチメニュー名


required
maxLength : 300 
areas array (RichmenuArea) 

リッチメニューの各動作 (action) のエリア (座標/サイズ)


required
minItems : 1
maxItems : 20 
size object (size) 

リッチメニューの幅と高さ


required 

RichmenuArea

PropertyTypeDescription
action object (action) 

エリアを押した時の動作


required 
bounds object (bounds) 

リッチメニューボタンの範囲モデル


required 

action

PropertyTypeDescription
type string 

Action の種類


required
Allowed values : postback, message, uri, copy 
label string 

項目に表示されるラベル
リッチメニューとカルーセルの defaultAction 項目を除き必須。リッチメニューは、値を指定しない場合、デスクトップ環境でデフォルトメッセージが表示される。

  • 画像カルーセルの最大文字数: 12 字
  • 固定メニューの最大文字数: 1,000 字
  • 上記以外の最大文字数: 20 字
 
data string 

"postback.data" プロパティとして返す文字列


maxLength : 300 
displayText string 

トーク画面に表示されるテキスト
入力しない場合、テキストが表示されない。クイックリプライでは必須。


maxLength : 300 
postback string 

"message.postback" として返される文字列


maxLength : 1000 
text string 

項目を押すと送信されるテキスト
カルーセル、画像カルーセル、リッチメニュー、クイックリプライでは必須値であり、ボタンテンプレート、リストテンプレート、固定メニューでは label に置き換えられる。


maxLength : 300 
uri string 

項目を押すと開く URI
http、https スキーマに対応する。


maxLength : 1000 
copyText string 

項目をクリックするとクリップボードにコピーされる文字列


maxLength : 1000 
i18nDisplayTexts array (i18nDisplayTexts) 

多言語の表示テキストリスト


minItems : 0 
i18nLabels array (i18nLabels) 

多言語のラベルリスト


minItems : 0 
i18nTexts array (i18nTexts) 

多言語のテキストリスト


minItems : 0 

i18nDisplayTexts

PropertyTypeDescription
language string 

多国語言語コード


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

ユーザーが送信したメッセージで、トーク画面に表示されるテキスト


required
maxLength : 300 

i18nLabels

PropertyTypeDescription
language string 

多国語言語コード


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

項目に表示されるラベル

  • 画像カルーセルの最大文字数: 12 字
  • 固定メニューの最大文字数: 1,000 字
  • 上記以外の最大文字数: 20 字

required 

i18nTexts

PropertyTypeDescription
language string 

多国語言語コード


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

項目を押すと送信されるテキスト
カルーセル、画像カルーセル、リッチメニュー、クイックリプライでは必須値として使用され、ボタンテンプレート、リストテンプレート、固定メニューでは label に置き換えられる。


required
maxLength : 300 

bounds

PropertyTypeDescription
x integer 

領域の左側からの水平位置


required
minimum : 0
maximum : 2500
format : int64 
y integer 

領域の上部からの垂直位置


required
minimum : 0
maximum : 1686
format : int64 
width integer 

領域の幅


required
minimum : 0
maximum : 2500
format : int64 
height integer 

領域の高さ


required
minimum : 0
maximum : 1686
format : int64 

size

PropertyTypeDescription
width integer 

リッチメニューの幅


required
Allowed values : 2500
format : int64 
height integer 

リッチメニューの高さ


required
Allowed values : 843, 1686
format : int64 

Response Example

example

1{2  "richmenuId": "40001",3  "richmenuName": "Example Richmenu",4  "areas": [5    {6      "action": {7        "type": "postback",8        "label": "Example label",9        "data": "Example data",10        "displayText": "Example displayText",11        "i18nDisplayTexts": [12          {13            "language": "en_US",14            "displayText": "Example display text"15          }16        ],17        "i18nLabels": [18          {19            "language": "en_US",20            "label": "Example label"21          }22        ]23      },24      "bounds": {25        "x": 0,26        "y": 0,27        "width": 2500,28        "height": 84329      }30    }31  ],32  "size": {33    "width": 2500,34    "height": 84335  }36}