> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fetchhive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

> 配置一个使用已连接的 Slack 账户向 Slack 频道发送消息的工作流步骤

# Slack

当你希望工作流步骤从已连接的工作区集成向 Slack 频道发送消息时,请使用 **Slack**。

## 配置

| 选项                                                                                                    | 是否必填 | 说明                                                   |
| ----------------------------------------------------------------------------------------------------- | ---- | ---------------------------------------------------- |
| Name                                                                                                  | 否    | 步骤在工作流画布中的标签。                                        |
| Integration Authorization                                                                             | 是    | 在 **Authentication** 中选择的已连接 Slack 账户。               |
| Action                                                                                                | 是    | Slack 操作。当前编辑器显示 **Send Channel Message**。           |
| Channel                                                                                               | 是    | 在 **Channel** 中输入的频道名称。                              |
| Message                                                                                               | 是    | 在 **Message** 中输入的消息正文。                              |
| When the step fails                                                                                   | 否    | 控制此步骤失败时工作流应 **Terminate Workflow** 还是 **Continue**。 |
| 在配置此步骤之前,请在工作区的 **Integrations** 中连接 Slack。如果没有可用的活动 Slack 连接,该步骤会显示警告并链接到 **Integrations**,而不是账户选择器。 |      |                                                      |

如果 **Channel** 和 **Message** 中任何值应来自起始输入或早前的工作流步骤,请使用其旁边的 **Insert Variable** 按钮。

## 输出

此步骤将发送消息返回的 Slack API 响应存储为步骤输出。

在后续步骤中使用完整输出引用:

```text theme={null}
{{STEP_IDENTIFIER.output}}
```

如果你需要返回的 Slack 载荷中的特定字段,在测试运行后从变量选择器中插入它:

```text theme={null}
{{step_2.output.some_field}}
```

可用的键取决于该消息运行返回的 Slack 响应。

## 示例

打开 **Integrations** 并连接 Slack(如果尚未连接)。

将 **Slack** 添加到你的工作流,并在 **Authentication** 中选择已连接的账户。

保持 **Action** 设置为 **Send Channel Message**。

在 **Channel** 中输入目标频道,例如 `general`,然后在 **Message** 中编写 Slack 帖子。你可以在消息正文中插入诸如 `{{step_1.output}}` 的值。

点击步骤标题中的 **Run** 来测试消息,然后如果你希望将其中任何数据传递给后续步骤,请查看 **Output** 中返回的载荷。

{/* Add screenshot: Slack step settings with Authentication, Channel, and Message */}

## 备注

* 此步骤依赖于工作区中已连接的 Slack 集成。
* channel 字段使用频道名称,而不是完整的 Slack URL。
* 当前编辑器公开一个 Slack 操作:**Send Channel Message**。

另见:[Integrations](../../../workspace/integrations)、[创建和编辑](../../creating-and-editing) 和 [测试与迭代](../../testing-and-iteration)
