#8684: fix(slack): add title param and channel resolution for file upload
channel: slack
stale
Cluster:
Slack Integration Improvements
## Summary
Fixes Slack file upload issues (#7110):
1. **Channel name resolution**: Add `resolveChannelIdForUpload` helper to resolve channel names, mentions, and IDs to valid channel IDs before calling `files.uploadV2`
2. **Title parameter**: Add `title` parameter to `uploadSlackFile` and pass it to Slack API
3. **Return value parsing**: Fix incorrect access pattern - Slack API returns `{ file: {...} }`, not `{ files: [...] }`
## Changes
- `src/slack/send.ts`:
- Add `resolveChannelIdForUpload()` for channel resolution
- Add `title` param to `SlackSendOpts`
- Fix `uploadSlackFile` to use `parsed.file ?? parsed`
- Pass `title` through the call chain
## Testing
- Verified file upload works with channel names (e.g., `#ems`)
- Verified title appears correctly in Slack
Closes #7110
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates Slack sending to make media uploads more reliable by (1) introducing `resolveChannelIdForUpload` to normalize channel inputs (names, `#channel`, and `<#C123|channel>` mentions) into channel IDs before calling `files.uploadV2`, (2) threading a new `title` option down into `uploadSlackFile` and the Slack API call, and (3) fixing the `files.uploadV2` response parsing to use `response.file` (instead of the older `files[]` shape).
The main behavior change is that channel recipients are now resolved through Slack’s conversations API before sending/uploads, rather than trusting the parsed recipient ID directly.
<h3>Confidence Score: 3/5</h3>
- Mostly safe to merge, but channel resolution may be incomplete or introduce scope/perf regressions in larger Slack workspaces.
- Changes are localized to Slack sending and fix a real response-shape bug, but the new channel-name resolution relies on a non-paginated `conversations.list` call and is now invoked for all channel recipients, which can add extra API calls and fail without the right scopes.
- src/slack/send.ts (channel resolution helpers)
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#17558: fix(slack): replace files.uploadV2 with 3-step upload flow to fix m...
by fif911 · 2026-02-15
85.6%
#8024: fix(slack): resolve channel names via directory for cross-account m...
by emma-digital-assistant · 2026-02-03
85.6%
#20479: fix(slack): keep replies flowing for oversized file uploads
by olyashok · 2026-02-19
85.0%
#15095: fix(slack): process all file attachments instead of only the first
by Lar000ki · 2026-02-13
83.7%
#14847: fix(slack): preserve auth across Slack-hosted file redirects
by natashache · 2026-02-12
80.2%
#13881: fix: Address Greptile feedback - test isolation and channel resolution
by trevorgordon981 · 2026-02-11
80.0%
#12954: feat(slack): Add channel name resolution with TTL cache
by trevorgordon981 · 2026-02-10
79.5%
#19430: Slack: infer bare user targets before media upload
by gg2uah · 2026-02-17
78.4%
#22096: fix(slack): traverse .original for Slack SDK errors; pass recipient...
by maiclaw · 2026-02-20
78.3%
#19083: Slack: preserve per-thread context and consistent thread replies
by jkimbo · 2026-02-17
78.3%