docs(wechatcom_kf): add web console onboarding tab

This commit is contained in:
6vision
2026-05-27 21:53:54 +08:00
parent 2fa6343fe5
commit 6721dbdbcc
4 changed files with 109 additions and 62 deletions

View File

@@ -713,8 +713,9 @@ class WebChannel(ChatChannel):
logger.info("[WebChannel] 5. dingtalk - 钉钉")
logger.info("[WebChannel] 6. wecom_bot - 企微智能机器人")
logger.info("[WebChannel] 7. wechatcom_app - 企微自建应用")
logger.info("[WebChannel] 8. wechatmp - 个人公众号")
logger.info("[WebChannel] 9. wechatmp_service - 企业公众号")
logger.info("[WebChannel] 8. wechatcom_kf - 微信客服")
logger.info("[WebChannel] 9. wechatmp - 个人公众号")
logger.info("[WebChannel] 10. wechatmp_service - 企业公众号")
logger.info("[WebChannel] ✅ Web控制台已运行")
logger.info(f"[WebChannel] 🌐 本地访问: http://localhost:{port}")
if is_public_bind:
@@ -1271,6 +1272,19 @@ class ChannelsHandler:
{"key": "wechatcomapp_port", "label": "Port", "type": "number", "default": 9898},
],
}),
("wechatcom_kf", {
"label": {"zh": "微信客服", "en": "WeCom Customer Service"},
"icon": "fa-headset",
"color": "emerald",
"fields": [
# wechatcom_corp_id is shared with wechatcom_app — same key, same value.
{"key": "wechatcom_corp_id", "label": "Corp ID", "type": "text"},
{"key": "wechatcom_kf_secret", "label": "Secret", "type": "secret"},
{"key": "wechatcom_kf_token", "label": "Token", "type": "secret"},
{"key": "wechatcom_kf_aes_key", "label": "AES Key", "type": "secret"},
{"key": "wechatcom_kf_port", "label": "Port", "type": "number", "default": 9888},
],
}),
("wechatmp", {
"label": {"zh": "公众号", "en": "WeChat MP"},
"icon": "fa-comment-dots",

View File

@@ -45,30 +45,41 @@ description: 将 CowAgent 接入微信客服WeCom Customer Service
## 三、配置和运行
在 `config.json` 中添加以下配置(各参数与企业微信后台的对应关系见上方截图
填入上一步收集到的 4 个字段Corp ID / Secret / Token / EncodingAESKey
```json
{
<Tabs>
<Tab title="Web 控制台">
启动 Cow 项目后打开 Web 控制台,选择 **通道** 菜单,点击 **接入通道**,选择 **微信客服**,依次填入 Corp ID / Secret / Token / AES Key端口默认 9888可改点击接入即可。
<img src="https://cdn.link-ai.tech/doc/cow-weixinkefu-web-control.png" width="800"/>
</Tab>
<Tab title="配置文件">
在 `config.json` 中添加以下配置(各参数与企业微信后台的对应关系见上方截图):
```json
{
"channel_type": "wechatcom_kf",
"wechatcom_corp_id": "YOUR_CORP_ID",
"wechatcom_kf_secret": "YOUR_SECRET",
"wechatcom_kf_token": "YOUR_TOKEN",
"wechatcom_kf_aes_key": "YOUR_AES_KEY",
"wechatcom_kf_port": 9888
}
```
}
```
| 参数 | 说明 |
| --- | --- |
| `wechatcom_corp_id` | 企业 ID |
| `wechatcom_kf_secret` | 绑定到微信客服的那个企微自建应用的 Secret |
| `wechatcom_kf_token` | API 接收配置中的 Token |
| `wechatcom_kf_aes_key` | API 接收配置中的 EncodingAESKey |
| `wechatcom_kf_port` | 监听端口,默认 9888 |
| 参数 | 说明 |
| --- | --- |
| `wechatcom_corp_id` | 企业 ID |
| `wechatcom_kf_secret` | 绑定到微信客服的那个企微自建应用的 Secret |
| `wechatcom_kf_token` | API 接收配置中的 Token |
| `wechatcom_kf_aes_key` | API 接收配置中的 EncodingAESKey |
| `wechatcom_kf_port` | 监听端口,默认 9888 |
</Tab>
</Tabs>
配置完成后启动程序。当日志中出现 `Listening on http://0.0.0.0:9888/wxkf/` 时,说明程序运行成功,需要将该端口对外开放(如在云服务器安全组中放行)。
接入完成后启动程序Web 控制台方式会自动重启),日志中出现 `Listening on http://0.0.0.0:9888/wxkf/` 表示运行成功,需要将该端口对外开放(如在云服务器安全组中放行)。
程序启动后,回到企业微信「接收消息 → 设置API接收」将回调 URL 填为 `http://<your-host>:9888/wxkf/`,点击保存。保存成功后还需将服务器 IP 添加到 **企业可信IP** 中,否则无法收发消息:
接着回到企业微信「接收消息 → 设置API接收」将回调 URL 填为 `http://<your-host>:9888/wxkf/`,点击保存。保存成功后还需将服务器 IP 添加到 **企业可信IP** 中,否则无法收发消息:
<img src="https://cdn.link-ai.tech/doc/wechat-com_config.png" width="600"/>

View File

@@ -45,30 +45,41 @@ Required resources:
## 3. Configuration and Run
Add the following configuration to `config.json` (each parameter maps to a field shown in the screenshots above):
Fill in the 4 fields collected from the previous step (Corp ID / Secret / Token / EncodingAESKey):
```json
{
<Tabs>
<Tab title="Web Console">
Start the Cow project and open the Web Console. Go to the **Channels** menu, click **Connect**, choose **WeCom Customer Service**, fill in Corp ID / Secret / Token / AES Key (port defaults to 9888, configurable), and click Connect.
<img src="https://cdn.link-ai.tech/doc/cow-weixinkefu-web-control.png" width="800"/>
</Tab>
<Tab title="Config File">
Add the following configuration to `config.json` (each parameter maps to a field shown in the screenshots above):
```json
{
"channel_type": "wechatcom_kf",
"wechatcom_corp_id": "YOUR_CORP_ID",
"wechatcom_kf_secret": "YOUR_SECRET",
"wechatcom_kf_token": "YOUR_TOKEN",
"wechatcom_kf_aes_key": "YOUR_AES_KEY",
"wechatcom_kf_port": 9888
}
```
}
```
| Parameter | Description |
| --- | --- |
| `wechatcom_corp_id` | Corp ID |
| `wechatcom_kf_secret` | Secret of the WeCom custom app bound to Customer Service |
| `wechatcom_kf_token` | Token from the API reception config |
| `wechatcom_kf_aes_key` | EncodingAESKey from the API reception config |
| `wechatcom_kf_port` | Listening port, default 9888 |
| Parameter | Description |
| --- | --- |
| `wechatcom_corp_id` | Corp ID |
| `wechatcom_kf_secret` | Secret of the WeCom custom app bound to Customer Service |
| `wechatcom_kf_token` | Token from the API reception config |
| `wechatcom_kf_aes_key` | EncodingAESKey from the API reception config |
| `wechatcom_kf_port` | Listening port, default 9888 |
</Tab>
</Tabs>
After configuration, start the program. When the log shows `Listening on http://0.0.0.0:9888/wxkf/`, the program is running successfully. You need to open this port externally (e.g., allow it in the cloud server security group).
After connecting, start the program (the Web Console method restarts the channel automatically). When the log shows `Listening on http://0.0.0.0:9888/wxkf/`, the program is running successfully. You need to open this port externally (e.g., allow it in the cloud server security group).
Once the program is running, go back to **Receive Messages → Set API Reception** in the WeCom console and set the callback URL to `http://<your-host>:9888/wxkf/`, then click Save. After saving successfully, you also need to add the server IP to **Enterprise Trusted IPs**, otherwise messages cannot be sent or received:
Then go back to **Receive Messages → Set API Reception** in the WeCom console and set the callback URL to `http://<your-host>:9888/wxkf/`, then click Save. After saving successfully, you also need to add the server IP to **Enterprise Trusted IPs**, otherwise messages cannot be sent or received:
<img src="https://cdn.link-ai.tech/doc/wechat-com_config.png" width="600"/>

View File

@@ -45,30 +45,41 @@ WeCom の自建アプリを「微信客服WeCom Customer Service」アカ
## 3. 設定と起動
`config.json` に以下の設定を追加します(各パラメータと WeCom コンソールの対応関係は上のスクリーンショットを参照してください)
前のステップで収集した 4 つのフィールドCorp ID / Secret / Token / EncodingAESKeyを入力します
```json
{
<Tabs>
<Tab title="Web コンソール">
Cow プロジェクトを起動した後、Web コンソールを開きます。**チャネル** メニューを選択し、**接入チャネル** をクリックし、**微信客服** を選択して、Corp ID / Secret / Token / AES Key を入力し(ポートはデフォルト 9888、変更可能、接入をクリックします。
<img src="https://cdn.link-ai.tech/doc/cow-weixinkefu-web-control.png" width="800"/>
</Tab>
<Tab title="設定ファイル">
`config.json` に以下の設定を追加します(各パラメータと WeCom コンソールの対応関係は上のスクリーンショットを参照してください):
```json
{
"channel_type": "wechatcom_kf",
"wechatcom_corp_id": "YOUR_CORP_ID",
"wechatcom_kf_secret": "YOUR_SECRET",
"wechatcom_kf_token": "YOUR_TOKEN",
"wechatcom_kf_aes_key": "YOUR_AES_KEY",
"wechatcom_kf_port": 9888
}
```
}
```
| パラメータ | 説明 |
| --- | --- |
| `wechatcom_corp_id` | 企業 ID |
| `wechatcom_kf_secret` | カスタマーサービスにバインドした企業微信自建アプリの Secret |
| `wechatcom_kf_token` | API 受信設定の Token |
| `wechatcom_kf_aes_key` | API 受信設定の EncodingAESKey |
| `wechatcom_kf_port` | リスンポート、デフォルトは 9888 |
| パラメータ | 説明 |
| --- | --- |
| `wechatcom_corp_id` | 企業 ID |
| `wechatcom_kf_secret` | カスタマーサービスにバインドした企業微信自建アプリの Secret |
| `wechatcom_kf_token` | API 受信設定の Token |
| `wechatcom_kf_aes_key` | API 受信設定の EncodingAESKey |
| `wechatcom_kf_port` | リスンポート、デフォルトは 9888 |
</Tab>
</Tabs>
設定後、プログラムを起動します。ログに `Listening on http://0.0.0.0:9888/wxkf/` と表示されれば、プログラムは正常に動作しています。このポートを外部に公開する必要があります(例:クラウドサーバーのセキュリティグループで許可します)。
接入完了後、プログラムを起動しますWeb コンソール方式ではチャネルが自動的に再起動されます)。ログに `Listening on http://0.0.0.0:9888/wxkf/` と表示されれば、プログラムは正常に動作しています。このポートを外部に公開する必要があります(例:クラウドサーバーのセキュリティグループで許可します)。
プログラム起動後、WeCom 管理コンソールの **メッセージ受信 → API 受信設定** に戻り、コールバック URL に `http://<your-host>:9888/wxkf/` を入力して保存します。保存が成功したら、サーバー IP を **企業の信頼済み IP** に追加する必要もあります。追加しないとメッセージの送受信ができません:
続いて、WeCom 管理コンソールの **メッセージ受信 → API 受信設定** に戻り、コールバック URL に `http://<your-host>:9888/wxkf/` を入力して保存します。保存が成功したら、サーバー IP を **企業の信頼済み IP** に追加する必要もあります。追加しないとメッセージの送受信ができません:
<img src="https://cdn.link-ai.tech/doc/wechat-com_config.png" width="600"/>