← Back to PRs

#8684: fix(slack): add title param and channel resolution for file upload

by shuans open 2026-02-04 08:31 View on GitHub →
channel: slack stale
## 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