Slack Message Skill
Post messages, list channels, and reply to threads using the Slack Web API.
Setup
- •Go to api.slack.com/apps → Create New App
- •Add Bot Token Scopes:
chat:write,channels:read,files:write - •Install app to workspace → Copy Bot User OAuth Token
bash
export SLACK_BOT_TOKEN="xoxb-xxx..."
Post a Message
bash
curl -s -X POST "https://slack.com/api/chat.postMessage" \
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel": "C0XXXXXX",
"text": "Deploy completed successfully"
}' | jq '{ok, ts: .ts, channel: .channel}'
List Channels
bash
curl -s "https://slack.com/api/conversations.list?types=public_channel&limit=50" \
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
| jq '.channels[] | {id, name, num_members}'
Reply to a Thread
bash
curl -s -X POST "https://slack.com/api/chat.postMessage" \
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel": "C0XXXXXX",
"thread_ts": "1234567890.123456",
"text": "Thread reply from agent"
}' | jq '{ok, ts}'
Post with Blocks (Rich Formatting)
bash
curl -s -X POST "https://slack.com/api/chat.postMessage" \
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel": "C0XXXXXX",
"blocks": [
{"type": "header", "text": {"type": "plain_text", "text": "Daily Report"}},
{"type": "section", "text": {"type": "mrkdwn", "text": "*Errors:* 3\n*Uptime:* 99.9%"}}
]
}' | jq '{ok, ts}'
Tips
- •Channel IDs start with
C(public) orG(private) — use IDs not names - •Bot must be invited to a channel before posting:
/invite @botname - •Rate limit: ~1 message/second per channel (burst: 100 per minute)
- •
thread_tsis the timestamp of the parent message - •Slack uses
mrkdwn(not markdown) — bold is*text*, italic is_text_