feat(slack): native MEDIA file upload via files:write scope - #23913
Closed
dirtyren wants to merge 1 commit into
Closed
feat(slack): native MEDIA file upload via files:write scope#23913dirtyren wants to merge 1 commit into
dirtyren wants to merge 1 commit into
Conversation
Extend send_message_tool to support MEDIA:<path> attachments on Slack, using the modern two-step upload API (files.getUploadURLExternal + files.completeUploadExternal) with automatic fallback to the legacy files.upload endpoint. Changes: - _send_slack: add thread_id parameter (was silently dropped before) - _send_slack_file: new helper -- modern 2-step upload, MIME detection, thread reply support, 120s timeout for large files - _send_slack_file_legacy: fallback for workspaces where the modern endpoint returns ok=false - _send_to_platform: add Slack MEDIA block (mirrors Discord/Matrix pattern) -- text chunks sent first, files uploaded on the last chunk - Error strings and tool description updated to include slack Requires the Slack bot to have the files:write OAuth scope. Tests (8 new, all passing): - TestSendSlackFile: missing file, modern happy path, thread_id forwarding, legacy fallback - TestSendToPlatformSlackMedia: media-only, text+media, thread_id forwarded to both helpers, file error propagation
This was referenced Jun 23, 2026
Contributor
|
Thanks for tackling the Slack Problems
Suggested changes
Automated hermes-sweeper review. |
4 tasks
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds native
MEDIA:<path>file upload support for Slack insend_message_tool, matching the existing pattern for Discord, Matrix, Signal, Feishu, and Telegram.Motivation
Slack bots with
files:writescope can upload files directly to channels/threads. Previously,MEDIA:paths were silently dropped on Slack — this PR wires up the full upload path.Changes
tools/send_message_tool.py_send_slack— addedthread_idparameter that was previously silently dropped_send_slack_file— new async helper implementing the modern two-step Slack upload API:files.getUploadURLExternal— get a pre-signed upload URL + file IDfiles.completeUploadExternal— share the file to the channel/threadmimetypesso Slack renders PDFs, images, etc. correctlythread_idfor posting into threads_send_slack_file_legacy— fallback tofiles.upload(multipart form) whengetUploadURLExternalreturnsok: false_send_to_platform— new Slack MEDIA block added before the "non-media platforms" fallthrough:_send_slack_send_slack_fileslackin the supported platforms listtests/tools/test_send_message_tool.py8 new tests in two classes:
TestSendSlackFiletest_returns_error_when_file_missingtest_modern_upload_happy_pathtest_thread_id_passed_to_complete_payloadtest_legacy_fallback_when_modern_endpoint_failsTestSendToPlatformSlackMediatest_slack_media_only_calls_send_slack_filetest_slack_text_and_media_sends_text_then_filetest_slack_media_thread_id_forwardedtest_slack_media_file_error_propagatesUsage
Requirements
The Slack bot token must have the
files:writeOAuth scope.Test Results