Communitygithub.com

Slack Automation(vercel-labs/slack)

ブラウザ自動操作を使ってSlackワークスペースと対話します。未読チャンネルの確認、Slack内の移動、メッセージ送信、データ抽出、情報検索、会話の検索、その他あらゆるSlackタスクの自動化が必要なときに使用します。

slack) とは?

このスキルは、ブラウザ自動操作ツール(agent-browser)を介してSlackワークスペースと対話するためのものです。Slack APIを必要とせず、既存のブラウザセッションに接続するか、https://app.slack.com を開くだけで利用できます。主な機能には、未読メッセージのチェック、チャンネルへの移動、メッセージやスレッドの検索、チャンネル情報の抽出、スクリーンショットやアクセシビリティツリーを利用したデータ取得が含まれます。開発者やAIエージェントにとって、Slackの操作をスクリプト化し、情報収集やタスク自動化を効率的に行える点が有用です。対応プラットフォームは主にWeb版Slack(app.slack.com)で、agent-browserコマンドを用いてCLIベースで操作します。スキルは、接続/ナビゲート→スナップショット(要素リファレンス取得)→クリック/入力→データ抽出→スクリーンショットのワークフローに従い、Slackのサイドバー構造やタブを理解しながら操作を進めます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/vercel-labs/agent-browser/tree/main/skill-data/slack

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Slack Automation (Slack自動化)

Slackワークスペースと対話して、メッセージの確認、データの抽出、一般的なタスクの自動化を行います。

クイックスタート

既存のSlackブラウザセッションに接続するか、Slackを開きます。

# 既存セッションに接続(ポート9222、通常は既に開いているSlack)
agent-browser connect 9222

# またはSlackがまだ起動していない場合
agent-browser open https://app.slack.com

続いてスナップショットを取得し、何が利用可能か確認します。

agent-browser snapshot -i

コアワークフロー

  1. 接続/ナビゲート: Slackを開くか接続する
  2. スナップショット: リファレンス(@e1、@e2など)と共にインタラクティブ要素を取得
  3. ナビゲート: タブをクリック、セクションを展開、または特定のチャンネルに移動
  4. 抽出/操作: データを読み取るかアクションを実行
  5. スクリーンショット: 発見事項の証拠をキャプチャ
# 例: 未読チャンネルを確認
agent-browser connect 9222
agent-browser snapshot -i
# 「More unreads」ボタンを探す
agent-browser click @e21  # 「More unreads」ボタンのリファレンス
agent-browser screenshot slack-unreads.png

一般的なタスク

未読メッセージの確認

# Slackに接続
agent-browser connect 9222

# スナップショットを取得して未読ボタンの位置を特定
agent-browser snapshot -i

# 以下の要素を探す:
# - 「More unreads」ボタン(通常サイドバーの上部付近)
# - Activityタブの「Unreads」トグル(未読数を表示)
# - 未読を示すバッジや太字テキストのあるチャンネル名

# Activityタブに移動して未読を一覧表示
agent-browser click @e14  # Activityタブ(リファレンスは変わる可能性あり)
agent-browser wait 1000
agent-browser screenshot activity-unreads.png

# またはDMタブを確認
agent-browser click @e13  # DMタブ
agent-browser screenshot dms.png

# またはサイドバーの「More unreads」を展開
agent-browser click @e21  # More unreadsボタン
agent-browser wait 500
agent-browser screenshot expanded-unreads.png

チャンネルへの移動

# サイドバー内でチャンネルを検索、または名前で検索
agent-browser snapshot -i

# リスト内のチャンネル名を探す(例: "engineering", "product-design")
# チャンネルのtreeitemリファレンスをクリック
agent-browser click @e94  # 例: engineeringチャンネルのリファレンス
# クリックしたチャンネル名(ここではengineering)を置き換えることで、
# 古いチャンネルヘッダーでは待機条件を満たせず、新しいチャンネルがレンダリングされるのを待つ。
agent-browser wait --fn "document.querySelector('[data-qa=\"channel_header\"]')?.innerText.includes('engineering')"
agent-browser screenshot channel.png

メッセージ/スレッドの検索

# Slack検索を使用
agent-browser snapshot -i
agent-browser click @e5  # 検索ボタン(一般的なリファレンス)
agent-browser fill @e_search "keyword"
agent-browser press Enter
# 送信したクエリと一致させることで、古いルートが再利用されるのを防ぐ。
agent-browser wait --fn "location.pathname.includes('/search') && new URL(location.href).searchParams.get('q') === 'keyword'"
agent-browser screenshot search-results.png

チャンネル情報の抽出

# 表示されているすべてのチャンネルを取得
agent-browser snapshot --json > slack-snapshot.json

# チャンネル名とメタデータを解析
# レベル=2のtreeitem要素(セクション下のサブチャンネル)を探す

チャンネル詳細の確認

# チャンネルを開く
agent-browser click @e_channel_ref
agent-browser wait 1000

# チャンネル情報を取得(メンバー、説明など)
agent-browser snapshot -i
agent-browser screenshot channel-details.png

# メッセージをスクロール
agent-browser scroll down 500
agent-browser screenshot channel-messages.png

メモ/状態のキャプチャ

Slackからの発見事項を文書化する必要がある場合:

# 注釈付きスクリーンショット(要素番号を表示)
agent-browser screenshot --annotate slack-state.png

# フルページスクリーンショット
agent-browser screenshot --full slack-full.png

# 現在のURLを参照用に取得
agent-browser get url

# ページタイトルを取得
agent-browser get title

サイドバーの構造

Slackのサイドバーを理解すると効率的にナビゲートできます。

- スレッド
- ハドル
- 下書きと送信済み
- ディレクトリ
- [セクションヘッダー - 外部接続、スター付き、チャンネルなど]
  - [チャンネルがtreeitemとしてリスト]
- ダイレクトメッセージ
  - [DMがリスト]
- アプリ
  - [アプリのショートカット]
- [More unreads] ボタン(未読チャンネルリストの表示/非表示を切り替え)

よく見つかるリファレンス:

  • @e12 - Homeタブ(通常)
  • @e13 - DMタブ
  • @e14 - Activityタブ
  • @e5 - 検索ボタン
  • @e21 - More unreadsボタン(セッションにより異なる)

Slackのタブ

チャンネルをクリックすると、以下のタブが表示されます:

  • Messages - チャンネルの会話
  • Files - 共有ファイル
  • Pins - ピン留めされたメッセージ
  • Add canvas - コラボレーションキャンバス
  • その他のタブ(ワークスペース設定による)

タブのリファレンスをクリックしてビューを切り替え、異なる情報を取得します。

Slackからのデータ抽出

テキストコンテンツの取得

# メッセージまたは要素のテキストを取得
agent-browser get text @e_message_ref

アクセシビリティツリーの解析

# プログラムで解析するためのJSON形式のフルスナップショット
agent-browser snapshot --json > output.json

# 以下の情報を探す:
# - チャンネル名(treeitemのnameフィールド)
# - メッセージ内容(listitem/document要素内)
# - ユーザー名(ユーザー情報を含むbutton要素)
# - タイムスタンプ(時刻情報を含むlink要素)

未読数のカウント

# unreadsセクションを展開した後:
agent-browser snapshot -i | grep -c "treeitem"
# unreadsセクション内のチャンネル名を持つ各treeitemが1つの未読を示す

ベストプラクティス

  • 既存セッションに接続する: Slackが既に開いている場合は agent-browser connect 9222 を使用します。新しいブラウザを開くより高速です。
  • クリック前にスナップショットを取得する: ボタンをクリックする前に必ず snapshot -i でリファレンスを特定してください。
  • ナビゲーション後に再スナップショット: 新しいチャンネルやセクションに移動した後、新しいリファレンスを見つけるために新しいスナップショットを取得してください。
  • 解析用にJSONスナップショットを使用する: 構造化データを抽出する必要がある場合は、機械可読な出力として snapshot --json を使用してください。
  • 操作の間隔を空ける: 高速な操作の合間に sleep 1 を追加してUIの更新を待ちます。
  • アクセシビリティツリーを確認する: アクセシビリティツリーは、スクリーンリーダー(および自動化ツール)が何を見られるかを示します。要素がスナップショットにない場合、非表示かスクロールが必要かもしれません。
  • サイドバー内でスクロールする: チャンネルリストが長い場合は agent-browser scroll down 300 --selector ".p-sidebar" を使用してSlackサイドバー内でスクロールします。

制限事項

  • Slack APIにはアクセスできません: これはブラウザ自動化を使用しており、Slack APIは使いません。OAuth、Webhook、ボットトークンは不要です。
  • セッション固有: スクリーンショットとスナップショットは現在のブラウザセッションに紐づいています。
  • レート制限: Slackは高速な操作に対してレート制限をかける可能性があります。必要に応じてコマンド間に遅延を追加してください。
  • ワークスペース固有: 自分のワークスペースとのみ対話します。クロスワークスペースの自動化はできません。

デバッグ

コンソールでエラーを確認

agent-browser console
agent-browser errors

現在のページ状態を取得

agent-browser get url
agent-browser get title
agent-browser screenshot page-state.png

例: 完全な未読チェック

#!/bin/bash

# Slackに接続
agent-browser connect 9222

# 最初のスナップショットを取得
echo "=== Slack未読をチェック ==="
agent-browser snapshot -i > snapshot.txt

# Activityタブで未読を確認
agent-browser click @e14  # Activityタブ
agent-browser wait 1000
agent-browser screenshot activity.png
ACTIVITY_RESULT=$(agent-browser get text @e_main_area)
echo "Activity: $ACTIVITY_RESULT"

# DMをチェック
agent-browser click @e13  # DMタブ
agent-browser wait 1000
agent-browser screenshot dms.png

# サイドバーの未読チャンネルをチェック
agent-browser click @e21  # More unreadsボタン
agent-browser wait 500
agent-browser snapshot -i > unreads-expanded.txt
agent-browser screenshot unreads.png

# サマリー
echo "=== サマリー ==="
echo "詳細は activity.png、dms.png、unreads.png を参照"

参考文献

  • Slack ドキュメント: https://slack.com/help
  • Web エクスペリエンス: https://app.slack.com
  • キーボードショートカット: Slack内で ? を入力するとショートカット一覧が表示されます

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

agent-browser

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to

vercel-labs/agentcore

Run agent-browser on AWS Bedrock AgentCore cloud browsers. Use when the user wants to use AgentCore, run browser automation on AWS, use a cloud browser with AWS credentials, or needs a managed browser session backed by AWS infrastructure. Triggers include "use agentcore", "run on AWS", "cloud browser with AWS", "bedrock browser", "agentcore session", or any task requiring AWS-hosted browser automation.

vercel-labs/derive-client

Reverse-engineer a website's internal API by recording browser traffic into a HAR file, then generate a standalone client or CLI that calls the endpoints directly, with no browser needed after the first recording. Use when asked to "derive a client", "build a CLI for <site>", "reverse engineer this site's API", "record network requests", "turn this site into an API", or when the same site will be automated repeatedly and direct HTTP calls would beat driving the browser every time.

vercel-labs/dogfood

Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to "dogfood", "QA", "exploratory test", "find issues", "bug hunt", "test this app/site/platform", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.

vercel-labs/electron

Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include "automate Slack app", "control VS Code", "interact with Discord app", "test this Electron app", "connect to desktop app", or any task requiring automation of a native Electron application.

vercel-labs/protected-vercel-deployments

Access and test Vercel deployments protected by Vercel Authentication, SSO, or Deployment Protection with agent-browser. Use when a preview or production URL redirects to a Vercel login page, returns a protection 401 or 403, or needs short-lived Trusted Sources OIDC authentication instead of a static bypass secret or public exception.

vercel-labs/vercel-sandbox

Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include "Vercel Sandbox browser", "microVM Chrome", "agent-browser in sandbox", "browser automation on Vercel", or any task requiring Chrome in a Vercel Sandbox.

vercel-labs/webmcp-gen

Build and validate experimental WebMCP tools for an existing web page. Use when an agent needs to expose a site's real workflows as page tools, create webmcp.init.js, define deterministic checks, or compare WebMCP with accessibility-tree automation.

関連スキル