# slack-fetcher > Fetch Slack messages and threads by URL. Auto-detects threads and returns structured JSON (message text, author, datetime, thread replies if present) ready for LLM processing. Use when needing to extract Slack context for analysis, documentation, or backlog items. - Author: Jonathan Glasmeyer - Repository: jonathanglasmeyer/dotfiles-2025 - Version: 20251217220623 - Stars: 1 - Forks: 0 - Last Updated: 2026-02-07 - Source: https://github.com/jonathanglasmeyer/dotfiles-2025 - Web: https://mule.run/skillshub/@@jonathanglasmeyer/dotfiles-2025~slack-fetcher:20251217220623 --- --- name: slack-fetcher description: Fetch Slack messages and threads by URL. Auto-detects threads and returns structured JSON (message text, author, datetime, thread replies if present) ready for LLM processing. Use when needing to extract Slack context for analysis, documentation, or backlog items. --- # Slack Fetcher ## Overview Fetch any Slack message by URL and automatically extract the full context. If the message is part of a thread, returns all replies. Otherwise returns just the message. Returns structured JSON with author, timestamp, channel, full text, and thread replies (if applicable) – ready for LLM processing. ## Quick Start **Prerequisites:** See [setup.md](references/setup.md) for token setup. **Usage:** ```bash python scripts/slack_fetch.py "https://your-workspace.slack.com/archives/C12345/p1234567890123456" ``` **Output:** Structured JSON containing: - `success`: Boolean status - `author`, `channel`, `datetime`: Message metadata - `text`: Full message content - `is_thread`: Boolean (true if message has replies) - `thread_replies`: Array of reply objects (if `is_thread=true`) See [output_schema.md](references/output_schema.md) for complete schema. ## How It Works 1. **Parse URL** – Extract channel ID and timestamp from Slack URL 2. **Fetch Message** – Retrieve message from Slack API with user/channel info 3. **Check for Replies** – Query `conversations.replies` API to detect threads 4. **Fetch Thread** – If replies exist, fetch all thread replies with full context 5. **Return JSON** – Structured output ready for LLM processing **Auto-Detection Logic:** - If message has `thread_replies > 0` → `is_thread=true` and includes full thread - If message is standalone → `is_thread=false` and `thread_replies=[]` ## Project Usage Examples **Product Ops Intelligence (Backlog Extraction):** When user pastes Slack discussion link into Claude Code: ``` User: "Add this to backlog: https://moiafamily.slack.com/archives/C09LRJSDZ4H/p1761840..." Claude: [Runs slack_fetch.py] → Extracts thread context → Adds concise item to BACKLOG.md with link + full context ``` **Analysis & Documentation:** When needing to preserve Slack discussions for later reference: ``` Claude: [Fetches thread] → Formats for markdown → Includes in project documentation ``` **Generic LLM Workflows:** Any Claude instance can use fetched Slack data for analysis, summarization, or extraction without direct API access. ## Error Handling **Common errors and causes:** | Error | Cause | Solution | |-------|-------|----------| | "Invalid Slack URL format" | URL doesn't match expected pattern | Use direct Slack message URL from browser | | "No token file found" | `slack_token.json` missing | See [setup.md](references/setup.md) | | "No access token found" | Token file malformed or empty | Verify token format in setup guide | | "Slack API error: not_in_channel" | Bot doesn't have channel access | Add bot to channel in Slack workspace | ## Resources ### scripts/ - **`slack_fetch.py`** – Main script. Handles URL parsing, message fetching, thread detection, and JSON output. ### references/ - **`setup.md`** – How to configure Slack token and obtain OAuth credentials. - **`output_schema.md`** – Complete JSON response schema with examples (use for LLM context building).