# Nextcloud 接入 Server酱：私有云盘事件推送到微信（2026 教程）

> 通过 Nextcloud 内置 Webhook listeners 或 Flow 脚本，将文件变更、分享等事件实时推送到微信，支持 Server酱 与 Server酱³。

- 网页版：https://sct.ftqq.com/docs/integrations/nextcloud/
- 更新日期：2026-07-17

# Nextcloud + Server酱：私有云盘事件推送到微信

> 效果：Nextcloud 中的文件变更、分享等事件实时推送到微信

## 前置条件

- 获取 Server酱 SendKey（参考 [30 秒获取 SendKey 教程](https://sct.ftqq.com/docs/getting-started/sendkey/)）
- Nextcloud 30+ 环境（支持 Webhook listeners）

## 配置步骤

### 方法一：Webhook listeners（固定标题通知）

在 Nextcloud 的 Webhook listeners 设置中（具体入口以应用内实际显示为准），将目标 URL 填写为：

```
https://sctapi.ftqq.com/你的SENDKEY.send?title=Nextcloud%E4%BA%8B%E4%BB%B6
```

此方法会将所有触发事件推送为标题为「Nextcloud事件」的消息。Nextcloud 推送的 JSON 详情无法直接显示在微信通知中。

如果你使用的是 Server酱³，端点请替换为 `https://你的UID.push.ft07.com/send/你的SENDKEY.send`。

### 方法二：Flow + curl（自定义内容）

也可使用 Nextcloud 的 workflow/Flow 配合外部脚本触发 curl，向 Server酱 发送请求：

```bash
curl -X POST "https://sctapi.ftqq.com/你的SENDKEY.send" \
  --data-urlencode "title=Nextcloud文件变更" \
  --data-urlencode "desp=检测到文件被修改或分享"
```

### 方法三：中转解析（推送详细事件内容）

若需将 Nextcloud 推送的固定 JSON 内容解析后送入 `desp` 正文，需部署一层中转（如 Cloudflare Workers 或云函数），接收 Nextcloud 的 POST 请求，解析 JSON 后再向 Server酱 API 发起请求。

## 完整示例

以下是一个 Cloudflare Worker 中转脚本示例，接收 Nextcloud 的 Webhook 请求，将 JSON 详情推送到 Server酱：

```javascript
export default {
  async fetch(request) {
    const payload = await request.json();
    const title = "Nextcloud事件";
    const desp = JSON.stringify(payload, null, 2);
    const sendkey = "你的SENDKEY";
    const url = `https://sctapi.ftqq.com/${sendkey}.send`;

    await fetch(url, {
      method: "POST",
      headers: { "Content-Type": "application/x-www-form-urlencoded" },
      body: `title=${encodeURIComponent(title)}&desp=${encodeURIComponent(desp)}`
    });

    return new Response("ok");
  }
}
```

将此 Worker 部署后，把 Worker 的 URL 填入 Nextcloud 的 Webhook listeners 即可。

## 常见问题

**Server酱的发送额度是多少？**

免费用户每日可发送 5 条，每分钟上限 50 条。订阅会员目前特价最低 3 元/月，一天最多可发 1000 条（[价格详情](https://sct.ftqq.com/subscribe)）。

**配置后没收到消息？**

检查 SendKey 是否正确，网络是否通畅。更多排查步骤见[常见问题与排查](https://sct.ftqq.com/docs/getting-started/faq/)。

**Webhook 推送的内容为什么是空的？**

Nextcloud Webhook listeners 发送的是固定结构的 JSON 事件体，其字段名与 Server酱 的 `title`/`desp` 并不对应。方法一用 URL query 传的是固定标题；若想把事件详情写进 `desp`，需用方法三的中转脚本解析 Nextcloud 的 JSON 后再映射到 `title`/`desp`。

**如何推送到企业微信、钉钉或飞书群？**

消息默认推送到你 SendKey 所绑定的通道；如需调整推送到微信/企业微信/钉钉等，详见[通道配置说明](https://sct.ftqq.com/docs/getting-started/channels/)。

## 相关集成

- [Python 脚本推送](https://sct.ftqq.com/docs/integrations/python/)
- [Uptime Kuma 宕机告警](https://sct.ftqq.com/docs/integrations/uptime-kuma/)
- [青龙面板任务通知](https://sct.ftqq.com/docs/integrations/qinglong/)


## 懒人方案：把这段话复制给你的 AI 助手

把下面这段文字原样粘贴给 Claude Code、Cursor 或任何 AI 编程助手，它就会替你完成 Server酱 的接入：

```text
请帮我把 Server酱 微信通知接入到我当前的项目/工具中：
1. API：POST https://sctapi.ftqq.com/{SendKey}.send，参数 title（必填，不能含换行）、desp（正文，支持 Markdown，可选）；成功时返回 JSON 的 code 为 0。
2. 如果我的 SendKey 以 sctp 开头，则改用 https://{uid}.push.ft07.com/send/{SendKey}.send，uid 是 SendKey 中 sctp 与 t 之间的数字。
3. SendKey 从环境变量 SERVERCHAN_SENDKEY 读取；如果没有，提醒我到 https://sct.ftqq.com 免费获取（每天 5 条额度）。
4. 安全要求：不要把 SendKey 硬编码进代码、不要打印到日志、不要提交到 git。
5. 频率约定：任务结束发 1 条结果摘要即可，批量任务合并成一条，不要每步都推。
请根据我当前的项目和场景直接写好代码/配置并验证。
```

