> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

> Send and read messages, list channels, and reply in threads.

# Slack

Send and read Slack messages, list channels, and reply in threads using the Slack Web API.

***

## Quick Start

```typescript theme={null}
import { Agent, openai, SlackToolkit } from "@agentium/core";

const slack = new SlackToolkit();
// Uses SLACK_BOT_TOKEN env var

const agent = new Agent({
  name: "slack-bot",
  model: openai("gpt-4o"),
  instructions: "Help manage Slack communications.",
  tools: [...slack.getTools()],
});

const result = await agent.run("Send 'Hello team!' to #general");
```

***

## Config

<ParamField body="token" type="string">
  Slack Bot User OAuth Token (`xoxb-...`). Falls back to `SLACK_BOT_TOKEN` env var.
</ParamField>

***

## Tools

| Tool                  | Description                          |
| --------------------- | ------------------------------------ |
| `slack_send_message`  | Send a message to a channel.         |
| `slack_list_channels` | List channels the bot has access to. |
| `slack_read_messages` | Read recent messages from a channel. |
| `slack_reply_thread`  | Reply to a message thread.           |

***

## Required Bot Scopes

* `chat:write` — Send messages
* `channels:read` — List public channels
* `channels:history` — Read public channel messages
* `groups:history` — Read private channel messages

***

## Environment Variables

```bash theme={null}
export SLACK_BOT_TOKEN="xoxb-..."
```

***

## Tool Usage Examples

### Send a Message

```typescript theme={null}
const result = await agent.run("Send 'Deployment complete! v2.3.1 is live.' to #deployments");

// The agent calls slack_send_message with:
// { channel: "#deployments", text: "Deployment complete! v2.3.1 is live." }
```

### Reply in Thread

```typescript theme={null}
const result = await agent.run(
  "Reply to the latest message in #support with " +
  "'Thanks for reporting this. We're looking into it now.'"
);

// The agent calls slack_read_messages to find the latest message,
// then calls slack_reply_thread with:
// {
//   channel: "#support",
//   threadTs: "1709234567.123456",
//   text: "Thanks for reporting this. We're looking into it now."
// }
```

### List Channels

```typescript theme={null}
const result = await agent.run("What channels do we have for the engineering team?");

// The agent calls slack_list_channels
// Returns: #engineering, #eng-frontend, #eng-backend, #eng-devops, #eng-standup
```

### Read Recent Messages

```typescript theme={null}
const result = await agent.run("What's been discussed in #product today?");

// The agent calls slack_read_messages with:
// { channel: "#product", limit: 20 }
// Then summarizes the conversation
```
