Repository navigation
Conversation
Uploads through Slack's external upload flow (files.getUploadURLExternal, the bytes to the issued upload URL, files.completeUploadExternal), which replaced the retired files.upload method. - Content from contentBase64, contentPath or content (exactly one), up to 64 MiB, the bound of one buffered request through the credential transport. - channel takes a conversation ID, or a user ID that is opened as a DM (conversations.open, needs im:write). Without channel the file stays private. - initialComment, threadTs, title, altText and snippetType pass through. - A new 'upload' credential target, https://files.slack.com/upload/v1/, POST only. The upload URL Slack returns is held to it with pathWithin, so the token is never sent off Slack's file host.
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.
What
Adds
slack.file.upload. Until now the Slack plugin could only read files (file.get,file.list), so an agent had no way to send a file to a channel or a DM.How
It uses Slack's external upload flow, which replaced the retired
files.uploadmethod:files.getUploadURLExternal(form body) →upload_url,file_idPOSTthe raw bytes toupload_urlfiles.completeUploadExternal(form body) shares the file tochannel_id/thread_tswithinitial_commentDetails:
contentBase64,contentPathorcontent, following the naming used bygoogleDrive,gmailandmicrosoftMail. It reuses_shared/base64and_shared/localFile. The filename defaults tocontentPath's basename, elsefile.channeltakes a conversation ID, or a user ID that is opened withconversations.open(this needsim:write). Withoutchannelthe file stays private to the uploader.uploadtarget,https://files.slack.com/upload/v1/,POSTonly. Theupload_urlSlack returns is checked withpathWithin, so a URL outside Slack's file host is refused before any bytes or token are sent.docs/bundled-plugins.md: slack action count 38 → 39.Tests
packages/codemode/src/tests/slack-plugin.test.ts:channel_id,thread_ts,initial_commentD…ID is usedcontentPathis named after its basename and sent as-is, with no channelfiles.slack.comis refused before the bytes are sentthreadTswithoutchannelare all refused before any requestbun run check,bun run typecheck, andbun --filter @shiftlabs/codemode test(2741 pass, 0 fail) all pass locally.I also tested it against a real Slack workspace with a user token: a text file from
contentPathwas shared to a DM with an initial comment, and a 7853-byte PNG sent ascontentBase64arrived as a thread reply with the same size, recognized asimage/png.