Send Slack messages and DMs as yourself directly from Claude Code using your browser session credentials. Extracts the target channel or user and message content directly from natural language prompts. Supports @username for DMs and
Sends Slack messages and DMs as yourself using natural language prompts with channel (#) and user (@) targeting.
/plugin marketplace add djalmaaraujo/claude-code-plugins/plugin install slack@djalmaaraujo-claude-code-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Send Slack messages and DMs as yourself using your authenticated browser session credentials. The target (channel or user) is inferred directly from your prompt — no pre-configuration required.
Features:
#channel-name@usernameslack-search-user for user lookupsWhen the user asks to send a Slack message, follow these steps:
ALWAYS check status first. The PLUGIN_ROOT is determined dynamically:
# Determine plugin root (adjust path based on where you're running from)
PLUGIN_ROOT="$HOME/.claude/plugins/marketplaces/djalmaaraujo-claude-code-plugins/plugins/slack"
STATUS_OUTPUT=$("$PLUGIN_ROOT/skills/slack-status/check.sh")
STATUS_CODE=$(echo "$STATUS_OUTPUT" | cut -d'|' -f1)
if [ "$STATUS_CODE" != "OK" ]; then
echo "⚠️ Slack is not properly configured"
echo "Please run: /slack:slack-setup"
exit 1
fi
Parse the user's prompt to identify:
#channel-name or user references like @usernameExamples of target extraction:
#general, message: hello#slack-ai-testing, message: build complete@fulano, message: good morning@john, message: are you ready?Check if the target starts with @ (user DM) or # (channel):
@: This is a DM, proceed to Step 2a# or is a plain channel name: This is a channel, proceed to Step 2bWhen the target is a user (starts with @), you need to:
conversations.open APIHere's the complete flow:
#!/bin/bash
PLUGIN_ROOT="$HOME/.claude/plugins/marketplaces/djalmaaraujo-claude-code-plugins/plugins/slack"
source "$PLUGIN_ROOT/lib/config.sh"
source "$PLUGIN_ROOT/lib/slack-api.sh"
TARGET_USER="fulano" # extracted from @fulano
MESSAGE="Your message here"
# Load config
load_config
# Step 1: Use slack-search-user to find the user
# The script outputs debug info to stderr and user ID to stdout
USER_ID=$("$PLUGIN_ROOT/skills/slack-search-user/search-user.sh" "$TARGET_USER")
SEARCH_EXIT_CODE=$?
if [ $SEARCH_EXIT_CODE -ne 0 ] || [ -z "$USER_ID" ]; then
echo "✗ User not found: $TARGET_USER"
exit 1
fi
echo "✓ Found user ID: $USER_ID"
# Step 2: Open DM channel
echo "Opening DM channel..."
DM_RESPONSE=$(slack_conversations_open "$USER_ID")
CHANNEL_ID=$(echo "$DM_RESPONSE" | jq -r '.channel.id')
if [ "$CHANNEL_ID" = "null" ] || [ -z "$CHANNEL_ID" ]; then
echo "✗ Failed to open DM channel"
exit 1
fi
# Step 3: Send message
echo "Sending message..."
SEND_RESPONSE=$(slack_chat_post_message "$CHANNEL_ID" "$MESSAGE")
if slack_check_response "$SEND_RESPONSE"; then
echo "✓ Message sent successfully!"
else
ERROR=$(slack_get_error "$SEND_RESPONSE")
echo "✗ Error sending message: $ERROR"
exit 1
fi
Key points:
slack-search-user script - no inline user search codelib/slack-api.shWhen the target is a channel (starts with # or is a plain channel name):
#!/bin/bash
PLUGIN_ROOT="$HOME/.claude/plugins/marketplaces/djalmaaraujo-claude-code-plugins/plugins/slack"
source "$PLUGIN_ROOT/lib/config.sh"
source "$PLUGIN_ROOT/lib/slack-api.sh"
# Remove # prefix if present
CHANNEL_NAME="slack-ai-testing" # extracted from #slack-ai-testing
MESSAGE="Your message here"
# Load config
load_config
# Send message directly (Slack resolves channel names automatically)
echo "Sending message to #$CHANNEL_NAME..."
SEND_RESPONSE=$(slack_chat_post_message "$CHANNEL_NAME" "$MESSAGE")
if slack_check_response "$SEND_RESPONSE"; then
echo "✓ Message sent successfully to #$CHANNEL_NAME!"
else
ERROR=$(slack_get_error "$SEND_RESPONSE")
echo "✗ Error sending message: $ERROR"
exit 1
fi
Important: Pass the channel name directly (e.g., general, slack-ai-testing). The Slack API accepts both channel names and channel IDs.
The response will be JSON. Check for "ok": true to confirm the message was sent successfully.
A successful response looks like:
{
"ok": true,
"channel": "C0A7V415BKQ",
"ts": "1234567890.123456",
"message": { ... }
}
An error response looks like:
{
"ok": false,
"error": "channel_not_found"
}
User prompt: "Send a message to #slack-ai-testing saying hello from Claude Code"
#slack-ai-testing, message: hello from Claude Code#)slack_chat_post_messageUser prompt: "Send a DM to @djalma saying: can you review my PR?"
@djalma, message: can you review my PR?@)slack-search-userU01ULLNEM3Q)conversations.openD98765XYZ)This skill uses the centralized Slack plugin configuration at:
~/.claude/plugins/marketplaces/djalmaaraujo-claude-code-plugins/plugins/slack/config.json
This skill integrates with:
# or plain names): No channel ID lookup needed@): Uses slack-search-user to find user, then opens DM channelslack-search-user skilljq is required/slack:slack-setup if needed)| Error | Solution |
|---|---|
Slack is not properly configured | Run /slack:slack-setup to configure credentials |
invalid_auth | Token or cookie expired. Re-run /slack:slack-setup |
channel_not_found | Check the channel name spelling or verify you have access |
not_in_channel | You need to join the channel first |
User 'X' not found | The username doesn't exist or doesn't match any name fields |
| DM channel ID is null/empty | The conversations.open response failed. Check user ID validity |
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.