#21781: feat(feishu): resolve merge_forward, enrich quoted message parsing, add media type support
channel: feishu
size: L
Cluster:
Feishu Enhancements and Fixes
## Summary
Enhance the Feishu plugin with three key capabilities: merge_forward message resolution, enriched quoted message parsing, and media type support.
## Changes
### bot.ts
#### merge_forward Resolution
- New `resolveMergeForwardContent()`: fetches sub-messages from merge_forward containers via `im.message.get` API
- Extracts text, images, and downloadable media from each sub-message
- Handles nested message types (text, post, image, video, media, file, interactive)
- Downloads media using **original file_keys** from sub-messages (not placeholder keys from the forwarded container, which return 400)
#### Enhanced `parsePostContent()`
- Now extracts embedded `<media>` tags (video/audio files in rich text) alongside images
- Returns `mediaKeys` array and `mentionedOpenIds` for downstream use
- Embedded media is downloaded and attached as inbound media
#### Media Type Support
- Added `"media"` to the mediaTypes whitelist in `resolveFeishuMediaList`
- Fixed fileKey priority: video/media types now prefer `fileKey` (actual content) over `imageKey` (thumbnail)
#### ReplyToId Exposure
- Dispatch envelope now includes `ReplyToId: ctx.parentId` so agents can trace quoted message chains
- Enables agent-level content recovery (e.g., searching session logs by message_id)
### send.ts
#### Enriched `getMessageFeishu()`
- **Post messages**: parses rich text elements (text, links, mentions, images, media tags) into readable text
- **Interactive (card) messages**: extracts text from card elements (`text`/`lark_md`/`md`/`markdown` tags), falls back to degraded post format
- Previously only handled `text` type, returning raw JSON for all others
## Usage
### merge_forward
Automatic: when a user forwards merged messages to the bot, sub-messages are expanded inline with sender info and timestamps.
### Quoted Messages
When a user replies to a message:
1. **Text messages**: gateway resolves content directly via `getMessageFeishu` ✅
2. **Card (interactive) messages**: gateway returns best-effort degraded text; agent can use `ReplyToId` to trace the quote chain via `im.message.get` API and recover full content from session logs
3. **Post (rich text) messages**: gateway now parses all element types including embedded media
### Media in Posts
Embedded videos/audio in rich text messages are now automatically downloaded and attached as media, alongside embedded images.
## Testing
- Tested merge_forward with 4+ sub-messages (text, post, interactive mix)
- Tested quoted message parsing for text, interactive, and post types
- Tested embedded media extraction from post messages
- Build passes, lint clean (0 warnings, 0 errors)
Most Similar PRs
#21786: feat(feishu): extract embedded video/media from post (rich text) me...
by laopuhuluwa · 2026-02-20
80.1%
#8975: feat(feishu): comprehensive enhancements for Feishu channel
by jiulingyun · 2026-02-04
77.1%
#12755: feat(feishu): render post rich text as markdown
by WilsonLiu95 · 2026-02-09
72.7%
#20685: feat(feishu): add audio/media message support with caption cards
by mmyyfirstb · 2026-02-19
72.6%
#10675: feat(feishu): add audio message support and fix file upload
by YumoeZhung · 2026-02-06
71.7%
#13669: feat(feishu): add audio message support
by AGI-XiaoBai-No1 · 2026-02-10
71.0%
#22957: fix(feishu): download media from quoted messages in group chats (#2...
by echoVic · 2026-02-21
70.8%
#15351: feat(feishu): Add native audio message support (voice bubble)
by lovejing0306 · 2026-02-13
70.8%
#18529: feat(feishu): add parentId and rootId to inbound context for quote/...
by qiangu · 2026-02-16
70.8%
#19793: feat(feishu): reply-in-thread, parallel group sessions, and fire-an...
by yinsn · 2026-02-18
67.9%