docs: add README.md for wechatcomapp channel

This commit is contained in:
lanvent
2023-04-20 08:43:17 +08:00
parent d2bf90c6c7
commit 3e9e8d442a
2 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
> 详细文档暂无
## 自建应用
- 在企业微信工作台自建应用
建立应用后点击通过API接收消息设置服务器地址服务器地址是`http://url:port/wxcomapp`的形式,也可以不用域名,比如 `http://ip:port/wxcomapp`
- 修改配置
在主目录下的`config.json`中填写以下配置项
```python
# wechatcom的通用配置
"wechatcom_corp_id": "", # 企业微信公司的corpID
# wechatcomapp的配置
"wechatcomapp_token": "", # 企业微信app的token
"wechatcomapp_port": 9898, # 企业微信app的服务端口,不需要端口转发
"wechatcomapp_secret": "", # 企业微信app的secret
"wechatcomapp_agent_id": "", # 企业微信app的agent_id
"wechatcomapp_aes_key": "", # 企业微信app的aes_key
```
- 运行程序
```python app.py```
在设置服务器页面点击保存
- 添加可信IP
在自建应用管理页下方将服务器的IP添加到可信IP

View File

@@ -43,7 +43,7 @@ class WechatComAppChannel(ChatChannel):
def startup(self):
# start message listener
urls = ("/wxcom", "channel.wechatcom.wechatcomapp_channel.Query")
urls = ("/wxcomapp", "channel.wechatcom.wechatcomapp_channel.Query")
app = web.application(urls, globals(), autoreload=False)
port = conf().get("wechatcomapp_port", 8080)
web.httpserver.runsimple(app.wsgifunc(), ("0.0.0.0", port))