slack-web-api
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.
More from wottpal/skills
date-fns
Practical workflow for date-fns v4 and native @date-fns/tz usage, covering imports, parsing/formatting, calculations, timezone-safe patterns, and common pitfalls.
49jotai-nextjs
Expert workflow for Jotai state management with a Next.js focus, covering core APIs, SSR hydration, utilities, recipes, and current release migrations.
10use-the-index-luke
Postgres query and index optimization workflow based on use-the-index-luke principles. Use for EXPLAIN analysis, index design, predicate rewrites, joins, sorting, and pagination tuning.
8deep-research-firecrawl
Conducts citation-backed research using Firecrawl MCP search, scrape, map, crawl, and agent tools with selectable quick, standard, deep, and ultradeep modes. Use for multi-source comparisons, technical evaluations, market research, and high-stakes decision support.
8readme-agents-writer
Build and maintain unified README.md + AGENTS.md + CLAUDE.md docs where symlink-triplet policy is strict, and the canonical README remains an in-depth, high-signal agent instruction and engineering playbook.
6worktree-handoff
Safely hand off the current source worktree state, including untracked files, onto a local target branch (default `develop`) without modifying the source worktree, using an alternate-index snapshot and target-side cherry-pick.
2