slack-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSlack Automation via Rube MCP
通过Rube MCP实现Slack自动化
Automate Slack workspace operations including messaging, search, channel management, and reaction workflows through Composio's Slack toolkit.
Toolkit docs: composio.dev/toolkits/slack
借助Composio的Slack工具包,自动化Slack工作区操作,包括消息发送、搜索、频道管理和消息反应工作流。
Prerequisites
前提条件
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active Slack connection via with toolkit
RUBE_MANAGE_CONNECTIONSslack - Always call first to get current tool schemas
RUBE_SEARCH_TOOLS
- 已连接Rube MCP(需可使用RUBE_SEARCH_TOOLS)
- 通过使用
RUBE_MANAGE_CONNECTIONS工具包建立有效的Slack连接slack - 请始终先调用以获取当前工具的架构
RUBE_SEARCH_TOOLS
Setup
设置步骤
Get Rube MCP: Add as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
https://rube.app/mcp- Verify Rube MCP is available by confirming responds
RUBE_SEARCH_TOOLS - Call with toolkit
RUBE_MANAGE_CONNECTIONSslack - If connection is not ACTIVE, follow the returned auth link to complete Slack OAuth
- Confirm connection status shows ACTIVE before running any workflows
获取Rube MCP:在客户端配置中添加作为MCP服务器。无需API密钥——只需添加该端点即可使用。
https://rube.app/mcp- 确认可正常响应,以此验证Rube MCP是否可用
RUBE_SEARCH_TOOLS - 调用并指定工具包为
RUBE_MANAGE_CONNECTIONSslack - 如果连接状态未显示为ACTIVE,请按照返回的授权链接完成Slack OAuth认证
- 在运行任何工作流之前,确认连接状态显示为ACTIVE
Core Workflows
核心工作流
1. Send Messages to Channels
1. 向频道发送消息
When to use: User wants to post a message to a Slack channel or DM
Tool sequence:
- - Resolve channel name to channel ID [Prerequisite]
SLACK_FIND_CHANNELS - - Fallback if FIND_CHANNELS returns empty/ambiguous results [Fallback]
SLACK_LIST_ALL_CHANNELS - - Resolve user for DMs or @mentions [Optional]
SLACK_FIND_USERS - - Open/reuse a DM channel if messaging a user directly [Optional]
SLACK_OPEN_DM - - Post the message with resolved channel ID [Required]
SLACK_SEND_MESSAGE - - Edit the posted message if corrections needed [Optional]
SLACK_UPDATES_A_SLACK_MESSAGE
Key parameters:
- : Channel ID or name (without '#' prefix)
channel - : Preferred field for formatted messages (supports headers, bold, italic, code blocks)
markdown_text - : Raw text fallback (deprecated in favor of markdown_text)
text - : Timestamp of parent message to reply in a thread
thread_ts - : Block Kit layout blocks (deprecated, use markdown_text)
blocks
Pitfalls:
- requires
SLACK_FIND_CHANNELSparam; missing it errors with "Invalid request data provided"query - requires valid channel plus one of markdown_text/text/blocks/attachments
SLACK_SEND_MESSAGE - Invalid block payloads return error=invalid_blocks (max 50 blocks)
- Replies become top-level posts if is omitted
thread_ts - Persist and
response.data.channelfrom SEND_MESSAGE for edit/thread operationsresponse.data.message.ts
适用场景:用户需要向Slack频道或私信发送消息
工具执行顺序:
- - 将频道名称解析为频道ID [前置步骤]
SLACK_FIND_CHANNELS - - 当FIND_CHANNELS返回空结果或模糊结果时作为备选方案 [备选]
SLACK_LIST_ALL_CHANNELS - - 解析用户ID以用于私信或@提及 [可选]
SLACK_FIND_USERS - - 如果直接向用户发送消息,打开或复用私信频道 [可选]
SLACK_OPEN_DM - - 使用解析后的频道ID发送消息 [必填]
SLACK_SEND_MESSAGE - - 如果需要修正内容,编辑已发送的消息 [可选]
SLACK_UPDATES_A_SLACK_MESSAGE
关键参数:
- : 频道ID或名称(无需添加#前缀)
channel - : 格式化消息的首选字段(支持标题、粗体、斜体、代码块)
markdown_text - : 纯文本备选字段(已弃用,建议使用markdown_text)
text - : 父消息的时间戳,用于在线程中回复
thread_ts - : Block Kit布局块(已弃用,建议使用markdown_text)
blocks
注意事项:
- 需要传入
SLACK_FIND_CHANNELS参数;若缺失会返回错误"Invalid request data provided"query - 需要有效的频道ID,且必须传入markdown_text/text/blocks/attachments中的至少一个
SLACK_SEND_MESSAGE - 无效的block负载会返回error=invalid_blocks错误(最多支持50个blocks)
- 如果省略,回复会成为顶级消息
thread_ts - 请保存返回结果中的
SLACK_SEND_MESSAGE和response.data.channel,用于后续的编辑或线程操作response.data.message.ts
2. Search Messages and Conversations
2. 搜索消息和对话
When to use: User wants to find specific messages across the workspace
Tool sequence:
- - Resolve channel for scoped search with
SLACK_FIND_CHANNELS[Optional]in:#channel - - Resolve user for author filter with
SLACK_FIND_USERS[Optional]from:@user - - Run keyword search across accessible conversations [Required]
SLACK_SEARCH_MESSAGES - - Expand threads for relevant hits [Required]
SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION
Key parameters:
- : Search string supporting modifiers (
query,in:#channel,from:@user,before:YYYY-MM-DD,after:YYYY-MM-DD,has:link)has:file - : Results per page (max 100), or total with auto_paginate=true
count - : 'score' (relevance) or 'timestamp' (chronological)
sort - : 'asc' or 'desc'
sort_dir
Pitfalls:
- Validation fails if is missing/empty
query - can still mean no hits (
ok=true)response.data.messages.total=0 - Matches are under (sometimes also
response.data.messages.matches)response.data_preview.messages.matches - may be empty/truncated; key info can appear in
match.textmatches[].attachments[] - Thread expansion via FETCH_MESSAGE_THREAD can truncate when ; paginate via
response.data.has_more=trueresponse_metadata.next_cursor
适用场景:用户需要在工作区中查找特定消息
工具执行顺序:
- - 解析频道ID,用于限定搜索范围(使用
SLACK_FIND_CHANNELS修饰符)[可选]in:#channel - - 解析用户ID,用于按作者过滤(使用
SLACK_FIND_USERS修饰符)[可选]from:@user - - 在可访问的对话中执行关键词搜索 [必填]
SLACK_SEARCH_MESSAGES - - 展开相关结果的线程对话 [必填]
SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION
关键参数:
- : 搜索字符串,支持修饰符(
query、in:#channel、from:@user、before:YYYY-MM-DD、after:YYYY-MM-DD、has:link)has:file - : 每页结果数量(最多100条),或设置auto_paginate=true获取全部结果
count - : 排序方式,可选'score'(按相关性)或'timestamp'(按时间顺序)
sort - : 排序方向,可选'asc'(升序)或'desc'(降序)
sort_dir
注意事项:
- 如果缺失或为空,验证会失败
query - 即使返回,也可能没有匹配结果(
ok=true)response.data.messages.total=0 - 匹配结果位于中(有时也会出现在
response.data.messages.matches)response.data_preview.messages.matches - 可能为空或被截断;关键信息可能出现在
match.text中matches[].attachments[] - 当时,通过
response.data.has_more=true展开线程会被截断;需使用SLACK_FETCH_MESSAGE_THREAD进行分页response_metadata.next_cursor
3. Manage Channels and Users
3. 管理频道和用户
When to use: User wants to list channels, users, or workspace info
Tool sequence:
- - Validate connectivity and get workspace identity [Required]
SLACK_FETCH_TEAM_INFO - - Enumerate public channels [Required]
SLACK_LIST_ALL_CHANNELS - - Include private channels and DMs [Optional]
SLACK_LIST_CONVERSATIONS - - List workspace members [Required]
SLACK_LIST_ALL_USERS - - Get detailed channel metadata [Optional]
SLACK_RETRIEVE_CONVERSATION_INFORMATION - - List user groups [Optional]
SLACK_LIST_USER_GROUPS_FOR_TEAM_WITH_OPTIONS
Key parameters:
- : Pagination cursor from
cursorresponse_metadata.next_cursor - : Results per page (default varies; set explicitly for large workspaces)
limit - : Channel types filter ('public_channel', 'private_channel', 'im', 'mpim')
types
Pitfalls:
- Workspace metadata is nested under , not top-level
response.data.team - returns public channels only; use
SLACK_LIST_ALL_CHANNELSfor private/IM coverageSLACK_LIST_CONVERSATIONS - can hit HTTP 429 rate limits; honor Retry-After header
SLACK_LIST_ALL_USERS - Always paginate via until empty; de-duplicate by
response_metadata.next_cursorid
适用场景:用户需要列出频道、用户或工作区信息
工具执行顺序:
- - 验证连接状态并获取工作区标识 [必填]
SLACK_FETCH_TEAM_INFO - - 枚举公开频道 [必填]
SLACK_LIST_ALL_CHANNELS - - 包含私有频道和私信 [可选]
SLACK_LIST_CONVERSATIONS - - 列出工作区成员 [必填]
SLACK_LIST_ALL_USERS - - 获取频道的详细元数据 [可选]
SLACK_RETRIEVE_CONVERSATION_INFORMATION - - 用户组列表 [可选]
SLACK_LIST_USER_GROUPS_FOR_TEAM_WITH_OPTIONS
关键参数:
- : 来自
cursor的分页游标response_metadata.next_cursor - : 每页结果数量(默认值不固定;针对大型工作区请显式设置)
limit - : 频道类型过滤器('public_channel'、'private_channel'、'im'、'mpim')
types
注意事项:
- 工作区元数据嵌套在下,而非顶层
response.data.team - 仅返回公开频道;如需获取私有频道/私信,请使用
SLACK_LIST_ALL_CHANNELSSLACK_LIST_CONVERSATIONS - 可能触发HTTP 429限流;请遵循Retry-After响应头
SLACK_LIST_ALL_USERS - 请始终通过进行分页,直到游标为空;通过
response_metadata.next_cursor对跨页结果去重id
4. React to and Thread Messages
4. 消息反应与线程对话管理
When to use: User wants to add reactions or manage threaded conversations
Tool sequence:
- or
SLACK_SEARCH_MESSAGES- Find the target message [Prerequisite]SLACK_FETCH_CONVERSATION_HISTORY - - Add an emoji reaction [Required]
SLACK_ADD_REACTION_TO_AN_ITEM - - List reactions on a message [Optional]
SLACK_FETCH_ITEM_REACTIONS - - Remove a reaction [Optional]
SLACK_REMOVE_REACTION_FROM_ITEM - - Reply in thread using
SLACK_SEND_MESSAGE[Optional]thread_ts - - Read full thread [Optional]
SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION
Key parameters:
- : Channel ID where the message lives
channel - /
timestamp: Message timestamp (unique identifier like '1234567890.123456')ts - : Emoji name without colons (e.g., 'thumbsup', 'wave::skin-tone-3')
name - : Parent message timestamp for threaded replies
thread_ts
Pitfalls:
- Reactions require exact channel ID + message timestamp pair
- Emoji names use Slack's naming convention without colons
- only returns main channel timeline, NOT threaded replies
SLACK_FETCH_CONVERSATION_HISTORY - Use with parent's
SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATIONto get thread repliesthread_ts
适用场景:用户需要添加消息反应或管理线程对话
工具执行顺序:
- 或
SLACK_SEARCH_MESSAGES- 找到目标消息 [前置步骤]SLACK_FETCH_CONVERSATION_HISTORY - - 添加表情反应 [必填]
SLACK_ADD_REACTION_TO_AN_ITEM - - 列出消息上的所有反应 [可选]
SLACK_FETCH_ITEM_REACTIONS - - 移除反应 [可选]
SLACK_REMOVE_REACTION_FROM_ITEM - - 使用
SLACK_SEND_MESSAGE在线程中回复 [可选]thread_ts - - 查看完整线程对话 [可选]
SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION
关键参数:
- : 目标消息所在的频道ID
channel - /
timestamp: 消息的时间戳(唯一标识符,格式如'1234567890.123456')ts - : 表情名称(无需添加冒号,例如'thumbsup'、'wave::skin-tone-3')
name - : 父消息的时间戳,用于线程回复
thread_ts
注意事项:
- 添加反应需要准确的频道ID和消息时间戳组合
- 表情名称需使用Slack的命名规范,无需添加冒号
- 仅返回频道主时间线的消息,不包含线程回复
SLACK_FETCH_CONVERSATION_HISTORY - 需使用并传入父消息的
SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION来获取线程回复thread_ts
5. Schedule Messages
5. 消息调度
When to use: User wants to schedule a message for future delivery
Tool sequence:
- - Resolve channel ID [Prerequisite]
SLACK_FIND_CHANNELS - - Schedule the message with
SLACK_SCHEDULE_MESSAGEtimestamp [Required]post_at
Key parameters:
- : Resolved channel ID
channel - : Unix timestamp for delivery (up to 120 days in advance)
post_at - /
text: Message contentblocks
Pitfalls:
- Scheduling is limited to 120 days in advance
- must be a Unix timestamp, not ISO 8601
post_at
适用场景:用户需要调度消息在未来发送
工具执行顺序:
- - 解析频道ID [前置步骤]
SLACK_FIND_CHANNELS - - 使用
SLACK_SCHEDULE_MESSAGE时间戳调度消息 [必填]post_at
关键参数:
- : 解析后的频道ID
channel - : 消息发送的Unix时间戳(最多提前120天)
post_at - /
text: 消息内容blocks
注意事项:
- 消息调度最多支持提前120天
- 必须为Unix时间戳,而非ISO 8601格式
post_at
Common Patterns
通用模式
ID Resolution
ID解析
Always resolve display names to IDs before operations:
- Channel name -> Channel ID: with
SLACK_FIND_CHANNELSparamquery - User name -> User ID: with
SLACK_FIND_USERSorsearch_queryemail - DM channel: with resolved user IDs
SLACK_OPEN_DM
在执行操作前,请始终将显示名称解析为ID:
- 频道名称 -> 频道ID:调用并传入
SLACK_FIND_CHANNELS参数query - 用户名称 -> 用户ID:调用并传入
SLACK_FIND_USERS或search_queryemail - 私信频道:调用并传入解析后的用户ID
SLACK_OPEN_DM
Pagination
分页
Most list endpoints use cursor-based pagination:
- Follow until empty
response_metadata.next_cursor - Set explicit values (e.g., 100-200) for reliable paging
limit - De-duplicate results by across pages
id
大多数列表接口使用基于游标的分页:
- 跟随进行分页,直到游标为空
response_metadata.next_cursor - 显式设置值(例如100-200)以确保分页可靠
limit - 通过对跨页结果去重
id
Message Formatting
消息格式化
- Prefer over
markdown_textortextfor formatted messagesblocks - Use format to mention users (not @username)
<@USER_ID> - Use for line breaks in markdown_text
\n
- 优先使用而非
markdown_text或text来格式化消息blocks - 使用格式提及用户(而非@用户名)
<@USER_ID> - 在中使用
markdown_text进行换行\n
Known Pitfalls
已知注意事项
- Channel resolution: can return empty results if channel is private and bot hasn't been invited
SLACK_FIND_CHANNELS - Rate limits: and other list endpoints can hit HTTP 429; honor Retry-After header
SLACK_LIST_ALL_USERS - Nested responses: Results may be nested under in wrapped executions
response.data.results[0].response.data - Thread vs channel: returns main timeline only; use
SLACK_FETCH_CONVERSATION_HISTORYfor thread repliesSLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION - Message editing: Requires both and original message
channel; persist these from SEND_MESSAGE responsets - Search delays: Recently posted messages may not appear in search results immediately
- Scope limitations: Missing OAuth scopes can cause 403 errors; check with
SLACK_GET_APP_PERMISSION_SCOPES
- 频道解析:如果频道是私有频道且机器人未被邀请,可能返回空结果
SLACK_FIND_CHANNELS - 限流:和其他列表接口可能触发HTTP 429限流;请遵循Retry-After响应头
SLACK_LIST_ALL_USERS - 嵌套响应:在包装执行中,结果可能嵌套在下
response.data.results[0].response.data - 线程与频道区别:仅返回主时间线消息;需使用
SLACK_FETCH_CONVERSATION_HISTORY获取线程回复SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION - 消息编辑:需要同时传入和原消息的
channel;请从ts的返回结果中保存这两个值SLACK_SEND_MESSAGE - 搜索延迟:最近发送的消息可能不会立即出现在搜索结果中
- 权限范围限制:缺失OAuth权限范围会导致403错误;可通过检查权限
SLACK_GET_APP_PERMISSION_SCOPES
Quick Reference
快速参考
| Task | Tool Slug | Key Params |
|---|---|---|
| Find channels | | |
| List all channels | | |
| Send message | | |
| Edit message | | |
| Search messages | | |
| Get thread | | |
| Add reaction | | |
| Find users | | |
| List users | | |
| Open DM | | user IDs |
| Schedule message | | |
| Get channel info | | channel ID |
| Channel history | | |
| Workspace info | | (none) |
Powered by Composio
| 任务 | 工具标识 | 关键参数 |
|---|---|---|
| 查找频道 | | |
| 列出所有频道 | | |
| 发送消息 | | |
| 编辑消息 | | |
| 搜索消息 | | |
| 获取线程对话 | | |
| 添加反应 | | |
| 查找用户 | | |
| 列出所有用户 | | |
| 打开私信 | | 用户ID |
| 调度消息 | | |
| 获取频道信息 | | 频道ID |
| 频道历史记录 | | |
| 工作区信息 | | 无 |
由Composio提供支持