Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

Commit 3b53121

Browse files
author
astrbot-docs-agent[bot]
committed
docs: update for AstrBotDevs/AstrBot#5224
1 parent 3b58129 commit 3b53121

File tree

2 files changed

+60
-43
lines changed

2 files changed

+60
-43
lines changed
Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,91 @@
1-
# AstrBot 接入微信公众平台
1+
# AstrBot Integration with WeChat Official Account
22

3-
AstrBot 支持接入微信公众平台(版本 >= v3.5.8),并以微信公众号的形式接入,届时,您可以直接在微信公众号聊天界面中与 AstrBot 进行交互。
3+
AstrBot supports integration with the WeChat Official Account platform (version >= v3.5.8). You can interact with AstrBot directly through the WeChat Official Account chat interface.
44

5-
## 准备接入
5+
## Preparation
66

7-
步骤:
7+
Steps:
88

9-
1. 进入 AstrBot 的管理面板
10-
2. 点击左边栏 `机器人`
11-
3. 然后在右边的界面中,点击 `+ 创建机器人`
12-
4. 选择 `weixin_official_account(微信公众平台)`
9+
1. Enter the AstrBot management panel.
10+
2. Click `Bot` in the left sidebar.
11+
3. In the right interface, click `+ Create Bot`.
12+
4. Select `weixin_official_account (WeChat Official Account)`.
1313

14-
这将弹出一个对话框。接下来,不要关闭页面,转移到下一步。
14+
A dialog box will pop up. Do not close the page; move to the next step.
1515

16-
## 创建/登入微信公众平台
16+
## Create/Log in to WeChat Official Account Platform
1717

18-
进入[微信公众平台](https://mp.weixin.qq.com/),如果您需要接入现有的公众号请直接登录即可,如果没有,请点击立即注册然后选择 `公众号` 并填写相关信息注册。
18+
Go to the [WeChat Official Account Platform](https://mp.weixin.qq.com/). If you want to connect an existing account, log in directly. If not, click "Register Now", select "Official Account", and fill in the relevant information to register.
1919

2020
> [!NOTE]
21-
> 新注册的公众号需要花费 1-2 天审核,期间不能使用。
21+
> Newly registered accounts require 1-2 days for review and cannot be used during this period.
2222
23-
## 设置回调服务
23+
## Set up Callback Service
2424

25-
点击 `设置与开发` -> `开发接口管理`。界面如下:
25+
Click `Settings & Development` -> `Development Interface Management`. The interface is as follows:
2626

27-
![开发接口管理](https://files.astrbot.app/docs/source/images/weixin-official-account/image.png)
27+
![Development Interface Management](https://files.astrbot.app/docs/source/images/weixin-official-account/image.png)
2828

29-
记录开发者 ID(AppID) 和开发者密码(AppSecret),分别填入 AstrBot 配置的 `appid` `secret` 处。
29+
Record the Developer ID (AppID) and Developer Password (AppSecret), and fill them into the `appid` and `secret` fields in the AstrBot configuration.
3030

31-
找到 IP白名单,点击查看,然后添加你的公网 IP 地址。如果有多个公网 IP 地址,换行分隔。
31+
Find the IP Whitelist, click View, and add your public IP address. If there are multiple public IP addresses, separate them with new lines.
3232

33-
找到下方的服务器配置,然后点击修改配置。
33+
Find the Server Configuration below and click "Modify Configuration".
3434

35+
`Token` is filled in by yourself. Please enter any string with a length of 3-32 characters. Fill the same string into the `token` field in the AstrBot configuration (they must be identical).
3536

36-
`Token` 由自己填写,请随意填写一个字符串,长度 3-32 位。并同样填入 AstrBot 配置的 `token` 处(一定要相同)。
37+
`EncodingAESKey`: Click "Random Generate" and copy it to the `encoding_aes_key` field in the AstrBot configuration.
3738

38-
`EncodingAESKey` 请点击随机生成,然后复制到 AstrBot 配置的 `encoding_aes_key` 处。
39+
It is recommended to keep `Unified Webhook Mode (unified_webhook_mode)` enabled.
3940

40-
建议保持 `统一 Webhook 模式 (unified_webhook_mode)` 为开启状态。
41+
Now you should have filled in all the configuration items for AstrBot to connect to the WeChat Official Account platform. Click Save at the bottom right of the AstrBot configuration page and wait for AstrBot to restart.
4142

42-
现在应该已经填完 AstrBot 连接到微信公众平台的所有配置项。点击 AstrBot 配置页右下角保存,等待 AstrBot 重启。
43+
`URL` filling:
4344

44-
`URL` 填写:
45-
46-
- 如果开启了 `统一 Webhook 模式`,点击保存之后,AstrBot 将会自动为你生成唯一的 Webhook 回调链接,你可以在日志中或者 WebUI 的机器人页的卡片上找到,将该链接填入 URL 处。
45+
- If `Unified Webhook Mode` is enabled, after clicking Save, AstrBot will automatically generate a unique Webhook callback link for you. You can find this link in the logs or on the bot card in the WebUI. Fill this link into the URL field.
4746

4847
![unified_webhook](https://files.astrbot.app/docs/source/images/use/unified-webhook.png)
4948

50-
- 如果没有开启 `统一 Webhook 模式`,请填入 `http://你的域名/callback/command`
49+
- If `Unified Webhook Mode` is not enabled, please enter `http://your-domain/callback/command`.
50+
51+
> Note ⚠️: Only ports 80 or 443 are supported. You may need to purchase a domain and reverse proxy the traffic to port `6185` (if Unified Webhook Mode is enabled) or `6194` (if not enabled) on the server where AstrBot is located, or change the port to 80 (ensure no other software is using port 80).
52+
53+
Select `Security Mode` for the message encryption method.
54+
55+
Wait a moment and click `Submit`. If everything is correct, it will show `Submitted successfully`.
5156

52-
> 注意⚠️:仅支持 80 或者 443 端口。您可能需要购买域名,然后反向代理流量到 AstrBot 所在服务器的 `6185` 端口(如果开启了统一 Webhook 模式)或 `6194` 端口(如果没有开启统一 Webhook 模式),或者将端口改成 80 端口(注意服务器需要没有软件在占用 80 端口)。
57+
## Message Reply Mechanism
5358

54-
消息加解密方式请选中 `安全模式`
59+
Due to the strict **5-second response time limit** for passive replies on the WeChat Official Account platform, AstrBot has optimized this process:
5560

56-
等待片刻,点击 `提交`。如果一切无误,会显示 `提交成功`
61+
1. **Timeout Placeholder**: If the AI takes longer than 5 seconds to respond, AstrBot will first return a placeholder message (e.g., `【Thinking about '...', reply any text to try getting the response】`) to prevent the WeChat server from reporting a timeout error.
62+
2. **Message Buffering**: The response generated by the AI will be stored in a buffer.
63+
3. **Retrieve Subsequent Replies**: When you see a placeholder message or a prompt saying "Subsequent messages are still buffering", please **send any text** (e.g., a dot) to the account. AstrBot will then retrieve and send the next segment of the reply from the buffer.
64+
4. **Long Text Chunking**: Long texts are automatically split into chunks of approximately 1024 characters to ensure successful delivery.
5765

58-
## 测试
66+
## Testing
5967

60-
点击左下角你的账号头像,点击账号详情,找到 `二维码`,扫码进入到公众号聊天界面,发送 `help`,看看 AstrBot 是否能够回复。
68+
Click your account avatar in the bottom left corner, click Account Details, find the `QR Code`, scan it to enter the chat interface, and send `help` to see if AstrBot can reply.
6169

62-
如果可以回复,说明接入成功。
70+
If it replies, the integration is successful.
6371

6472
> [!NOTE]
65-
> 如果没有回复,并且控制台报错 `ip xxxxx not in whitelist`,说明你没有添加公网 IP 地址到微信公众平台的 IP 白名单中。如果确认添加了,那请等待若干分钟以让微信服务器更新。
73+
> If there is no reply and the console reports `ip xxxxx not in whitelist`, it means you haven't added the public IP address to the WeChat Official Account platform's IP whitelist. If you are sure it has been added, please wait a few minutes for the WeChat server to update.
6674
67-
## 反向代理(自定义 API BASE)
75+
## Reverse Proxy (Custom API BASE)
6876

69-
AstrBot 支持自定义企业微信的终结点以适应家庭 ip 没有固定的公网 IP 问题。
77+
AstrBot supports custom endpoints for WeChat to adapt to the issue of not having a fixed public IP for home IPs.
7078

71-
只需要将您的自定义地址填入 `api_base_url` 即可。
79+
Just fill your custom address into `api_base_url`.
7280

73-
> 如果您没有公网 ip 当然也可以购买一台服务器,推荐 阿里云 的 99 元/年的服务器。
81+
> If you don't have a public IP, you can also purchase a server.
7482
75-
## 语音输入
83+
## Voice Input
7684

77-
为了语音输入,需要你的电脑上安装有 `ffmpeg`
85+
For voice input, you need to have `ffmpeg` installed on your computer.
7886

79-
linux 用户可以使用 `apt install ffmpeg` 安装。
87+
Linux users can install it using `apt install ffmpeg`.
8088

81-
windows 用户可以在 [ffmpeg 官网](https://ffmpeg.org/download.html) 下载安装。
89+
Windows users can download and install it from the [ffmpeg official website](https://ffmpeg.org/download.html).
8290

83-
mac 用户可以使用 `brew install ffmpeg` 安装。
91+
Mac users can install it using `brew install ffmpeg`.

zh/deploy/platform/weixin-official-account.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ AstrBot 支持接入微信公众平台(版本 >= v3.5.8),并以微信公
5555

5656
等待片刻,点击 `提交`。如果一切无误,会显示 `提交成功`
5757

58+
## 消息回复机制说明
59+
60+
由于微信公众平台对被动回复有严格的 **5 秒响应时间限制**,AstrBot 针对此限制进行了优化:
61+
62+
1. **超时占位符**:如果 AI 响应时间超过 5 秒,AstrBot 会先返回一个占位消息(例如:`【正在思考...,回复任意文字尝试获取回复】`),以防止微信服务器因超时报错。
63+
2. **消息缓冲**:AI 生成的回复会被存储在缓冲区中。
64+
3. **获取后续回复**:当看到占位消息或提示“后续消息还在缓冲中”时,请**发送任意文字**(如一个句号)给公众号,AstrBot 将会从缓冲区中取出并发送下一段回复。
65+
4. **长文本分片**:长文本会被自动切分为约 1024 字符的分片,以确保发送成功。
66+
5867
## 测试
5968

6069
点击左下角你的账号头像,点击账号详情,找到 `二维码`,扫码进入到公众号聊天界面,发送 `help`,看看 AstrBot 是否能够回复。
@@ -80,4 +89,4 @@ linux 用户可以使用 `apt install ffmpeg` 安装。
8089

8190
windows 用户可以在 [ffmpeg 官网](https://ffmpeg.org/download.html) 下载安装。
8291

83-
mac 用户可以使用 `brew install ffmpeg` 安装。
92+
mac 用户可以使用 `brew install ffmpeg` 安装。

0 commit comments

Comments
 (0)