> 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/shade-academy/shade-academy-zh/zi-dong-hua-yu-zi-ding-yi-dui-xiang/automations.md).

# 自动化

Automations 是一个零代码工作流构建器，直接内置于 Shade 中。你可以定义当你的云盘中发生某些事件时应执行的规则，Shade 会在后台自动运行这些规则——无需第三方工具，也无需编写代码。

每个自动化都由一个 **触发器** （启动它的事件）和一个或多个 **动作** （Shade 的响应操作）组成。你可以使用可视化的基于块的编辑器来构建自动化。

{% embed url="<https://youtu.be/PIK9cQBpcSE?si=f7nBru4WD7SK9zjY>" %}

### 自动化的工作方式

* 选择一个 **触发器** ——启动自动化的事件
* 添加一个或多个 **动作** ——按顺序串联执行
* 保存后，每当触发器被触发时，自动化就会自动运行

<figure><img src="https://450378260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2F1Cs5qy7BCtq7vD9CF9ws%2FAutomations%200.gif?alt=media&#x26;token=2405d772-6b17-475a-bf76-1d790e788786" alt=""><figcaption></figcaption></figure>

### 触发器

触发器是你云盘中的事件。在编辑器中，它们按如下方式分组：

* **手动：** 手动触发器
* **文件：** 资产已上传、资产已下载、资产已更新（元数据变更时，可选指定某个字段和值）、资产已重命名、资产已移除、资产已删除
* **集合：** 资产已添加到集合、资产已从集合移除、集合已创建、集合已更新、集合已删除
* **自定义对象：** 记录已创建、记录已更新
* **分享链接：** 分享链接已创建、分享链接已删除
* **评论：** 评论已添加、评论已更新、评论已删除、评论已解决、评论已反应
* **人员：** 人员已识别
* **代理文件、预览和转录：** 转录已完成、视频代理文件已完成、音频代理文件已完成、元数据已提取
* **网络：** 收到 Webhook

<figure><img src="https://450378260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FgJ0O6bl6f3RcYwf7OiQT%2FAutomations%201.gif?alt=media&#x26;token=c75a9235-0f85-4406-8a86-46711e69e581" alt=""><figcaption></figcaption></figure>

### 动作

通常来说，动作就是你已经可以在 Shade 中手动完成的操作。它们包括：

* **逻辑：** 筛选、如果 / 否则、切换
* **文件：** 创建文件夹、重命名资产、移动资产、更新资产元数据
* **分享链接：** 生成分享链接、生成文件夹分享链接、生成集合分享链接
* **集合：** 添加到集合、从集合中移除、重命名集合、创建集合、删除集合
* **自定义对象：** 创建记录、查找记录、更新记录、删除记录、获取记录
* **文本：** 转换文本
* **计算：** 随机数、调整时间
* **网络：** 发送 HTTP 请求
* **其他：** 发送电子邮件、将文件保存到云盘

**发送电子邮件** 向收件人发送一条包含你编写的主题和正文的消息。正文支持基本的 HTML 格式。

**收到 Webhook** 当另一个服务向其 webhook URL 发送请求时启动自动化，并且 **发送 HTTP 请求** 可在任意步骤中调用外部 URL。有关设置、身份验证和请求详情，请参阅 [自动化中的 Webhook](https://academy.shade.inc/developers/webhooks#webhooks-in-automations).

<figure><img src="https://450378260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2F95JU1hzganNGVCaP7Pgc%2FAutomations%202.gif?alt=media&#x26;token=bea74699-1295-47a0-bb5f-75eb3a05b6e7" alt=""><figcaption></figcaption></figure>

### 构建自动化

使用可视化的基于块的编辑器来构建自动化：

* 创建新的自动化
* 选择你的触发器（例如， **资产已添加到集合**）并将其指向相关集合
* 按它们应运行的顺序添加你的动作（例如， **生成分享链接** -> **发送电子邮件**)
* 保存

### 示例工作流

* **两阶段审批：** 当某个资产的 **审批状态** 变为 **审核中**时，自动生成一个分享链接并通过电子邮件发送给内部审核人。当它切换为 **已批准**时，将最终的分享链接发送给外部审核人——两个阶段，零手动交接。
* **交付包生成器：** 当资产移动到 **准备交付** （或被添加到交付集合）时，自动生成正确的分享链接，并发送一封包含链接、所含资产以及任何备注的交付电子邮件。这样就能把“导出 + 发送链接”变成一次状态变更。
* **收件路由：** 当文件上传到传入文件夹时，使用一个 **如果 / 否则** 块来检查其元数据，然后将其移动到正确的项目文件夹，更新其元数据，并将其添加到审阅集合中——这样新媒体就能在没有人工整理的情况下到达它应在的位置。


---

# 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/shade-academy/shade-academy-zh/zi-dong-hua-yu-zi-ding-yi-dui-xiang/automations.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.
