slack-web-api
SKILL.md
Slack Web API Skill
Use the bundled Bun+TypeScript CLI wrapper to call Slack Web API methods with a bot token.
Preconditions
- Ensure
SLACK_TOKENis set in the shell environment. - Run the script from this repo (uses the local
@slack/web-apidependency).
CLI Wrapper (Bun + TS)
Script: scripts/slack_web_api.ts
Commands:
list_channelspostpost_tabledeletesearchchannel_historythreadreactions_addreactions_remove
Optional flags:
--resolve_users trueto adduser_namefields--include_threads trueto embed full thread replies inchannel_historypostsupports rich message inputs:--text_filefor multiline body from file--unescape_text trueto convert\n/\tescapes in--textinto actual newlines/tabs--blocks_json/--blocks_filefor Block Kit--attachments_json/--attachments_filefor legacy attachments--thread_ts,--reply_broadcast true,--unfurl_links false,--unfurl_media false,--mrkdwn true
post_tablesupports:--headers_json/--headers_file--rows_json/--rows_file--title,--text,--include_index true--max_rows(default20),--max_col_width(default32)
All commands return JSON to stdout.
Examples
List channels (all pages):
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts list_channels --all true
Post message:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts post --channel C123 --text "Hello"
Post message with escaped newlines:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts post \
--channel C123 \
--text "Line 1\\nLine 2\\n- bullet" \
--unescape_text true
Post rich Block Kit message from JSON string:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts post \
--channel C123 \
--text "Fallback text" \
--blocks_json '[{"type":"header","text":{"type":"plain_text","text":"Perf Update"}},{"type":"section","text":{"type":"mrkdwn","text":"*All probes:* :white_check_mark: 24/24 exposed"}}]'
Post rich Block Kit message from file:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts post \
--channel C123 \
--text "Fallback text" \
--blocks_file /tmp/slack-blocks.json
Post an aligned table:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts post_table \
--channel C123 \
--title "Pipeline Performance (user_add)" \
--headers_json '["kind","exposed","timeout","p50_min","p90_min"]' \
--rows_json '[["account",12,0,8.79,33.73],["video",12,0,12.01,50.44]]'
Post a larger table from file (array of objects):
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts post_table \
--channel C123 \
--headers_json '["kind","platform","status","minutes_to_exposed"]' \
--rows_file /tmp/perf_rows.json \
--include_index true \
--max_rows 40 \
--max_col_width 40
Search messages:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts search --query "in:#general budget review" --count 100
Read an entire channel history (paginate):
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts channel_history --channel C123 --all true
Fetch a thread:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts thread --channel C123 --ts 1712345678.9012 --all true --resolve_users true
Channel history with usernames + embedded threads:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts channel_history --channel C123 --all true --resolve_users true --include_threads true
Add/remove reactions:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts reactions_add --channel C123 --ts 1712345678.9012 --name eyes
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts reactions_remove --channel C123 --ts 1712345678.9012 --name eyes
Delete a message:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts delete --channel C123 --ts 1712345678.9012
Pattern: read + analyze a channel
- Fetch history to JSON:
SLACK_TOKEN=... bun ./ .codex/skills/slack-web-api/scripts/slack_web_api.ts channel_history --channel C123 --all true > /tmp/slack.json - Analyze locally (summaries, keyword extraction, timeline, etc.).
Notes
- Use channel IDs (
C.../G...) for reliability. searchrespects Slack’s search index, whilechannel_historyis raw channel data.- If API permissions block results, update bot scopes in Slack app settings.
Weekly Installs
3
Repository
wottpal/skillsFirst Seen
13 days ago
Security Audits
Installed on
mcpjam3
command-code3
claude-code3
junie3
windsurf3
zencoder3