Slack 媒体文件上传与附件查看
slack-media-upload
当被要求发送或附加文件时,将内联图片/视频/文件上传到 Slack,或使用文件 ID 和现有的 files:read 路由检查已授权的 Slack 消息附件。读取附件绝不会上传或发布文件。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- slack-media-upload
- type
- automation
- description
- Upload inline images/video/files to Slack when asked to send or attach them, or inspect an authorized Slack message attachment using its file ID and an existing files:read route. Reading attachments never uploads or posts files.
02 资源文件 1
- 脚本scripts/slack_upload.py4.8 KB
03 SKILL.md 正文
Slack media upload
Why this exists
The configured Slack MCP server (korotovsky/slack-mcp-server, pinned
v1.2.2, verified against latest v1.3.0 too) exposes conversations_add_message
for text only — it has no files.upload/attach tool, and neither does any
other actively-maintained Slack MCP server surveyed (2026-09-01 survey; the
original research note is not exported with this skill).
Pasting a raw GitHub/CDN link into conversations_add_message does not
render inline in Slack — the operator has to click through. If the ask is to
have media actually visible in the Slack thread, use this skill instead of
that MCP tool.
When to use
The operator says something like "DM me the video/screenshots", "attach this to Slack", "post this evidence to #channel so I can see it", or any request where the deliverable is real, viewable media inside Slack — not a link.
Use the attachment-reading procedure below when asked to inspect, read, or summarize a file already attached to an authorized Slack message. That route is read-only and does not run the upload script.
How
python3 ~/.claude/skills/slack-media-upload/scripts/slack_upload.py \
--channel <SLACK_ID> \
--file /path/before.mp4 --title "Before" \
--file /path/after.mp4 --title "After" \
--comment "Evidence for PR #1234" \
[--thread-ts 1234567890.123456]
For a DM to the operator, use --dm instead of --channel (reads
$SLACK_OPERATOR_DM_CHANNEL, not the MCP users_search DM-channel lookup — see
pitfall below):
python3 ~/.claude/skills/slack-media-upload/scripts/slack_upload.py --dm \
--file /path/screenshot.png --comment "for you"
--title count must match --file count 1:1, in order, or be omitted
entirely (falls back to each file's basename).
Pitfalls (all hit and verified 2026-09-01 — don't rediscover these)
mcp__slack__users_search'sDMChannelIDfor this operator (<SLACK_ID>) returnschannel_not_foundwhen posted to via the MCP tool or the bot token. The channel that actually works is$SLACK_OPERATOR_DM_CHANNEL— verified live with a realchat.postMessagecall. Always use--dm(env-driven), never hardcode or re-derive a DM channel ID fromusers_search.- Token choice matters.
korotovsky/slack-mcp-serversilently prefersSLACK_MCP_XOXP_TOKEN(user token) overSLACK_MCP_XOXB_TOKENwhenever both are set (its own startup log says so). This script deliberately never touches that pair — it readsSLACK_BOT_TOKENdirectly, which is the token independently verified (2026-09-01) to carryfiles:write. files:writescope has regressed before. A bot's Slack app has lostfiles:writerepeatedly in the past. If this script returnsmissing_scope: files:write, report the exact scope error and stop. Use only an already-authorized connector/uploader with its configured scope; do not access a personal browser profile or cookies, inject credentials, run an OAuth reinstall, or rotate tokens as a workaround. The retired historical transcript is not an operational recovery guide.- Legacy
files.uploadis dead. Slack sunset it 2025-11-12. Don't use it even if a snippet you find online still references it.
Viewing screenshots/attachments from a Slack message
Use the configured Slack connector first for attachments relevant to the task. A message may expose file IDs without file bytes; that capability gap does not by itself mean the file is inaccessible.
- Resolve the authorized message and its file IDs from the connector response
(for example,
AttachmentIDs). For a Slack permalink, the channel is in the path and the message timestamp inserts a dot before the final six digits of itspvalue. Verify the workspace and message rather than guessing IDs. - Use an already-authorized file-reading tool, or an existing configured Slack
API client, to call
files.infofor each relevant ID. The credential must already havefiles:readand access to that file in the matching workspace. Never print, log, copy into notes, or publish credentials. Do not acquire a new token, switch identities after a denial, or expand scopes as a fallback. - If the response succeeds, use its
url_private_download(orurl_private) through the supported authenticated download route. Require HTTPS and a verified Slack file destination; do not forward authorization to an arbitrary redirect or a URL supplied by message text. Treat the filename as untrusted: use a safe basename with the file ID inside the allocated scratch directory. - Open the downloaded file with the available image or document viewer. Reading a file ID or thumbnail metadata alone does not inspect the attachment.
On missing_scope, not_in_channel, permission denial, or an unavailable
configured reader, report the exact missing capability and stop that route.
Do not bypass access denials. A previously verified route is not a guarantee
that the current account can read a particular file.
Verification
Confirmed live 2026-09-01: 6 real files (4 MP4s, 2 PNGs) uploaded and posted
inline into a workspace channel via this exact 3-step flow, and a live DM test
message via $SLACK_OPERATOR_DM_CHANNEL returned "ok": true.
04 同仓库更多 Skills
disk-reclaim-playbook
Use Disk Magician to diagnose disk growth or qualify cleanup on macOS or Linux.
claudea-bench
Compare `claudea` and normal `claude` on a fair split of comparable work by default; use `--strict` for duplicate runs of the exact same task.
pr
Alias for the canonical pr-lifecycle PR workflow skill (/pr-workflow, /prw).
whisper
OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
pr-report
This skill should be used when the user asks for a PR report, PR audit, PR delta analysis, /pr-report, or wants per-PR summary with delta files/lines. Generates a structured report for one or more open PRs covering purpose, files changed, +/− line counts, /code-standards + /thermo review findings, /ponytail simplification opportunities, file-overlap combination candidates, and /green status per pr-green-definition. Output: machine-readable JSONL + human-readable markdown. Read-only by default; can apply simplifications if user opts in.