Skip to content

Commit 0e755ad

Browse files
GlucksbergTakhoffman
andauthored
fix(feishu): use msg_type "audio" for opus files instead of "media" (#28269) thanks @Glucksberg
Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
1 parent 60ef923 commit 0e755ad

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Docs: https://docs.openclaw.ai
1616
### Fixes
1717

1818
- Feishu/Probe status caching: cache successful `probeFeishu()` bot-info results for 10 minutes (bounded cache with per-account keying) to reduce repeated status/onboarding probe API calls, while bypassing cache for failures and exceptions. (#28907) Thanks @Glucksberg.
19+
- Feishu/Opus media send type: send `.opus` attachments with `msg_type: "audio"` (instead of `"media"`) so Feishu voice messages deliver correctly while `.mp4` remains `msg_type: "media"` and documents remain `msg_type: "file"`. (#28269) Thanks @Glucksberg.
1920
- Feishu/Local media sends: propagate `mediaLocalRoots` through Feishu outbound media sending into `loadWebMedia` so local path attachments work with post-CVE local-root enforcement. (#27884) Thanks @joelnishanth.
2021
- Security/Feishu webhook ingress: bound unauthenticated webhook rate-limit state with stale-window pruning and a hard key cap to prevent unbounded pre-auth memory growth from rotating source keys. (#26050) Thanks @bmendonca3.
2122
- Telegram/Reply media context: include replied media files in inbound context when replying to media, defer reply-media downloads to debounce flush, gate reply-media fetch behind DM authorization, and preserve replied media when non-vision sticker fallback runs (including cached-sticker paths). (#28488) Thanks @obviyus.

extensions/feishu/src/media.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe("sendMediaFeishu msg_type routing", () => {
129129
);
130130
});
131131

132-
it("uses msg_type=media for opus", async () => {
132+
it("uses msg_type=audio for opus", async () => {
133133
await sendMediaFeishu({
134134
cfg: {} as any,
135135
to: "user:ou_target",
@@ -145,7 +145,7 @@ describe("sendMediaFeishu msg_type routing", () => {
145145

146146
expect(messageCreateMock).toHaveBeenCalledWith(
147147
expect.objectContaining({
148-
data: expect.objectContaining({ msg_type: "media" }),
148+
data: expect.objectContaining({ msg_type: "audio" }),
149149
}),
150150
);
151151
});

extensions/feishu/src/media.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ export async function sendFileFeishu(params: {
306306
cfg: ClawdbotConfig;
307307
to: string;
308308
fileKey: string;
309-
/** Use "media" for audio/video files, "file" for documents */
310-
msgType?: "file" | "media";
309+
/** Use "media" for video, "audio" for audio, "file" for documents */
310+
msgType?: "file" | "media" | "audio";
311311
replyToMessageId?: string;
312312
accountId?: string;
313313
}): Promise<SendMediaResult> {
@@ -433,13 +433,13 @@ export async function sendMediaFeishu(params: {
433433
fileType,
434434
accountId,
435435
});
436-
// Feishu requires msg_type "media" for audio/video, "file" for documents
437-
const isMedia = fileType === "mp4" || fileType === "opus";
436+
// Feishu API: opus -> "audio", mp4 -> "media", everything else -> "file"
437+
const msgType = fileType === "opus" ? "audio" : fileType === "mp4" ? "media" : "file";
438438
return sendFileFeishu({
439439
cfg,
440440
to,
441441
fileKey,
442-
msgType: isMedia ? "media" : "file",
442+
msgType,
443443
replyToMessageId,
444444
accountId,
445445
});

0 commit comments

Comments
 (0)