# 交易评价-评价管理接口
「小程序交易评价」是小程序官方提供的真实公正的评价系统。在小程序的交易用户可针对某次交易体验进行评价打分、发表建议和感受。 以下接口提供给小程序开发者用于查询、回复、处理小程序用户交易评价。
- 4.1 差评通知CallBack
- 4.2 重置Api客服quota
# 1、查询
使用该接口可以查询某小程序下,所有评价相关内容。
# 1.1查询评价列表
查询某小程序下面所有的评价。
# 请求方式
GET
# 请求 URL
https://api.weixin.qq.com/wxaapi/comment/mpcommentlist/get # 请求参数示例: Javascript
https://api.weixin.qq.com/wxaapi/comment/mpcommentlist/get?filterType=1&offset=0&limit=8&startTime=1588237130&endTime=1588237131&access_token=xxxx
query 参数包括
{ startTime: "1588237130", endTime: "1588237131", filterType: 1, offset: 0, limit: 8, access_token: 'xxxx' } # 请求参数含义
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| startTime | String | 是 | 查询时间段的开始时间 |
| endTime | String | 是 | 查询时间段的结束时间 |
| filterType | Number | 否 | 过滤的数据类型,枚举参考下方表格 |
| offset | Number | 否 | 查询的偏移数(从offset开始计数拉取),默认值为 0 代表首页拉取 |
| limit | Number | 否 | 查询每页中的数量,默认值为 8 |
# 评价类型筛选枚举(filterType)
| 值 | 说明 |
|---|---|
| 1 | 全部差评,所有评价分数为1星、2星的评价 |
| 2 | 全部好评,所有评价分数为4星、5星的评价 |
| 3 | 差评待处理,所有未提交「和解挽回」的评价 |
| 4 | 开发者待回复,所有待开发者回复的评价 |
| 5 | 差评已改评 |
| 6 | 全部评价,所有好评、差评、中评(3星)部评价 |
# 正确返回示例
{ errcode: 0, success: true, commentList: [{ commentId: "2797755680173111111", amount: 100, orderId: "payorder@_4200001761202302096311111111", payTime: "1675915718", wxPayId: "4200001761202302096311111111", orderInfo: { busiOrderId: 'xxxxxx' }, userInfo: { openid: "xxxxxxxxxx", headImg: "http://wx.qlogo.cn/mmhead/xxxxxxxxxxx", nickName: "test" }, bizInfo: { appid: "wx1234567890", headImg: "http://wx.qlogo.cn/mmhead/xxxxxxxxxxxx", nickName: "xxx" }, score: 200, // 200分对应2星,每100分就是1星 createTime: "1676351504", content: { media: [{img: 'http://xxx', thumbImg: 'http://xxx'}], txt: "一般吧 我总感觉这个成分很伤皮肤,用了之后一直很干燥,不是很喜欢这款产品" }, extInfo: { isAlreadySendTmpl: false, }, productInfo: { productList: [ { name: "纸巾一张", picUrl: "https://xxxxxx", } ] } }], total: 3, offset: 0, } # 返回参数含义
| 属性 | 类型 | 说明 | |||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| errcode | Number | 错误码 | |||||||||||||||||||||||||||||||||||||||||||
| offset | Number | 查询的偏移数(从offset开始计数拉取) | |||||||||||||||||||||||||||||||||||||||||||
| total | Number | 评价总数 | |||||||||||||||||||||||||||||||||||||||||||
| commentList | Array < Object > | 评价的列表具体如下 | |||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
userInfo 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| openid | String | 评价用户openid |
| headImg | String | 评价用户的头像 |
| nickName | String | 评价用户的昵称 |
orderInfo 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| busiOrderId | String | 商户单号:商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一;是微信支付接口文档中的 out_trade_no |
bizInfo 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| appid | String | 商家小程序的appid |
| headImg | String | 商家小程序的头像 |
| nickName | String | 商家小程序的昵称 |
content 的具体参数
| 属性 | 类型 | 说明 | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| txt | String | 评价内容 | |||||||||||||||||||
| media | Array< Object > | 评价的媒体文件,如图片、视频, 视频跟图片只能存在一种,不同时存在,如果是图片可以有多张图,如果是视频只会有一个视频 | |||||||||||||||||||
| |||||||||||||||||||||
extInfo 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| isAlreadySendTmpl | Boolean | 是否已发过「差评客服会话」 |
productInfo 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| productList | Array< Object > | 商品列表 |
| productList.name | String | 商品名 |
| productList.picUrl | String | 商品图片 |
# 1.2查询评论列表
查询某评价下面所有的评论和回复。(目前开发者创建的第一条回复定义为评论,之后的回复都是基于这条评论去做回复的,未来会进行评论回复的展开)
# 请求方式
GET
# 请求 URL
https://api.weixin.qq.com/wxaapi/comment/replyandcommentreplylist/get # 请求参数示例: Javascript
https://api.weixin.qq.com/wxaapi/comment/replyandcommentreplylist/get?commentId=123456&access_token=xxxx
query 参数包括
{ commentId: '123456', access_token: 'xxxx' // 登录凭证 } # 请求参数含义
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| commentId | String | 是 | 评价的 id |
# 正确返回示例
{ errcode: 0, list: { reply: { // 评论(评论回复第一条内容) commentId: '123', replyId: '1' createTime: '1669032337', updateTime: '1669032341', replyContent: { content: '999' }, replyObject: { nickname: '小程序名称', imgUrl: 'http://xxx/xx' }, }, commentReplyList: [ // 回复(评论回复第二条及之后的所有集合) { commentId: '12345', commentReplyId: '1' createTime: '1669032388', updateTime: '1669032392', commentReplyContent: { content: 'uuuuuuuuu' }, commentReplyObject: { nickname: '啊哈', imgUrl: 'xxx' }, } ] } } # 返回参数含义
reply (评论) 下的参数含义
| 属性 | 类型 | 说明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| commentId | String | 评价id | ||||||||||
| replyId | String | 评论id | ||||||||||
| createTime | String | 创建时间,单位是秒 | ||||||||||
| updateTime | String | 更新时间,单位是秒 | ||||||||||
| replyContent.content | String | 回复的内容 | ||||||||||
| replyObject | Object | 评论的内容 | ||||||||||
| ||||||||||||
commentReplyList(回复列表) 下的参数含义
| 属性 | 类型 | 说明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| commentId | String | 评价id | ||||||||||
| commentReplyId | String | 回复id | ||||||||||
| createTime | String | 评价创建时间,单位是秒 | ||||||||||
| updateTime | String | 更新时间,单位是秒 | ||||||||||
| commentReplyContent.content | String | 回复的内容 | ||||||||||
| commentReplyObject | Object | 评论的内容 | ||||||||||
| ||||||||||||
# 1.3查询评价详情
查询某条评价的详细内容。
# 请求方式
GET
# 请求 URL
https://api.weixin.qq.com/wxaapi/comment/commentinfo/get # 请求参数示例: Javascript
https://api.weixin.qq.com/wxaapi/comment/commentinfo/get?commentId=123456&access_token=xxxxxx
query 参数示例
{ commentId: '123456', access_token: 'xxxxxx' } # 请求参数含义
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| commentId | String | 是 | 评价的 id |
# 正确返回示例
{ info: { content: { commentId: '123', createTime: '1669031402', userInfo: { openid: 'xxx', headImg: '', nickName: '啊哈' }, content: { txt: '突突突突突突有', media: [ { video: 'https://xxx/xx', videoCover: 'http://xxx/xx', videoDuration: 11 } ] }, bizInfo: { appid: "wx1234567890", headImg: "http://wx.qlogo.cn/mmhead/xxxxxx", nickName: "xxx的小商店" }, score: 200, // 评价分数、星级,这里200分对应2星 orderId: 'payorder@xxxx', wxPayId: 'xxxx', orderInfo: { busiOrderId: 'xxxxxx' }, productInfo: { productList: [{ name: "我是描述", picUrl: "https://xxxxx/x" }] }, payTime: '1669030760', amount: 1, } }, processInfo: { // 订单处理进度数据 commentId: 'xxx', actionList: [ { type: 1, updateTime: 1669031402, }, { type: 2 }, { type: 3 } ] }, oldComment: { commentId: 'xxx', content: {}, score: 100, createTime: 11111 }, } # 返回参数含义
返回的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| info | Object | 评价的信息 |
| processNnfo | Object | 进度条的信息(只有差评才会有) |
| oldComment | Object | 旧评价的信息(只有改评的新评价才有) |
info 里的具体信息
| 属性 | 类型 | 说明 | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| content | Object | 评价具体如下 | ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||
bizInfo 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| appid | String | 商家小程序的appid |
| headImg | String | 商家小程序的头像 |
| nickName | String | 商家小程序的昵称 |
userInfo 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| openid | String | 评价用户openid |
| headImg | String | 评价用户的头像 |
| nickName | String | 评价用户的昵称 |
orderInfo 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| busiOrderId | String | 商户单号:商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一;是微信支付接口文档中的 out_trade_no |
info.content.content 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| media | Array< Object > | 评价的媒体文件,如图片、视频 |
| txt | String | 评价内容 |
productInfo 的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| productList | Array< Object > | 商品列表 |
| productList.name | String | 商品名 |
| productList.picUrl | String | 商品链接 |
processInfo 进度的具体参数
| 参数 | 类型 | 说明 |
|---|---|---|
| actionList | Array< actionListItem > | 进度的具体状态,数组类型,从数组最后往前数有updateTime的就是当前状态 |
| commentId | String | 评价进度对应的评价id |
actionListItem(processInfo.actionList里的每个元素)具体参数
| 属性 | 类型 | 说明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| processInfo.actionList | Object | 评价具体如下 | ||||||||||
| ||||||||||||
oldComment 旧评论的具体参数
| 属性 | 类型 | 说明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| commentId | String | 评价id | ||||||||||
| createTime | String | 创建时间,单位是秒 | ||||||||||
| score | Number | 用户评价的打分,每100对应1分以及1颗星 | ||||||||||
| content | Object | 评论的内容 | ||||||||||
| ||||||||||||
# 2、评论
目前开发者创建的第一条回复定义为评论。
# 2.1创建评论
# 请求方式
POST
# 请求 URL
https://api.weixin.qq.com/wxaapi/comment/reply/add # 请求参数示例:Javascript
https://api.weixin.qq.com/wxaapi/comment/reply/add?access_token=xxxx
query 参数包括
{ access_token: 'xxxx' // 登录凭证 } body 参数包括
{ commentId: "xxxxxxxxxx", content: "我是内容" } # 请求参数含义
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| commentId | String | 是 | 评价的 id |
| content | String | 是 | 评论的内容 |
# 正确返回示例
{ errcode: 0, success: true } # 返回参数含义
| 参数 | 类型 | 说明 |
|---|---|---|
| errcode | Number | 请求的状态码 |
| success | Boolean | 请求是否成功状态 |
| errmsg | String | 错误信息 |
# 2.2删除评论
目前开发者创建的第一条回复定义为评论,如果删除该条评论,基于这条评论的所有回复将会被一并删除。
# 请求方式
POST
# 请求 URL
https://api.weixin.qq.com/wxaapi/comment/reply/delete # 请求参数示例:Javascript
https://api.weixin.qq.com/wxaapi/comment/reply/delete?access_token=xxxx
query 参数包括
{ access_token: 'xxxx' } body 参数包括
{ commentId: "xxxxxxxxxx", replyId: "xxxxx" } # 请求参数含义
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| commentId | String | 是 | 评价的 id |
| replyId | String | 是 | 评论的 id |
# 正确返回示例
{ errcode: 0, success: true } # 返回参数含义
| 参数 | 类型 | 说明 |
|---|---|---|
| errcode | Number | 请求的状态码 |
| success | Boolean | 请求是否成功状态 |
| errmsg | String | 错误信息 |
# 3、回复
# 3.1创建回复
# 请求方式
POST
# 请求 URL
https://api.weixin.qq.com/wxaapi/comment/commentreply/add # 请求参数示例:Javascript
https://api.weixin.qq.com/wxaapi/comment/commentreply/add?access_token=xxxx
query 参数包括
{ access_token: 'xxxx' } body 参数包括
{ commentId: "xxxxxxxxxx", replyId: "xxxxx", content: "我是内容" } # 请求参数含义
| 参数 | 类型 | 必填 | 说明 | |
|---|---|---|---|---|
| commentId | String | 是 | 评价的 id | |
| replyId | String | 是 | 评论的 id | |
| content | String | 是 | 回复评论的内容 |
# 正确返回示例
{ errcode: 0, success: true } # 返回参数含义
| 参数 | 类型 | 说明 |
|---|---|---|
| errcode | Number | 请求的状态码 |
| success | Boolean | 请求是否成功状态 |
| errmsg | String | 错误信息 |
# 3.2删除回复
# 请求方式
POST
# 请求 URL
https://api.weixin.qq.com/wxaapi/comment/commentreply/delete # 请求参数示例:Javascript
http://api.weixin.qq.com/wxaapi/comment/commentreply/delete?access_token=xxxx
query 参数包括
{ access_token: 'xxxx' } body 参数包括
{ commentId: "xxxxxxxxxx", replyId: "xxxxx", commentReplyId: "xxxxx" } # 请求参数含义
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| commentId | String | 是 | 评价的 id |
| replyId | String | 是 | 评论的 id |
| commentReplyId | String | 是 | 回复评论的 id |
# 正确返回示例
{ errcode: 0, success: true } # 返回参数含义
| 参数 | 类型 | 说明 |
|---|---|---|
| errcode | Number | 请求的状态码 |
| success | Boolean | 请求是否成功状态 |
| errmsg | String | 错误信息 |
# 4、差评客服会话
使用微信小程序客服消息能力的开发者,针对用户差评,平台提供了「差评客服会话」能力,开发者可使用该能力主动下发一条客服消息给差评用户;当用户回复后,开发者可继续用小程序客服消息能力与用户沟通。
使用流程: 1.用户发起差评 2.微信服务器会推送callback请求通知开发者,详情可看4.1 差评通知CallBack 3.开发者可以选择调用重置客服quota的api,详情可看4.2 重置api客服quota 4.重置客服quota后,可以直接使用微信小程序客服的api能力去下发客服消息
# 4.1差评通知CallBack
# 请求方式
POST
# 请求 URL
开发者在微信开放平台配置的callback服务器地址
# 请求参数含义
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| ToUserName | string | 是 | 商家小程序名称 |
| FromUserName | string | 是 | 微信团队的 OpenID(固定值) |
| CreateTime | number | 是 | 事件时间,Unix时间戳 |
| MsgType | string | 是 | 消息类型,固定为event |
| Event | string | 是 | 事件类型,固定为 wxa_comment_bad_score |
| result | object | 是 | 结果对象 |
| result.comment_id | string | 是 | 评价 ID |
# 请求示例
<xml> <ToUserName><![CDATA[gh_abcdefg]]></ToUserName> <FromUserName><![CDATA[oABCD]]></FromUserName> <CreateTime>1704038400</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[wxa_comment_bad_score]]></Event> <result> <comment_id>2272502024443330610</comment_id> </result> </xml> # 正确返回示例
{ errcode: 0, success: true } # 4.2重置Api客服quota
# 请求方式
POST
# 请求 URL
https://api.weixin.qq.com/wxaapi/comment/apikfquota/reset # 请求参数示例:Javascript
https://api.weixin.qq.com/wxaapi/comment/apikfquota/reset?access_token=xxxx
query 参数包括
{ access_token: 'xxxx' } body 参数包括
{ commentId: "xxxxxxxxxx" } # 请求参数含义
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| commentId | String | 是 | 评价的 id |
# 正确返回示例
{ errcode: 0, success: true } # 返回参数含义
| 参数 | 类型 | 说明 |
|---|---|---|
| errcode | Number | 请求的状态码 |
| success | Boolean | 请求是否成功状态 |
# 5、确认和解
# 请求方式
POST
# 请求 URL
https://api.weixin.qq.com/wxaapi/comment/confirmcompromise # 请求参数示例:Javascript
https://api.weixin.qq.com/wxaapi/comment/confirmcompromise?access_token=xxxx
query 参数包括
{ "access_token": 'xxxx' } body 参数包括
{ commentId: "xxxxxxxxxx", picList: ['mediaid', 'mediaid'], content: "我是和解的内容" } # 请求参数含义
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| commentId | String | 是 | 评价的 id |
| picList | Array< String > | 否 | 和解的图片mediaId集合,可参考这 https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html |
| content | String | 否 | 和解的文本内容 |
# 正确返回示例
{ errcode: 0, success: true } # 返回参数含义
| 参数 | 类型 | 说明 |
|---|---|---|
| errcode | Number | 请求的状态码 |
| success | Boolean | 请求是否成功状态 |
| errmsg | String | 错误信息 |
# ERRORCODE
| 值 | 说明 |
|---|---|
| -10007 | 无权限调用接口 |
| -10008 | 服务异常 |
| -10001 | 参数异常 |
| -10003 | 参数不匹配 |
| -10403 | 无权限操作该评价/评论/回复 |
| 10000 | 和解:不是差评/发送过模板消息;其它:参数异常 |