# 自動化

> Owner-built automations on triggers, with conditions, branches, delays, retries, custom triggers and HTTP actions.

> Markdown version of https://kanorio.com/zh-HK/developers/products/automation. Append `.md` to any developer docs URL for this format. Index: https://kanorio.com/llms.txt · MCP: https://app.kanorio.com/api/mcp
>
> Translated from the English original: https://kanorio.com/en/developers/products/automation.md

Status: **Available**

自動化功能會在特定事件發生時執行步驟：例如訂單已付款、網上表單已提交、特定日期到達，或是您的系統回報了某個事件。發送電子郵件只是眾多動作中的其中一種。

## 核心物件

- **觸發條件與動作：** 一個包含每個觸發條件資料與每個動作輸入之 JSON schema 的目錄。
- **自動化：** 在後台或透過 API 建立的條件、分支、延遲與速率限制。
- **執行紀錄：** 每次執行的詳細步驟，包含重試機制、失敗細節以及重新執行的選項。
- **自訂觸發條件：** 使用 `POST /sites/{id}/automations/events` 回報您自己的事件以啟動自動化。

## API 如何運作

- 使用 Management API 讀取目錄、建立與編輯自動化、進行測試，以及讀取並重試執行紀錄。
- `automations.run.failed` Webhook 會在執行失敗時通知您。

## What the APIs expose

| Capability | Status | API | Elements | Hosted site | Webhooks |
| --- | --- | --- | --- | --- | --- |
| Automation engine: trigger/action catalog, owner-built flows, per-step runs, custom triggers | Available | Management API (REST/MCP) `automations.catalog.get`, `automations.templates.list`, `automations.flows.*` (list/get/validate/create/update/set_status/archive/delete/test), `automations.runs.*` (list/get/rerun), `automations.events.report`/`cancel`, `automations.triggers.*`, `automations.secrets.*`; preinstalled toggles via `automations.list`/`set_action_enabled`; signed inbound endpoint `POST /api/webhooks/automations/<token>` (Standard Webhooks) | — | `/automations`, `/automations/settings` | Every trigger in the catalog is also a subscribable webhook event; custom triggers accept signed inbound webhooks (planned) |

## API reference

- Management API: [Automations](https://kanorio.com/en/developers/management-api/automations) (27 operations)

## Webhook events

- `automations.run.failed`: Fired when a run of an owner-built automation ends in FAILED after retries (compensation already applied). Not fired for test runs or platform-default automations; at most once per automation revision every 30 days.
- `automations.flow.paused`: Fired when Kanorio turns an owner-built automation off automatically because its current revision ran more than 20 times in the past 7 days and 95% or more of those runs failed.

Payloads: https://kanorio.com/en/developers/webhooks/events
