Advanced / Specialized

Slack automation

Slack's web app is just a big web app — chrome-use drives it like any other page: connect to an already-logged-in session, read an accessibility snapshot to get elements with @ref, then check unreads, jump to channels, search conversations, and extract messages. Everything runs through a real browser, never touching the Slack API, and needing no OAuth, webhooks, or bot tokens.

ℹ️ This page is just a quick tour
Below are the recipes you'll reach for most often. For the full refs conventions, edge cases, and debugging details, pull up the complete skill doc any time with skills get slack.

Quick start

chrome-use drives your already-logged-in real Chrome through the extension, so Slack's login is reused and you never open a debug port (Chrome 136+ pops "Allow remote debugging?" on every connect to one — see How It Works). Just have it open the Slack web app.

connect-or-open.sh
# Drive your logged-in real Chrome via the extension; open the Slack web app (login reused)
$ chrome-use open https://app.slack.com

# Grab an interactive snapshot to see what's on the page
$ chrome-use snapshot -i
✅ The core loop
Connect / navigate → snapshot -i to get elements with refs → click a tab, expand a group, or enter a channel → read data or run an action → screenshot when you need evidence. Re-snapshot after every navigation, because refs change as the page changes.

Check unread messages

Unreads are scattered across a few places: the "More unreads" button at the top of the sidebar, the unread roundup in the Activity tab, and channel names shown in bold / with a badge. Snapshot first to locate refs, then check them one by one.

check-unreads.sh
# Continuing on the Slack tab opened above
$ chrome-use snapshot -i

# Open the Activity tab to see the unread roundup (ref may differ each time)
$ chrome-use click @e14
$ chrome-use wait 1000
$ chrome-use screenshot activity-unreads.png

# Or expand the sidebar's "More unreads"
$ chrome-use click @e21
$ chrome-use wait 500
$ chrome-use screenshot expanded-unreads.png

To count how many unread channels there are, expand the unread group and count the treeitems:

count-unreads.sh
# After expanding unreads, each treeitem with a channel name counts as one unread
$ chrome-use snapshot -i | grep -c "treeitem"

Navigate to a channel

After snapshotting, find the channel name in the sidebar list (e.g. engineering, product-design) and click its treeitem ref. Once inside the channel, use wait --load networkidle to let the content finish loading before acting.

open-channel.sh
$ chrome-use snapshot -i

# Click the channel's treeitem (example ref — go by your own snapshot)
$ chrome-use click @e94
$ chrome-use wait --load networkidle

# Scroll down in the message area to load more history
$ chrome-use scroll down 500
$ chrome-use screenshot channel-messages.png
✅ When the sidebar is long
Channel list won't scroll? Scroll inside the sidebar container, not the whole page: chrome-use scroll down 300 --selector ".p-sidebar".

Search conversations

Using Slack's built-in search is the easiest path: click the search button, type the keyword, hit Enter, and wait for results to load.

search.sh
$ chrome-use snapshot -i
$ chrome-use click @e5          # search button
$ chrome-use fill @e_search "keyword"
$ chrome-use press Enter
$ chrome-use wait --load networkidle
$ chrome-use screenshot search-results.png

Extract data

For programmatic parsing, use a JSON snapshot to get a machine-readable accessibility tree; for a single element's text, use get text. For more systematic extraction patterns, see Extract data.

extract.sh
# Export the whole accessibility tree as JSON for easy parsing
$ chrome-use snapshot --json > slack-snapshot.json

# Get the plain text of a specific message / element
$ chrome-use get text @e_message_ref

# Current page URL and title, to keep as a reference
$ chrome-use get url
$ chrome-use get title

When parsing the JSON, watch for how these fields map:

What you wantWhere to find it in the snapshot
Channel namethe name field of a treeitem (sub-channels are level=2)
Message contentlistitem / document elements
Usernamebutton elements carrying user info
Timestamplink elements carrying time info

Common refs & sidebar structure

The Slack sidebar is roughly: Threads / Huddles / Drafts & sent / Directories, followed by group headers (Starred, Channels, etc.) with channel treeitems under them, then Direct Messages, Apps, and a "More unreads" button at the bottom. The refs below are common locations, for reference only — go by your own snapshot.

🏠 @e12 · Home

Home tab (usually).

✉️ @e13 · DMs

Direct messages tab.

🔔 @e14 · Activity

Activity tab, showing the unread count.

🔎 @e5 · Search

Search button.

📥 @e21 · More unreads

Expands the unread channel list (changes each time).

⚠️ refs drift
The @e14 and @e21 written in the docs are just typical values; they change with the session and page state. Always snapshot -i before you click — don't hard-code refs.

Debugging

This stealth fork disables console/error capture by default — to use console / errors, start the session with AGENT_BROWSER_CAPTURE_CONSOLE=1, otherwise they return empty.

debug.sh
# You must first start the session with AGENT_BROWSER_CAPTURE_CONSOLE=1
$ chrome-use console
$ chrome-use errors

# When stuck, check the current page state
$ chrome-use get url
$ chrome-use get title
$ chrome-use screenshot page-state.png

Caveats

ℹ️ Related pages
The Slack web app is also a kind of Electron desktop app — to drive the desktop client itself, see Electron desktop apps. To connect to the logged-in browser you use day to day, see Drive real Chrome. For basic actions and reading snapshots, see Interacting and Reading pages, and for waiting strategies see Waiting & asserting.