vendor_connectors.slack.tools
AI framework tools for Slack operations.
This module provides tools for Slack operations that work with multiple AI agent frameworks. The core functions are framework-agnostic Python functions, with native wrappers for each supported framework.
Supported Frameworks:
- LangChain (via langchain-core) - get_langchain_tools()
- CrewAI - get_crewai_tools()
- AWS Strands - get_strands_tools() (plain functions)
- Auto-detection - get_tools() picks the best available
Tools provided:
- slack_list_channels: List Slack channels
- slack_list_users: List Slack users
- slack_send_message: Send a message to a channel
- slack_get_channel_history: Get recent messages from a channel
Usage: from vendor_connectors.slack.tools import get_tools tools = get_tools() # Returns best format for installed framework
Module Contents
Section titled “Module Contents”Classes
Section titled “Classes”ListChannelsSchema | Schema for listing Slack channels. |
|---|---|
ListUsersSchema | Schema for listing Slack users. |
SendMessageSchema | Schema for sending a Slack message. |
GetChannelHistorySchema | Schema for getting Slack channel history. |
Functions
Section titled “Functions”_get_connector | Create a SlackConnector with tokens from environment variables. |
|---|---|
list_channels | List Slack channels. |
list_users | List Slack users. |
send_message | Send a message to a Slack channel. |
get_channel_history | Get recent messages from a Slack channel. |
get_langchain_tools | Get all Slack tools as LangChain StructuredTools. |
get_crewai_tools | Get all Slack tools as CrewAI tools. |
get_strands_tools | Get all Slack tools as plain Python functions for AWS Strands. |
get_tools | Get Slack tools for the specified or auto-detected framework. |
TOOL_DEFINITIONS |
|---|
class vendor_connectors.slack.tools.ListChannelsSchema
Section titled “class vendor_connectors.slack.tools.ListChannelsSchema”Bases: pydantic.BaseModel
Schema for listing Slack channels.
exclude_archived : bool
Section titled “exclude_archived : bool”‘Field(…)’
channels_only : bool
Section titled “channels_only : bool”‘Field(…)’
limit : int
Section titled “limit : int”‘Field(…)’
class vendor_connectors.slack.tools.ListUsersSchema
Section titled “class vendor_connectors.slack.tools.ListUsersSchema”Bases: pydantic.BaseModel
Schema for listing Slack users.
include_bots : bool
Section titled “include_bots : bool”‘Field(…)’
include_deleted : bool
Section titled “include_deleted : bool”‘Field(…)’
max_results : int
Section titled “max_results : int”‘Field(…)’
class vendor_connectors.slack.tools.SendMessageSchema
Section titled “class vendor_connectors.slack.tools.SendMessageSchema”Bases: pydantic.BaseModel
Schema for sending a Slack message.
channel : str
Section titled “channel : str”‘Field(…)’
‘Field(…)’
thread_id : str
Section titled “thread_id : str”‘Field(…)’
class vendor_connectors.slack.tools.GetChannelHistorySchema
Section titled “class vendor_connectors.slack.tools.GetChannelHistorySchema”Bases: pydantic.BaseModel
Schema for getting Slack channel history.
channel : str
Section titled “channel : str”‘Field(…)’
limit : int
Section titled “limit : int”‘Field(…)’
vendor_connectors.slack.tools._get_connector()
Section titled “vendor_connectors.slack.tools._get_connector()”Create a SlackConnector with tokens from environment variables.
The slack_sdk WebClient only falls back to environment variables when token=None, not when given empty strings. We explicitly load tokens from environment to ensure proper authentication.
Returns: SlackConnector: Configured Slack connector instance.
vendor_connectors.slack.tools.list_channels(exclude_archived: bool = True, channels_only: bool = True, limit: int = 100) → list[dict[str, Any]]
Section titled “vendor_connectors.slack.tools.list_channels(exclude_archived: bool = True, channels_only: bool = True, limit: int = 100) → list[dict[str, Any]]”List Slack channels.
Args: exclude_archived: Exclude archived channels when True channels_only: Return only channel-type conversations when True limit: Maximum number of channels to return
Returns: List of channels with their properties (id, name, is_private, topic, purpose, member_count)
vendor_connectors.slack.tools.list_users(include_bots: bool = False, include_deleted: bool = False, max_results: int = 100) → list[dict[str, Any]]
Section titled “vendor_connectors.slack.tools.list_users(include_bots: bool = False, include_deleted: bool = False, max_results: int = 100) → list[dict[str, Any]]”List Slack users.
Args: include_bots: Include bot accounts when True include_deleted: Include deactivated accounts when True max_results: Maximum number of users to return
Returns: List of users with their properties (id, name, real_name, email, is_admin, is_bot)
vendor_connectors.slack.tools.send_message(channel: str, text: str, thread_id: str = ”) → dict[str, Any]
Section titled “vendor_connectors.slack.tools.send_message(channel: str, text: str, thread_id: str = ”) → dict[str, Any]”Send a message to a Slack channel.
Args: channel: Channel name (without #) to send message to text: Message text to send thread_id: Optional thread timestamp to reply in a thread
Returns: Dict with channel, text, and timestamp of the sent message
vendor_connectors.slack.tools.get_channel_history(channel: str, limit: int = 100) → list[dict[str, Any]]
Section titled “vendor_connectors.slack.tools.get_channel_history(channel: str, limit: int = 100) → list[dict[str, Any]]”Get recent messages from a Slack channel.
Args: channel: Channel name (without #) to get history from limit: Maximum number of messages to return
Returns: List of messages with their properties (timestamp, user, text, type)
vendor_connectors.slack.tools.TOOL_DEFINITIONS
Section titled “vendor_connectors.slack.tools.TOOL_DEFINITIONS”None
vendor_connectors.slack.tools.get_langchain_tools() → list[Any]
Section titled “vendor_connectors.slack.tools.get_langchain_tools() → list[Any]”Get all Slack tools as LangChain StructuredTools.
Returns: List of LangChain StructuredTool objects.
Raises: ImportError: If langchain-core is not installed.
vendor_connectors.slack.tools.get_crewai_tools() → list[Any]
Section titled “vendor_connectors.slack.tools.get_crewai_tools() → list[Any]”Get all Slack tools as CrewAI tools.
Returns: List of CrewAI BaseTool objects.
Raises: ImportError: If crewai is not installed.
vendor_connectors.slack.tools.get_strands_tools() → list[Any]
Section titled “vendor_connectors.slack.tools.get_strands_tools() → list[Any]”Get all Slack tools as plain Python functions for AWS Strands.
Returns: List of callable functions.
vendor_connectors.slack.tools.get_tools(framework: str = ‘auto’) → list[Any]
Section titled “vendor_connectors.slack.tools.get_tools(framework: str = ‘auto’) → list[Any]”Get Slack tools for the specified or auto-detected framework.
Args: framework: Framework to use. Options:
- “auto” (default): Auto-detect based on installed packages
- “langchain”: Force LangChain StructuredTools
- “crewai”: Force CrewAI tools
- “strands”: Force plain functions for Strands
- “functions”: Force plain functions (alias for strands)
Returns: List of tools in the appropriate format for the framework.
Raises: ImportError: If the requested framework is not installed. ValueError: If an unknown framework is specified.