#9606: fix: pass fileName to WhatsApp document messages
channel: whatsapp-web
agents
size: XS
Cluster:
WhatsApp Document Handling Fixes
Fixes #5781 - WhatsApp document filename always shows 'file' instead of actual filename.
Changes:
- src/web/active-listener.ts: Add fileName to ActiveWebSendOptions type
- src/web/outbound.ts: Extract and pass mediaFileName through sendOptions
- src/web/inbound/send-api.ts: Use sendOptions?.fileName with fallback to 'file'
This properly wires the filename from loadWebMedia through the send path.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR wires a media filename through the WhatsApp Web outbound send path so that document messages use the original filename instead of always sending `"file"`.
Concretely:
- `src/web/active-listener.ts` extends `ActiveWebSendOptions` with an optional `fileName`.
- `src/web/outbound.ts` captures `media.fileName` from `loadWebMedia()` and includes it in `sendOptions` when present.
- `src/web/inbound/send-api.ts` uses `sendOptions?.fileName || "file"` when building the Baileys document payload.
This fits into the existing architecture where `src/web/outbound.ts` prepares media metadata and forwards it through `ActiveWebListener.sendMessage()` into the WhatsApp Web send API adapter (`src/web/inbound/send-api.ts`).
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Changes are small, type-only extension plus straightforward propagation of an existing `loadWebMedia().fileName` value to the WhatsApp document payload, with a conservative fallback to the previous constant value.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#10889: fix: pass fileName through WhatsApp document send path
by DeveshParagiri · 2026-02-07
92.6%
#7458: fix: pass filename through to WhatsApp document sends (#7446)
by gavinbmoore · 2026-02-02
91.9%
#6566: fix: thread fileName through WhatsApp document send path
by giannisanni · 2026-02-01
91.7%
#15650: fix(whatsapp): pass fileName to document sends instead of hardcodin...
by whoknowsmann · 2026-02-13
89.2%
#21881: fix(whatsapp): pass user-provided fileName through document send pipe…
by saakshigupta2002 · 2026-02-20
87.3%
#16785: fix(whatsapp): preserve document filenames in outbound Baileys mode
by SahilSahu731 · 2026-02-15
86.1%
#16817: fix(whatsapp): infer extension-aware fallback filename for Baileys ...
by VintLin · 2026-02-15
83.2%
#23148: fix: forward mediaLocalRoots in whatsapp plugin sendMedia
by MunemHashmi · 2026-02-22
79.8%
#8052: fix(whatsapp): strip leading whitespace from outbound messages
by FelixFoster · 2026-02-03
79.4%
#19303: Fix WhatsApp internal error leakage + cron.run timeout defaults
by koala73 · 2026-02-17
79.2%