Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Slack tool allows you to send messages, read channels, and interact with Slack workspaces.
Installation
pip install "praisonai[tools]"
Environment Variables
export SLACK_BOT_TOKEN=xoxb-your-bot-token
export SLACK_WEBHOOK_URL=https://hooks.slack.com/services/... # Optional
Quick Start
from praisonai_tools import SlackTool
# Initialize
slack = SlackTool()
# Send message
slack.send_message("#general", "Hello from PraisonAI!")
Usage with Agent
from praisonaiagents import Agent
from praisonai_tools import SlackTool
agent = Agent(
name="SlackBot",
instructions="You send notifications to Slack.",
tools=[SlackTool()]
)
response = agent.chat("Send a message to #alerts saying the deployment is complete")
print(response)
Available Methods
send_message(channel, text)
Send a message to a channel.
from praisonai_tools import SlackTool
slack = SlackTool()
slack.send_message("#general", "Hello!")
get_channels()
List available channels.
channels = slack.get_channels()
get_history(channel, limit=10)
Get channel message history.
messages = slack.get_history("#general", limit=20)
Common Errors
| Error | Cause | Solution |
|---|
SLACK_BOT_TOKEN not configured | Missing token | Set environment variable |
channel_not_found | Invalid channel | Check channel name |
not_in_channel | Bot not in channel | Invite bot to channel |