Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计异常

slackSlack 团队协作

Agent Skill

用于处理 Slack 工作区里的频道、消息、线程、用户和通知信息。它适合让 Agent 查询团队沟通记录、整理上下文、回复线程或辅助协作提醒。使用时需要确认机器人或用户 token 是否具备目标频道访问权,私有频道和历史消息通常有额外权限限制;发送消息、@成员或批量读取对话时,应避免泄露内部讨论和敏感工作信息。

总安装

546

周安装

23

GitHub Stars

2

下载量

191
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:slack(Slack 团队协作)
来源仓库:https://github.com/azmym/agent-skills
仓库路径:skills/slack
安装命令:
npx skills add https://github.com/azmym/agent-skills --skill slack
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/azmym/agent-skills --skill slack

简介

用于处理 Slack 工作区里的频道、消息、线程、用户和通知信息,适合查询团队沟通记录和辅助协作提醒。

  • Slack Web API 技能,支持读取、写入、搜索、反应、固定和管理对话。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需初始化配置模式(Token、Browser 或 Local)。
  • 使用时需确认机器人 token 具备目标频道访问权,避免泄露内部讨论和敏感工作信息。
  • slack 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Slack Web API Skill

Interact with Slack: read, write, search, react, pin, and manage conversations via the Web API.

IMPORTANT: First-Use Initialization

Before executing any Slack operation, check if the mode config file exists:

cat ~/.agents/config/slack/config.env

If the file does not exist (or does not contain SLACK_MODE), you must ask the user which mode they want to use. Present these three options:

  1. Token (macOS only): Extracts session tokens directly from Chrome. Fastest option. Requires Chrome with Slack open, AppleScript enabled, and uvx installed.
  2. Browser (cross-platform): Uses a local Playwright browser to make API calls. Works on macOS, Linux, and Windows. Requires Node.js 18+. Supports SSO and 2FA login.
  3. Auto-detect (recommended): Automatically uses browser mode if a Playwright session exists, otherwise falls back to token mode. Best of both worlds.

Once the user selects a mode, save it immediately:

mkdir -p ~/.agents/config/slack
echo 'SLACK_MODE=<selected_value>' > ~/.agents/config/slack/config.env

Where <selected_value> is token, browser, or auto.

After saving, never ask again. On all subsequent invocations, the config file will exist and the skill will use the saved mode automatically.

If the user selected browser mode, also run the browser session setup:

{SKILL_DIR}/scripts/slack-browser-session.sh login-manual

This opens a visible browser for the user to log in to Slack (supports SSO/2FA). The session is saved and reused for all future API calls.


Mode Selection

The skill supports three modes. Set via ~/.agents/config/slack/config.env or the SLACK_MODE environment variable:

ModeValueBehavior
TokentokenDirect curl calls using Chrome session tokens. Fast. macOS only.
BrowserbrowserAPI calls through a local Playwright browser session. Cross-platform.
Auto-detectautoUse browser if session exists; falls back to token on auth failure. (default)

Configure the mode

Option 1: Config file (persistent)

echo 'SLACK_MODE=token' > ~/.agents/config/slack/config.env
# or
echo 'SLACK_MODE=browser' > ~/.agents/config/slack/config.env
# or
echo 'SLACK_MODE=auto' > ~/.agents/config/slack/config.env

Option 2: Environment variable (per-call override)

SLACK_MODE=browser slack-api.sh conversations.history channel=C041RSY6DN2 limit=20

The environment variable takes priority over the config file.

Config and State Directory

All skill config and state lives under ~/.agents/config/slack/:

FilePurpose
config.envMode selection (`SLACK_MODE=auto\token\browser`)
tokens.envCached session tokens (xoxc, xoxd, user-agent)
browser-sessionActive browser session ID
sessions/<id>/storageState.jsonPlaywright session cookies and localStorage

This directory is created automatically on first use.

API Wrapper

All calls go through a single unified script:

{SKILL_DIR}/scripts/slack-api.sh <method> [key=value ...]

Where {SKILL_DIR} is the base directory provided when this skill is loaded (e.g., ~/.agents/skills/slack).

The script automatically routes to the correct mode based on your configuration. For the full method reference, see references/api-methods.md.

Token Mode (macOS)

Token mode extracts session tokens from your running Chrome browser and makes direct curl calls to the Slack Web API.

Prerequisites:

  • Chrome running with Slack open at app.slack.com
  • Chrome > View > Developer > Allow JavaScript from Apple Events
  • uvx installed (brew install uv)

No manual setup needed. On first API call, tokens are extracted automatically.

Browser Mode (Cross-Platform)

Browser mode uses a local Playwright Chromium instance to maintain a Slack session. API calls are made via fetch() inside the browser context, so no token extraction is needed. This works on macOS, Linux, and Windows.

Prerequisites:

  • Node.js 18+ installed
  • Playwright auto-installs on first use (downloads Chromium, ~150 MB)

For detailed documentation, see references/browser-mode.md.

Quick Start (Browser Mode)

# 1. Set mode to browser
echo 'SLACK_MODE=browser' > ~/.agents/config/slack/config.env

# 2. Start a browser session and log in manually (supports SSO/2FA)
{SKILL_DIR}/scripts/slack-browser-session.sh login-manual

# Or: automated email+password login
{SKILL_DIR}/scripts/slack-browser-session.sh start
{SKILL_DIR}/scripts/slack-browser-session.sh login user@example.com mypassword

# 3. Verify login succeeded
{SKILL_DIR}/scripts/slack-browser-session.sh status

# 4. Make API calls (same script, routes through browser automatically)
{SKILL_DIR}/scripts/slack-api.sh conversations.history channel=C041RSY6DN2 limit=20

# 5. Close when done
{SKILL_DIR}/scripts/slack-browser-session.sh stop

UI Automation (API Gaps)

Browser mode also enables direct interaction with Slack's web UI for features that lack API support:

# Get the session ID
SESSION_ID=$({SKILL_DIR}/scripts/slack-browser-session.sh get)

# Navigate to a specific channel
node {SKILL_DIR}/scripts/playwright-bridge.js --function interact --session $SESSION_ID \
  --input '{"action": "goto", "url": "https://app.slack.com/client/TEAM_ID/CHANNEL_ID"}'

# Take a snapshot to see interactive elements
node {SKILL_DIR}/scripts/playwright-bridge.js --function snapshot --session $SESSION_ID --input '{}'

# Interact with UI elements using @e refs from the snapshot
node {SKILL_DIR}/scripts/playwright-bridge.js --function interact --session $SESSION_ID \
  --input '{"action": "click", "ref": "@e5"}'

# Take a screenshot for visual verification
node {SKILL_DIR}/scripts/playwright-bridge.js --function screenshot --session $SESSION_ID --input '{}'

Use cases for UI automation:

  • Canvas creation and editing (no public API)
  • Huddle interactions (no API)
  • Workflow Builder configuration
  • Slack Connect invitations
  • Admin and settings pages
  • Visual message verification via screenshots

Parsing Slack URLs

Extract channel and timestamp from Slack URLs:

https://{WORKSPACE}.slack.com/archives/{CHANNEL_ID}/p{TIMESTAMP_WITHOUT_DOT}

Insert a dot before the last 6 digits of the timestamp:

  • URL: p1770725748342899 -> ts: 1770725748.342899

For threaded messages, the URL may include?thread_ts= parameter.

Read Operations

Read a thread

slack-api.sh conversations.replies channel=CHANNEL_ID ts=THREAD_TS limit=100

Read channel history

slack-api.sh conversations.history channel=CHANNEL_ID limit=20

Optional: oldest / latest (Unix timestamps) to bound the time range.

Search messages

slack-api.sh search.messages query="search terms" count=10

Modifiers: in:#channel, from:@user, before:YYYY-MM-DD, after:YYYY-MM-DD, has:link, has:reaction, has:pin.

Find a channel by name

slack-api.sh conversations.list types=public_channel limit=200 | python3 -c "import sys,json; channels=json.load(sys.stdin).get('channels',[]); matches=[c for c in channels if 'TARGET' in c['name']]; [print(f\"{c['id']} #{c['name']}\") for c in matches]"

Look up a user

slack-api.sh users.info user=USER_ID

Name: .user.real_name or .user.profile.display_name.

List pinned items

slack-api.sh pins.list channel=CHANNEL_ID

List channel members

slack-api.sh conversations.members channel=CHANNEL_ID limit=100

Write Operations

IMPORTANT: Confirmation required before any write operation.

Before sending, editing, deleting a message, adding/removing reactions, or pinning/unpinning, always show the user a preview and ask for confirmation. Format the preview as:

To: #channel-name (or @username for DMs) Message: The exact message text Action: Send / Edit / Delete / React / Pin (as applicable) Send this? (or: want to change anything?)

Do NOT execute the write API call until the user explicitly confirms. If the user wants changes, update the preview and ask again.

Send a message

For simple one-line messages:

slack-api.sh chat.postMessage channel=CHANNEL_ID text="Hello world"

Thread reply: add thread_ts=PARENT_TS. Broadcast to channel: add reply_broadcast=true.

Send a formatted multi-line message

For messages with newlines, bold, lists, or other mrkdwn formatting, use blocks instead of text. The text parameter with URLSearchParams double-escapes newlines in browser mode, so blocks are the reliable way to send formatted content.

Build the blocks JSON with python and pass it to the API:

BLOCKS=$(python3 -c "
import json
blocks = [
    {'type': 'section', 'text': {'type': 'mrkdwn', 'text': '*Bold heading*'}},
    {'type': 'section', 'text': {'type': 'mrkdwn', 'text': 'Line 1\nLine 2\nLine 3'}},
    {'type': 'section', 'text': {'type': 'mrkdwn', 'text': '1. First item\n2. Second item'}}
]
print(json.dumps(blocks))
")
slack-api.sh chat.postMessage channel=CHANNEL_ID blocks="$BLOCKS" text="Fallback text"

The text parameter serves as fallback for notifications and clients that cannot render blocks. Always include it with a plain-text summary.

Each block text field has a 3000-character limit. For longer messages, split across multiple section blocks.

Edit a message

slack-api.sh chat.update channel=CHANNEL_ID ts=MESSAGE_TS text="Updated text"

Delete a message

slack-api.sh chat.delete channel=CHANNEL_ID ts=MESSAGE_TS

Add a reaction

slack-api.sh reactions.add channel=CHANNEL_ID timestamp=MESSAGE_TS name=thumbsup

Emoji name without colons. Supports skin tones: thumbsup::skin-tone-3.

Remove a reaction

slack-api.sh reactions.remove channel=CHANNEL_ID timestamp=MESSAGE_TS name=thumbsup

Pin a message

slack-api.sh pins.add channel=CHANNEL_ID timestamp=MESSAGE_TS

Unpin a message

slack-api.sh pins.remove channel=CHANNEL_ID timestamp=MESSAGE_TS

Image and File Handling

Messages may contain files. In token mode:

source ~/.agents/config/slack/tokens.env
curl -s "FILE_URL_PRIVATE" \
  -H "Authorization: Bearer ${SLACK_XOXC}" \
  -H "Cookie: d=${SLACK_XOXD}" \
  -o /tmp/slack-image-N.png

In browser mode, navigate to the file URL and screenshot:

node {SKILL_DIR}/scripts/playwright-bridge.js --function interact --session $SESSION_ID \
  --input '{"action": "goto", "url": "FILE_URL_PRIVATE"}'
node {SKILL_DIR}/scripts/playwright-bridge.js --function screenshot --session $SESSION_ID --input '{}'

Then use the Read tool to view the downloaded image.

Output Formatting

  1. Parse JSON with python3 -c "import sys,json;..."
  2. Resolve user IDs (U...) to real names via users.info (cache lookups)
  3. Present messages with timestamps and names
  4. Replace <@U...> mentions with resolved real names
  5. Decode Slack markup (entities, link syntax, channel references) to plain text

Rate Limiting

  • Add sleep 1 between consecutive API calls
  • Never bulk-paginate large datasets (users.list), it kills the session
  • Prefer targeted queries over bulk fetches
  • Browser mode has additional latency per call; batch where possible

Token Refresh (Token Mode, Automatic)

Token refresh is fully automatic. The API wrapper:

  1. Auto-refreshes if ~/.agents/config/slack/tokens.env is missing
  2. Auto-refreshes on invalid_auth errors and retries the call

Tokens are extracted from the running Chrome browser:

  • xoxc: from Slack's localStorage via AppleScript
  • xoxd: from Chrome's cookie database via lsof + pycookiecheat

Setup

Token Mode (macOS)

  1. Open Chrome with Slack at app.slack.com
  2. Enable Chrome > View > Developer > Allow JavaScript from Apple Events
  3. Install uv: brew install uv
  4. Set mode (optional, auto-detect works by default): echo 'SLACK_MODE=token' > ~/.agents/config/slack/config.env

Browser Mode (Cross-Platform)

  1. Install Node.js 18+ from https://nodejs.org
  2. Set mode and start a session: echo 'SLACK_MODE=browser' > ~/.agents/config/slack/config.env {SKILL_DIR}/scripts/slack-browser-session.sh login-manual Playwright and Chromium install automatically on first use.

Auto-detect (Default)

No configuration needed. The skill checks for an active browser session first and makes the API call via Playwright. If the browser call returns an auth error (invalid_auth, not_authed, or no_teams_found), it automatically falls back to token mode. This provides seamless recovery when a browser session expires.

Full API Reference

For additional methods (bookmarks, user groups, reminders, emoji, files, user profiles, etc.), see references/api-methods.md.

Error Handling

  • not_in_channel: User does not have access to this channel
  • channel_not_found: Invalid channel ID
  • invalid_auth: Token expired, auto-refresh attempted (token mode)
  • ratelimited: Wait and retry with sleep 5
  • cant_update_message / cant_delete_message: Can only modify own messages
  • no_browser_session: No active browser session; run slack-browser-session.sh start
  • node_not_found: Node.js not installed; install from https://nodejs.org
  • no_teams_found: Slack has not loaded workspace data in browser; wait and retry
  • Automatic fallback: In auto mode, if the browser call returns invalid_auth, not_authed, or no_teams_found, the skill automatically retries via token mode. No manual intervention needed.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.55%
按下载量换算66

Claude

29.93%
按下载量换算57

Cursor

17.68%
按下载量换算34

Gemini CLI

8.13%
按下载量换算16

安全审计

Gen Agent Trust Hub

未通过

Socket

可疑

Snyk

未通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills