360 Secure SkillHub
360 安全技能中心

Feishu Merged Msg

核心功能:解决飞书机器人API无法读取合并转发消息内容的问题,调用飞书IM接口获取并解析合并消息的所有子消息,提取子消息内容、发送者等信息。典型场景:收到仅显示“合并转发消息”无内容的消息、消息类型为merge_forward、用户询问无法读取的转发消息。输入合并消息的message_id,输出解析后的子消息序列;需飞书应用具备im:message:readonly权限,子消息中图片仅能获取key无法直接显示。

deadblue22
deadblue22
热度 61.47
最近更新 2026-05-17 13:18:05
分类:自动化依赖:代码执行 / 读写文件 / 第三方 API应用场景:摘要总结 / API 集成 / 数据处理 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add feishu-merged-msg
Metadata
name
feishu-merged-msg
description
Fetch and parse Feishu merged/forwarded messages (合并转发消息). Activate when a Feishu message shows "Merged and Forwarded Message" with no readable content, or when you need to retrieve sub-messages from a merge_forward message type.

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 "Merged and Forwarded Message"
  • msg_type is merge_forward
  • 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:
      python3 -c "import json; d=json.load(open('/root/.openclaw/openclaw.json')); c=d['channels']['feishu']; print(c.get('appId',''), c.get('appSecret',''))"
      
  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.