Files
chatgpt-on-wechat/docs/en/channels/wechatmp.mdx
2026-02-27 12:10:16 +08:00

59 lines
1.9 KiB
Plaintext

---
title: WeChat Official Account
description: Integrate CowAgent with WeChat Official Accounts
---
# WeChat Official Account
CowAgent supports both personal subscription accounts and enterprise service accounts.
| Type | Requirements | Features |
| --- | --- | --- |
| **Personal Subscription** | Available to individuals | Users must send a message to retrieve replies |
| **Enterprise Service** | Enterprise registration with verified customer service API | Can proactively push replies to users |
<Note>
Official Accounts only support server and Docker deployment. Install extended dependencies: `pip3 install -r requirements-optional.txt`
</Note>
## Personal Subscription Account
Add the following to `config.json`:
```json
{
"channel_type": "wechatmp",
"wechatmp_app_id": "YOUR_APP_ID",
"wechatmp_app_secret": "YOUR_APP_SECRET",
"wechatmp_aes_key": "",
"wechatmp_token": "YOUR_TOKEN",
"wechatmp_port": 80
}
```
### Setup Steps
1. Get parameters from [WeChat Official Account Platform](https://mp.weixin.qq.com/) under **Settings & Development → Basic Configuration → Server Configuration**
2. Enable developer secret and add server IP to the whitelist
3. Start the program (listens on port 80)
4. In the official account console, **enable server configuration** with URL format `http://{HOST}/wx`
## Enterprise Service Account
The setup is largely identical to the subscription account, with these differences:
1. Register an enterprise service account and complete WeChat verification, ensure **Customer Service API** permission is granted
2. Set `"channel_type": "wechatmp_service"` in `config.json`
3. Replies can be proactively pushed to users without them having to manually retrieve them
```json
{
"channel_type": "wechatmp_service",
"wechatmp_app_id": "YOUR_APP_ID",
"wechatmp_app_secret": "YOUR_APP_SECRET",
"wechatmp_aes_key": "",
"wechatmp_token": "YOUR_TOKEN",
"wechatmp_port": 80
}
```