← Blog

Slack AI Agent: Set Up a Self-Hosted Bot With POLYROB

Slack AI Agent: Set Up a Self-Hosted Bot With POLYROB

A Slack AI agent is an AI assistant that lives in your Slack workspace and answers in direct messages, channels and threads. POLYROB runs as one on your own machine: you start polyrob slack, it connects out to Slack over Socket Mode, and it needs no public URL.

This page covers what the Slack connection does, how to set it up, who can talk to it, and where it is still thin. Every POLYROB claim comes from the public repository at release v1.7.8, and the files are listed at the end.

What is a Slack AI agent?

Gumloop’s guide, checked on 2026-11-12, describes a Slack AI agent as a Slackbot that works like an employee inside your Slack channels and acts on your behalf (Gumloop, Slack AI agents).

The question that decides everything else is where the agent runs. Some Slack agents are products hosted by a vendor and installed into your workspace. POLYROB is the other kind: a self-hosted agent that you run yourself, and Slack is one of the places it talks to you. The same agent also answers in the terminal and the web console, so the conversation does not belong to one app. If you want the wider picture of what self-hosting involves, read the guide to a self-hosted AI agent.

How does POLYROB connect to Slack?

It uses Socket Mode. The client calls Slack’s apps.connections.open to get a WebSocket address and listens on it, so Slack never has to reach your machine. Slack’s own documentation contrasts that WebSocket URL with a public HTTP endpoint (Slack, Using Socket Mode, fetched 2026-11-12). For a laptop, a home server or a small VPS behind a firewall, that is the practical difference.

What do you need before you start?

Two tokens from a Slack app you create at api.slack.com/apps:

Socket Mode and the Events API message events must be switched on in the Slack app settings. If either token is missing, polyrob slack refuses to start and says so. The reaction feature below also needs the reactions:write scope.

How do you start it?

Install POLYROB, put both tokens in the environment, and run the command.

curl -fsSL https://polyrob.dev/install.sh | bash
export SLACK_BOT_TOKEN=xoxb-your-bot-token
export SLACK_APP_TOKEN=xapp-your-app-token
polyrob slack

You can pass --bot-token and --app-token instead of the environment variables. When it connects it prints slack bot online. If you already run other chat apps, polyrob gateway starts every enabled surface in one process, and a surface with missing credentials is skipped.

How does it behave in DMs, channels and threads?

The Slack code turns each event into a message with a chat type.

Messages from other bots, edits, joins and other message subtypes are ignored, except a message that shares a file.

What does the agent send back?

Replies are plain text. The Slack surface sets markdown_flavor="none" and posts with mrkdwn off, so you will not see bold or headings render. A reply longer than 4,000 characters is split into several messages. The agent can also send files: it uploads them with Slack’s external-upload flow, after the text.

While the agent works on a message addressed to it, it adds an eyes reaction. When the turn ends, the reaction is removed, and if the turn failed it adds an x. Slack gives a bot no typing indicator, so the reaction is the only signal that the message was seen. A room line that does not mention the bot gets no reaction, because that would suggest the agent reads and answers all room chatter.

Who can talk to it?

A chat surface starts locked. On Slack the owner is an id you configure: set OWNER_SLACK_ID to your Slack member id, which starts with U or W, and a message from that id is treated as the owner.

polyrob config set OWNER_SLACK_ID U01234ABCDE

The same id is where the agent sends owner notices, such as approvals and reports, when OWNER_SURFACE lists slack. If you want the agent to answer people other than you, pairing is the control: a paired sender gets their own memory and work, and never reaches your wallet, approvals, owner commands or your memory. See the AI agent security guide for the model behind those limits.

Rooms have their own gate. Group chat is off by default (GROUP_CHAT_ENABLED), a room must be allowed explicitly, and the default mode answers only when the agent is mentioned.

Does it stay connected?

Socket Mode asks the client to acknowledge every event envelope, or Slack sends it again. POLYROB acknowledges first and handles the message afterwards, in its own task, so a slow agent turn does not delay the next acknowledgement. Slack rotates connections now and then; when it sends a disconnect, the client reconnects. After an error it waits and retries with a backoff that doubles up to 60 seconds. A deduplication store (slack_dedup.db) drops a message that arrives twice.

Where does the Slack surface fall short?

Four limits matter before you rely on it.

  1. Live validation is pending. The repository’s migration guide marks Slack as built, with “live-account validation pending”. Test it in a workspace you control first.
  2. Rooms have no history on Slack. The room ledger reads a Telegram message id, so a Slack room records no lines and the agent answers each line without the earlier conversation. Allowlists, roles, modes and caps still work.
  3. Replies are plain text, as above.
  4. One process serves one pair of tokens. The command takes one bot token and one app token, so several workspaces mean several processes.

Can the same agent run in other chat apps?

Yes. POLYROB has eight chat surfaces: Telegram, email, WhatsApp, Discord, Slack, Signal, Feishu/Lark and DingTalk. Counts differ by project, so check the numbers in the comparison page (dated 2026-10-27) if you are choosing between agents on channel count. The full list of what the agent can do sits on the capabilities page, and the personal AI agent guide shows how the pieces fit for one person. The Discord AI agent guide covers the server case.

Slack AI agent questions

Do I need a public URL or a server with open ports?

No. Socket Mode makes the connection from your side, outward. The command’s own description says no public URL is needed.

Which Slack tokens does POLYROB need?

Both: a bot token (xoxb-) and an app-level token (xapp-). The environment variables are SLACK_BOT_TOKEN and SLACK_APP_TOKEN. Without both, polyrob slack will not start.

Can the agent reply inside a thread?

Yes. A message in a thread is answered in that thread.

Does it cost anything?

The engine is MIT licensed, and you pay your model provider, or nothing with a local model. Slack’s own plan terms are Slack’s.

Where do you start?

Create the Slack app, run the commands above, send the agent a DM, and set OWNER_SLACK_ID once you see it answer. Then try a channel mention.

Install POLYROB, read the docs, or browse the open-source code. It is MIT licensed.

Sources

All POLYROB facts are from the public repository at release v1.7.8 (github.com/theselfruleorg/polyrob).


POLYROB is an open-source AI agent you run and own. Install it or read the docs.