Skip to main content

slack-latest

Gather recent Slack messages, read threads, send replies, and upload/download files. Use when the user asks about Slack activity or wants to interact with Slack.

Quellinformationen

Repository
junghan0611/agent-config
Letzte Quellaktivitรคt
1. Juni 2026 um 07:58
Erkannte Sprache von SKILL.md
Koreanisch
Sterne
5
Forks
0

Installationsoptionen

StandardmรครŸig ist der Prompt ausgewรคhlt, der zuerst die Quelle prรผft. Sie kรถnnen zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.

Quelldateien prรผfen

Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich fรผr eine Installation entscheiden.

Datei-Explorer
2 Dateien

SKILL.md wird angezeigt

SKILL.md
Quellanweisungen ยท Schreibgeschรผtzte Vorschau
name
slack-latest
description
Gather recent Slack messages, read threads, send replies, and upload/download files. Use when the user asks about Slack activity or wants to interact with Slack.
# Slack: gather, read, send, file upload/download `slack.py` is a self-contained Python script (no dependencies beyond the standard library) at `{baseDir}/slack.py`. ## Authentication **ํ™˜๊ฒฝ๋ณ€์ˆ˜ ๋ฐฉ์‹** (๊ถŒ์žฅ โ€” `~/.env.local`์— ์„ค์ •): ```bash export SLACK_WORKSPACE_URL="https://WORKSPACE.slack.com" export SLACK_TOKEN="xoxc-..." export SLACK_COOKIE="xoxd-..." ``` ํ™˜๊ฒฝ๋ณ€์ˆ˜๊ฐ€ ์—†์œผ๋ฉด `~/.config/skills/slack-latest/credentials.json` ํŒŒ์ผ์„ ์ฝ์Œ. ### ํ† ํฐ ๋ฐœ๊ธ‰ (๋ธŒ๋ผ์šฐ์ € cURL ๋ณต์‚ฌ) 1. Slack **์›น ๋ธŒ๋ผ์šฐ์ €**์—์„œ F12 โ†’ Network ํƒญ 2. ํ•„ํ„ฐ์— `api/` ์ž…๋ ฅ โ†’ `*.slack.com/api/` ์š”์ฒญ ์ฐพ๊ธฐ 3. ์šฐํด๋ฆญ โ†’ **Copy as cURL** 4. ํ† ํฐ ์ €์žฅ: ```bash pbpaste | python3 {baseDir}/slack.py auth ``` **ํ† ํฐ ์ˆ˜๋ช…:** ๋ธŒ๋ผ์šฐ์ € ๋กœ๊ทธ์•„์›ƒ ์‹œ ๋งŒ๋ฃŒ. ์ธ์ฆ ์—๋Ÿฌ ๋ฐœ์ƒํ•˜๋ฉด ์žฌ์„ค์ •. ๊ฒ€์ฆ: ```bash python3 {baseDir}/slack.py auth-test ``` ## Gather recent messages ์ฑ„๋„ ๋ฉ”์‹œ์ง€ ์ˆ˜์ง‘. **๊ธฐ๋ณธ์ ์œผ๋กœ `--no-dm`์„ ์‚ฌ์šฉ**ํ•˜์—ฌ ๊ฐœ์ธ DM์„ ์ œ์™ธํ•œ๋‹ค. ```bash # ์ฑ„๋„๋งŒ (DM ์ œ์™ธ) โ€” ๊ธฐ๋ณธ ์‚ฌ์šฉ๋ฒ• python3 {baseDir}/slack.py gather --days 3 --no-dm --out ~/tmp/slack-recent.json # DM ํฌํ•จ (์‚ฌ์šฉ์ž๊ฐ€ ๋ช…์‹œ์ ์œผ๋กœ ์š”์ฒญํ•œ ๊ฒฝ์šฐ๋งŒ) python3 {baseDir}/slack.py gather --days 3 --out ~/tmp/slack-recent.json ``` Output: JSON array grouped by channel (most recently active first). ### Options | Flag | Description | |------|-------------| | `--days N` | time window (default: 3) | | `--no-dm` | **DM/group DM ์ œ์™ธ** (์ฑ„๋„๋งŒ) | | `--max-text N` | truncate message text in chars (default: 500) | | `--include-ids` | add `_id`, `_uid`, `_ts` for follow-up API calls | | `--compact` | single-line JSON (saves ~25% size) | | `--out PATH` | output file path (default: ~/tmp/slack-recent.json) | ### Output format ```json [ { "channel": "#general", "messages": [ { "from": "ํ™๊ธธ๋™", "at": "2026-03-07 12:18 KST", "text": "๋ฐฐํฌ ์™„๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค", "replies": [ {"from": "๊น€์˜ํฌ", "at": "2026-03-07 12:20 KST", "text": "ํ™•์ธ!"} ] } ] } ] ``` - Messages: oldest-first (narrative order) - Thread replies expanded inline under `replies` - `older_replies: N` when replies fall outside time window - Timestamps in KST (UTC+9, suffix `KST`) ## Read one channel's history (bot alert ํšŒ์ˆ˜ โ€” "๋ฌธ์ œ ์—†๋‚˜?!") `gather` ๋Š” bot_message ๋ฅผ noise ๋กœ ๋ฒ„๋ ค์„œ, **๋ด‡์ด ์˜๋Š” alert ์ฑ„๋„**(์„œ๋ฒ„์‘๋‹ต์ฒดํฌ / cube alerts ๋“ฑ)์„ ํ†ต์งธ ๋ˆ„๋ฝํ•œ๋‹ค. `history` ๋Š” ๋‹จ์ผ ์ฑ„๋„์„ ์ฝ๋˜ `--include-bot` ์œผ๋กœ bot alert ๋ฅผ ์‚ด๋ฆฌ๊ณ , alert ๋ณธ๋ฌธ์ด `attachments`/`blocks` ์—๋งŒ ์žˆ์„ ๋•Œ๋„ `text` ๋กœ ๋ณต์›ํ•œ๋‹ค. read-only. ์ด๊ฒƒ์ด ์šด์˜ ์ ๊ฒ€("๋ฌธ์ œ ์—†๋‚˜?!")์—์„œ **P0 bot alert ํšŒ์ˆ˜ ๊ฒฝ๋กœ**๋‹ค. ```bash # bot alert ์ฑ„๋„ โ€” --include-bot ํ•„์ˆ˜ python3 {baseDir}/slack.py history --channel C095PQMMW9J \ --days 14 --include-ids --include-bot --out /tmp/noti-server-history.json ``` ์ถœ๋ ฅ์€ `gather` ํ˜ธํ™˜ `[{"channel","_id","messages":[...]}]` ๋ผ์„œ incidentcli `slack_alert` ingest ๊ฐ€ ๋ฐ”๋กœ ๋จน๋Š”๋‹ค: ```bash cd ~/repos/work/incidentcli ./run.sh ingest --from slack_alert --input /tmp/noti-server-history.json \ --incident-id <DENOTE_ID> --window FROM..UNTIL --out /tmp/envelope.json ./run.sh validate-output /tmp/envelope.json ``` | Flag | Description | |------|-------------| | `--channel` | Channel ID (required) | | `--include-bot` | **bot_message alert ํฌํ•จ** (๊ธฐ๋ณธ ์ œ์™ธ โ€” alert ์ฑ„๋„์—” ํ•„์ˆ˜) | | `--days N` | time window (default: 1). ๋น„๋ฉด 7/14 ๋กœ ๋„“ํ˜€๋„ ๋จ โ€” **๋นˆ ๊ฒฐ๊ณผ๋Š” ์ •์ƒ์ผ ์ˆ˜ ์žˆ์Œ** | | `--channel-name` | ํ‘œ์‹œ ์ด๋ฆ„ override (๊ธฐ๋ณธ: conversations.info ๋กœ ํ•ด์„) | | `--include-ids` | `_uid` ์ถ”๊ฐ€ (`_ts`/`_id` ๋Š” ํ•ญ์ƒ ํฌํ•จ) | | `--max-text N` | message text truncate (default: 800) | | `--compact` / `--out` | gather ์™€ ๋™์ผ | - DM ์€ ๋Œ€์ƒ์ด ์•„๋‹ˆ๋‹ค(๋‹จ์ผ ์ฑ„๋„ ID ๋งŒ). gather ์˜ DM ๊ธฐ๋ณธ ์ œ์™ธ ์›์น™๊ณผ send ์ „ ํ™•์ธ ์›์น™์€ ๊ทธ๋Œ€๋กœ ์œ ์ง€. - ์ง„์งœ ์‹œ์Šคํ…œ noise(`channel_join` ๋“ฑ)๋งŒ ํ•ญ์ƒ skip, bot alert ๋Š” `--include-bot` ๋กœ ์ œ์–ด. ## Read a single thread ```bash python3 {baseDir}/slack.py thread --channel C0123456789 --ts 1700000000.000001 ``` ## Send (text, file, or both) `send` ๋Š” ํ…์ŠคํŠธ๋งŒ / ํŒŒ์ผ๋งŒ / ํ…์ŠคํŠธ+ํŒŒ์ผ ์ฒจ๋ถ€ ๋ชจ๋‘ ์ง€์›. ์Šค๋ ˆ๋“œ ๋‹ต๊ธ€๋„ ๊ฐ€๋Šฅ. ```bash # ํ…์ŠคํŠธ๋งŒ (chat.postMessage) python3 {baseDir}/slack.py send --channel C0123456789 --text "Hello" # ์Šค๋ ˆ๋“œ ๋‹ต๊ธ€ python3 {baseDir}/slack.py send --channel C0123456789 \ --thread-ts 1700000000.000001 --text "Got it" # ํŒŒ์ผ๋งŒ ์—…๋กœ๋“œ (files.upload v2 โ€” getUploadURLExternal + complete) python3 {baseDir}/slack.py send --channel D09336BAYF7 \ --file ~/Documents/report.pdf # ํŒŒ์ผ + ๋ฉ”์‹œ์ง€ (--text ๊ฐ€ initial_comment ๋กœ ๋“ค์–ด๊ฐ) python3 {baseDir}/slack.py send --channel D09336BAYF7 \ --file ~/report.pdf \ --text "์ด์‚ฌ๋‹˜, ๊ฒ€ํ†  ์š”์ฒญ๋“œ๋ฆฝ๋‹ˆ๋‹ค." # ์Šค๋ ˆ๋“œ ์•ˆ์— ํŒŒ์ผ ์ฒจ๋ถ€ python3 {baseDir}/slack.py send --channel C0123456789 \ --thread-ts 1700000000.000001 \ --file ~/snapshot.png --text "๋ฐฉ๊ธˆ ์บก์ณ" ``` ์˜ต์…˜: | Flag | Description | |------|-------------| | `--channel` | Channel/DM ID (required) | | `--text` | ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ. `--file` ๊ณผ ํ•จ๊ป˜ ์“ฐ๋ฉด ์ฒจ๋ถ€ ์ฝ”๋ฉ˜ํŠธ๋กœ ๋“ค์–ด๊ฐ | | `--file` | ์—…๋กœ๋“œํ•  ํŒŒ์ผ ๊ฒฝ๋กœ | | `--title` | ํŒŒ์ผ ์ œ๋ชฉ (๊ธฐ๋ณธ: ํŒŒ์ผ๋ช…). `--file` ์—†์œผ๋ฉด ๋ฌด์‹œ | | `--thread-ts` | ์Šค๋ ˆ๋“œ ๋‹ต๊ธ€ timestamp | `--text` ์™€ `--file` ๋‘˜ ๋‹ค ๋น„์–ด ์žˆ์œผ๋ฉด ์—๋Ÿฌ. ## Download a file ```bash # ํŒŒ์ผ ID ๋กœ ๋‹ค์šด๋กœ๋“œ (ํ˜„์žฌ ๋””๋ ‰ํ† ๋ฆฌ์— ์›๋ณธ ํŒŒ์ผ๋ช…์œผ๋กœ ์ €์žฅ) python3 {baseDir}/slack.py get-file --file-id F0B529622S3 # Permalink URL ๋กœ๋„ ๊ฐ€๋Šฅ (URL ์•ˆ์—์„œ F<ID> ์ž๋™ ์ถ”์ถœ) python3 {baseDir}/slack.py get-file \ --url "https://team.slack.com/files/U092.../F0B5.../report.doc" # ์ถœ๋ ฅ ๊ฒฝ๋กœ/๋””๋ ‰ํ† ๋ฆฌ ์ง€์ • python3 {baseDir}/slack.py get-file --file-id F0B529622S3 --out /tmp/report.doc python3 {baseDir}/slack.py get-file --file-id F0B529622S3 --out ~/Downloads/ ``` ํŒŒ์ผ ID ๋Š” `gather --include-ids` ๊ฒฐ๊ณผ์˜ ๋ฉ”์‹œ์ง€์— ๋ณด์ด๋Š” `files[].id`, ๋˜๋Š” ์—…๋กœ๋“œ ํ›„ ์‘๋‹ต์˜ `permalink` URL ์—์„œ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค. ## ์—์ด์ „ํŠธ ๊ทœ์น™ 1. **DM์€ ๊ธฐ๋ณธ ์ œ์™ธ**: gather ์‹œ ํ•ญ์ƒ `--no-dm` ์‚ฌ์šฉ. ์‚ฌ์šฉ์ž๊ฐ€ ๋ช…์‹œ์ ์œผ๋กœ DM ์š”์ฒญ ์‹œ์—๋งŒ ์ƒ๋žต 2. **๋ฉ”์‹œ์ง€/ํŒŒ์ผ ์ „์†ก ์ „ ํ™•์ธ**: `send` ์‹คํ–‰ ์ „ ๋ฐ˜๋“œ์‹œ ์‚ฌ์šฉ์ž ํ™•์ธ (ํŒŒ์ผ ์ฒจ๋ถ€๋„ ๋™์ผ) 3. **๋‹ค์šด๋กœ๋“œ ํŒŒ์ผ ์œ„์น˜ ๋ณด๊ณ **: `get-file` ๊ฒฐ๊ณผ์˜ `saved` ๊ฒฝ๋กœ๋ฅผ ์‚ฌ์šฉ์ž์—๊ฒŒ ์•Œ๋ฆผ 4. **๊ฐœ์ธ์ •๋ณด ์ฃผ์˜**: ์ˆ˜์ง‘๋œ ๋ฉ”์‹œ์ง€์™€ ๋‹ค์šด๋กœ๋“œํ•œ ํŒŒ์ผ์„ ์™ธ๋ถ€์— ๋…ธ์ถœํ•˜์ง€ ์•Š์Œ
Auf GitHub ansehen