> For the complete documentation index, see [llms.txt](https://academy.shade.inc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.shade.inc/guides/guides-zh/zi-dong-hua/tong-guo-webhooks-jiang-shade-lian-jie-dao-qi-ta-gong-ju.md).

# 通过 webhooks 将 Shade 连接到其他工具

可通过 webhook 从任意工具启动 Shade 自动化，也可使用 HTTP 请求将数据从 Shade 发送到任意 API。

**结果：** Shade 与你技术栈其余部分之间的双向连接。你的项目工具可以启动一个 Shade 自动化，而 Shade 也可以把更新回传给它，无需你自己编写服务。

**适用于：** 面向运维思维的制片人和技术团队成员，将 Shade 连接到项目跟踪器、CMS、Slack 或内部工具。如果你更愿意写代码，请查看 [开发者](/guides/guides-zh/kai-fa-zhe.md) 指南。

**时间：** 每个连接大约 20 分钟。

## 开始之前

* 构建 [你的第一个自动化](/guides/guides-zh/zi-dong-hua/ni-de-di-yi-ge-zi-dong-hua.md) 如果你还没有使用过自动化编辑器，请先。
* 先打开另一个工具的文档。你需要它的出站 webhook 设置，或者你要调用的 API 端点。

## 第 1 部分：从另一个工具启动自动化

此示例会在你的跟踪器中创建新项目时创建一个项目文件夹。

{% stepper %}
{% step %}

### 添加一个 Webhook Received 触发器

创建一个自动化并选择 **Webhook Received**。Shade 会为此自动化显示一个 webhook URL。保持 **要求身份验证** 开启。Shade 会生成一个 **认证令牌**，传入请求必须将其作为 bearer token 发送。
{% endstep %}

{% step %}

### 将另一个工具指向它

在另一个工具的出站 webhook 或自动化设置中，粘贴该 URL，并添加一个 `Authorization` 标头，值为 `Bearer` ，后跟该令牌。让它发送一个 JSON 正文，例如：

```json
{ "project_name": "ACME 春季活动" }
```

{% endstep %}

{% step %}

### 在你的步骤中使用载荷

添加 **创建文件夹**。在 **路径**中，输入 `Projects/`，然后输入 `{` 并选择 `project_name` 来自触发器的 **载荷**。选择一个 **文件夹模板** 以在新文件夹中构建标准结构。

在完成这一步之前，先从另一个工具发送一条测试请求。一旦 Shade 见过一个真实请求，载荷中的字段就更容易选择。
{% endstep %}

{% step %}

### 保存并激活

点击 **保存**，然后 **启用**，并在另一个工具中创建一个测试项目。
{% endstep %}
{% endstepper %}

## 第 2 部分：从 Shade 向另一个工具发送数据

此示例会在评论被解决时向 Slack 的入站 webhook 发布一条消息。

{% stepper %}
{% step %}

### 选择 Shade 事件

创建一个自动化并选择重要的事件，这里是 **评论已解决**.
{% endstep %}

{% step %}

### 添加发送 HTTP 请求

* **方法：** POST
* **URL：** 另一个工具的端点，这里是你的 Slack 入站 webhook URL
* **标头：** API 所需的任何内容，例如一个 `Authorization` 带有 API 密钥的标头
* **正文：** JSON，包含来自触发器的变量。对于 Slack：

```json
{ "text": "ASSET_NAME 上的评论已解决" }
```

替换 `ASSET_NAME` 为一个变量：删除它，输入 `{`，然后从触发器中选择资产名称。其他早先步骤中的值也用同样的方法插入。
{% endstep %}

{% step %}

### 如有需要，可使用响应

该请求的响应可供后续步骤使用。例如，你可以将另一个工具返回的 ID 存储到一个 Shade 元数据字段中，使用 **更新资产元数据**.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
来自另一个工具的非 2xx 响应不会自动停止自动化。如果后续步骤依赖于请求成功，请在请求的 **如果 / 否则** 上添加一个 **状态** 输出。
{% endhint %}

## 变体

* **无代码连接器：** 如果另一个工具在 Zapier 上，你可能根本不需要 webhooks。请参见 [Zapier 集成](https://academy.shade.inc/workspaces-and-drives/zapier-integration).
* **面向开发者的事件订阅：** 要在你自己的服务中接收 Shade 事件，请参见 [Webhooks](https://academy.shade.inc/developers/webhooks).

## 相关文章

* [为每个新项目创建一个文件夹](/guides/guides-zh/zi-ding-yi-dui-xiang-he-yuan-shu-ju/wei-mei-ge-xin-xiang-mu-chuang-jian-yi-ge-wen-jian-jia.md)
* [将 Shade MCP 与 Claude 或 Cursor 一起使用](/guides/guides-zh/sou-suo-ai-he-dang-an/jiang-shade-mcp-yu-claude-huo-cursor-yi-qi-shi-yong.md)
* [开发者](/guides/guides-zh/kai-fa-zhe.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://academy.shade.inc/guides/guides-zh/zi-dong-hua/tong-guo-webhooks-jiang-shade-lian-jie-dao-qi-ta-gong-ju.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
