Skip to main content

Documentation Index

Fetch the complete documentation index at: https://agno-v2-team-approvals.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

SlackTools enable an Agent to interact with the Slack API. 12 methods cover messaging, channels, file management, search, threads, and user lookup.

Prerequisites

uv pip install -U "agno[slack]"
export SLACK_TOKEN=***

Example

The following agent sends a message to a Slack channel, lists channels, and retrieves message history.
cookbook/14_tools/slack_tools.py
import os

from agno.agent import Agent
from agno.tools.slack import SlackTools

slack_tools = SlackTools()

agent = Agent(tools=[slack_tools])

# Example 1: Send a message to a Slack channel
agent.print_response("Send a message 'Hello from Agno!' to the channel #general", markdown=True)

# Example 2: List all channels in the Slack workspace
agent.print_response("List all channels in our Slack workspace", markdown=True)

# Example 3: Get the message history of a specific channel by channel ID
agent.print_response("Get the last 10 messages from the channel 1231241", markdown=True)

Toolkit Params

ParameterTypeDefaultDescription
tokenOptional[str]NoneSlack API token. Falls back to SLACK_TOKEN env var.
markdownboolTrueEnable Slack mrkdwn formatting in messages.
output_directoryOptional[str]NoneDirectory to save downloaded/uploaded files locally.
enable_send_messageboolTrueEnable send_message tool.
enable_send_message_threadboolTrueEnable send_message_thread tool.
enable_list_channelsboolTrueEnable list_channels tool.
enable_get_channel_historyboolTrueEnable get_channel_history tool.
enable_upload_fileboolTrueEnable upload_file tool.
enable_download_fileboolTrueEnable download_file tool.
enable_search_messagesboolFalseEnable search_messages tool. Requires a user token and the search:read OAuth scope.
enable_search_workspaceboolFalseEnable search_workspace tool. Uses Slack’s assistant.search.context API. Requires search:read.public, search:read.files, and search:read.users bot scopes. Only works through the Slack interface (needs action_token).
enable_get_threadboolFalseEnable get_thread tool.
enable_list_usersboolFalseEnable list_users tool.
enable_get_user_infoboolFalseEnable get_user_info tool.
enable_get_channel_infoboolFalseEnable get_channel_info tool.
allboolFalseEnable all tools. Overrides individual flags.
sslOptional[SSLContext]NoneSSL context for the Slack WebClient.
max_file_sizeint1073741824Maximum file size in bytes for uploads and downloads (default 1 GB).
thread_message_limitint20Maximum number of messages to fetch in get_thread.

Toolkit Functions

FunctionDescription
send_message(channel, text)Send a message to a Slack channel.
send_message_thread(channel, text, thread_ts)Reply to a message thread in a channel.
list_channels()List all channels in the workspace.
get_channel_history(channel, limit=100)Get message history from a channel.
upload_file(channel, content, filename, title?, initial_comment?, thread_ts?)Upload a file to a channel with optional caption.
download_file(file_id, dest_path?)Download a file by file ID. Returns path or base64 content.
search_messages(query, limit=20)Search messages across the workspace. Requires a user token (bot tokens return not_allowed_token_type).
search_workspace(query, content_types?, channel_types?, limit=10, include_context_messages=True)Search messages, files, channels, and users across the workspace using Slack’s Real-Time Search API. Only works through the Slack interface.
get_thread(channel, thread_ts, limit=20)Get all messages in a thread by parent timestamp. Capped by thread_message_limit.
list_users(limit=100)List all users in the workspace.
get_user_info(user_id)Get detailed info about a user by user ID.
get_channel_info(channel)Get channel metadata: name, topic, purpose, member count, and visibility.
search_messages supports Slack search modifiers: from:@user, in:#channel, has:link, before:2024-01-01, after:2024-01-01. Combine them to narrow results.

Developer Resources

Slack Interface

Streaming, sessions, file handling, and behavior details.

Source Code

View the SlackTools implementation on GitHub.