From a0be7df5e24d1302cddef4f56ef5f435c21972a4 Mon Sep 17 00:00:00 2001 From: 0xRaini <0xRaini@users.noreply.github.com> Date: Thu, 12 Feb 2026 21:01:40 +0800 Subject: [PATCH] fix(feishu): use msg_type 'media' for video/audio messages Feishu API requires msg_type 'media' for audio (opus) and video (mp4) files, but sendFileFeishu always used 'file'. This caused error 230055 'file upload type does not match message type' when sending videos. Closes #14638 --- extensions/feishu/src/media.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/extensions/feishu/src/media.ts b/extensions/feishu/src/media.ts index c9e74fddf65..8f5eafce384 100644 --- a/extensions/feishu/src/media.ts +++ b/extensions/feishu/src/media.ts @@ -359,10 +359,13 @@ export async function sendFileFeishu(params: { cfg: ClawdbotConfig; to: string; fileKey: string; + /** Use "media" for audio/video files, "file" for documents */ + msgType?: "file" | "media"; replyToMessageId?: string; accountId?: string; }): Promise { const { cfg, to, fileKey, replyToMessageId, accountId } = params; + const msgType = params.msgType ?? "file"; const account = resolveFeishuAccount({ cfg, accountId }); if (!account.configured) { throw new Error(`Feishu account "${account.accountId}" not configured`); @@ -382,7 +385,7 @@ export async function sendFileFeishu(params: { path: { message_id: replyToMessageId }, data: { content, - msg_type: "file", + msg_type: msgType, }, }); @@ -401,7 +404,7 @@ export async function sendFileFeishu(params: { data: { receive_id: receiveId, content, - msg_type: "file", + msg_type: msgType, }, }); @@ -524,6 +527,15 @@ export async function sendMediaFeishu(params: { fileType, accountId, }); - return sendFileFeishu({ cfg, to, fileKey, replyToMessageId, accountId }); + // Feishu requires msg_type "media" for audio/video, "file" for documents + const isMedia = fileType === "mp4" || fileType === "opus"; + return sendFileFeishu({ + cfg, + to, + fileKey, + msgType: isMedia ? "media" : "file", + replyToMessageId, + accountId, + }); } }