Feishu Merged Message Fetcher
Feishu's merge_forward messages appear as "Merged and Forwarded Message" with no content in the bot API. Use the Feishu REST API to retrieve the actual sub-messages.
When to Use
- - Message body contains only INLINECODE0
- INLINECODE1 is INLINECODE2
- User asks about a forwarded/合并转发 message you can't read
How It Works
The Feishu GET /open-apis/im/v1/messages/{message_id} endpoint returns the parent message plus all sub-messages in data.items[]. Sub-messages have upper_message_id pointing to the parent.
Steps
- 1. Get the
message_id of the merged message (from inbound context or replied message metadata).
- 2. Run the fetch script:
bash <skill_dir>/scripts/fetch_merged_msg.sh <message_id> <app_id> <app_secret>
-
app_id /
app_secret: from OpenClaw config at
.channels.feishu in
openclaw.json
- If credentials are not readily available, extract them:
CODEBLOCK1
- 3. Parse the JSON response:
-
data.items[0] is the parent (merge_forward) message
-
data.items[1:] are the sub-messages in chronological order
- Each sub-message has
body.content with the actual text/post content
-
mentions[] maps
@_user_N placeholders to real names
-
sender.id identifies who sent each sub-message
- 4. Summarize the conversation thread for the user.
Notes
- - The API requires
im:message:readonly scope on the Feishu app. - Images inside sub-messages show as
image_key references; they cannot be directly displayed but can be described from context. - Sub-messages may come from different chats (check
chat_id); the original chat context may differ from the current group.
飞书合并转发消息获取器
飞书的merge_forward消息在机器人API中显示为合并转发消息且无实际内容。通过飞书REST API可获取实际的子消息。
使用场景
- - 消息体仅包含合并转发消息
- msgtype 为 mergeforward
- 用户询问你无法读取的转发/合并转发消息
工作原理
飞书GET /open-apis/im/v1/messages/{messageid}接口返回父消息及data.items[]中的所有子消息。子消息的uppermessage_id指向父消息。
操作步骤
- 1. 获取合并消息的message_id(从入站上下文或回复的消息元数据中获取)。
- 2. 运行获取脚本:
bash
bash
dir>/scripts/fetchmergedmsg.sh id> id> secret>
- appid / appsecret:来自OpenClaw配置中openclaw.json的.channels.feishu字段
- 如果无法直接获取凭证,可通过以下命令提取:
bash
python3 -c import json; d=json.load(open(/root/.openclaw/openclaw.json)); c=d[channels][feishu]; print(c.get(appId,), c.get(appSecret,))
- 3. 解析JSON响应:
- data.items[0] 为父消息(合并转发消息)
- data.items[1:] 为按时间顺序排列的子消息
- 每个子消息的body.content包含实际文本/帖子内容
- mentions[] 将@userN占位符映射为真实姓名
- sender.id 标识每条子消息的发送者
- 4. 为用户总结对话线程。
注意事项
- - API需要飞书应用的im:message:readonly权限范围。
- 子消息中的图片显示为imagekey引用;无法直接展示,但可根据上下文描述。
- 子消息可能来自不同聊天(检查chat
id);原始聊天上下文可能与当前群组不同。