mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-07-07 04:58:03 +02:00
Add files via upload
This commit is contained in:
+231
-15
@@ -2,7 +2,7 @@
|
||||
|
||||
[English](robot_en.md)
|
||||
|
||||
本文档说明如何通过**钉钉**、**飞书**与 **企业微信** 与 CyberStrikeAI 对话(长连接 / 回调模式),在手机端即可使用,无需在服务器上打开网页。按下面步骤操作可避免常见弯路。
|
||||
本文档说明如何通过**个人微信**、**钉钉**、**飞书**与 **企业微信** 与 CyberStrikeAI 对话(长连接 / 回调模式),在手机端即可使用,无需在服务器上打开网页。按下面步骤操作可避免常见弯路。
|
||||
|
||||
---
|
||||
|
||||
@@ -11,11 +11,14 @@
|
||||
1. 登录 CyberStrikeAI Web 端
|
||||
2. 左侧导航进入 **系统设置**
|
||||
3. 在左侧设置分类中点击 **机器人设置**(位于「基本设置」与「安全设置」之间)
|
||||
4. 按平台勾选并填写(钉钉填 Client ID / Client Secret,飞书填 App ID / App Secret)
|
||||
5. 点击 **应用配置** 保存
|
||||
6. **重启 CyberStrikeAI 应用**(只保存不重启,机器人不会连上)
|
||||
4. 按平台配置:
|
||||
- **个人微信**:点击「微信 / iLink」→「生成二维码并绑定」,用微信扫码确认(见 [3.4 个人微信](#34-个人微信-wechat--ilink))
|
||||
- **钉钉**:勾选并填写 Client ID / Client Secret
|
||||
- **飞书**:勾选并填写 App ID / App Secret
|
||||
5. 点击 **应用配置** 保存(微信扫码绑定成功后会**自动保存并启用**,一般无需再点)
|
||||
6. **重启 CyberStrikeAI 应用**(钉钉/飞书:只保存不重启,长连接不会建立;微信绑定成功后会自动重启连接,通常无需手动重启)
|
||||
|
||||
配置会写入 `config.yaml` 的 `robots` 段,也可在配置文件中直接编辑。**修改钉钉/飞书配置后必须重启,长连接才会生效。**
|
||||
配置会写入 `config.yaml` 的 `robots` 段,也可在配置文件中直接编辑。**修改钉钉/飞书配置后必须重启,长连接才会生效。** 个人微信绑定成功后程序会自动写入 `robots.wechat` 并重启 iLink 长轮询。
|
||||
|
||||
---
|
||||
|
||||
@@ -23,9 +26,14 @@
|
||||
|
||||
| 平台 | 说明 |
|
||||
|----------|------|
|
||||
| 个人微信 | 使用微信 iLink 协议,Web 端扫码绑定后长轮询收消息,**无需公网回调** |
|
||||
| 钉钉 | 使用 Stream 长连接,程序主动连接钉钉接收消息 |
|
||||
| 飞书 | 使用长连接,程序主动连接飞书接收消息 |
|
||||
| 企业微信 | 使用 HTTP 回调接收消息,被动回包 + 主动调用企业微信发送消息 API |
|
||||
| Telegram | Bot API 长轮询(getUpdates),**无需公网回调** |
|
||||
| Slack | Socket Mode(出站 WebSocket),**无需公网回调** |
|
||||
| Discord | Gateway WebSocket,**无需公网回调** |
|
||||
| QQ 机器人 | QQ 开放平台 WebSocket(C2C / 群 @),**无需公网回调** |
|
||||
|
||||
下面第三节会按平台写清:在开放平台要做什么、要复制哪些字段、填到 CyberStrikeAI 的哪一栏。
|
||||
|
||||
@@ -151,9 +159,150 @@
|
||||
|
||||
---
|
||||
|
||||
### 3.4 个人微信 (WeChat / iLink)
|
||||
|
||||
> 个人微信采用「Web 扫码绑定 + iLink 长轮询」方式工作:
|
||||
> - 在 CyberStrikeAI Web 端生成二维码 → 用**手机微信**扫码并确认绑定;
|
||||
> - 绑定成功后自动写入 `config.yaml` 的 `robots.wechat`,并启动 iLink 长轮询(程序主动连接 `ilinkai.weixin.qq.com` 收消息);
|
||||
> - **无需**在服务器上配置公网回调 URL,也**无需**去微信开放平台注册应用。
|
||||
|
||||
**与企业微信的区别**
|
||||
|
||||
| 项目 | 个人微信 (iLink) | 企业微信 (WeCom) |
|
||||
|------|------------------|------------------|
|
||||
| 使用场景 | 个人微信私聊 | 企业微信自建应用 |
|
||||
| 配置方式 | Web 端扫码绑定 | 管理后台配置回调 URL + Token |
|
||||
| 是否需要公网 | 否(长轮询出站即可) | 是(需可被企业微信访问的 HTTPS 回调) |
|
||||
| 配置段 | `robots.wechat` | `robots.wecom` |
|
||||
|
||||
**绑定步骤(按顺序做)**
|
||||
|
||||
1. **登录 CyberStrikeAI Web 端**
|
||||
左侧 **系统设置** → **机器人设置** → 点击 **微信 / iLink** 卡片。
|
||||
|
||||
2. **(可选)勾选「启用微信机器人」**
|
||||
首次绑定可跳过;绑定成功后会自动勾选并启用。
|
||||
|
||||
3. **生成二维码**
|
||||
点击 **「生成二维码并绑定」**。页面会显示二维码(约 **5 分钟**有效;过期请重新生成)。
|
||||
|
||||
4. **微信扫码确认**
|
||||
- 用手机微信扫描页面二维码;
|
||||
- 按手机提示完成确认;
|
||||
- 若手机微信弹出**配对数字**,在 Web 页面对应输入框填写并点击 **提交**(仅部分账号需要)。
|
||||
|
||||
5. **等待绑定完成**
|
||||
页面显示「绑定成功,微信机器人已启用」即完成。`bot_token`、`ilink_bot_id` 等会自动写入 `config.yaml`,程序会自动重启 iLink 长轮询,**一般无需手动重启服务**。
|
||||
|
||||
6. **在手机微信里测试**
|
||||
打开与 CyberStrikeAI 机器人的**私聊**(绑定后微信内会出现对应会话),发送「帮助」或任意文字测试。
|
||||
|
||||
**CyberStrikeAI 微信栏位说明**
|
||||
|
||||
| 栏位 | 说明 |
|
||||
|------|------|
|
||||
| 启用微信机器人 | 勾选后启动 iLink 长轮询;绑定成功后会自动勾选 |
|
||||
| 生成二维码并绑定 | 发起扫码绑定流程 |
|
||||
| **高级设置**(一般保持默认即可) | |
|
||||
| API Base URL | 默认 `https://ilinkai.weixin.qq.com` |
|
||||
| Bot Type | 默认 `3` |
|
||||
| Bot Agent | 默认 `CyberStrikeAI/1.0` |
|
||||
| iLink Bot ID | 绑定成功后自动填充,只读 |
|
||||
|
||||
**使用方式**
|
||||
|
||||
- 仅支持在与机器人的**私聊**中对话,直接发送文字即可,**不需要 @**。
|
||||
- 不支持群聊 @ 机器人(与钉钉/飞书群聊不同)。
|
||||
- 仅处理**文本消息**;图片、语音等会忽略或提示暂不支持。
|
||||
|
||||
**重新绑定**
|
||||
|
||||
- 若需更换绑定的微信账号,在机器人设置页点击 **「重新绑定」**,再次扫码即可。
|
||||
- 若提示「该微信已绑定过,无需重复绑定」,说明该账号此前已完成绑定。
|
||||
|
||||
**常见问题**
|
||||
|
||||
| 现象 | 处理 |
|
||||
|------|------|
|
||||
| 二维码过期 | 重新点击「生成二维码并绑定」(有效期约 5 分钟) |
|
||||
| 扫码后要求输入数字 | 查看手机微信显示的配对数字,在 Web 页面输入并提交 |
|
||||
| 绑定成功但发消息无回复 | 看程序日志是否有 `微信 iLink 长轮询已启动`、`微信收到消息`;确认已勾选「启用微信机器人」 |
|
||||
| 断网或睡眠后无回复 | 程序会自动重连(约 5~60 秒);仍无回复可重启 CyberStrikeAI |
|
||||
| 无法生成二维码 | 确认服务器能访问 `https://ilinkai.weixin.qq.com`(出站 HTTPS) |
|
||||
|
||||
---
|
||||
|
||||
### 3.5 Telegram
|
||||
|
||||
> Telegram 使用 **Bot API 长轮询**(`getUpdates`):程序主动连接 `api.telegram.org` 收消息,**无需公网回调**。
|
||||
|
||||
**配置步骤:**
|
||||
|
||||
1. 在 Telegram 中找 **@BotFather**,发送 `/newbot` 创建机器人,获得 **Bot Token**。
|
||||
2. CyberStrikeAI → **系统设置** → **机器人设置** → **Telegram**。
|
||||
3. 勾选「启用 Telegram 机器人」,粘贴 **Bot Token**。
|
||||
4. (可选)填写 Bot Username(不含 `@`),或留空由程序自动 `getMe`。
|
||||
5. (可选)勾选「允许群聊」— 群聊中仅响应 **@机器人** 的消息。
|
||||
6. 点击 **应用配置**(会自动重启长轮询连接)。
|
||||
|
||||
**使用:** 与机器人私聊直接发消息;群聊需 @ 机器人(且已勾选允许群聊)。
|
||||
|
||||
---
|
||||
|
||||
### 3.6 Slack
|
||||
|
||||
> Slack 使用 **Socket Mode**(出站 WebSocket):需 **Bot Token** 与 **App-Level Token**,**无需公网回调**。
|
||||
|
||||
**配置步骤:**
|
||||
|
||||
1. 在 [Slack API](https://api.slack.com/apps) 创建 App → 启用 **Socket Mode**。
|
||||
2. **Basic Information** → **App-Level Tokens** → 创建 token(scope: `connections:write`),即 **xapp-** 开头。
|
||||
3. **OAuth & Permissions** → 添加 Bot Token Scopes:`app_mentions:read`、`chat:write`、`im:history`、`im:read` 等 → 安装到工作区,获得 **xoxb-** Bot Token。
|
||||
4. **Event Subscriptions** → 订阅 `message.im`、`app_mention` 等(Socket Mode 下在应用内配置)。
|
||||
5. 在 CyberStrikeAI 填入 Bot Token 与 App-Level Token → **应用配置**。
|
||||
|
||||
**使用:** 与 Bot 私聊直接发;频道中需 @ 机器人。
|
||||
|
||||
---
|
||||
|
||||
### 3.7 Discord
|
||||
|
||||
> Discord 使用 **Gateway WebSocket**:程序主动连接 Discord Gateway,**无需公网回调**。
|
||||
|
||||
**配置步骤:**
|
||||
|
||||
1. 在 [Discord Developer Portal](https://discord.com/developers/applications) 创建应用 → **Bot** → 复制 **Token**。
|
||||
2. 开启 **Privileged Gateway Intents** 中的 **Message Content Intent**(否则读不到消息正文)。
|
||||
3. OAuth2 → URL Generator → scopes: `bot` → 权限勾选 **Send Messages**、**Read Message History** 等 → 邀请 Bot 到服务器。
|
||||
4. CyberStrikeAI → **机器人设置** → **Discord** → 填入 Token → **应用配置**。
|
||||
5. (可选)勾选「允许服务器频道」— 频道中仅响应 **@机器人**。
|
||||
|
||||
**使用:** 与 Bot 私聊直接发;服务器频道需 @ 机器人(且已勾选允许服务器频道)。
|
||||
|
||||
---
|
||||
|
||||
### 3.8 QQ 机器人
|
||||
|
||||
> QQ 机器人使用 **QQ 开放平台 WebSocket**(官方 `botgo` SDK):支持 C2C 私聊与群 @,**无需公网回调**(WebSocket 出站连接)。
|
||||
|
||||
**配置步骤:**
|
||||
|
||||
1. 在 [QQ 机器人开放平台](https://q.qq.com) 创建机器人,获取 **App ID** 与 **Client Secret**。
|
||||
2. 在沙箱中添加测试成员(上线前仅沙箱可对话)。
|
||||
3. 订阅 **C2C 消息**、**群 @ 消息** 等事件(WebSocket 模式)。
|
||||
4. CyberStrikeAI → **机器人设置** → **QQ 机器人** → 填入 App ID、Client Secret。
|
||||
5. 测试阶段勾选 **沙箱环境**;正式上线后取消沙箱并发布。
|
||||
6. 点击 **应用配置**。
|
||||
|
||||
**使用:** 与机器人 C2C 私聊直接发;QQ 群中需 @ 机器人。
|
||||
|
||||
> 注意:QQ 官方正逐步推广 Webhook 回调;当前实现使用 WebSocket(与钉钉/飞书类似的长连接模式)。若配置变更后连接未刷新,可重启 CyberStrikeAI 进程。
|
||||
|
||||
---
|
||||
|
||||
## 四、机器人命令
|
||||
|
||||
在钉钉/飞书中向机器人发送以下**文本命令**(仅支持文本):
|
||||
在任一已接入平台(钉钉/飞书/微信/Telegram/Slack/Discord/QQ 等)向机器人发送以下**文本命令**(仅支持文本):
|
||||
|
||||
| 命令 | 说明 |
|
||||
|------|------|
|
||||
@@ -175,16 +324,25 @@
|
||||
|
||||
## 五、如何使用(要 @ 机器人吗?)
|
||||
|
||||
- **单聊(推荐)**:在钉钉/飞书里**搜索并打开该机器人**,进入与机器人的**私聊**,直接输入「帮助」或任意文字即可,**不需要 @**。
|
||||
- **群聊**:若机器人被添加到群里,在群内只有 **@机器人** 后发送的消息才会被机器人收到并回复;不 @ 的群消息不会触发机器人。
|
||||
- **个人微信**:在与 CyberStrikeAI 机器人的**私聊**中直接发送即可,**不需要 @**(不支持群聊)。
|
||||
- **钉钉 / 飞书单聊(推荐)**:**搜索并打开该机器人**,进入**私聊**,直接输入「帮助」或任意文字即可,**不需要 @**。
|
||||
- **钉钉 / 飞书群聊**:若机器人被添加到群里,在群内只有 **@机器人** 后发送的消息才会被机器人收到并回复;不 @ 的群消息不会触发机器人。
|
||||
|
||||
总结:和机器人**单聊时直接发**;在**群里用时需要 @机器人** 再发内容。
|
||||
总结:**个人微信、单聊时直接发**;**钉钉/飞书在群里用时需要 @机器人** 再发内容。
|
||||
|
||||
---
|
||||
|
||||
## 六、推荐使用流程(避免漏步骤)
|
||||
|
||||
1. **在开放平台**:按第三节完成钉钉或飞书应用创建、凭证复制、机器人开通(钉钉务必选 **Stream 模式**)、权限与发布。
|
||||
**个人微信(最简单,无需开放平台)**
|
||||
|
||||
1. CyberStrikeAI Web 端 → 系统设置 → 机器人设置 → **微信 / iLink** → **生成二维码并绑定**。
|
||||
2. 手机微信扫码确认(如需配对数字则在 Web 页填写)。
|
||||
3. 绑定成功后,在手机微信私聊中发「帮助」测试。
|
||||
|
||||
**钉钉 / 飞书**
|
||||
|
||||
1. **在开放平台**:按第三节完成应用创建、凭证复制、机器人开通(钉钉务必选 **Stream 模式**)、权限与发布。
|
||||
2. **在 CyberStrikeAI**:系统设置 → 机器人设置 → 勾选对应平台,粘贴 Client ID/App ID、Client Secret/App Secret → 点击 **应用配置**。
|
||||
3. **重启 CyberStrikeAI 进程**(否则长连接不会建立)。
|
||||
4. **在手机钉钉/飞书**:找到该机器人(单聊直接发,群聊需 @机器人),发「帮助」或任意内容测试。
|
||||
@@ -199,6 +357,14 @@
|
||||
|
||||
```yaml
|
||||
robots:
|
||||
wechat: # 个人微信 iLink(扫码绑定后自动写入,一般无需手填)
|
||||
enabled: true
|
||||
bot_token: "your_bot_token@im.bot:..."
|
||||
ilink_bot_id: "your_bot_id@im.bot"
|
||||
ilink_user_id: "your_user_id@im.wechat"
|
||||
base_url: "https://ilinkai.weixin.qq.com"
|
||||
bot_type: "3"
|
||||
bot_agent: "CyberStrikeAI/1.0"
|
||||
dingtalk:
|
||||
enabled: true
|
||||
client_id: "your_dingtalk_app_key"
|
||||
@@ -208,9 +374,33 @@ robots:
|
||||
app_id: "your_lark_app_id"
|
||||
app_secret: "your_lark_app_secret"
|
||||
verify_token: ""
|
||||
wecom:
|
||||
enabled: false
|
||||
corp_id: ""
|
||||
agent_id: 0
|
||||
token: ""
|
||||
encoding_aes_key: ""
|
||||
secret: ""
|
||||
telegram:
|
||||
enabled: false
|
||||
bot_token: ""
|
||||
allow_group_messages: false
|
||||
slack:
|
||||
enabled: false
|
||||
bot_token: ""
|
||||
app_token: ""
|
||||
discord:
|
||||
enabled: false
|
||||
bot_token: ""
|
||||
allow_guild_messages: false
|
||||
qq:
|
||||
enabled: false
|
||||
app_id: ""
|
||||
client_secret: ""
|
||||
sandbox: true
|
||||
```
|
||||
|
||||
修改后需**重启应用**,长连接在应用启动时建立。
|
||||
修改钉钉/飞书/企业微信/Telegram/Slack/Discord/QQ 配置后,点击 **应用配置** 会自动重启对应长连接。个人微信扫码绑定成功后会自动写入并重启 iLink 连接。
|
||||
|
||||
---
|
||||
|
||||
@@ -235,7 +425,30 @@ curl -X POST "http://localhost:8080/api/robot/test" \
|
||||
|
||||
---
|
||||
|
||||
## 九、钉钉发消息没反应时排查
|
||||
## 九、发消息没反应时排查
|
||||
|
||||
### 9.1 个人微信
|
||||
|
||||
按顺序检查:
|
||||
|
||||
1. **是否已完成扫码绑定**
|
||||
机器人设置页应显示「已连接」或已绑定 Bot ID;`config.yaml` 中 `robots.wechat.bot_token` 不应为空。
|
||||
|
||||
2. **是否已启用**
|
||||
确认「启用微信机器人」已勾选;若刚修改过,可重启 CyberStrikeAI 进程。
|
||||
|
||||
3. **看程序日志**
|
||||
- 启动后应看到:`微信 iLink 长轮询已启动`;
|
||||
- 发消息后应有:`微信收到消息`;若没有,多为未绑定成功或 `bot_token` 失效,可尝试 **重新绑定**。
|
||||
- 若出现 `微信 iLink 长轮询异常,将自动重连`,等待自动重连或重启进程。
|
||||
|
||||
4. **网络**
|
||||
服务器需能访问 `https://ilinkai.weixin.qq.com`(出站 HTTPS)。绑定阶段若无法生成二维码,优先检查此项。
|
||||
|
||||
5. **断网或睡眠后**
|
||||
与钉钉/飞书类似,程序会**自动重连**(约 5~60 秒);仍无回复可重启 CyberStrikeAI。
|
||||
|
||||
### 9.2 钉钉
|
||||
|
||||
按顺序检查:
|
||||
|
||||
@@ -260,8 +473,10 @@ curl -X POST "http://localhost:8080/api/robot/test" \
|
||||
|
||||
## 十、常见弯路(避免踩坑)
|
||||
|
||||
- **个人微信与企业微信混淆**:个人微信走 `robots.wechat` + Web 扫码绑定;企业微信走 `robots.wecom` + 管理后台回调 URL,二者完全不同。
|
||||
- **个人微信二维码过期**:二维码约 5 分钟有效,过期需重新生成,不要一直扫旧码。
|
||||
- **用错了机器人类型**:在钉钉**群里**添加的「自定义」机器人(Webhook + 加签)**不能**用来做对话,本程序只支持**开放平台「企业内部应用」**里的机器人。
|
||||
- **只保存没重启**:在 CyberStrikeAI 里改完机器人配置后必须**重启应用**,否则长连接不会建立。
|
||||
- **只保存没重启**:钉钉/飞书改完配置后必须**重启应用**,否则长连接不会建立(个人微信扫码绑定会自动重启连接)。
|
||||
- **Client ID 抄错**:开放平台是 `504` 就填 `504`,不要填成 `5o4`;尽量用复制粘贴。
|
||||
- **钉钉只开了 HTTP 回调没开 Stream**:本程序通过 **Stream 长连接**收消息,开放平台里机器人的消息接收方式必须选 **Stream 模式**。
|
||||
- **应用没发布**:开放平台里修改了机器人或权限后,要在「版本管理与发布」里**发布新版本**,否则不生效。
|
||||
@@ -270,6 +485,7 @@ curl -X POST "http://localhost:8080/api/robot/test" \
|
||||
|
||||
## 十一、注意事项
|
||||
|
||||
- 钉钉、飞书均**仅处理文本消息**;其他类型(如图片、语音)会提示暂不支持或忽略。
|
||||
- 各平台均**仅处理文本消息**;其他类型(如图片、语音)会提示暂不支持或忽略。
|
||||
- 个人微信仅支持**私聊**,不支持群聊 @ 机器人。
|
||||
- 会话与 Web 端共用同一套对话数据:在机器人里创建的对话会在 Web 端「对话」列表中看到,反之亦然。
|
||||
- 机器人执行与 **Eino 单/多代理** 相同逻辑(`ProcessMessageForRobot`,含进度回调与过程详情入库),仅不向客户端推送 SSE,最后一次性回复钉钉/飞书/企业微信。默认 `robot_default_agent_mode: eino_single`。
|
||||
- 机器人执行与 **Eino 单/多代理** 相同逻辑(`ProcessMessageForRobot`,含进度回调与过程详情入库),仅不向客户端推送 SSE,最后一次性回复个人微信/钉钉/飞书/企业微信。默认 `robot_default_agent_mode: eino_single`。
|
||||
|
||||
+205
-14
@@ -2,7 +2,7 @@
|
||||
|
||||
[中文](robot.md)
|
||||
|
||||
This document explains how to chat with CyberStrikeAI from **DingTalk**, **Lark (Feishu)**, and **WeCom (Enterprise WeChat)** using long-lived connections or HTTP callbacks—no need to open a browser on the server. Following the steps below helps avoid common mistakes.
|
||||
This document explains how to chat with CyberStrikeAI from **personal WeChat**, **DingTalk**, **Lark (Feishu)**, and **WeCom (Enterprise WeChat)** using long-lived connections or HTTP callbacks—no need to open a browser on the server. Following the steps below helps avoid common mistakes.
|
||||
|
||||
---
|
||||
|
||||
@@ -11,11 +11,14 @@ This document explains how to chat with CyberStrikeAI from **DingTalk**, **Lark
|
||||
1. Log in to the CyberStrikeAI web UI.
|
||||
2. Open **System Settings** in the left sidebar.
|
||||
3. Click **Robot settings** (between “Basic” and “Security”).
|
||||
4. Enable the platform and fill in credentials (DingTalk: Client ID / Client Secret; Lark: App ID / App Secret).
|
||||
5. Click **Apply configuration** to save.
|
||||
6. **Restart the CyberStrikeAI process** (saving alone does not establish the connection).
|
||||
4. Configure per platform:
|
||||
- **Personal WeChat**: Open **WeChat / iLink** → **Generate QR code and bind**, then scan with WeChat (see [Section 3.4](#34-personal-wechat-wechat--ilink))
|
||||
- **DingTalk**: Enable and fill in Client ID / Client Secret
|
||||
- **Lark**: Enable and fill in App ID / App Secret
|
||||
5. Click **Apply configuration** to save (WeChat binding saves and enables automatically on success—usually no extra click needed)
|
||||
6. **Restart the CyberStrikeAI process** (DingTalk/Lark: saving alone does not establish the connection; WeChat auto-restarts the iLink poll after binding—usually no manual restart needed)
|
||||
|
||||
Settings are written to the `robots` section of `config.yaml`; you can also edit the file directly. **After changing DingTalk or Lark config, you must restart for the long-lived connection to take effect.**
|
||||
Settings are written to the `robots` section of `config.yaml`; you can also edit the file directly. **After changing DingTalk or Lark config, you must restart for the long-lived connection to take effect.** Personal WeChat binding automatically writes `robots.wechat` and restarts the iLink long poll.
|
||||
|
||||
---
|
||||
|
||||
@@ -23,9 +26,14 @@ Settings are written to the `robots` section of `config.yaml`; you can also edit
|
||||
|
||||
| Platform | Description |
|
||||
|----------------|-------------|
|
||||
| Personal WeChat| WeChat iLink protocol; scan QR in the web UI to bind, then long-poll for messages—**no public callback URL needed** |
|
||||
| DingTalk | Stream long-lived connection; the app connects to DingTalk to receive messages |
|
||||
| Lark (Feishu) | Long-lived connection; the app connects to Lark to receive messages |
|
||||
| WeCom (Qiye WX)| HTTP callback to receive messages; CyberStrikeAI replies via WeCom’s message sending API |
|
||||
| Telegram | Bot API long polling (`getUpdates`); **no public callback URL needed** |
|
||||
| Slack | Socket Mode (outbound WebSocket); **no public callback URL needed** |
|
||||
| Discord | Gateway WebSocket; **no public callback URL needed** |
|
||||
| QQ Bot | QQ Open Platform WebSocket (C2C / group @); **no public callback URL needed** |
|
||||
|
||||
Section 3 below describes, per platform, what to do in the developer console and which fields to copy into CyberStrikeAI.
|
||||
|
||||
@@ -148,9 +156,125 @@ In **Permission management** (权限管理), enable the following (names and ide
|
||||
|
||||
---
|
||||
|
||||
### 3.4 Personal WeChat (WeChat / iLink)
|
||||
|
||||
> Personal WeChat uses **“web QR binding + iLink long polling”**:
|
||||
> - Generate a QR code in the CyberStrikeAI web UI → scan and confirm with **WeChat on your phone**;
|
||||
> - On success, `robots.wechat` in `config.yaml` is updated automatically and iLink long polling starts (the app connects outbound to `ilinkai.weixin.qq.com`);
|
||||
> - **No** public callback URL on your server and **no** WeChat Open Platform app registration required.
|
||||
|
||||
**Personal WeChat vs WeCom**
|
||||
|
||||
| Item | Personal WeChat (iLink) | WeCom (Enterprise WeChat) |
|
||||
|------|-------------------------|---------------------------|
|
||||
| Use case | Private chat in personal WeChat | Custom app in WeCom |
|
||||
| Setup | QR scan in web UI | Admin console callback URL + Token |
|
||||
| Public IP needed? | No (outbound long poll only) | Yes (HTTPS callback reachable by WeCom) |
|
||||
| Config key | `robots.wechat` | `robots.wecom` |
|
||||
|
||||
**Binding steps (in order)**
|
||||
|
||||
1. **Log in to CyberStrikeAI web UI**
|
||||
**System settings** → **Robot settings** → click the **WeChat / iLink** card.
|
||||
|
||||
2. **(Optional) Enable “Enable WeChat robot”**
|
||||
You can skip this on first bind; it is checked automatically after a successful bind.
|
||||
|
||||
3. **Generate QR code**
|
||||
Click **“Generate QR code and bind”**. The QR code is valid for about **5 minutes**; regenerate if it expires.
|
||||
|
||||
4. **Scan and confirm in WeChat**
|
||||
- Scan the QR code with WeChat on your phone;
|
||||
- Complete confirmation on the phone;
|
||||
- If WeChat shows a **pairing code**, enter it on the web page and click **Submit** (only some accounts need this).
|
||||
|
||||
5. **Wait for binding to complete**
|
||||
When the page shows “Binding successful, WeChat robot enabled”, you’re done. `bot_token`, `ilink_bot_id`, etc. are saved to `config.yaml` and the iLink poll restarts automatically—**usually no manual service restart**.
|
||||
|
||||
6. **Test in WeChat**
|
||||
Open the **private chat** with the CyberStrikeAI bot in WeChat and send “帮助” (help) or any text.
|
||||
|
||||
**Field reference (WeChat)**
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| Enable WeChat robot | Starts iLink long polling when checked; auto-enabled after bind |
|
||||
| Generate QR code and bind | Starts the scan-to-bind flow |
|
||||
| **Advanced** (defaults are fine) | |
|
||||
| API Base URL | Default `https://ilinkai.weixin.qq.com` |
|
||||
| Bot Type | Default `3` |
|
||||
| Bot Agent | Default `CyberStrikeAI/1.0` |
|
||||
| iLink Bot ID | Filled automatically after bind (read-only) |
|
||||
|
||||
**How to use**
|
||||
|
||||
- **Private chat only**—send text directly; **no @ needed**.
|
||||
- Group @-bot is **not** supported (unlike DingTalk/Lark groups).
|
||||
- **Text messages only**; images, voice, etc. are ignored or not supported.
|
||||
|
||||
**Re-bind**
|
||||
|
||||
- To bind a different WeChat account, click **“Re-bind”** on the robot settings page and scan again.
|
||||
- If you see “This WeChat account is already bound”, that account was bound before.
|
||||
|
||||
**Common issues**
|
||||
|
||||
| Symptom | What to do |
|
||||
|---------|------------|
|
||||
| QR code expired | Click “Generate QR code and bind” again (~5 min TTL) |
|
||||
| Phone asks for a pairing code | Enter the digits shown in WeChat on the web page |
|
||||
| Bound but no replies | Check logs for `微信 iLink 长轮询已启动` and `微信收到消息`; ensure “Enable WeChat robot” is on |
|
||||
| No reply after sleep / network drop | Auto-reconnect in ~5–60 s; restart CyberStrikeAI if still stuck |
|
||||
| Cannot generate QR code | Ensure outbound HTTPS to `https://ilinkai.weixin.qq.com` |
|
||||
|
||||
---
|
||||
|
||||
### 3.5 Telegram
|
||||
|
||||
> Telegram uses **Bot API long polling** (`getUpdates`): the app connects outbound to `api.telegram.org`—**no public callback URL needed**.
|
||||
|
||||
1. Create a bot via **@BotFather** (`/newbot`) and copy the **Bot Token**.
|
||||
2. CyberStrikeAI → **System settings** → **Robot settings** → **Telegram**.
|
||||
3. Enable, paste the token, optionally allow group @ mentions → **Apply configuration**.
|
||||
|
||||
---
|
||||
|
||||
### 3.6 Slack
|
||||
|
||||
> Slack uses **Socket Mode** (outbound WebSocket): requires **Bot Token (xoxb-)** and **App-Level Token (xapp-)** with `connections:write`.
|
||||
|
||||
1. Create an app at [api.slack.com](https://api.slack.com/apps) → enable **Socket Mode**.
|
||||
2. Create an App-Level Token; install the app to get a Bot Token.
|
||||
3. Subscribe to `message.im` and `app_mention` events.
|
||||
4. Paste both tokens in CyberStrikeAI → **Apply configuration**.
|
||||
|
||||
---
|
||||
|
||||
### 3.7 Discord
|
||||
|
||||
> Discord uses **Gateway WebSocket**—**no public callback URL needed**.
|
||||
|
||||
1. [Discord Developer Portal](https://discord.com/developers/applications) → create app → **Bot** → copy **Token**.
|
||||
2. Enable **Message Content Intent** under Privileged Gateway Intents.
|
||||
3. Invite the bot with `Send Messages` permission.
|
||||
4. Paste token in CyberStrikeAI; optionally allow guild @ mentions → **Apply configuration**.
|
||||
|
||||
---
|
||||
|
||||
### 3.8 QQ Bot
|
||||
|
||||
> QQ Bot uses **QQ Open Platform WebSocket** (official `botgo` SDK) for C2C and group @—**no public callback URL needed**.
|
||||
|
||||
1. Create a bot at [q.qq.com](https://q.qq.com) → get **App ID** and **Client Secret**.
|
||||
2. Add sandbox testers before going live.
|
||||
3. Subscribe to C2C and group @ events (WebSocket).
|
||||
4. Fill in CyberStrikeAI; use **Sandbox** for testing → **Apply configuration**.
|
||||
|
||||
---
|
||||
|
||||
## 4. Bot commands
|
||||
|
||||
Send these **text commands** to the bot in DingTalk or Lark (text only):
|
||||
Send these **text commands** to the bot on any connected platform (text only):
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
@@ -172,15 +296,24 @@ Any other text is sent to the AI as a user message, same as in the web UI (e.g.
|
||||
|
||||
## 5. How to use (do I need to @ the bot?)
|
||||
|
||||
- **Direct chat (recommended)**: In DingTalk or Lark, **search for the bot and open a direct chat**. Type “帮助” or any message; **no @ needed**.
|
||||
- **Group chat**: If the bot is in a group, only messages that **@ the bot** are received and answered; other group messages are ignored.
|
||||
- **Personal WeChat**: Send directly in the **private chat** with the bot; **no @ needed** (group chat not supported).
|
||||
- **DingTalk / Lark direct chat (recommended)**: **Search for the bot and open a direct chat**. Type “帮助” or any message; **no @ needed**.
|
||||
- **DingTalk / Lark group chat**: If the bot is in a group, only messages that **@ the bot** are received and answered; other group messages are ignored.
|
||||
|
||||
Summary: **Direct chat** — just send; **in a group** — @ the bot first, then send.
|
||||
Summary: **Personal WeChat and direct chat**—just send; **DingTalk/Lark in a group**—@ the bot first, then send.
|
||||
|
||||
---
|
||||
|
||||
## 6. Recommended flow (so you don’t skip steps)
|
||||
|
||||
**Personal WeChat (simplest—no open platform)**
|
||||
|
||||
1. CyberStrikeAI web UI → System settings → Robot settings → **WeChat / iLink** → **Generate QR code and bind**.
|
||||
2. Scan with WeChat and confirm (enter pairing code on the web page if prompted).
|
||||
3. After binding, send “帮助” in the WeChat private chat to test.
|
||||
|
||||
**DingTalk / Lark**
|
||||
|
||||
1. **In the open platform**: Complete app creation, copy credentials, enable the bot (DingTalk: **Stream mode**), set permissions, and publish (Section 3).
|
||||
2. **In CyberStrikeAI**: System settings → Robot settings → Enable the platform, paste Client ID/App ID and Client Secret/App Secret → **Apply configuration**.
|
||||
3. **Restart the CyberStrikeAI process** (otherwise the long-lived connection is not established).
|
||||
@@ -196,6 +329,14 @@ Example `robots` section in `config.yaml`:
|
||||
|
||||
```yaml
|
||||
robots:
|
||||
wechat: # Personal WeChat iLink (auto-filled after QR bind; usually no manual edit)
|
||||
enabled: true
|
||||
bot_token: "your_bot_token@im.bot:..."
|
||||
ilink_bot_id: "your_bot_id@im.bot"
|
||||
ilink_user_id: "your_user_id@im.wechat"
|
||||
base_url: "https://ilinkai.weixin.qq.com"
|
||||
bot_type: "3"
|
||||
bot_agent: "CyberStrikeAI/1.0"
|
||||
dingtalk:
|
||||
enabled: true
|
||||
client_id: "your_dingtalk_app_key"
|
||||
@@ -205,9 +346,33 @@ robots:
|
||||
app_id: "your_lark_app_id"
|
||||
app_secret: "your_lark_app_secret"
|
||||
verify_token: ""
|
||||
wecom:
|
||||
enabled: false
|
||||
corp_id: ""
|
||||
agent_id: 0
|
||||
token: ""
|
||||
encoding_aes_key: ""
|
||||
secret: ""
|
||||
telegram:
|
||||
enabled: false
|
||||
bot_token: ""
|
||||
allow_group_messages: false
|
||||
slack:
|
||||
enabled: false
|
||||
bot_token: ""
|
||||
app_token: ""
|
||||
discord:
|
||||
enabled: false
|
||||
bot_token: ""
|
||||
allow_guild_messages: false
|
||||
qq:
|
||||
enabled: false
|
||||
app_id: ""
|
||||
client_secret: ""
|
||||
sandbox: true
|
||||
```
|
||||
|
||||
**Restart the app** after changes; the long-lived connection is created at startup.
|
||||
After changing DingTalk/Lark/WeCom/Telegram/Slack/Discord/QQ settings, **Apply configuration** restarts the corresponding connections. Personal WeChat QR binding saves and restarts automatically.
|
||||
|
||||
---
|
||||
|
||||
@@ -232,7 +397,30 @@ API: `POST /api/robot/test` (requires login). Body: `{"platform":"optional","use
|
||||
|
||||
---
|
||||
|
||||
## 9. DingTalk: no response when sending messages
|
||||
## 9. Troubleshooting: no response when sending messages
|
||||
|
||||
### 9.1 Personal WeChat
|
||||
|
||||
Check in this order:
|
||||
|
||||
1. **Binding completed?**
|
||||
Robot settings should show “Connected” or a bound Bot ID; `robots.wechat.bot_token` in `config.yaml` must not be empty.
|
||||
|
||||
2. **Enabled?**
|
||||
Confirm “Enable WeChat robot” is checked; restart CyberStrikeAI if you just changed settings.
|
||||
|
||||
3. **Application logs**
|
||||
- On startup: `微信 iLink 长轮询已启动`;
|
||||
- After sending a message: `微信收到消息`; if missing, binding may have failed or `bot_token` is invalid—try **Re-bind**.
|
||||
- `微信 iLink 长轮询异常,将自动重连`: wait for auto-reconnect or restart.
|
||||
|
||||
4. **Network**
|
||||
The server must reach `https://ilinkai.weixin.qq.com` (outbound HTTPS). If QR generation fails, check this first.
|
||||
|
||||
5. **After sleep or network drop**
|
||||
Same as DingTalk/Lark: **auto-reconnect** in ~5–60 s; restart if still no response.
|
||||
|
||||
### 9.2 DingTalk
|
||||
|
||||
Check in this order:
|
||||
|
||||
@@ -257,8 +445,10 @@ Check in this order:
|
||||
|
||||
## 10. Common pitfalls
|
||||
|
||||
- **Personal WeChat vs WeCom**: Personal WeChat uses `robots.wechat` + web QR bind; WeCom uses `robots.wecom` + admin callback URL—they are completely different.
|
||||
- **WeChat QR expired**: QR codes last ~5 minutes; regenerate instead of reusing an old one.
|
||||
- **Wrong bot type**: The “Custom” bot added in a DingTalk **group** (Webhook + sign secret) **cannot** be used for two-way chat. Only the **enterprise internal app** bot from the open platform is supported.
|
||||
- **Saved but not restarted**: After changing robot settings in CyberStrikeAI you **must restart** the app, or the long-lived connection will not be established.
|
||||
- **Saved but not restarted**: After changing DingTalk/Lark robot settings you **must restart** the app (WeChat QR bind restarts the connection automatically).
|
||||
- **Client ID typo**: If the platform shows `504`, use `504` (not `5o4`); prefer copy/paste.
|
||||
- **DingTalk: only HTTP callback, no Stream**: This app receives messages via **Stream**. In the open platform, message reception must be **Stream mode**.
|
||||
- **App not published**: After changing the bot or permissions in the open platform, **publish a new version** under “Version management and release”, or changes won’t apply.
|
||||
@@ -267,6 +457,7 @@ Check in this order:
|
||||
|
||||
## 11. Notes
|
||||
|
||||
- DingTalk and Lark: **text messages only**; other types (e.g. image, voice) are not supported and may be ignored.
|
||||
- All platforms: **text messages only**; other types (e.g. image, voice) are not supported and may be ignored.
|
||||
- Personal WeChat: **private chat only**—group @-bot is not supported.
|
||||
- Conversations are shared with the web UI: conversations created from the bot appear in the web “Conversations” list and vice versa.
|
||||
- Bot execution uses the same **Eino single/multi-agent** path as the web UI (`ProcessMessageForRobot`, with progress callbacks and process details stored in the DB); only the final reply is sent back to DingTalk/Lark in one message (no SSE). Default: `robot_default_agent_mode: eino_single`.
|
||||
- Bot execution uses the same **Eino single/multi-agent** path as the web UI (`ProcessMessageForRobot`, with progress callbacks and process details stored in the DB); only the final reply is sent back to personal WeChat/DingTalk/Lark/WeCom in one message (no SSE). Default: `robot_default_agent_mode: eino_single`.
|
||||
|
||||
Reference in New Issue
Block a user