前提条件
以下示例需要slack-sdk 库。
示例
以下代理将使用 Slack 向频道发送消息、列出所有频道以及获取特定频道的消息历史记录。cookbook/tools/slack_tools.py
Toolkit 参数
| 参数 | 类型 | 默认 | 描述 |
|---|---|---|---|
token | str | - | 用于身份验证的 Slack API 令牌 |
send_message | bool | True | 启用向 Slack 频道发送消息的功能 |
list_channels | bool | True | 启用列出可用 Slack 频道的功能 |
get_channel_history | bool | True | 启用从频道检索消息历史记录的功能 |
Toolkit 函数
| 函数 | 描述 |
|---|---|
send_message | 向指定的 Slack 频道发送消息 |
list_channels | 列出 Slack 工作区中所有可用频道 |
get_channel_history | 从指定频道检索消息历史记录 |