聊天记录
聊天记录
查询聊天记录
- 描述 - 分页查询聊天记录 
- URI - /wscrm-bus-api/open/message/msgPage 
- 请求方式 - POST、Content-Type: application/json 
- 请求参数说明 
| 参数名 | 类型 | 是否必填 | 备注 | 
|---|---|---|---|
| tenantId | Long | 是 | 公司编号 | 
| info | Object | 是 | 查询条件 | 
| current | int | 否 | 页码 默认 1 | 
| pageSize | int | 否 | 数量 默认 10 | 
info 参数说明
| 参数名 | 类型 | 是否必填 | 备注 | 
|---|---|---|---|
| friendWhatsId | String | 否 | 目标客户 | 
| whatsId | String | 否 | 客服账号 | 
| chatType | Integer | 否 | 消息类别 1 个人 2 群聊 | 
| actionType | Integer | 否 | 1 发送 2 接收 | 
| contentType | String | 否 | 内容类型 | 
| startChatTime | Long | 否 | 聊天时间(起始) 毫秒级时间戳 | 
| endChatTime | Long | 否 | 聊天时间(结束) 毫秒级时间戳 | 
| agentAccount | String | 否 | 坐席账号(完全匹配) | 
注:范围时间需要成双成对出现,即数据创建时间需要起始和结束同时出现,聊天时间起始和结束需要同时出现
- 请求示例
{
  "tenantId": 82,
  "current": 1,
  "pageSize": 10,
  "info": {
    "whatsId": "",
    "friendWhatsId": "91844XXXX",
    "chatType": 1,
    "contentType": 2,
    "agentAccount": "dev_miors"
  }
}
- 响应参数说明 - 参数名 - 类型 - 是否必填 - 示例值 - 备注 - code - int - 是 - 200 - 状态码 - message - String - 否 - 成功 - 描述 - data - Object - 否 - 数据 - data 参数说明 - 参数名 - 类型 - 是否必填 - 示例值 - 备注 - total - Integer - 是 - 1 - 总数量 - size - Integer - 是 - 条数 - current - Integer - 是 - 当前页码 - pages - Integer - 是 - records - array - 是 - 数据数组 - records 对象参数说明 - 参数名 - 类型 - 是否必填 - 示例值 - 备注 - username - string - 是 - 1 - 坐席账号 - whatsId - string - 是 - 客服账号 - actionType - Integer - 是 - 动作类型 1 发送 2 接收 - chatType - Integer - 是 - 消息类别 1 个人 2 群聊 - content - 是 - 聊天内容 (结构根据聊天类型进行变化) - contentType - Integer - 是 - 聊天类型 - friendWhatsId - string - 是 - 聊天目标对象 - friendName - string - 是 - 聊天目标对象名称 - chatTime - long - 是 - 聊天时间 - createTime - long - 是 - 数据创建时间 
详细聊天内容类型介绍: 0、普通文字;1、图片;2、视频;3、音频;4、文件;6,名片;7、贴图;9、引用消息
- 响应示例
{
  "code": 200,
  "message": "Success ",
  "data": {
    "records": [
      {
        "id": "2082",
        "userId": 1255,
        "username": "kubrick108",
        "whatsId": "86131xxxxxx",
        "actionType": 1,
        "chatType": 1,
        "content": "{\"caption\":\"hasaki\",\"filename\":\"wallpaper.png\",\"mimeType\":\"image/png\",\"type\":4,\"url\":\"http://wascrm008.oss-ap-southeast-1.aliyuncs.com/8435252A37C416whatsapp2CB4454C3EB0CC2D32D87993DACE07?Expires=1742354786&OSSAccessKeyId=STS.NWfTNWrMnN8g2VRK32yjgVsiK&Signature=ior0i3YcXR8nQSY27Wdmy2z9mec%3D&security-token=CAIS9gJ1q6Ft5B2yfSjIr5TTH%2FTjn5JP%2BfqMMHDjrzNndeVLubbCqTz2IHpJdHJrBOAZsPo1m2BS7v0dlo16E5RJH0GVY44g4s4NtF%2FxP4aE6sfsvflYg8H9FDjOUhD10pKKqzg0x2GHKJmXcFnhunJZ89mTLEefPTGMNZmOluQQDLA%2BVRW5ajxrHcpfIhAYxuYRKXrWM4TCUHPtmXGCTjAr2GxGhHh49L60z%2BCF9xPalyea8OIOoJnrKZXWCKsJNZxkAdCux740JOiTkgwoskgarvgq3PEaoGqY5o3NW2M8uUvWb7DmlfR0NxJ8a6QAHKpJkePxj%2FUQuJaIzdmnkE0Qbb4LDX6AFNr4m5TeY%2BiuM9M%2Bc%2FPgJ2%2BI28qKc4Pytw40ue%2BppfOpv7HLQ1oH6nxEIlmyQsfPc2DS6YsIeIavxEBbAzfkAhiZPDsnaophec%2Ft9QwyFLGykS2mSRCYcxLP3EEInQICETdFQ4LxZ%2BEVyHgLbvzR7GW6PhqAAVyckDg%2FpKbDfz5pqvGkNw7lzP1j3d%2FrINXTZSYNWd%2Bq0IOYEsQ4aHfyNBLyxsbIh4Bxg3btIMNCROp6ZzU3hkT%2F%2FREMNJSNCf1lo5awaYYB0QXyB6op2c0hCPXRw1sbz%2FGwvMXQY20lj5SjiIirfsWcAsufbm%2FNdTzPIZqFjzeFIAA%3D\",\"referContent\":{\"caption\":\"\",\"filename\":\"8435252A37C416whatsapp2CB4454C3EB084F0BFB4F7694B9684\",\"mimeType\":\"image/jpeg\",\"type\":1,\"url\":\"http://wascrm008.oss-ap-southeast-1.aliyuncs.com/8435252A37C416whatsapp2CB4454C3EB084F0BFB4F7694B9684?Expires=1742354786&OSSAccessKeyId=STS.NWfTNWrMnN8g2VRK32yjgVsiK&Signature=490ZbvCQCVDpfdrlp6sLVGPqclA%3D&security-token=CAIS9gJ1q6Ft5B2yfSjIr5TTH%2FTjn5JP%2BfqMMHDjrzNndeVLubbCqTz2IHpJdHJrBOAZsPo1m2BS7v0dlo16E5RJH0GVY44g4s4NtF%2FxP4aE6sfsvflYg8H9FDjOUhD10pKKqzg0x2GHKJmXcFnhunJZ89mTLEefPTGMNZmOluQQDLA%2BVRW5ajxrHcpfIhAYxuYRKXrWM4TCUHPtmXGCTjAr2GxGhHh49L60z%2BCF9xPalyea8OIOoJnrKZXWCKsJNZxkAdCux740JOiTkgwoskgarvgq3PEaoGqY5o3NW2M8uUvWb7DmlfR0NxJ8a6QAHKpJkePxj%2FUQuJaIzdmnkE0Qbb4LDX6AFNr4m5TeY%2BiuM9M%2Bc%2FPgJ2%2BI28qKc4Pytw40ue%2BppfOpv7HLQ1oH6nxEIlmyQsfPc2DS6YsIeIavxEBbAzfkAhiZPDsnaophec%2Ft9QwyFLGykS2mSRCYcxLP3EEInQICETdFQ4LxZ%2BEVyHgLbvzR7GW6PhqAAVyckDg%2FpKbDfz5pqvGkNw7lzP1j3d%2FrINXTZSYNWd%2Bq0IOYEsQ4aHfyNBLyxsbIh4Bxg3btIMNCROp6ZzU3hkT%2F%2FREMNJSNCf1lo5awaYYB0QXyB6op2c0hCPXRw1sbz%2FGwvMXQY20lj5SjiIirfsWcAsufbm%2FNdTzPIZqFjzeFIAA%3D\",\"whatsId\":\"918448631208@c.us\",\"msgId\":\"3EB084F0BFB4F7694B9684\"}}",
        "contentType": 9,
        "friendWhatsId": "91844xxxxxx",
        "friendName": "",
        "chatTime": 1733225447000,
        "createTime": 1733230230000
      },
      {
        "id": "23383535",
        "userId": 846164,
        "username": "kubrick108",
        "whatsId": "5735xxxx",
        "actionType": 2,
        "chatType": 1,
        "content": "这里是China",
        "contentType": 0,
        "friendWhatsId": "905343694925",
        "friendName": "",
        "chatTime": 1741962820000,
        "createTime": 1741962822000
      },
      {
        "id": "40830094",
        "userId": 846311,
        "username": "kubrick108",
        "whatsId": "5735xxxx",
        "actionType": 2,
        "chatType": 2,
        "content": "{\"filename\":\"null\",\"url\":\"https://whatsappscrm.oss-ap-southeast-1.aliyuncs.com/542192/soundRecordUploadFile/20241024/IMG-20241024-WA0008.jpg\",\"mimeType\":\"image/jpeg\",\"caption\":\"\"}",
        "contentType": 1,
        "friendWhatsId": "120363295594719602",
        "friendName": "",
        "chatTime": 1729753057000,
        "createTime": 1729753081000
      },
      {
        "id": "39604704",
        "userId": 846302,
        "username": "kubrick108",
        "whatsId": "5735xxxx",
        "actionType": 1,
        "chatType": 1,
        "content": "{\"filename\":\"d36a02a3-2566-453a-8a71-bf577dc64beb.mp4\",\"url\":\"https://whatsappscrm.oss-ap-southeast-1.aliyuncs.com/542192/soundRecordUploadFile/20241023/VID-20241023-WA0011.mp4\",\"mimeType\":\"video/mp4\",\"caption\":\"\"}",
        "contentType": 2,
        "friendWhatsId": "5735xxxx",
        "friendName": "",
        "chatTime": 1729686522154,
        "createTime": 1729686537000
      },
      {
        "id": "23383328",
        "userId": 846164,
        "username": "kubrick108",
        "whatsId": "5735xxxx",
        "actionType": 2,
        "chatType": 1,
        "content": "{\"filename\":\"null\",\"url\":\"https://whatsappscrm.oss-ap-southeast-1.aliyuncs.com/542192/soundRecordUploadFile/20250314/PTT-20250314-WA0001.opus\",\"mimeType\":\"audio\",\"caption\":\"\"}",
        "contentType": 3,
        "friendWhatsId": "9053436xxxxxx",
        "friendName": "",
        "chatTime": 1741962804000,
        "createTime": 1741962815000
      },
      {
        "id": "40791329",
        "userId": 846302,
        "username": "kubrick108",
        "whatsId": "5735xxxx",
        "actionType": 2,
        "chatType": 2,
        "content": "{\"filename\":\"2dc7dc135da9abad576ce2049a4f4b44.jpeg\",\"url\":\"https://whatsappscrm.oss-ap-southeast-1.aliyuncs.com/542192/soundRecordUploadFile/20241024/2dc7dc135da9abad576ce2049a4f4b44.jpeg\",\"mimeType\":\"document\",\"caption\":\"2dc7dc135da9abad576ce2049a4f4b44.jpeg\"}",
        "contentType": 4,
        "friendWhatsId": "120363295594719602",
        "friendName": "",
        "chatTime": 1729751088000,
        "createTime": 1729751099000
      },
      {
        "id": "38390136",
        "userId": 824461,
        "username": "kubrick108",
        "whatsId": "5735xxxx",
        "actionType": 1,
        "chatType": 1,
        "content": "BEGIN:VCARD\nVERSION:3.0\nN:;Jack 001;;;\nFN:Jack 001\nX-WA-BIZ-NAME:ChiuChiu Furniture\nTEL;type=CELL;type=VOICE;waid=4477590xxxxx:+44 7759 xxxxx\nEND:VCARD",
        "contentType": 6,
        "friendWhatsId": "5735xxxx",
        "friendName": "",
        "chatTime": 1742780478000,
        "createTime": 1742780487000
      },
      {
        "id": "38411417",
        "userId": 866063,
        "username": "kubrick108",
        "whatsId": "5735xxxx",
        "actionType": 2,
        "chatType": 1,
        "content": "{\"filename\":\"8672762A37C416whatsapp2CB4454C3A422ABC9FE76503910D\",\"url\":\"https://wascrm-oss-static.socialepoch.com/client/da1af6271ac8df062768aa80da058172/8672762A37C416whatsapp2CB4454C3A422ABC9FE76503910D\",\"mimeType\":\"image/webp\",\"caption\":\"\"}",
        "contentType": 7,
        "friendWhatsId": "5735xxxx",
        "friendName": "Evbuomwan Lawrence",
        "chatTime": 1742782392000,
        "createTime": 1742782401000
      }
    ],
    "total": 1,
    "size": 10,
    "current": 1,
    "pages": 1
  }
}
同步聊天记录
- 描述 - 客户端收发消息同步 
- WebHook 
- 配置 ID <MSG_SYNC_MESSAGE> 
- 请求参数说明 - 参数名 - 类型 - 是否必填 - 备注 - accessToken - String - 是 - 签名字符串 token - tenantId - int - 是 - 公司 id - timestamp - Long - 是 - 毫秒时间戳 - data - List - 是 - 格式[{},{}],详细如下(数量 0-50 条) - data 参数说明: - 参数名 - 类型 - 是否必填 - 备注 - id - String - 是 - 数据 id 标识(uuid) - messageId - String - 是 - 消息 id - userName - String - 是 - 坐席登录账号 - whatsId - String - 是 - 消息发送 whatsapp( 个人指谁发送的消息,群聊指群里谁发送的消息) - friendWhatsId - String - 是 - 好友 whatsapp (当类型为群聊的时候是群名称) - currentWhatsId - String - 是 - 当前客服号 - actionType - int - 是 - 行为类型 1、发消息 2、 收消息 - chatType - int - 是 - 聊天性质 1、普通聊天 2、 群聊 - messageStatus - int - 是 - 消息状态 1、已发送(客户端) 3、已到达 4、已读 - content - String - 是 - 内容(详细如下) - contentType - int - 是 - 内容类型 0、普通文字 1、图片 2、视频 3、音频 4、文件 7、贴图 - sendTime - String - 是 - 消息聊天时间 - originType - int - 是 - 来源 1、pc 2、app 3、web - userProfile - object - 是 - 好友用户画像 - taskId - long - 否 - 群发任务id - taskInfoId - long - 否 - 群发任务详情id 
data 参数 messageStatus 发生变更时会重新同步状态,其他内容不变
- content 参数说明: - 参数名 - 类型 - 是否必填 - 备注 - filename - String - 是 - 文件名称 - url - String - 是 - 文件地址 - mimeType - String - 是 - mime 类型 - caption - String - 是 - 文件说明 - 当内容类型为 1,2,3,4 时:
 - 1 图片: image/jpeg、image/png、image/webp - 2 视频: video/mp4 - 3 音频: audio/aac、audio/m4a、audio/amr、audio/mpeg、audio/ogg; codecs=opus、codecs=opus - 4 文件: application/pdf、application/msword、application/ppt、application/xls 
- userProfile 参数说明 - 参数名 - 类型 - 是否必填 - 备注 - id - Long - 是 - 客户 id - name - String - 是 - 客户昵称 - whatsApp - String - 是 - 客户 whastapp - username - String - 是 - 负责人名字 - income - String - 是 - 收入 - profession - String - 是 - 职业 - desc - String - 是 - 备注 - tags - array - 是 - 标签 - email - String - 是 - 邮箱地址 - address - String - 是 - 地址 - extendsMap - String - 是 - 扩展信息(json 字符串) 
- 请求示例: 
{
    "accessToken": "e6e18763d8212d26ced4f92512881c63c468d5a756d45c01486d7ad6742152ac",
    "tenantId": 1238,
    "timestamp": 1667295870936,
    "data": [
        {
            "id": "30e873ab8f4840e2b610c414fe967327",
            "messageId": "7a324c7b5512468cb7a9296af0f8379b",
            "userName": "gdkj002",
            "whatsId": "8617633819542@c.us",
            "friendWhatsId": "8615601882491@c.us",
            "currentWhatsId": "8617633819542@c.us",
            "actionType": 1,
            "chatType": 1,
            "messageStatus": 1,
            "content": "再见",
            "contentType": 0,
            "originType": 1,
            "sendTime": "2022-10-31 16:25:42",
            "userProfile":{
                "id":8423922419416375296,
                "name":"好友1",
                "whatsApp":"447759820897",
                "username":"testlsl001",
                "extendsMap":"{\"单行文本\":\"caseId009\",\"多选\":\"[]\",\"日期\":\"\"}",
                "income":"",
                "profession":"",
                "desc":"",
                "tags":[
                    "测试",
                    "测试000000000000000000",
                    "11111"
                ],
                "email":"",
                "address":"北京"
            },
            "taskId": 0,
            "taskInfoId": 0
        },
        {
            "id": "31057e55b9f842b4becf4a9ff699b64e",
            "messageId": "82bfefadceb948428fd3f3ef659e14b3",
            "userName": "gdkj002",
            "whatsId": "8617633819542@c.us",
            "friendWhatsId": "8615601882491@c.us",
            "currentWhatsId": "8617633819542@c.us",
            "actionType": 1,
            "chatType": 1,
            "messageStatus": 1,
            "content": "{\"caption\":\"\",\"filename\":\"\",\"mimetype\":\"video/mp4\",\"url\":\"https://image.whatsappscrm.com/client/603704/chat_history/1665198225749_video\"}",
            "contentType": 2,
            "originType": 1,
            "sendTime": "2022-10-31 16:25:42",
            "userProfile":{
                "id":8423922419416375296,
                "name":"好友2",
                "whatsApp":"447759820897",
                "username":"testlsl001",
                "extendsMap":"{\"单行文本\":\"caseId007\",\"多选\":\"[]\",\"日期\":\"\"}",
                "income":"100002",
                "profession":"IT",
                "desc":"备注",
                "tags":[
                    "测试",
                    "测试000000000000000000",
                    "11111"
                ],
                "email":"",
                "address":"北京"
            },
            "taskId": null,
            "taskInfoId": null
        }
    ]
}
- 返回参数说明 - 参数名 - 类型 - 是否必填 - 备注 - code - int - 是 - 状态码 - message - String - 否 - 描述 - data - String - 否 - 数据 
- 响应示例: - { "code": 200, "message": "success!", "data": "" }
客户端消息同步
- 描述
客户端消息同步
- WebHook 
- 配置ID <CLIENT_SYNC_MESSAGE> 
- 请求方式 
POST、Content-Type: application/json
- 请求参数说明
| 字段 | 类型 | 是否必填 | 备注 | 
|---|---|---|---|
| userId | String | 否 | 坐席id,协议消息时默认为空 | 
| String | 是 | ||
| friendWhatsApp | String | 是 | friendWhatsApp | 
| actionType | int | 是 | 行为类型 1、发消息 2、 收消息 | 
| chatType | int | 是 | 聊天性质 1、普通聊天 2、 群聊 | 
| taskId | String | 否 | 任务 id | 
| taskInfoId | String | 否 | 任务详情 id | 
| content | List | 是 | 消息内容 | 
- content 参数说明
| 参数名 | 类型 | 是否必填 | 备注 | 
|---|---|---|---|
| type | int | 是 | 内容类型 1、文字 2、图片 3、音频 4、文件 5、视频 6、名片 7、贴纸 8、电话 9、引用 10、名片超链 11、分流超链 12、语音 13、地理位置 14、多名片 15、GIF图片 99、暂不支持类型 | 
| text | String | 否 | 文本内容 | 
| url | String | 否 | 消息对象,非文字类型时,该字段才有值 | 
| messageId | String | 是 | 消息 id | 
| time | long | 是 | 时间 | 
| referContent | String | 否 | 类型为引用时消息内容 | 
- url 参数说明
| 参数名 | 类型 | 是否必填 | 备注 | 
|---|---|---|---|
| filename | String | 否 | 文件名称 | 
| url | String | 否 | 链接地址 | 
| mimeType | String | 否 | 媒体类型 | 
| caption | String | 否 | 标题 | 
| type | int | 否 | 内容类型,当外层 type 为引用类型时,该字段有值 | 
- referContent 参数说明
| 参数名 | 类型 | 是否必填 | 备注 | 
|---|---|---|---|
| filename | String | 否 | 文件名称 | 
| url | String | 否 | 链接地址 | 
| mimeType | String | 否 | 媒体类型 | 
| caption | String | 否 | 标题 | 
| messageId | String | 是 | 消息 id | 
| String | 是 | ||
| type | int | 是 | 内容类型 1、文字 2、图片 3、音频 4、文件 5、视频 6、名片 7、贴纸 8、电话 9、引用 10、名片超链 11、分流超链 12、语音 13、地理位置 14、多名片 15、GIF图片 99、暂不支持类型 | 
- 常见 MIME 类型列表
- 请求示例:
[
    {
      "userId":"82",
      "whatsApp":"86172272727",
      "friendWhatsApp":"61191828282",
      "actionType":1,
      "chatType":1,
      "taskId":"taskid00001",
      "taskInfoId":"a0001",
      "content":[
        {
          "type": 1,
          "text": "hello",
          "messageId": "19282dskdasldjl01",
          "time": 1689129792000
        }
      ]
    },
    {
      "userId":"82",
      "whatsApp":"86172272727",
      "friendWhatsApp":"61191828282",
      "actionType":1,
      "chatType":1,
      "taskId":"taskid00001",
      "taskInfoId":"a0002",
      "content":[
        {
          "type": 2,
          "url": "{\"filename\": \"e70faa31-62dc-4d00-a42a-8a07735aa350\",\"url\": \"https://id-wscrm.oss-accelerate.aliyuncs.com/client/d584b8cfb9185cc999389f17b4236b3b/61733005-dfdb-4704-9c5d-944423c70dd1\",\"mimeType\": \"image/jpeg\", \"caption\": \"\"}",
          "messageId": "19282dskdasldjl02",
          "time": 1689129793000
        }
      ]
    },
    {
      "userId":"82",
      "whatsApp":"86172272727",
      "friendWhatsApp":"8615375457649",
      "actionType":1,
      "chatType":1,
      "taskId":"taskid00001",
      "taskInfoId":"a0003",
      "content":[
        {
          "type": 9,
          "url": "{\"caption\":\"1\",\"filename\":\"\",\"mimeType\":\"\",\"type\":1,\"url\":\"\"}",
          "messageId": "19282dskdasldjl03",
          "time": 1689129794000,
          "referContent": "{\"caption\":\"1\",\"filename\":\"\",\"mimeType\":\"\",\"type\":1,\"url\":\"\",\"whatsApp\":\"8615375457649\",\"messageId\":\"3EB04F939512D66B1F2DFA\"}"
        }
      ]
    }
]
- 响应参数说明
| 参数名 | 类型 | 是否必填 | 备注 | 
|---|---|---|---|
| code | int | 是 | 状态码 | 
| message | String | 否 | 描述 | 
| data | String | 否 | 数据 | 
- 响应示例:
{
  "data": "",
  "code": 200,
  "message": "success"
}
客户端消息状态同步
- 描述
客户端消息状态同步
- WebHook 
- 配置 ID<CLIENT_SYNC_MESSAGE_STATUS> 
- 请求方式 
POST、Content-Type: application/json
- 请求参数说明
| 字段 | 类型 | 是否必填 | 备注 | 
|---|---|---|---|
| userId | String | 是 | 坐席id | 
| taskId | String | 否 | 任务 id | 
| taskInfoId | String | 否 | 任务详情 id | 
| messageStatus | int | 是 | 消息状态 1,未发送到wa服务器 2,已发送到wa服务器 3,未读 4,已读 | 
| messageId | String | 是 | 消息 id | 
- 请求示例
[
    {
      "userId":"82",
      "taskId":"",
      "taskInfoId":"",
      "messageStatus": 2,
      "messageId": "19282dskdasldjl21"
    }
]
- 响应参数说明
| 参数名 | 类型 | 是否必填 | 备注 | 
|---|---|---|---|
| code | int | 是 | 状态码 | 
| message | String | 否 | 描述 | 
| data | String | 否 | 数据 | 
- 响应示例:
{
  "data": "",
  "code": 200,
  "message": "success"
}
