现在我们制作一个微信智能聊天机器人。发送文字它可以回复一段话,或一张图片,是不是有点小酷!
当然,这种智能回复的算法和数据库我们自己肯定是没有的,所以我们借助于gewe框架的开放API接口来完成我们的功能。

请求参数
Header 参数
export interface ApifoxModel {
"X-GEWE-TOKEN": string;
[property: string]: any;
}
Body 参数application/json
export interface ApifoxModel {
/**
* 设备ID
*/
appId: string;
/**
* 图片链接
*/
imgUrl: string;
/**
* 好友/群的ID
*/
toWxid: string;
[property: string]: any;
}
示例
{
"appId": "",
"toWxid": "34757816141@chatroom",
"imgUrl": "http://dummyimage.com/400x400"
}
示例代码
curl --location --request POST 'http://api.geweapi.com/gewe/v2/api/message/postImage' \
--header 'X-GEWE-TOKEN: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "",
"toWxid": "34757816141@chatroom",
"imgUrl": "http://dummyimage.com/400x400"
}'
返回响应
成功(200)
HTTP 状态码: 200 内容格式: JSONapplication/json
数据结构
export interface ApifoxModel {
data: Data;
msg: string;
ret: number;
[property: string]: any;
}
export interface Data {
/**
* cdn相关的aeskey
*/
aesKey: string;
/**
* 发送时间
*/
createTime: number;
/**
* cdn相关的fileid
*/
fileId: string;
/**
* 图片高度
*/
height: number;
/**
* 图片文件大小
*/
length: number;
/**
* 图片md5
*/
md5: string;
/**
* 消息ID
*/
msgId: number;
/**
* 消息ID
*/
newMsgId: number;
/**
* 接收人的wxid
*/
toWxid: string;
/**
* 消息类型
*/
type: null;
/**
* 图片宽度
*/
width: number;
[property: string]: any;
}
示例
{
"ret": 200,
"msg": "操作成功",
"data": {
"toWxid": "34757816141@chatroom",
"createTime": 0,
"msgId": 640355969,
"newMsgId": 8992614056172360013,
"type": null,
"aesKey": "7678796e6d70626e6b626c6f7375616b",
"fileId": "3052020100044b30490201000204e49785f102033d11fd0204136166b4020465966eea042437646265323234362d653662662d343464392d393363362d3139313661363863646266390204052418020201000400",
"length": 1096,
"width": 400,
"height": 400,
"md5": "e6355eab0393facbd6a2cde3f990ef60"
}
}