PollyHub

Slack Messaging

Clean

Read, send, search, and manage Slack messages using the user's Slack account. Use when the user wants to read channel messages or DMs, send a message to a channel or person, search Slack for a topic or keyword, post an update to a channel, list channels, or get recent DMs. Keywords: slack, channel, DM, direct message, post, message, send slack, search slack.

SKILL.md

---
name: slack-messaging
description: "Read, send, search, and manage Slack messages using the user's Slack account. Use when the user wants to read channel messages or DMs, send a message to a channel or person, search Slack for a topic or keyword, post an update to a channel, list channels, or get recent DMs. Keywords: slack, channel, DM, direct message, post, message, send slack, search slack."
metadata:
  openclaw:
    primaryEnv: SLACK_USER_TOKEN
    requires:
      env:
        - SLACK_USER_TOKEN
---

# Slack Messaging

Interact with Slack on behalf of the user via the Slack Web API using their user token.

## First-Time Setup

If the user does not have a token yet, read `references/setup.md` and walk them through it step by step.

## Auth & Security

- Token is stored in `~/.bashrc` as `SLACK_USER_TOKEN` — **never pass it on the command line**
- Always invoke via: `bash -c 'source ~/.bashrc && python3 scripts/slack.py <cmd>'`
- **Never** hardcode or print the token in any command, log, or output
- **Never** pass the token as a CLI argument or environment variable inline in the command string
- The token grants full user-level Slack access — treat it as a password

## Workflows

### Read channel messages
1. Resolve channel name → ID via `conversations.list`
2. Fetch messages via `conversations.history`
3. Resolve user IDs → names via `users.info` as needed
4. Summarize or display messages

### Send a message
- To a channel: `chat.postMessage` with `channel=<channel_id>`
- To a user (DM): open DM first via `im.open`, then `chat.postMessage`

### Search messages
- Use `search.messages` with a query string
- Returns matches across all channels the user has access to

### Get DMs
1. List DM channels via `conversations.list?types=im`
2. Resolve user IDs to names via `users.info`
3. Fetch messages via `conversations.history`

### List channels
- `conversations.list?types=public_channel,private_channel`
- Filter by name if the user specifies one

## Invocation Pattern

Always use this pattern — never inline the token:

```bash
bash -c 'source ~/.bashrc && python3 /home/polly/skills/user/slack-messaging/scripts/slack.py <command> [args]'
```

Examples:
```bash
bash -c 'source ~/.bashrc && python3 .../slack.py test'
bash -c 'source ~/.bashrc && python3 .../slack.py list-channels'
bash -c 'source ~/.bashrc && python3 .../slack.py history general 20'
bash -c 'source ~/.bashrc && python3 .../slack.py send general "Hello!"'
bash -c 'source ~/.bashrc && python3 .../slack.py search "deployment"'
bash -c 'source ~/.bashrc && python3 .../slack.py dm "John Smith"'
```

## Rules
- Always source `~/.bashrc` before running any Slack command
- Always resolve channel/user IDs before making history or message calls
- Use `cursor`-based pagination for large result sets
- On error, check `ok` field and surface the `error` string to the user
- Never log, echo, or expose the token value in any output
Authorhxie
Downloads3
Versions1
Published15d ago

Version History

v1.0.0latest

Initial release

Mar 26, 2026

Clean.zip

SHA-256 (latest)

45852d9e95cbf5a657f52b1a239049cfff782a023a38a62fffb1e03852fd0d5a