工作手机推送对接文档
加解密SDK包地址
说明
- 
推送方式为 POST,数据传递使用JSON格式(请求头:Content-Type: application/json)
- 
body为加密的字符串,加密的 key为openapi颁发的clientSecret
- 
推送的数据结构如下: 
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| event | string | 事件名 | true | 
| body | string | 事件内容,方式加密详见SDK | true | 
示例:
{
    "event": "wxUser",
    // 注意,加密后的数据难以阅读,因此以下接口文档body参数以JSON方式展示
    "body": "neD0iV1eFLpIy4/F1XHFEomEfx2kV/EPMg+edO9TU/8="
}
- 响应数据结构(第三方接收到推送数据后请按照下面的json结构响应结果)
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| code | int | 状态码 0 失败,1 成功 | true | 
| msg | string | 状态信息 | false | 
示例:
{
    "code": 1,
    "msg": "成功!"
}
- 失败重试:
在推送不成功的情况下,总共会发起15次重试,重试频率为15s/15s/30s/3m/10m/20m/30m/30m/30m/60m/3h/3h/3h/6h/6h - 总计 24h4m
event 字段(字符串类型)表示数据类型,说明当前推送的data属于哪类数据,以下是所有event的值:
| event | 说明 | 
|---|---|
| call | 通话记录 | 
| record | 通话录 | 
| wxUser | 微信用户 | 
| wxContact | 微信联系人 | 
| wxChatRoom | 微信群 | 
| wxChatRoomMember | 群成员 | 
| wxChat | 微信会话 | 
| wxMessage | 微信消息 | 
| wxMedia | 微信多媒体消息 | 
- 建议接受推送后校验数据的完整性即响应推送服务,避免请求一直挂起
通话模块
通话记录
event: "call"
目前是先同步通话记录,通话录音需要先上传到服务器,之后再修改通话记录的录音地址,所以需要用户提供修改录音地址(soundUrl)的接口,下面会提供推送录音地址的数据
字段说明:
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| _id | string | 通话记录的唯一id | true | 
| did | string | 设备id | true | 
| imei | string | 设备IMEI码 | true | 
| callType | string | 短信类型( in:呼入,out:呼出) | true | 
| connectType | string | 通话类型("connected":接通,"disconnected":未接通) | true | 
| localTel | string | 本机号码 | true | 
| uid | string | 当时设备持有座席id | true | 
| uName | string | 当时设备持有座席name | true | 
| contactTel | string | 联系号码 | true | 
| contactName | string | 联系号码通讯录名称 | false | 
| beginTime | string | 呼通时间(例如:2006-01-02 15:04:05) | true | 
| endTime | string | 挂机时间(例如:2006-01-02 15:05:06) | true | 
| duration | int | 录音时长(例如:61) | true | 
| soundUrl | string | 录音地址,"not_found":录音未找到, "copy_fail":录音拷贝失败,"multiple_call_lose":多通通话录音丢失 | false | 
推送示例:
{
  "event" : "call",
  "body" : {
    "_id" : "0e4ccc60-8b6e-4693-87d4-f7d84bf57bf5",
    "did" : "e1ec479c-971f-11e9-b311-0242ac120002",
    "imei" : "867183048059394",
    "callType" : "out",
    "connectType" : "disconnected",
    "localTel" : "13323333333",
    "uid" : "076f2acf-e810-4bc0-9c31-bbc21135709d",
    "uName" : "川普",
    "contactTel" : "15023333333",
    "contactName" : "奥巴马",
    "beginTime" : "2019-06-26 11:01:49",
    "endTime" : "2019-06-26 11:02:50",
    "duration" : 61,
    "soundUrl" : ""
    }
}
通话录音
event: "record"
字段说明:
需要更新该条通话记录(唯一_id)的录音地址(soundUrl)
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| _id | string | 通话记录的唯一id | true | 
| uid | string | 座席id | true | 
| soundUrl | string | 录音地址(值为"not_found"说明没有录音,比如多方通话则没有录音) | true | 
推送示例:
{
  "event" : "record",
  "body" : {
    "_id" : "0e4ccc60-8b6e-4693-87d4-f7d84bf57bf5",
    "soundUrl" : "cf-workphone.oss-cn-hangzhou.aliyuncs.com/originalRecord/P00000000024/201907/20190708172233-19926022861-outCall-1562577753335.mp3"
    }
}
微信模块
微信账号
当前设备登录的微信账号信息;全量推送,需要接收方自己去重
event: wxUser
字段说明:
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| id | string | 主键Id | true | 
| imei | string | 设备imei | true | 
| phone | string | 当前坐席登陆的手机号 | true | 
| wxNo | string | 微信号 | true | 
| wxNo1 | string | 微信号1 | false | 
| version | string | 微信版本号 | true | 
| nick | string | 昵称 | true | 
| headImg | string | 头像 | true | 
| headImg1 | string | 大头像 | false | 
| remark | string | 备注 | false | 
示例:
{
  "event": "wxUser",
  "body": {
    "id": "xxx",    
    "imei": "xxx",
    "phone": "13888888888",   
    "wxNo": "xxx",            
    "wxNo1": "xxx",           
    "version": "v1.0.0",      
    "nick": "昵称",           
    "headImg": "xxx",         
    "headImg1": "xxx",        
    "remark": ""
  }
}
微信联系人
当前设备登录的微信的好友信息,agentWxNo为wxUser的wxNo或者wxNo1;增量推送,数据可能重复(联系人信息变更),需要接收方自己实现更新逻辑。
event: "wxContact"
字段说明:
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| id | string | 主键Id | true | 
| imei | string | 设备imei | true | 
| agentWxNo | string | 当前设备手机号 | true | 
| agentNick | string | 设备imei | true | 
| wxNo | string | 微信号 | true | 
| wxNo1 | string | 微信号1 | false | 
| nick | string | 微信昵称 | true | 
| headImg | string | 头像 | false | 
| headImg1 | string | 大头像 | false | 
| sign | string | 签名 | false | 
| remark | string | 备注 | false | 
| status | string | 状态(normal:正常,deleted:已删除,blacklist:已拉黑) | true | 
| createTime | string | 创建时间 | true | 
| ts | long | 创建时间时间戳 | true | 
示例:
{
  "event": "wxContact",
  "body": {
    "id": "xxx",                         
    "agentWxNo" : "wxid_adzps6vi1i8o22", 
    "agentNick" : "小仙女",          
    "wxNo" : "v7moor",                   
    "wxNo1": "wxid_adzps6vi1i8o22",      
    "nick" : "容联七陌-s",                
    "headImg" : "xx",                    
    "headImg1" : "",                    
    "sign" : "",                         
    "remark" : "",                       
    "status" : "",                       
    "createTime" : "2019-06-26 15:31:12",
    "ts" : 1562307211188
  }
}
群信息
当前设备登录的微信的群信息,agentWxNo为wxUser的wxNo或者wxNo1;增量推送,需要接收方自己去重
event: "wxChatRoom"(群)
字段说明:
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| id | string | 主键Id | true | 
| imei | string | 设备imei | true | 
| agentWxNo | string | 坐席微信号 | true | 
| name | string | 群名称 | true | 
| headImg | string | 群头像 | false | 
| memberList | string | 群成员微信号,使用“;”分割 | true | 
| displayName | string | 群成员微信昵称(含有特殊字符使用微信号),使用“、”分割 | true | 
| roomOwner | string | 群主微信Id | true | 
| selfDisplayName | string | 自己在群里面的昵称 | false | 
| memberCount | int | 群成员数量 | true | 
示例:
{
  "event": "wxChatRoom",
  "body": {
    "id": "xxx",                       
    "imei": "xxx",                     
    "agentWxNo": "wxid_adzps6vi1i8o22",                   
    "name": "慧算账内部沟通裙",        
    "headImg": "xxx",                  
    "memberList": "xx;xx",             
    "displayName": "程佳玉、xx",       
    "roomOwner": "wxid_eh6cq1l1n1c521", 
    "selfDisplayName": "",              
    "memberCount": "12"                 
  }
}
event: "wxChatRoomMember"(群成员)
字段说明:
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| id | string | 主键Id | true | 
| chatRoomId | string | 所属群id,即chatRoom的Id | true | 
| nick | string | 昵称 | true | 
| headImg | string | 小头像 | false | 
| headImg1 | string | 大头像 | false | 
| wxNo | string | 微信号 | true | 
| isAgent | bool | 是否是坐席 | true | 
| agentWxNo | string | 坐席微信Id | true | 
示例:
{
  "event": "wxChatRoomMember",
  "body": {
    "id": "xxx",         
    "chatRoomId": "xxx", 
    "nick": "程佳玉",    
    "headImg": "xxx",    
    "headImg1": "xxx",    
    "wxNo": "xxx",       
    "isAgent": false,    
    "agentWxNo": ""      
  }
}
微信会话
当前设备登录的微信的会话信息,agentWxNo为wxUser的wxNo或者wxNo1;增量推送
event: "wxChat"
字段说明:
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| id | string | 主键Id | true | 
| imei | string | 设备imei | true | 
| agentWxNo | string | 坐席微信号 | true | 
| contactWxNo | string | 联系人微信号(1v1聊天有值) | false | 
| group | string | 群id,(会话类型为group有值) | false | 
| chatType | string | 会话类型(group:群,single:单个聊天) | true | 
| isSend | string | 会话发起 0 :对方 1:自己 | true | 
示例:
{
  "event": "wxChat",
  "body": {
    "id": "xxx",         
    "imei" : "设备imei", 
    "agentWxNo" : "xxx", 
    "contactWxNo" : "",  
    "group" : "",        
    "chatType" : "group",  
    "isSend" : "0"
  }
}
微信消息
当前设备登录的微信的消息信息,chatId为wxChat的Id;增量推送
event: "wxMessage"
字段说明:
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| id | string | 主键Id | true | 
| imei | string | 设备imei | true | 
| chatId | string | 会话Id | true | 
| from | string | 发送人 (可能为空,通过消息类型来分辨) | false | 
| msg | string | 消息内容 | false | 
| msgType | int | 消息类型 | true | 
| date | string | 发送日期 | true | 
| ts | long | 发送时间戳(毫秒) | true | 
| payId | string | 转账、红包Id | false | 
| msgId | string | 聊天信息id | true | 
| isSend | string | 发送方 0:对方;1:自己 | false | 
| msgSvrId | string | 多媒体消息Id | false | 
{
  "event": "wxMessage",
  "body": {
    "id" : "xxx",
    "imei" : "xxx",   
    "chatId" : "xxx", 
    "from" : "xxx",   
    "msg" : "原先是多少啊", 
    "msgType" : 1, 
    "date" : "2019-06-26",  
    "ts" : 1561531920,
    "payId" : "",  
    "msgId" : "3", 
    "isSend" : "0",   
    "msgSvrId": "xx" 
  }
}  
msgType 类型说明
| 类型 | 解释 | 
|---|---|
| 101 | 文本 | 
| 102 | 图片 | 
| 103 | 语音 | 
| 104 | 视频 | 
| 105 | 名片 | 
| 106 | 地理位置 | 
| 107 | 分享链接,网址,文件 | 
| 108 | 系统消息 | 
| 109 | 撤回消息 | 
| 110 | 群系统消息 | 
| 111 | SEMI_XML | 
| 112 | 红包 | 
| 113 | 群收款 | 
| 114 | 群收款提醒 | 
| 115 | 转账 | 
多媒体数据
当前设备登录的微信的消息的多媒体消息,id对应wxMessage的msgSvrId;增量推送
event: "wxMedia"
字段说明:
| 字段 | 类型 | 说明 | 是否必须 | 
|---|---|---|---|
| id | string | 主键Id | true | 
| thumbImgPath | string | 图片缩略图、语音消息、视频封面 | true | 
| bigImgPath | string | 图片原图,视频连接 | false | 
{
  "event": "wxMedia",
  "body": {
    "id": "xxx",        
    "thumbImgPath": "", 
    "bigImgPath": "" 
  }
}
微信消息数据结构
文本
- 类型:101
- 数据结构:
wxMessage中的msg
{
  "msg": "这是文本"
}
图片、语音、视频
- 类型:102、103、104
- 数据结构:
wxMedia的存储结构
{
  "bigImgPath" : "test_big.jpg",
  "thumbImgPath" : "test_thumb.jpg"
}
名片
- 类型:105
- 数据结构:
wxMessage中的msg,json格式的字符串
{
    "nickName": "一块二包邮",
    "wxNo": "gh_66cc2df58915",
    "bigHeadImgUrl": "http://wx.qlogo.cn/mmhead/Q3auHgzwzM5riaOEnlFZtibiaMZMpIricKZaosia2ExVGKzNZga4D2L92OQ/0",
    "smallHeadImgUrl": "http://wx.qlogo.cn/mmhead/Q3auHgzwzM5riaOEnlFZtibiaMZMpIricKZaosia2ExVGKzNZga4D2L92OQ/96"
}
地理位置
- 类型:106
- 数据结构:
wxMessage中的msg,json格式的字符串
{
    "log": "104.062881",
    "lat": "30.554096",
    "address": "蜀都中心二期(武侯区吉庆三路333号)",
    "wxNo": "wxid_0080250784612"
}
分享链接,网址,文件 等
- 类型:107
- 数据结构:
wxMessage中的msg,json格式的字符串
{
  "title": "余林呱与余林🐑的聊天记录", //标题
  "des": "余林呱:[图片]\n余林呱:那个。。给我发个红包???\n余林呱:[动画表情]\n余林呱:[图片]\n余林呱:[色]...", //描述
  "type": "19", //类型:33 小程序,5 链接,6 文件, 19 聊天记录
  "showtrueype": "0",
  "url": "https://support.weixin.qq.com/cgi-bin/mmsupport-bin/readtemplate?t=page/favorite_record__w_unsupport\u0026from=singlemessage\u0026isappinstalled=0",//微信内部链接
  "recordItem": "余林呱与余林🐑的聊天记录" //详细内容
}
系统消息
- 类型:108
- 数据结构:
wxMessage中的msg,json格式的字符串
{
    "content": "\"A手机维修二手买卖\" 撤回了一条消息", //内容
    "payId": "",     //微信支付Id(红包有值)
    "msgIsSend": "", //原始消息发送类型(红包有值)
    "type": 3        //类型 1 红包,2 普通消息,3 未知消息
}
{
  "content":"位置共享已经结束", //内容
  "payId":"", //红包微信支付Id
  "msgIsSend": "",
  "type":2  //类型 1 红包,2 普通消息,3 未知消息
}
{
  "content":"H.Note领取了你的红包",
  "payId":"1000039501201906056015038761805",
  "msgIsSend": "",
  "type":1
}
{
    "content": "\"H.Note\" 撤回了一条消息",
    "payId": "",
    "msgIsSend": "",
    "type": 2
}
撤回的消息
- 类型: 109
- 数据结构:
wxMessage中的msg,json格式的字符串
{
    "test": "你撤回了一条消息", //撤回消息展示
    "timestrueamp": "1560150444638", //撤回消息发送时间
    "preContent": "这是第三条消息", //撤回消息内容
    "link": {
        "text": "重新编辑"
    }
}
群系统消息
- 类型:110
- 数据结构:
wxMessage中的msg,字符串格式
{
  "msg": `"名字"邀请"余林🐑"加入了群聊`
}
{
  "msg": `"名字"修改群名为“测试群”`
}
{
  "msg": `"superwomen"邀请你加入了群聊,群聊参与人还有:呵呵😄`
}
红包
- 类型:112
- 数据结构:
wxMessage中的msg,json格式的字符串
{
    "des": "我给你发了一个红包,赶紧去拆!",
    "url": "https://wxapp.tenpay.com/mmpayhb/wxhb_personalreceive?showwxpaytitle=1\u0026msgtype=1\u0026channelid=1\u0026sendid=1000039501201906056011499657896\u0026ver=6\u0026sign=6cabac162d11b76b628227520ee424b1e3878d33e78df534abba75b16c9cf1d36fede8e6db6677195b986d7a31e887fabaeeba13e6614b49334fd3d26b047d81a65fc89e97a304e6e2e7803398f0c573",
    "type": "2001",
    "title": "微信红包",
    "thumbUrl": "https://wx.gtimg.com/hongbao/1800/hb.png",
    "wcPayInfo": {
        "templateId": "7a2a165d31da7fce6dd77e05c300028a",
        "url": "https://wxapp.tenpay.com/mmpayhb/wxhb_personalreceive?showwxpaytitle=1\u0026msgtype=1\u0026channelid=1\u0026sendid=1000039501201906056011499657896\u0026ver=6\u0026sign=6cabac162d11b76b628227520ee424b1e3878d33e78df534abba75b16c9cf1d36fede8e6db6677195b986d7a31e887fabaeeba13e6614b49334fd3d26b047d81a65fc89e97a304e6e2e7803398f0c573",
        "iconUrl": "https://wx.gtimg.com/hongbao/1800/hb.png",
        "receivertrueitle": "普天同庆", //收到的红包标题
        "sendertrueitle": "普天同庆",   //发送的红包标题
        "scenetrueext": "微信红包",     //场景描述,1002对应的为微信红包
        "senderDes": "查看红包",     //发送的红包描述
        "receiverDes": "领取红包",   //收到的红包描述
        "nativeUrl": "wxpay://c2cbizmessagehandler/hongbao/receivehongbao?msgtype=1\u0026channelid=1\u0026sendid=1000039501201906056011499657896\u0026sendusername=wxid_1gdwolwrn5hs22\u0026ver=6\u0026sign=6cabac162d11b76b628227520ee424b1e3878d33e78df534abba75b16c9cf1d36fede8e6db6677195b986d7a31e887fabaeeba13e6614b49334fd3d26b047d81a65fc89e97a304e6e2e7803398f0c573",
        "sceneId": "1002", //类型:1002 红包,1001 群收款
        "innertrueype": "0",
        "payMsgId": "1000039501201906056011499657896", //微信支付交易Id
        "Invalidtrueime": "1559803593",
        "m7trueype": "0" //收钱类型 0 未领取,1 已领取
    }
}
群收款
- 类型 113
- 数据结构:
wxMessage中的msg,json格式的字符串
{
    "des": "",
    "url": "https://support.weixin.qq.com/security/readtemplate?t=w_security_center_website/upgrade\u0026wechat_real_lang=zh_CN",
    "type": "2001",
    "title": "",
    "thumbUrl": "http://wx.gtimg.com/hongbao/img/newaa_3x.png",
    "wcPayInfo": {
        "templateId": "b9a794071ca79264fb48909c24f2c6cc",
        "url": "https://support.weixin.qq.com/security/readtemplate?t=w_security_center_website/upgrade\u0026wechat_real_lang=zh_CN",
        "iconUrl": "http://wx.gtimg.com/hongbao/img/newaa_3x.png",
        "receivertrueitle": "活动账单",
        "sendertrueitle": "活动账单",
        "scenetrueext": "活动账单",
        "senderDes": "每人需支付0.02元",
        "receiverDes": "每人需支付0.02元",
        "nativeUrl": "",
        "sceneId": "1001",
        "innertrueype": "0",
        "payMsgId": "",
        "Invalidtrueime": "1562226087",
        "newAa": {
            "billNo": "00db48218eb1a54d77489c9bb4fcd80bb22bd76fdd5d1316e8df44490f9f68aba92abfd31eb7b217dcb88e490b3d0e02",
            "newAatrueype": "2",
            "receiverList": "wxid_1gdwolwrn5hs22,1,5,0",//发起人微信号,收款状态?3 = 已收齐,2 = 有人支付,1 = 无人支付,参与人数,已支付人数
            "payerList": "wxid_tzp39rgo8r9u22,2,1|wxid_m90g9psrmdbf22,2,1|wxid_afhuw9rhn5dy22,2,1|wxid_1mel9kj31aft22,2,1|wxid_0080250784612,2,1"//支付人微信号,需支付金额(单位:分),支付状态:1 = 未支付,2 = 已支付
        },
        "m7trueype": "0"
    },
    "content": ""
}
群收款提示
- 类型 114
- 数据结构:
wxMessage中的msg,json格式的字符串
{
    "content": "@菜头 @「卷心菜」 @呵呵😄 @电信手机📱 @余林呱\n你有一笔未支付的群收款", //消息内容
    "payId": "0db48218eb1a54d77489c9bb4fcd80b50b2aa1cb9846f6a12cb53f24f8ce45a910f32bdc64fc4d5eaf51bbf30ed4c4d" //收款支付Id
}
转账
- 类型:115
- 数据结构
wxMessage中的msg,json格式的字符串
{
    "title": "微信转账",
    "des": "收到转账0.01元。如需收钱,请点此升级至最新版本",
    "type": "2000",
    "content": "",
    "url": "https://support.weixin.qq.com/cgi-bin/mmsupport-bin/readtemplate?t=page/common_page__upgrade\u0026text=text001\u0026btn_text=btn_text_0",
    "thumbUrl": "https://support.weixin.qq.com/cgi-bin/mmsupport-bin/readtemplate?t=page/common_page__upgrade\u0026text=text001\u0026btn_text=btn_text_0",
    "lowurl": "",
    "extinfo": "",
    "wcPayInfo": {
        "paySubtrueype": "3", //转账类型
        "feeDesc": "¥0.01", //转账金额
        "transcationId": "100005010119060500024224115148949337",//交易Id
        "transferId": "1000050101201906051703664585970",//转账Id
        "invalidtrueime": "1559813867",//失效时间
        "begintrueransfertrueime": "1559727467",//开始时间
        "effectiveDate": "1",
        "payMsgId": "",
        "payMemo": "",//转账附加消息
        "hastrueransferAddress": "",
        "m7trueype": "2" //领取类型
    }
}
内部字段解释
| paySubType | 解释 | 
|---|---|
| 1 | 实时转账 | 
| 3 | 实时转账收钱回执 | 
| 4 | 转账退还回执 | 
| 5 | 非实时转账收钱回执 | 
| 7 | 非实时转账 | 
| m7Type | 解释 | 
|---|---|
| 0 | 未领取 | 
| 1 | 已被领取(paySubType==1,7) | 
| 2 | 已领取(paySubType==3) | 
| 3 | 已退还(paySubType==1,4,7) | 
| 4 | 已领取待入账(paySubType==5,7) |