#21786: feat(feishu): extract embedded video/media from post (rich text) messages
channel: feishu
size: S
Cluster:
Feishu Streaming Enhancements
## Summary
Feishu post (rich text) messages can contain embedded videos and audio via `<media>` tags, but `parsePostContent()` only extracted `<img>` tags. This meant embedded videos in rich text posts were silently dropped — the agent never received them.
## Problem
When a user sends a rich text message with an embedded video (common in Feishu — the editor allows dragging videos into posts), the message is received as `message_type: 'post'` with content like:
```json
{"content": [[{"tag": "media", "file_key": "file_v3_xxx", "file_name": "video.mov"}]]}
```
The existing `parsePostContent()` only looked for `img` tags, so this media was ignored.
## Changes
### `parsePostContent()`
- Now also extracts `media` tags (embedded video/audio) with their `file_key` and optional `file_name`
- Returns new `mediaKeys: Array<{ fileKey: string; fileName?: string }>` alongside existing `imageKeys`
### `resolveFeishuMediaList()`
- After downloading embedded images, now also downloads embedded media files from posts
- Uses `messageResource` API with `type: 'file'` for media downloads
- Adds logging for media discovery and download
## Testing
- Build passes (`pnpm build`)
- Lint passes (`pnpm lint`, 0 warnings 0 errors)
- Tested with real Feishu post messages containing embedded .MOV video files
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds support for extracting embedded video/audio files from Feishu rich text (post) messages.
Previously, `parsePostContent()` only extracted `<img>` tags, silently dropping `<media>` tags containing videos/audio. This change:
- Extends `parsePostContent()` to collect both image keys and media keys (file_key + optional file_name) from post content
- Updates `resolveFeishuMediaList()` to download embedded media files using the `messageResource` API with `type: 'file'`
- Adds appropriate logging for media discovery and downloads
The implementation follows the existing pattern for embedded images and correctly uses the `messageResource` API for downloading files from messages.
<h3>Confidence Score: 4/5</h3>
- Safe to merge with one minor type inconsistency
- The implementation correctly mirrors the existing embedded image handling pattern and properly uses the Feishu messageResource API. The change is well-tested according to the PR description. One minor type inconsistency exists where `fileName` is added to the media info object but not defined in the `FeishuMediaInfo` type - however, this doesn't affect runtime behavior since the property is not used downstream.
- No files require special attention
<sub>Last reviewed commit: c3ef915</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#10675: feat(feishu): add audio message support and fix file upload
by YumoeZhung · 2026-02-06
81.7%
#13669: feat(feishu): add audio message support
by AGI-XiaoBai-No1 · 2026-02-10
80.7%
#22957: fix(feishu): download media from quoted messages in group chats (#2...
by echoVic · 2026-02-21
80.5%
#15351: feat(feishu): Add native audio message support (voice bubble)
by lovejing0306 · 2026-02-13
80.4%
#12755: feat(feishu): render post rich text as markdown
by WilsonLiu95 · 2026-02-09
80.3%
#21781: feat(feishu): resolve merge_forward, enrich quoted message parsing,...
by laopuhuluwa · 2026-02-20
80.1%
#16311: test(feishu): add regression for audio download resource type=file
by Yaxuan42 · 2026-02-14
74.5%
#19171: fix(feishu): pass mediaLocalRoots to sendMediaFeishu for agent-scop...
by whiskyboy · 2026-02-17
74.0%
#20685: feat(feishu): add audio/media message support with caption cards
by mmyyfirstb · 2026-02-19
73.8%
#8975: feat(feishu): comprehensive enhancements for Feishu channel
by jiulingyun · 2026-02-04
73.3%