系统设置
企微API配置
修改后点击保存按钮生效,也可通过环境变量 WEWORK_HOST, WEWORK_PORT 设置默认值
API Key管理
| 名称 | 密钥 | 状态 | 操作 |
|---|---|---|---|
| 自动采购通知 | 05b23a48...63d3 | 启用 |
第三方API调用说明
1. 获取模板列表
GET /api/external/templates/
Headers:
X-API-Key: your_api_key
2. 发送消息
POST /api/external/send/
Headers:
X-API-Key: your_api_key
Content-Type: application/json
Body:
{
"template_id": 1,
"user_id": "用户ID或群ID",
"params": {
"name": "张三",
"order_id": "12345"
}
}
3. 响应格式
{
"errno": 0,
"errmsg": "OK",
"data": null
}
4. Python调用示例
import requests
url = "http://your-server/api/external/send/"
headers = {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
data = {
"template_id": 1,
"user_id": "788xxx",
"params": {"name": "张三"}
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
已复制到剪贴板