Skip to content

Feishu: mp4 video messages sent as text link (msg_type should be "media" not "file") #33674

@smthfoxy

Description

@smthfoxy

Bug

When sending an MP4 video via the message tool (action=send, media=path.mp4), the recipient sees a text link like 📎 /path/to/video.mp4 instead of a playable video.

Root Cause

In extensions/feishu/src/media.ts, sendMediaFeishu() determines msgType as:

// Feishu API: opus -> "audio", everything else (including video) -> "file"
const msgType = fileType === "opus" ? "audio" : "file";

This is incorrect. Feishu API requires msg_type: "media" for mp4/video files (not "file").

  • opus"audio"
  • mp4"media" ❌ (currently sends "file", Feishu returns error code 230055)
  • other files → "file"

Fix

// Feishu API: opus -> "audio", mp4/video -> "media", everything else -> "file"
const msgType = fileType === "opus" ? "audio" : fileType === "mp4" ? "media" : "file";

Behavior

When the upload succeeds but send fails (error 230055), the sendMedia in outbound.ts falls back to:

const fallbackText = `📎 ${mediaUrl}`;

So the user sees a file path as plain text instead of the video.

Verification

Direct API call with msg_type: "media" works correctly:

curl -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"receive_id": "ou_xxx", "msg_type": "media", "content": "{\"file_key\":\"file_v3_xxx\"}"}'
# Returns code=0 success

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions