Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Automate Slack via browser automation to check unreads, navigate channels, send messages, and extract conversation data.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: slack3description: Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include "check my Slack", "what channels have unreads", "send a message to", "search Slack for", "extract from Slack", "find who said", or any task requiring programmatic Slack interaction.4allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*)5---67# Slack Automation89Interact with Slack workspaces to check messages, extract data, and automate common tasks.1011## Quick Start1213Connect to an existing Slack browser session or open Slack:1415```bash16# Connect to existing session on port 9222 (typical for already-open Slack)17agent-browser connect 92221819# Or open Slack if not already running20agent-browser open https://app.slack.com21```2223Then take a snapshot to see what's available:2425```bash26agent-browser snapshot -i27```2829## Core Workflow30311. **Connect/Navigate**: Open or connect to Slack322. **Snapshot**: Get interactive elements with refs (`@e1`, `@e2`, etc.)333. **Navigate**: Click tabs, expand sections, or navigate to specific channels344. **Extract/Interact**: Read data or perform actions355. **Screenshot**: Capture evidence of findings3637```bash38# Example: Check unread channels39agent-browser connect 922240agent-browser snapshot -i41# Look for "More unreads" button42agent-browser click @e21 # Ref for "More unreads" button43agent-browser screenshot slack-unreads.png44```4546## Common Tasks4748### Checking Unread Messages4950```bash51# Connect to Slack52agent-browser connect 92225354# Take snapshot to locate unreads button55agent-browser snapshot -i5657# Look for:58# - "More unreads" button (usually near top of sidebar)59# - "Unreads" toggle in Activity tab (shows unread count)60# - Channel names with badges/bold text indicating unreads6162# Navigate to Activity tab to see all unreads in one view63agent-browser click @e14 # Activity tab (ref may vary)64agent-browser wait 100065agent-browser screenshot activity-unreads.png6667# Or check DMs tab68agent-browser click @e13 # DMs tab69agent-browser screenshot dms.png7071# Or expand "More unreads" in sidebar72agent-browser click @e21 # More unreads button73agent-browser wait 50074agent-browser screenshot expanded-unreads.png75```7677### Navigating to a Channel7879```bash80# Search for channel in sidebar or by name81agent-browser snapshot -i8283# Look for channel name in the list (e.g., "engineering", "product-design")84# Click on the channel treeitem ref85agent-browser click @e94 # Example: engineering channel ref86agent-browser wait --load networkidle87agent-browser screenshot channel.png88```8990### Finding Messages/Threads9192```bash93# Use Slack search94agent-browser snapshot -i95agent-browser click @e5 # Search button (typical ref)96agent-browser fill @e_search "keyword"97agent-browser press Enter98agent-browser wait --load networkidle99agent-browser screenshot search-results.png100```101102### Extracting Channel Information103104```bash105# Get list of all visible channels106agent-browser snapshot --json > slack-snapshot.json107108# Parse for channel names and metadata109# Look for treeitem elements with level=2 (sub-channels under sections)110```111112### Checking Channel Details113114```bash115# Open a channel116agent-browser click @e_channel_ref117agent-browser wait 1000118119# Get channel info (members, description, etc.)120agent-browser snapshot -i121agent-browser screenshot channel-details.png122123# Scroll through messages124agent-browser scroll down 500125agent-browser screenshot channel-messages.png126```127128### Taking Notes/Capturing State129130When you need to document findings from Slack:131132```bash133# Take annotated screenshot (shows element numbers)134agent-browser screenshot --annotate slack-state.png135136# Take full-page screenshot137agent-browser screenshot --full slack-full.png138139# Get current URL for reference140agent-browser get url141142# Get page title143agent-browser get title144```145146## Sidebar Structure147148Understanding Slack's sidebar helps you navigate efficiently:149150```151- Threads152- Huddles153- Drafts & sent154- Directories155- [Section Headers - External connections, Starred, Channels, etc.]156- [Channels listed as treeitems]157- Direct Messages158- [DMs listed]159- Apps160- [App shortcuts]161- [More unreads] button (toggles unread channels list)162```163164Key refs to look for:165- `@e12` - Home tab (usually)166- `@e13` - DMs tab167- `@e14` - Activity tab168- `@e5` - Search button169- `@e21` - More unreads button (varies by session)170171## Tabs in Slack172173After clicking on a channel, you'll see tabs:174- **Messages** - Channel conversation175- **Files** - Shared files176- **Pins** - Pinned messages177- **Add canvas** - Collaborative canvas178- Other tabs depending on workspace setup179180Click tab refs to switch views and get different information.181182## Extracting Data from Slack183184### Get Text Content185186```bash187# Get a message or element's text188agent-browser get text @e_message_ref189```190191### Parse Accessibility Tree192193```bash194# Full snapshot as JSON for programmatic parsing195agent-browser snapshot --json > output.json196197# Look for:198# - Channel names (name field in treeitem)199# - Message content (in listitem/document elements)200# - User names (button elements with user info)201# - Timestamps (link elements with time info)202```203204### Count Unreads205206```bash207# After expanding unreads section:208agent-browser snapshot -i | grep -c "treeitem"209# Each treeitem with a channel name in the unreads section is one unread210```211212## Best Practices213214- **Connect to existing sessions**: Use `agent-browser connect 9222` if Slack is already open. This is faster than opening a new browser.215- **Take snapshots before clicking**: Always `snapshot -i` to identify refs before clicking buttons.216- **Re-snapshot after navigation**: After navigating to a new channel or section, take a fresh snapshot to find new refs.217- **Use JSON snapshots for parsing**: When you need to extract structured data, use `snapshot --json` for machine-readable output.218- **Pace interactions**: Add `sleep 1` between rapid interactions to let the UI update.219- **Check accessibility tree**: The accessibility tree shows what screen readers (and your automation) can see. If an element isn't in the snapshot, it may be hidden or require scrolling.220- **Scroll in sidebar**: Use `agent-browser scroll down 300 --selector ".p-sidebar"` to scroll within the Slack sidebar if channel list is long.221222## Limitations223224- **Cannot access Slack API**: This uses browser automation, not the Slack API. No OAuth, webhooks, or bot tokens needed.225- **Session-specific**: Screenshots and snapshots are tied to the current browser session.226- **Rate limiting**: Slack may rate-limit rapid interactions. Add delays between commands if needed.227- **Workspace-specific**: You interact with your own workspace -- no cross-workspace automation.228229## Debugging230231### Check console for errors232233```bash234agent-browser console235agent-browser errors236```237238### Get current page state239240```bash241agent-browser get url242agent-browser get title243agent-browser screenshot page-state.png244```245246## Example: Full Unread Check247248```bash249#!/bin/bash250251# Connect to Slack252agent-browser connect 9222253254# Take initial snapshot255echo "=== Checking Slack unreads ==="256agent-browser snapshot -i > snapshot.txt257258# Check Activity tab for unreads259agent-browser click @e14 # Activity tab260agent-browser wait 1000261agent-browser screenshot activity.png262ACTIVITY_RESULT=$(agent-browser get text @e_main_area)263echo "Activity: $ACTIVITY_RESULT"264265# Check DMs266agent-browser click @e13 # DMs tab267agent-browser wait 1000268agent-browser screenshot dms.png269270# Check unread channels in sidebar271agent-browser click @e21 # More unreads button272agent-browser wait 500273agent-browser snapshot -i > unreads-expanded.txt274agent-browser screenshot unreads.png275276# Summary277echo "=== Summary ==="278echo "See activity.png, dms.png, and unreads.png for full details"279```280281## References282283- **Slack docs**: https://slack.com/help284- **Web experience**: https://app.slack.com285- **Keyboard shortcuts**: Type `?` in Slack for shortcut list286