Tool

Fetch and send messages in Slack channels

Read, send, and list messages across Slack channels from a LlamaIndex agent.

Works with slackopenai

74
Spark score
out of 100
Updated 2 days ago
Version 0.14.23

Add to Favorites

Why it matters

Connect AI agents to Slack workspaces to read channel history, send messages, and manage communication workflows programmatically through the Slack API.

Outcomes

What it gets done

01

Load message history from specified Slack channels

02

Send messages to Slack channels via bot token

03

Fetch and list available channels in workspace

04

Query recent channel activity through natural language

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-tool-tools-slack | bash

Overview

Slack Tool

A LlamaIndex tool that loads messages from Slack channels, sends messages, and lists channels via a bot token. Use when an agent needs to read or post Slack channel content the bot token has access to.

What it does

The Slack Tool lets a LlamaIndex agent fetch text from a list of Slack channels, send messages, and list available channels. It is initialized with a Slack API token, either passed directly or via the SLACK_BOT_TOKEN environment variable.

Three functions are exposed. load_data loads messages from a list of channels, giving the agent access to the text content of conversations across those channels. send_message sends a message to a specified channel, letting the agent post rather than only read. fetch_channel fetches the list of channels, so the agent (or a developer) can discover what channels are available before targeting one with the other two functions.

When to use - and when NOT to

Use it when a LlamaIndex agent needs to answer questions grounded in what was said in specific Slack channels - for example, "What is the most recent message in the announcements channel?" - or needs to post updates back into Slack as part of its workflow. Do not use it for channels the bot token has not been granted access to; the tool can only read or write to channels the underlying Slack app is a member of or otherwise authorized for.

Capabilities

load_data loads message text from a list of channels. send_message posts a message to a channel. fetch_channel lists the channels the token has access to.

How to install

from llama_index.tools.slack import SlackToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

tool_spec = SlackToolSpec(slack_token="token")

agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

Requires a Slack API token, either passed to the tool spec or set as SLACK_BOT_TOKEN.

Who it's for

Developers building LlamaIndex agents that need to read from and post to Slack channels as part of answering questions or automating team workflows.

Source README

Slack Tool

This tool fetches the text from a list of Slack channels. You will need to initialize the loader with your Slack API Token or have the SLACK_BOT_TOKEN environment variable set.

Usage

from llama_index.tools.slack import SlackToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

tool_spec = SlackToolSpec(slack_token="token")

agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

print(
    await agent.run(
        "What is the most recent message in the announcements channel?"
    )
)

load_data: Loads messages from a list of channels
send_message: Sends a message to a channel
fetch_channel: Fetches the list of channels

This loader is designed to be used as a way to load data as a Tool in a Agent.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.