Read and send Slack messages on your behalf. Use when the user wants to check Slack messages, respond to someone on Slack, or download/upload files from Slack conversations.
Resources
1Install
npx skillscat add sepehr500/skills/slack Install via the SkillsCat registry.
Slack Integration
Interact with Slack on the user's behalf using the Python Slack SDK - read messages, send replies, download and upload files.
Setup
Ensure the Python Slack SDK is installed:
pip install slack-sdkAuthentication
Use the Slack token from $SLACK_TOKEN environment variable. If not available, ask the user to provide it.
Required scopes (add via https://api.slack.com/apps -> OAuth & Permissions -> User Token Scopes):
search:read- search messages and files (preferred method)users:read- look up users (required forusers.list)users:read.email- access email addresses in user profiles (optional)im:history,im:read- read DMsim:write,chat:write- send messageschannels:history,channels:read- read channels (optional)files:read- download filesfiles:write- upload files
Python Slack SDK Client
A reusable client module is available at ~/.claude/skills/slack/scripts/slack_client.py.
CLI Usage
# Test authentication
python ~/.claude/skills/slack/scripts/slack_client.py auth
# Search messages
python ~/.claude/skills/slack/scripts/slack_client.py search "from:me to:username" --count 5
# List users
python ~/.claude/skills/slack/scripts/slack_client.py users
# Find a user by name
python ~/.claude/skills/slack/scripts/slack_client.py find-user "Alice"
# List conversations (DMs)
python ~/.claude/skills/slack/scripts/slack_client.py conversations --types im
# Get DM channel with user
python ~/.claude/skills/slack/scripts/slack_client.py dm-channel U12345
# Read messages from channel
python ~/.claude/skills/slack/scripts/slack_client.py read D67890 --limit 10
# Send a message
python ~/.claude/skills/slack/scripts/slack_client.py send D67890 "Hello there!"Module Usage (inline Python)
import sys
sys.path.insert(0, str(Path.home() / ".claude/skills/slack/scripts"))
from slack_client import (
test_auth, search_messages, list_users, find_user,
get_dm_channel, read_messages, send_message,
get_file_info, download_file, upload_file
)
# Test auth
auth = test_auth()
print(f"Authenticated as {auth['user']}")
# Search messages
messages = search_messages("from:me to:alice", count=5)
for msg in messages:
print(f"{msg['ts']}: {msg['text']}")
# Find user and send message
user = find_user("Alice")
if user:
channel = get_dm_channel(user['id'])
result = send_message(channel, "Hello Alice!")
print(f"Sent message: {result['ts']}")Common Operations
Search messages (preferred method)
Use search to find messages without needing to look up user/channel IDs:
python ~/.claude/skills/slack/scripts/slack_client.py search "from:me to:alice" --count 5 --sort timestamp --sort-dir descSearch operators:
from:me- messages you sentfrom:username- messages from a specific userto:username- messages in DMs with a userin:channel- messages in a specific channelhas:link/has:file- messages with links or filesbefore:YYYY-MM-DD/after:YYYY-MM-DD- date filters
List all users
python ~/.claude/skills/slack/scripts/slack_client.py usersFind a user by name
python ~/.claude/skills/slack/scripts/slack_client.py find-user "Alice"Get DM channel with a user
python ~/.claude/skills/slack/scripts/slack_client.py dm-channel U_ALICE_IDRead recent messages from a DM
python ~/.claude/skills/slack/scripts/slack_client.py read D_CHANNEL_ID --limit 10Send a message
python ~/.claude/skills/slack/scripts/slack_client.py send D_CHANNEL_ID "Your message here"Download a file
from slack_client import get_file_info, download_file
info = get_file_info("FILE_ID")
download_file(info['url_private_download'], "/tmp/downloaded_file")Upload a file
from slack_client import upload_file
upload_file("/tmp/myfile.txt", "D_CHANNEL_ID", title="My File", initial_comment="Here's the file!")Workflow
When the user asks to interact with Slack:
- Verify token: Run
python ~/.claude/skills/slack/scripts/slack_client.py auth - Find messages: Use
searchcommand with operators likefrom:me to:username - Send messages: Use
sendcommand with channel ID (get from search results or dm-channel) - Handle files: Download or upload files as needed
Note: Prefer search over the multi-step process of users -> conversations -> read. Search is simpler and supports powerful query operators.