Prerequisites
The following example requires theslack-sdk library.
Example
The following agent will use Slack to send a message to a channel, list all channels, and get the message history of a specific channel.cookbook/tools/slack_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
You are viewing v1 docs. For the latest documentation, visit docs.agno.com
slack-sdk library.
pip install openai slack-sdk
export SLACK_TOKEN=***
import os
from agno.agent import Agent
from agno.tools.slack import SlackTools
slack_tools = SlackTools()
agent = Agent(tools=[slack_tools], show_tool_calls=True)
# 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)
| Parameter | Type | Default | Description |
|---|---|---|---|
token | str | - | Slack API token for authentication |
send_message | bool | True | Enables the functionality to send messages to Slack channels |
list_channels | bool | True | Enables the functionality to list available Slack channels |
get_channel_history | bool | True | Enables the functionality to retrieve message history from channels |
| Function | Description |
|---|---|
send_message | Sends a message to a specified Slack channel |
list_channels | Lists all available channels in the Slack workspace |
get_channel_history | Retrieves message history from a specified channel |
Was this page helpful?