Slack
Send and read Slack messages, list channels, and reply in threads using the Slack Web API.
Quick Start
import { Agent, openai, SlackToolkit } from "@radaros/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
Slack Bot User OAuth Token (xoxb-...). Falls back to SLACK_BOT_TOKEN env var.
| 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
export SLACK_BOT_TOKEN="xoxb-..."
Send a Message
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
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
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
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