feat: add highlight_type to files.completeUploadExternal and files_upload_v2#1875
Open
zimeg wants to merge 5 commits into
Open
feat: add highlight_type to files.completeUploadExternal and files_upload_v2#1875zimeg wants to merge 5 commits into
zimeg wants to merge 5 commits into
Conversation
…load_v2 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1875 +/- ##
=======================================
Coverage 84.13% 84.13%
=======================================
Files 117 117
Lines 13337 13337
=======================================
Hits 11221 11221
Misses 2116 2116 ☔ View full report in Codecov by Sentry. |
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…tion Rely on the existing None-stripping logic in files_completeUploadExternal instead of conditionally building the dict. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
commented
May 15, 2026
Member
Author
zimeg
left a comment
There was a problem hiding this comment.
📝 A note for reviewers! After building this branch logs might appear in debug as:
DEBUG:slack_sdk.web.base_client:Sending a request - url: https://slack.com/api/files.completeUploadExternal, query_params: {}, body_params: {'files': '[{"id": "F0B41L9PU4R", "title": "Image Upload", "highlight_type": "png"}]', 'channel_id': 'C04CRUE6MU3', 'initial_comment': 'Uploaded with highlight_type for optimistic rendering'}, files: {}, json_body: None, headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': '(redacted)', 'User-Agent': 'Python/3.13.1 slackclient/3.41.0 Darwin/25.4.0'}
| self, | ||
| *, | ||
| files: List[Dict[str, str]], | ||
| files: List[Dict[str, Optional[str]]], |
Member
Author
There was a problem hiding this comment.
📣 note: This becomes less strict as highlight_type is an optional value for files argument! It's also removed if left to the value None below.
6 tasks
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
This pull request adds
highlight_typesupport tofiles.completeUploadExternaland thefiles_upload_v2method.The
highlight_typeparameter allows specifying the file type hint for uploads (e.g.png,jpg,gif), enabling optimistic rendering before the async upload processing job completes.📚 https://docs.slack.dev/reference/methods/files.completeUploadExternal
Changes
highlight_typeto_to_v2_file_upload_itemso it passes through per-filehighlight_typetofiles_upload_v2so it can be specified when using the high-level upload methodhighlight_typethrough to each file object infiles.completeUploadExternalUsage
Testing
_to_v2_file_upload_itempasses throughhighlight_typevia new unit testhighlight_typeis stripped from the files JSON whenNone(existingfiles_completeUploadExternallogic filtersNonevalues)Category
/docs(Documents)/tutorial(PythOnBoardingBot tutorial)tests/integration_tests(Automated tests for this library)Requirements
python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.