Loading...
Loading...
Interact with Slack from the command line. Send messages, read channel history, list channels and users, upload files, manage reminders, and more. Use when the user wants to communicate with Slack, check messages, or automate Slack workflows.
npx skill4agent add michaelliv/dotskills slack-clislack-cliAssumeis already installed and configured. If theslack-clicommand is not found or returnsslack, refer to references/INSTALLATION.md for setup instructions.not_inited
slackslacketcdir/opt/homebrew/etc/slack-cli/.slackSLACK_CLI_TOKENpsst --global set SLACK_CLI_TOKEN --tag slackpsst --global SLACK_CLI_TOKEN -- slack chat send 'Hello!' '#channel'psst getcurl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" "https://slack.com/api/..."slack# Send a message
slack chat send 'Hello world!' '#channel'
# Send with rich formatting
slack chat send --text 'text' --channel '#channel' --color good --title 'Title' --pretext 'Pretext'
# Pipe content as a message
echo "some output" | slack chat send --channel '#channel'
# Update a message (requires timestamp and channel)
slack chat update 'Updated text' 1405894322.002768 '#channel'
# Delete a message
slack chat delete 1405894322.002768 '#channel'
# Chain: send, capture ts+channel, then update
slack chat send 'hello' '#general' --filter '.ts + "\n" + .channel' | \
xargs -n2 slack chat update 'goodbye'# Upload a file
slack file upload README.md '#channel'
# Upload with metadata
slack file upload README.md '#channel' --comment 'See attached' --title 'README'
# Create a Slack post from markdown
slack file upload --file post.md --filetype post --title 'Post Title' --channels '#channel'
# List files
slack file list
slack file list --filter '[.files[] | {id, name, size}]'
# File info / delete
slack file info F2147483862
slack file delete F2147483862# Add a reminder
slack reminder add 'lunch' $(date -v +30M "+%s")
# List / complete / delete
slack reminder list
slack reminder complete Rm7MGABKT6
slack reminder delete Rm7MGABKT6slack snooze start 60 # Start snooze for 60 minutes
slack snooze info # Check your snooze status
slack snooze end # End snoozeslack presence active
slack presence away--filter|-f <jq-filter>--compact|-cp--monochrome|-m--trace|-xslack chat send 'msg' '@user'channel_not_foundchat:writeslackcurlslack chat send# Step 1: Open (or find) the DM channel with a user
DM_CHANNEL=$(curl -s -X POST \
-H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
-H "Content-Type: application/json" \
-d '{"users":"USER_ID"}' \
"https://slack.com/api/conversations.open" | jq -r '.channel.id')
# Step 2: Send the message
curl -s -X POST \
-H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
-H "Content-Type: application/json" \
-d "{\"channel\":\"${DM_CHANNEL}\",\"text\":\"Hello!\"}" \
"https://slack.com/api/chat.postMessage"Requiresscope. Without it,im:writewill fail. If you don't haveconversations.open, you can work around it by finding an existing DM channel:im:writebashDM_CHANNEL=$(curl -s \ -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \ "https://slack.com/api/conversations.list?types=im&limit=200" | \ jq -r '.channels[] | select(.user == "USER_ID") | .id')
curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/conversations.list?types=public_channel,private_channel&limit=200" | \
jq '[.channels[] | {name, id, is_private}]'# Get recent messages from a channel (use channel ID)
curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/conversations.history?channel=CHANNEL_ID&limit=20" | \
jq '[.messages[] | {user, text, ts}]'
# Get messages from last 7 days
OLDEST=$(date -v -7d +%s)
curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/conversations.history?channel=CHANNEL_ID&oldest=${OLDEST}&limit=100" | \
jq '[.messages[] | {user, text, ts}]'
# Get messages within a specific date range (oldest and latest are unix timestamps)
curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/conversations.history?channel=CHANNEL_ID&oldest=${START_TS}&latest=${END_TS}&limit=100" | \
jq '[.messages[] | {user, text, ts}]'curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/users.list" | \
jq '[.members[] | {name, id, real_name}]'
# Resolve multiple user IDs (no batch endpoint — fetch all and filter)
curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/users.list" | \
jq '[.members[] | select(.id == "U1234" or .id == "U5678") | {id, name: .real_name}]'# Use auth.test (not team.info — team.info requires a scope we don't have)
curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/auth.test" | \
jq '{team, team_id, url}'curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/search.messages?query=keyword&count=10" | \
jq '[.messages.matches[] | {channel: .channel.name, text, ts}]'# Add a reaction
curl -s -X POST \
-H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
-H "Content-Type: application/json" \
-d '{"channel":"CHANNEL_ID","timestamp":"1234567890.123456","name":"thumbsup"}' \
"https://slack.com/api/reactions.add"
# Get reactions on a message
curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/reactions.get?channel=CHANNEL_ID×tamp=1234567890.123456"# Get replies in a thread (use the parent message ts)
curl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
"https://slack.com/api/conversations.replies?channel=CHANNEL_ID&ts=1234567890.123456" | \
jq '[.messages[] | {user, text, ts}]'curl -s -X POST \
-H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" \
-H "Content-Type: application/json" \
-d '{"channel":"CHANNEL_ID","text":"reply text","thread_ts":"1234567890.123456"}' \
"https://slack.com/api/chat.postMessage"#nameCHANNEL_ID--filter--filter '.ts + "\n" + .channel'cursorlimitresponse_metadata.next_cursorcurl -s -H "Authorization: Bearer $(psst --global get SLACK_CLI_TOKEN)" "https://slack.com/api/users.list" | jq -r '.members[] | select(.real_name | test("Name"; "i")) | {name, id, real_name}'https://<workspace>.slack.com/archives/<channel_id>/p<ts_without_dot>1769935497.539749p1769935497539749