添加群菜单
POST
https://open.feishu.cn/open-apis/im/v1/chats/{chat_id}/menu_tree
错误码
HTTP状态码 | 错误码 | 描述 | 排查建议 |
---|---|---|---|
400 | 232001 | Your request contains an invalid request parameter. | 参数错误,参考本文档检查输入参数。 |
400 | 232008 | Your request specifies a chat whose type is NOT supported currently. | 不支持的群模式(chat_mode)或群类型(chat_type)。 |
400 | 232011 | Operator can NOT be out of the chat. | 操作者需要在群组中。 |
400 | 232014 | The token used in the request does NOT have the permissions necessary to complete the request. | 操作者没有权限进行该操作,请检查是否具有相应的权限。 |
400 | 232025 | Bot ability is not activated. | 应用需要开启机器人能力。 |
400 | 232056 | The operator is not the image's owner, no permission to complete the request. | 机器人需要使用自己上传的图片。 |
400 | 231170 | The number of chat_menu_top_level has reached the limit. | 群内一级菜单不能超过3个。 |
400 | 231171 | The number of chat_menu_second_level has reached the limit. | 群内二级菜单不能超过5个。 |
400 | 232073 | The group menu is being modified, please try again later. | 群内菜单正在修改中,请稍后重试。 |
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://open.feishu.cn/open-apis/im/v1/chats//menu_tree' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
"menu_tree": {
"chat_menu_top_levels": [
{
"chat_menu_item": {
"action_type": "NONE",
"redirect_link": {
"common_url": "https://open.feishu.cn/",
"ios_url": "https://open.feishu.cn/",
"android_url": "https://open.feishu.cn/",
"pc_url": "https://open.feishu.cn/",
"web_url": "https://open.feishu.cn/"
},
"image_key": "img_v2_b0fbe905-7988-4282-b882-82edd010336j",
"name": "菜单",
"i18n_names": {
"zh_cn": "菜单",
"en_us": "Menu",
"ja_jp": "メニュー"
}
},
"children": [
{
"chat_menu_item": {
"action_type": "REDIRECT_LINK",
"redirect_link": {
"common_url": "https://open.feishu.cn/",
"ios_url": "https://open.feishu.cn/",
"android_url": "https://open.feishu.cn/",
"pc_url": "https://open.feishu.cn/",
"web_url": "https://open.feishu.cn/"
},
"image_key": "img_v2_b0fbe905-7988-4282-b882-82edd010336j",
"name": "报名",
"i18n_names": {
"zh_cn": "报名",
"en_us": "Sign up",
"ja_jp": "サインアップ"
}
}
}
]
}
]
}
}'
响应示例响应示例
{
"code": 0,
"msg": "success",
"data": {
"menu_tree": {
"chat_menu_top_levels": [
{
"chat_menu_top_level_id": "7117116451961487361",
"chat_menu_item": {
"action_type": "NONE",
"redirect_link": {
"common_url": "https://open.feishu.cn/",
"ios_url": "https://open.feishu.cn/",
"android_url": "https://open.feishu.cn/",
"pc_url": "https://open.feishu.cn/",
"web_url": "https://open.feishu.cn/"
},
"image_key": "img_v2_b0fbe905-7988-4282-b882-82edd010336j",
"name": "菜单",
"i18n_names": {
"zh_cn": "菜单",
"en_us": "Menu",
"ja_jp": "メニュー"
}
},
"children": [
{
"chat_menu_second_level_id": "7039638308221468675",
"chat_menu_item": {
"action_type": "REDIRECT_LINK",
"redirect_link": {
"common_url": "https://open.feishu.cn/",
"ios_url": "https://open.feishu.cn/",
"android_url": "https://open.feishu.cn/",
"pc_url": "https://open.feishu.cn/",
"web_url": "https://open.feishu.cn/"
},
"image_key": "img_v2_b0fbe905-7988-4282-b882-82edd010336j",
"name": "报名",
"i18n_names": {
"zh_cn": "报名",
"en_us": "Sign up",
"ja_jp": "サインアップ"
}
}
}
]
}
]
}
}
}
请求参数
Path 参数
chat_id
string
必需
Header 参数
Authorization
string
必需
默认值:
Bearer {{access_token}}
Content-Type
string
必需
默认值:
application/json; charset=utf-8
Body 参数application/json
返回响应
修改于 2023-01-13 02:50:18