PowerShell Provider for Slack workspaces. Navigate channels, users, and messages like a file system.
The most popular Slack module for PowerShell, PSSlack, has not been updated since 2021 and relies on deprecated Slack APIs (channels.*, groups.*) that no longer work with new Slack apps. SlackDrive uses the modern conversations.* API and provides a unique file-system navigation experience.
- Navigate Slack workspaces as PowerShell drives (
ls,cd,Get-Content,New-Item) - Browse channels, private channels, DMs, users, and files
- Read message threads by navigating into messages
- Post messages and thread replies with
New-Item - Search users with
Find-SlackUser - Tab completion for channel names, user names, and messages
- Automatic two-tier caching (memory + disk) for performance
- OAuth 2.0 with PKCE support (via GitHub Pages relay)
- Multiple workspace support (one drive per workspace)
- Optional SecretManagement integration for secure token storage
# From PowerShell Gallery
Install-PSResource SlackDrivegit clone https://github.com/yotsuda/SlackDrive.git
cd SlackDrive
.\build.ps1
Import-Module .\module\SlackDrive.psd1SlackDrive supports three connection methods. Choose the one that fits your environment.
Authenticate via browser. No token stored on disk. Best for personal workspaces or workspaces where the admin has approved the app.
- Go to https://api.slack.com/apps
- Click Create New App > From scratch
- Enter an app name and select your workspace
Go to OAuth & Permissions > Redirect URLs and add:
https://yotsuda.github.io/SlackDrive/oauth/callback.html
This is a static page hosted by SlackDrive that relays the OAuth callback to your local machine. PKCE ensures security -- the auth code alone cannot be used to obtain a token.
Note: Manual configuration of User Token Scopes is not required. SlackDrive automatically requests the necessary scopes during the PKCE flow.
Copy the Client ID and Client Secret from the Basic Information page.
Edit-SlackConfig{
"PSDrives": [
{
"Name": "Slack",
"Description": "My workspace",
"ClientId": "YOUR_CLIENT_ID",
"ClientSecret": "YOUR_CLIENT_SECRET",
"Enabled": true
}
]
}Import-SlackConfig
cd Slack:\A browser window opens on first access for OAuth authentication. After approval, the token is used for the current session.
Copy a user token (xoxp-) from the Slack App settings. Use this when PKCE is blocked by workspace admin policy.
Go to OAuth & Permissions > User Token Scopes and add:
channels:read,channels:history-- Channelsgroups:read,groups:history-- Private channelsim:read,im:history-- Direct messagesmpim:read,mpim:history-- Group DMsusers:read-- User listfiles:read-- File listchat:write-- Post messages (optional)
Click Install to Workspace (or Reinstall) after adding scopes.
Copy the User OAuth Token (xoxp-...) from the OAuth & Permissions page.
New-SlackDrive -Name Slack -Token 'xoxp-...'Or add to the config file:
{
"PSDrives": [
{
"Name": "Slack",
"Token": "xoxp-...",
"Enabled": true
}
]
}Tip: Use SecretManagement to avoid storing tokens in plain text:
Set-SlackDriveSecret -Name "MySlackToken" -Token "xoxp-..." New-SlackDrive -Name Slack -SecretName "MySlackToken"
Use a token from the Slack web client. No Slack App creation needed. Tokens are short-lived (hours to days).
- Log in to Slack in your browser
- Open DevTools (F12) > Network tab
- Select a request with
conversationin the URL - Copy the
tokenvalue (xoxc-...) from the Payload tab - Go to Application tab > Cookies > copy the
dvalue (xoxd-...)
New-SlackDrive -Name Slack -Token 'xoxc-...' -Cookie 'd=xoxd-...'Note: Browser tokens expire when the Slack session ends. Do not store them in config files.
Slack:\
+-- Channels\
| +-- general\
| | +-- 0329_0820_4959_alice_Hello everyone\ <- message (cd into for thread)
| | +-- 0329_0825_1234_bob_Great idea <- thread reply
| +-- random\
+-- DirectMessages\
+-- Users\
| +-- alice
| +-- bob
+-- Files\
# List channels
ls Slack:\Channels
# List messages in a channel
ls Slack:\Channels\general
# Navigate into a message to see thread replies
cd Slack:\Channels\general\0329_0820_4959_alice_Hello
ls
# Read message text
Get-Content Slack:\Channels\general\0329_0820_4959_alice_Hello
# Get channel details
Get-Item Slack:\Channels\general
# List users
ls Slack:\Users
# Refresh cache
ls Slack:\Channels -Force
ls Slack:\Users -Force# Post to a channel
New-Item Slack:\Channels\general -Value "Hello from PowerShell!"
# Reply to a thread
New-Item Slack:\Channels\general\0329_0820_4959_alice_Hello -Value "Thread reply"# Search by name (uses Slack's internal search API)
Find-SlackUser john{
"PSDrives": [
{ "Name": "Work", "ClientId": "...", "ClientSecret": "...", "Enabled": true },
{ "Name": "Personal", "Token": "xoxp-...", "Enabled": true }
]
}Import-SlackConfig
ls Work:\Channels
ls Personal:\Channels- PowerShell 7.4+
- .NET 9.0