API调用 帮助文档
接口调用前请先确保正确安装了e小天: https://daoadmin.kuryun.com/home/guide/bot/id/90/v/1.x.html
HTTP调用地址
地址格式:(http | https)://(IP 或 域名):8203/
e小天端口固定为8203,但需要自行开放安全组
例子:
本地:http://127.0.0.1:8203/
外网IP:http://121.11.12.10:8203/
域名形式:http://xpw.apifox.cn:8203/
注:若外网调用,清注意以下几点:
请确保您的e小天设置了允许外网访问
防火墙开启了8203端口,否则无法使用;
调用接口时记得填写外网IP。
调用方式统一为POST
除 GET 外,必须使用 JSON
参数名 | 说明 | 类型 | 必填 | 备注 |
---|---|---|---|---|
method | 接口标识 | string | 是 | 接口name |
pid | 对应微信登录的pid | int | 否 | 一台设备只登录一个号是可不填,否则得填对应的pid |
....... | other parameters | ...... | 否 | other parameters |
请求例子(发送文本消息):
{
"method": "sendText",
"wxid": "filehelper", //接收人wxid
"msg": "欢迎使用e小天", //发送的内容
"atid": "", //如果是群里还可以艾特人
"pid": 0 //默认使用第一个微信
}
API调用后返回json,固定参数如下
- 请求成功
{
"method": "sendText_Recv",
"myid": "wxid_7v3b6hncdo6f12",
"pid":0,
"status": 1,
"msg": "",
"data": "0"
}
- 请求报错:
{
"method": "sendTex1t_Recv",
"myid": "wxid_7v3b6hncdo6f12",
"pid": 7860,
"status": 0,
"msg": "invalid method"
}