msg_type 字段新增「reference」枚举值,新增 reference 、 evaluate_result 字段本文档描述服务器端接收的消息或事件,详细说明参见消息推送。
事件英文名:commkf_send_msg_to_kf
当微信客户、接待人员发消息或有行为动作时,商家客服后台会将事件的回调数据包发送到指定URL。
相关 API 接口:
相关开发指南:
Request Payload| 参数名 | 类型 | 说明 |
|---|---|---|
| ToUserName | string | 小店UserName |
| FromUserName | string | 小店用户的OpenID |
| CreateTime | number | 事件时间,Unix时间戳,即格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数 |
| MsgType | string | 消息类型,固定为 event |
| Event | string | 事件类型,本接口固定为 commkf_send_msg_to_kf |
| msg_id | string | 用户发送该条消息的所捆绑的单调自增msg_id |
| msg_type | object | 消息类型, 参考发送消息中的消息类型 |
| msg_event | object | 事件类型 |
| text | object | 当msg_type为text时,则会返回text对应消息结构体 |
| video | object | 当msg_type为video时,则会返回video对应消息结构体 |
| image | object | 当msg_type为image时,则会返回image对应消息结构体 |
| file | object | 当msg_type为file时,则会返回file对应消息结构体 |
| product_share | object | 当msg_type为product_share时,则会返回product_share对应消息结构体 |
| order_share | object | 当msg_type为order_share时,则会返回order_share对应消息结构体 |
| voice | object | 当msg_type为voice时,则会返回voice对应消息结构体 |
| union_id | string | 用户的unionid |
| reference | object | 当 msg_type 为 reference时,则会返回reference对应消息结构体 |
| evaluate_result | object | 当 msg_event 为 EVENT_TYPE_EVALUATE_RESULT时,则会返回evaluate_result对应消息结构体 |
Object Payload消息类型, 参考发送消息中的消息类型
| 参数名 | 类型 | 说明 |
|---|---|---|
| text | object | msg_type为text |
| video | object | msg_type为video |
| image | object | msg_type为image |
| file | object | msg_type为file |
| product_share | object | msg_type为product_share |
| order_share | object | msg_type为order_share |
| voice | object | msg_type为voice |
| reference | object | msg_type为reference |
Object Payload事件类型
| 参数名 | 类型 | 说明 |
|---|---|---|
| EVENT_TYPE_SEND_MSG | object | 用户发送消息时的回调行为 |
Object Payload当msg_type为text时,则会返回text对应消息结构体
| 参数名 | 类型 | 示例 | 说明 |
|---|---|---|---|
| content | string | 测试消息123 | msg_type为text时,必返回的回报消息 |
Object Payload当msg_type为video时,则会返回video对应消息结构体
| 参数名 | 类型 | 示例 | 说明 |
|---|---|---|---|
| play_length | uint32 | 24 | msg_type为video时,表示返回视频秒数 |
| cos_url | string | https://channels.weixin.qq.com/shop/commkf/downloadmedia?encrypted_param=xxxxx×tamp=xxxxx&openid=xxxxxxxxx&msg_type=7 | msg_type为video时,表示返回视频的可下载cos_url |
| ld_img_url | string | https://channels.weixin.qq.com/shop/commkf/downloadmedia?encrypted_param=xxxxx×tamp=xxxxx&openid=xxxxxxxxx&msg_type=2 | msg_type为video时,表示返回视频的封面图 |
Object Payload当msg_type为image时,则会返回image对应消息结构体
| 参数名 | 类型 | 示例 | 说明 |
|---|---|---|---|
| cos_url | string | https://channels.weixin.qq.com/shop/commkf/downloadmedia?encrypted_param=xxxxx×tamp=xxxxx&openid=xxxxxxxxx&msg_type=2 | msg_type为image时,表示返回图片的可下载cos_url |
Object Payload当msg_type为file时,则会返回file对应消息结构体
| 参数名 | 类型 | 示例 | 说明 |
|---|---|---|---|
| cos_url | string | https://channels.weixin.qq.com/shop/commkf/downloadmedia?encrypted_param=xxxxx×tamp=xxxxx&openid=xxxxxxxxx&msg_type=8 | msg_type为file时,表示返回文件的可下载cos_url |
Object Payload当msg_type为product_share时,则会返回product_share对应消息结构体
| 参数名 | 类型 | 示例 | 说明 |
|---|---|---|---|
| product_id | string | 1000018045xxxxx | msg_type为product_share时,表示当前用户发送的卡片商品Id |
Object Payload当msg_type为order_share时,则会返回order_share对应消息结构体
| 参数名 | 类型 | 示例 | 说明 |
|---|---|---|---|
| order_id | string | 37265222601xxxxxxxxx | msg_type为order_share时,表示当前用户发送的卡片订单Id |
Object Payload当msg_type为voice时,则会返回voice对应消息结构体
| 参数名 | 类型 | 示例 | 说明 |
|---|---|---|---|
| translated_msg | string | 您好,问一下这个商品如何下单 | msg_type为voice时,表示当前用户发送语音翻译成功后的文本 |
| play_length | number | 2287 | msg_type为voice时,表示当前用户发送语音的语音长度,单位为毫秒(ms) |
| translation_succ | bool | true | msg_type为voice时,表示当前用户发送语音文本是否翻译成功 |
Object Payload当 msg_type 为 reference时,则会返回reference对应消息结构体
| 参数名 | 类型 | 说明 |
|---|---|---|
| content | string | 本消息的文本内容 |
| ref_msg | object | 被引用消息摘要 |
Object Payload当 msg_event 为 EVENT_TYPE_EVALUATE_RESULT时,则会返回evaluate_result对应消息结构体
| 参数名 | 类型 | 说明 |
|---|---|---|
| value | number | 评价值:1=不够好,2=一般般,3=挺好的 |
| reason_list | array | 评价原因列表 |
| room_id | number | 会话 ID |
| msg_id | number | 满意度消息 ID |
| evaluate_time | timestamp | 评价时间戳 |
Object Payload被引用消息摘要
| 参数名 | 类型 | 说明 |
|---|---|---|
| msg_id | string | 被引用消息 ID |
| msg_type | number | 被引用消息类型(enMsgType 数值) |
| content | string | 被引用消息内容(文本摘要) |
| from_name | string | 被引用消息发送者昵称 |
Response Payload回复 success 或空字符串(无需加密)
本事件无代码示例
msg_type 字段新增「reference」枚举值,新增 reference 、 evaluate_result 字段