| name | slack |
| description | 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. |
| allowed-tools | Bash(agent-browser:*), Bash(npx agent-browser:*) |
Slack Automation
Interact with Slack workspaces to check messages, extract data, and automate common tasks.
Quick Start
Connect to an existing Slack browser session or open Slack:
agent-browser connect 9222
agent-browser open https://app.slack.com
Then take a snapshot to see what's available:
agent-browser snapshot -i
Core Workflow
- Connect/Navigate: Open or connect to Slack
- Snapshot: Get interactive elements with refs (
@e1, @e2, etc.)
- Navigate: Click tabs, expand sections, or navigate to specific channels
- Extract/Interact: Read data or perform actions
- Screenshot: Capture evidence of findings
agent-browser connect 9222
agent-browser snapshot -i
agent-browser click @e21
agent-browser screenshot slack-unreads.png
Common Tasks
Checking Unread Messages
agent-browser connect 9222
agent-browser snapshot -i
agent-browser click @e14
agent-browser wait 1000
agent-browser screenshot activity-unreads.png
agent-browser click @e13
agent-browser screenshot dms.png
agent-browser click @e21
agent-browser wait 500
agent-browser screenshot expanded-unreads.png
Navigating to a Channel
agent-browser snapshot -i
agent-browser click @e94
agent-browser wait --load networkidle
agent-browser screenshot channel.png
Finding Messages/Threads
agent-browser snapshot -i
agent-browser click @e5
agent-browser fill @e_search "keyword"
agent-browser press Enter
agent-browser wait --load networkidle
agent-browser screenshot search-results.png
Extracting Channel Information
agent-browser snapshot --json > slack-snapshot.json
Checking Channel Details
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
Taking Notes/Capturing State
When you need to document findings from Slack:
agent-browser screenshot --annotate slack-state.png
agent-browser screenshot --full slack-full.png
agent-browser get url
agent-browser get title
Sidebar Structure
Understanding Slack's sidebar helps you navigate efficiently:
- Threads
- Huddles
- Drafts & sent
- Directories
- [Section Headers - External connections, Starred, Channels, etc.]
- [Channels listed as treeitems]
- Direct Messages
- [DMs listed]
- Apps
- [App shortcuts]
- [More unreads] button (toggles unread channels list)
Key refs to look for:
@e12 - Home tab (usually)
@e13 - DMs tab
@e14 - Activity tab
@e5 - Search button
@e21 - More unreads button (varies by session)
Tabs in Slack
After clicking on a channel, you'll see tabs:
- Messages - Channel conversation
- Files - Shared files
- Pins - Pinned messages
- Add canvas - Collaborative canvas
- Other tabs depending on workspace setup
Click tab refs to switch views and get different information.
Extracting Data from Slack
Get Text Content
agent-browser get text @e_message_ref
Parse Accessibility Tree
agent-browser snapshot --json > output.json
Count Unreads
agent-browser snapshot -i | grep -c "treeitem"
Best Practices
- Connect to existing sessions: Use
agent-browser connect 9222 if Slack is already open. This is faster than opening a new browser.
- Take snapshots before clicking: Always
snapshot -i to identify refs before clicking buttons.
- Re-snapshot after navigation: After navigating to a new channel or section, take a fresh snapshot to find new refs.
- Use JSON snapshots for parsing: When you need to extract structured data, use
snapshot --json for machine-readable output.
- Pace interactions: Add
sleep 1 between rapid interactions to let the UI update.
- 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.
- Scroll in sidebar: Use
agent-browser scroll down 300 --selector ".p-sidebar" to scroll within the Slack sidebar if channel list is long.
Limitations
- Cannot access Slack API: This uses browser automation, not the Slack API. No OAuth, webhooks, or bot tokens needed.
- Session-specific: Screenshots and snapshots are tied to the current browser session.
- Rate limiting: Slack may rate-limit rapid interactions. Add delays between commands if needed.
- Workspace-specific: You interact with your own workspace -- no cross-workspace automation.
Debugging
Check console for errors
agent-browser console
agent-browser errors
Get current page state
agent-browser get url
agent-browser get title
agent-browser screenshot page-state.png
Example: Full Unread Check
#!/bin/bash
agent-browser connect 9222
echo "=== Checking Slack unreads ==="
agent-browser snapshot -i > snapshot.txt
agent-browser click @e14
agent-browser wait 1000
agent-browser screenshot activity.png
ACTIVITY_RESULT=$(agent-browser get text @e_main_area)
echo "Activity: $ACTIVITY_RESULT"
agent-browser click @e13
agent-browser wait 1000
agent-browser screenshot dms.png
agent-browser click @e21
agent-browser wait 500
agent-browser snapshot -i > unreads-expanded.txt
agent-browser screenshot unreads.png
echo "=== Summary ==="
echo "See activity.png, dms.png, and unreads.png for full details"
References