Skip to content

Conversation

@vercellone
Copy link

Fixes #133 - Update Send-SlackFile for new Slack API

Summary

Replaces deprecated files.upload API with the new 3-step upload workflow (files.getUploadURLExternal → upload → files.completeUploadExternal) as mandated by Slack's deprecation on 11/12/2025.

Changes

  • Implements new 3-step file upload flow supporting both PowerShell 7+ and legacy Windows PowerShell 3.0+
  • PowerShell 7+: Uses modern -Authentication Bearer and -Token parameters
  • PowerShell 3.0-5.1: Uses manual Authorization headers for compatibility
  • Unified code path: Single implementation with conditional authentication based on $IsCoreCLR
  • Supports both parameter sets: Content snippets and file uploads via -InFile
  • Proper content types: Form-encoded for metadata, JSON for completion, octet-stream for uploads
  • Maintains all existing parameters: Channel, Thread, Title, Comment, FileType, etc.
  • Style consistency: Matches repo conventions (verbose logging, spacing, bracing)

Testing Status

⚠️ Untested - Based on proven PowerShell 7+ implementation but requires validation, particularly:

  • Legacy PowerShell 3.0-5.1 compatibility
  • File uploads (both Content and Path parameter sets)
  • Thread and multi-channel targeting
  • Error handling with Parse-SlackError

Breaking Changes

None - Function signature and parameters remain unchanged.

Additional Notes

  • Removed legacy files.upload implementation (officially deprecated)
  • Pre-signed upload URL in Step 2 requires no authentication
  • Compatible with minimum PowerShell 3.0 requirement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack Files.Upload Method Retiring

1 participant