title: Slack and Other Chat Platforms tags: [pubsub, hermes, slack, access]
Slack and Other Chat Platforms
Cowboy reaches Slack, Telegram, Mattermost and the other platforms Hermes Agent
supports through Hermes’ own platform adapters. One bridge package hosts any
of them (pkgs/hermes/): the adapter connects to the platform, and the driver
moves messages between it and the agent’s Redis streams. Adding a platform is
configuration, not code.
The platforms available are the ones in pkgs/hermes/platforms.json, which is
generated from the packaged Hermes build.
Who may talk to the bot
A chat bot in a shared workspace is reachable by everyone in it, so access is
Hermes’ model, enforced by Hermes’ own code (pkgs/hermes/access.py) on every
inbound message:
- Deny by default. Nobody is admitted until you say who.
allowedUsersadmits the listed platform user ids. An empty list admits nobody, exactly as an unset one does.pairing = truelets anyone who DMs the bot request access. They receive a one-time code; you approve it on the host and they are admitted from then on. Codes expire after an hour and requests are rate-limited.allowAllUsers = trueadmits everyone who can reach the bot. It cannot be combined with the other two, since it makes them meaningless.
Every enabled platform must choose at least one of these; a configuration that admits nobody fails to build. Messages from people who are not admitted never reach the agent. In a DM they may be offered a pairing code; in a channel they are dropped silently.
Platform-specific filters are Hermes’ own and go in settings, for example
Slack’s require_mention (on by default: the bot answers in channels only when
mentioned, or inside a thread it is already in), allowed_channels and
free_response_channels.
A group bot should be its own agent. Each agent has its own session and memory, so what the group says never mixes with a private conversation held elsewhere.
Slack
1. Create the Slack app
At https://api.slack.com/apps, choose Create New App, then From an app
manifest, pick your workspace, and paste pkgs/hermes/slack-manifest.json.
It enables Socket Mode (no public URL is needed), the Messages tab for DMs, and
the minimum scopes: reading the conversations the bot is in, posting, looking
up display names, and adding the 👀 reaction that shows a message was seen.
Then:
- Settings → Basic Information → App-Level Tokens: generate a token with
the
connections:writescope. It starts withxapp-. - Settings → Install App: install the app to the workspace and copy the
Bot User OAuth Token. It starts with
xoxb-. - Invite the bot to each channel it should read (
/invite @cowboy).
2. Store the tokens
Put both tokens in an agenix secret, one KEY=value per line:
SLACK_BOT_TOKEN=xoxb-...
SLACK_APP_TOKEN=xapp-...
3. Configure the bridge
services.cowboy.agents.team = {
enable = true;
# ...
};
services.cowboy.pubsub.hermes.platforms.slack = {
enable = true;
env = config.age.secrets.slack-env.path;
defaultAgent = "team";
# Pick who may talk to it:
pairing = true; # people you approve by code
# allowedUsers = [ "U01ABCDEF" ]; # and/or these member ids
# allowAllUsers = true; # or everyone in the workspace
settings = {
require_mention = true;
# allowed_channels = [ "C0123" ]; # only these channels
};
};
A member id is under a person’s Slack profile: ⋮ → Copy member ID.
4. Admit people
With pairing on, someone DMs the bot and receives a code. Approve it on the
host:
sudo cowboy-pairing hermes-slack approve <code>
sudo cowboy-pairing hermes-slack list # pending and approved
sudo cowboy-pairing hermes-slack revoke <member-id>
What people see
The bot answers in a thread under the message that mentioned it, and replies to a message inside a thread land in that thread. A 👀 reaction appears when the agent has read a message, and turns into ✅ when it replies.
Limits
- Text only. Attachments and voice messages are not passed to the agent yet.
- Hermes’ slash commands (
/model,/newand so on) are not registered; the app manifest above has none. - The seen marker is added but not removed on failure; the ✅ appears when a reply is sent.