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

# Slack

> 通过 incoming webhook 将安全告警转发到 Slack 频道

Slack 集成通过 incoming webhook 将安全告警发布到 Slack 频道。它只向外发送：OASM 将事件发送到 Slack，从不读取你的 Slack 工作区。

## 前提条件

* 一个你可以安装应用的 Slack 工作区。如果你的工作区限制安装应用，请先让管理员批准 OASM 应用。
* 创建应用并添加 incoming webhook 的权限。
* 一个用于接收告警的频道。

## 创建 incoming webhook

**1. 打开 Slack 应用控制台**

访问 [api.slack.com/apps](https://api.slack.com/apps) 并选择 **Create New App**。

**2. 创建应用**

选择 **From scratch**，输入一个名称（例如 `OASM Alerts`），选择你的工作区，然后创建应用。

**3. 启用 incoming webhooks**

在侧边栏中打开 **Incoming Webhooks** 并开启该功能。

**4. 向工作区添加 webhook**

选择 **Add New Webhook to Workspace**，选择接收告警的频道，然后允许访问。

**5. 复制 webhook URL**

复制生成的 URL。它以 `https://hooks.slack.com/services/` 开头。

> [!WARNING]
>
> 请将 webhook URL 视为凭据。任何拥有它的人都可以向该频道发帖。如果泄露，请在 Slack 中删除该 webhook，并连接一个新的 webhook。

## 连接 Slack

**1. 打开应用选项卡**

在控制台侧边栏中打开**集成**，然后选择**应用**选项卡。

**2. 打开 Slack**

选择 **Slack** 卡片。

**3. 输入名称和 webhook URL**

输入**集成名称**，然后粘贴从 Slack 获取的 **Webhook URL**。

**4. 设置机器人用户名（可选）**

输入**机器人用户名**，控制发送者在 Slack 中的显示名称。如果留空，Slack 会使用 webhook 上设置的名称。

**5. 选择事件**

使用**事件**和**严重级别**开关控制 OASM 发送的内容。参见[通知类集成发送的内容](https://docs.oasm.io/zh/integrations/overview.md#what-notification-integrations-send)。

**6. 连接**

选择**连接**。OASM 会发布一条欢迎消息，以确认 webhook 正常工作。

## 测试

在**已连接**选项卡中打开该集成，然后选择**测试集成**。Slack 频道中会出现一条测试消息。如果没有收到，请确认该 webhook 在 Slack 中仍处于启用状态，并且频道仍然存在。

## 相关内容

> [card] [通知](https://docs.oasm.io/zh/notifications.md)
>
> 查看平台产生的所有事件

> [card] [集成概览](https://docs.oasm.io/zh/integrations/overview.md)
>
> 了解事件、密钥和连接的工作方式

> [card] [Telegram](https://docs.oasm.io/zh/integrations/telegram.md)
>
> 将告警发送到 Telegram 而不是 Slack


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.