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

# 管理通知连接器

> 创建、读取、更新、测试和删除通知连接器。

通知连接器保存组织范围的 SMTP、Slack、飞书和通用 Webhook 投递凭证。创建、更新、测试或删除连接器
需要 `alerts.manage`，列出和读取连接器需要 `alerts.read`。

## 列出支持的类型

```http theme={null}
GET /api/v1/notify/connector-types
```

响应会说明运行中后端注册的各连接器类型与能力。当前类型包括 `email_smtp`、`slack_app`、
`slack_webhook`、`lark_app`、`lark_webhook` 和 `webhook`。

## 创建连接器

```http theme={null}
POST /api/v1/notify/connectors
```

```json theme={null}
{
  "name": "Operations Slack",
  "connector_type": "slack_webhook",
  "config": {
    "webhook_url": "https://hooks.slack.com/services/T000/B000/secret",
    "timeout_secs": 10
  },
  "enabled": true
}
```

API 返回 `201 Created`。响应包含连接器 ID、能力、状态、测试信息和时间戳。敏感配置会被掩码：

```json theme={null}
{
  "id": "3J4connector",
  "organization_id": "3J4organization",
  "name": "Operations Slack",
  "connector_type": "slack_webhook",
  "config": {
    "webhook_url": "***",
    "timeout_secs": 10
  },
  "capabilities": {
    "direct_user": false,
    "group": true,
    "rich_text": true,
    "interactive": false,
    "acknowledgement": false,
    "attachments": false
  },
  "enabled": true,
  "status": "unknown",
  "last_tested_at": null,
  "last_test_status": null,
  "last_test_error": null
}
```

## 列出和读取连接器

```http theme={null}
GET /api/v1/notify/connectors
GET /api/v1/notify/connectors/{id}
```

MoleSignal 会加密保存完整 `config` 对象。响应会把密码、Secret、Token、URL 和 Header 对象替换为
`***`。

## 更新连接器

```http theme={null}
PUT /api/v1/notify/connectors/{id}
```

```json theme={null}
{
  "name": "Operations Slack",
  "config": {
    "webhook_url": "***",
    "timeout_secs": 20
  },
  "enabled": true
}
```

创建后不能更改 `connector_type`。敏感字段原样提交 `***` 会保留已保存的密钥；提交新的明文值会替换
密钥。省略 `config` 可以保持整个配置不变。

## 测试连接器

```http theme={null}
POST /api/v1/notify/connectors/{id}/test
```

```json theme={null}
{
  "target_type": "fixed_group",
  "target": "operations",
  "message": {
    "title": "MoleSignal connector test",
    "text": "Notification delivery is working.",
    "markdown": "**Notification delivery is working.**"
  }
}
```

目标类型必须与连接器兼容。测试成功或失败都会更新 `status`、`last_tested_at`、`last_test_status` 和
`last_test_error`。已停用的连接器不能执行测试。

## 删除连接器

```http theme={null}
DELETE /api/v1/notify/connectors/{id}
```

删除成功返回 `204 No Content`。如果用户端点、通知策略或兜底路由仍引用连接器，API 会返回冲突。
删除前先迁移这些引用。

服务商配置字段、目标类型和路由操作见[通知渠道与投递](/zh-Hans/notification-channels)。
