Chat Records
Chat Records
Query Chat Records
Description
Paginated query of chat records
URI
/wscrm-bus-api/open/message/msgPage
Request Method
POST, Content-Type: application/json
Request Parameter Description
| Parameter Name | Type | Required | Remarks |
|---|---|---|---|
| tenantId | Long | Yes | Company id |
| info | Object | Yes | Query conditions |
| current | int | No | Page number, default 1 |
| pageSize | int | No | Count, default 10 |
info Parameter Description
| Parameter Name | Type | Required | Remarks |
|---|---|---|---|
| friendWhatsId | String | No | Target customer |
| whatsId | String | No | Customer service account |
| chatType | Integer | No | Message category: 1 individual, 2 group chat |
| actionType | Integer | No | 1 send 2 receive |
| contentType | String | No | Content type |
| startChatTime | Long | No | Chat time start (millisecond timestamp) |
| endChatTime | Long | No | Chat time end (millisecond timestamp) |
| agentAccount | String | No | Agent account(exact match) |
Note: range time values must appear in pairs; both creation start/end and chat start/end must be provided together.
- Request Example
{
"tenantId": 82,
"current": 1,
"pageSize": 10,
"info": {
"whatsId": "",
"friendWhatsId": "91844XXXX",
"chatType": 1,
"contentType": 2,
"agentAccount": "dev_miors"
}
}Response Parameter Description
Parameter Name Type Required Example Remarks code int Yes 200 Status code message String No Success Description data Object No Data data Parameter Description
Parameter Name Type Required Example Remarks total Integer Yes 1 Total count size Integer Yes Count current Integer Yes Current page pages Integer Yes records array Yes Data array records Object Parameter Description
Parameter Name Type Required Example Remarks username string Yes 1 Agent account whatsId string Yes Customer service account actionType Integer Yes Action type: 1 send, 2 receive chatType Integer Yes Message category: 1 individual, 2 group chat content Yes Chat content (structure varies by chat type) contentType Integer Yes Chat type friendWhatsId string Yes Chat target friendName string Yes Chat target name chatTime long Yes Chat time createTime long Yes Data creation time
Detailed chat content type description: 0 text; 1 image; 2 video; 3 audio; 4 file; 6 contact card; 7 sticker; 9 quoted message
- Response Example
{
"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": "This is 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://oss/1.png\",\"mimeType\":\"image/webp\",\"caption\":\"\"}",
"contentType": 7,
"friendWhatsId": "5735xxxx",
"friendName": "Evbuomwan Lawrence",
"chatTime": 1742782392000,
"createTime": 1742782401000
}
],
"total": 1,
"size": 10,
"current": 1,
"pages": 1
}
}Sync Chat Records
Description
Client send/receive message sync (when message status changes, it will be pushed again; only
messageStatusdiffers).WebHook
Configuration ID <MSG_SYNC_MESSAGE>
Request Parameter Description
Parameter Name Type Required Remarks accessToken String Yes Signature token string tenantId int Yes Company id timestamp Long Yes Millisecond timestamp data List Yes Format: [{},{}], details below (0-50 records) data Parameter Description:
Parameter Name Type Required Remarks id String Yes Data id identifier (uuid) messageId String Yes Message id userName String Yes Agent login account whatsId String Yes Sender WhatsApp (for individual chat: sender; for group chat: sender in group) friendWhatsId String Yes Friend WhatsApp (for group chat, this is group name) currentWhatsId String Yes Current customer service account actionType int Yes Action type: 1 send, 2 receive chatType int Yes Chat nature: 1 normal chat, 2 group chat messageStatus int Yes Message status: 1 sent (client), 3 delivered, 4 read content String Yes Content (details below) contentType int Yes Content type: 0 text, 1 image, 2 video, 3 audio, 4 file, 7 sticker newContentType int Yes Content type: 1 text, 2 image, 3 audio, 4 file, 5 video, 6 contact card, 7 sticker, 8 call, 9 quote, 10 contact card link, 11 routing link, 12 voice, 13 location, 14 multi-contact card, 15 GIF image, 99 unsupported type sendTime String Yes Message chat time originType int Yes Source: 1 PC, 2 app, 3 web userProfile object Yes Friend profile groupId string No Group id, present for group chats memberName string No Speaker name, present for group chats taskId long No Mass dispatch task id taskInfoId long No Mass dispatch task detail id
For data parameters, when
messageStatuschanges, status is re-synced; other content remains unchanged.
content Parameter Description:
Parameter Name Type Required Remarks filename String Yes File name url String Yes File URL mimeType String Yes MIME type caption String Yes File description - When content type is 1,2,3,4:
1 Image: image/jpeg、image/png、image/webp
2 Video: video/mp4
3 Audio: audio/aac、audio/m4a、audio/amr、audio/mpeg、audio/ogg; codecs=opus、codecs=opus
4 File: application/pdf、application/msword、application/ppt、application/xls
userProfile Parameter Description
Parameter Name Type Required Remarks id Long Yes Customer id name String Yes Customer nickname whatsApp String Yes Customer WhatsApp username String Yes Owner name income String Yes Income profession String Yes Profession desc String Yes Remarks tags array Yes Tags email String Yes Email address address String Yes Address extendsMap String Yes Extended info (JSON string) Request Example:
{
"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": "Goodbye",
"contentType": 0,
"originType": 1,
"sendTime": "2022-10-31 16:25:42",
"userProfile":{
"id":8423922419416375296,
"name":"Friend1",
"whatsApp":"447759820897",
"username":"testlsl001",
"extendsMap":"{\"Single line text\":\"caseId009\",\"Multi select\":\"[]\",\"Date\":\"\"}",
"income":"",
"profession":"",
"desc":"",
"tags":[
"test",
"test000000000000000000",
"11111"
],
"email":"",
"address":"Beijing"
},
"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":"Friend2",
"whatsApp":"447759820897",
"username":"testlsl001",
"extendsMap":"{\"Single line text\":\"caseId007\",\"Multi select\":\"[]\",\"Date\":\"\"}",
"income":"100002",
"profession":"IT",
"desc":"Remarks",
"tags":[
"test",
"test000000000000000000",
"11111"
],
"email":"",
"address":"Beijing"
},
"taskId": null,
"taskInfoId": null
}
]
}Response Parameter Description
Parameter Name Type Required Remarks code int Yes Status code message String No Description data String No Data Response Example:
{ "code": 200, "message": "success!", "data": "" }
Client Message Sync
- Description
Client message sync
WebHook
Configuration ID <CLIENT_SYNC_MESSAGE>
Request Method
POST, Content-Type: application/json
- Request Parameter Description
| Field | Type | Required | Remarks |
|---|---|---|---|
| userId | String | No | Agent id, empty by default for protocol messages |
| String | Yes | ||
| friendWhatsApp | String | Yes | friendWhatsApp |
| actionType | int | Yes | Action type: 1 send, 2 receive |
| chatType | int | Yes | Chat nature: 1 normal chat, 2 group chat |
| taskId | String | No | Task id |
| taskInfoId | String | No | Task detail id |
| content | List | Yes | Message content |
- content Parameter Description
| Parameter Name | Type | Required | Remarks |
|---|---|---|---|
| type | int | Yes | Content type: 1 text, 2 image, 3 audio, 4 file, 5 video, 6 contact card, 7 sticker, 8 call, 9 quote, 10 contact card link, 11 routing link, 12 voice, 13 location, 14 multi-contact card, 15 GIF image, 99 unsupported type |
| text | String | No | Text content |
| url | String | No | Message object; this field is set for non-text types |
| messageId | String | Yes | Message id |
| time | long | Yes | Time |
| referContent | String | No | Message content when type is quote |
- url Parameter Description
| Parameter Name | Type | Required | Remarks |
|---|---|---|---|
| filename | String | No | File name |
| url | String | No | Link URL |
| mimeType | String | No | Media type |
| caption | String | No | Title |
| type | int | No | Content type; set when outer type is quote |
- referContent Parameter Description
| Parameter Name | Type | Required | Remarks |
|---|---|---|---|
| filename | String | No | File name |
| url | String | No | Link URL |
| mimeType | String | No | Media type |
| caption | String | No | Title |
| messageId | String | Yes | Message id |
| String | Yes | ||
| type | int | Yes | Content type: 1 text, 2 image, 3 audio, 4 file, 5 video, 6 contact card, 7 sticker, 8 call, 9 quote, 10 contact card link, 11 routing link, 12 voice, 13 location, 14 multi-contact card, 15 GIF image, 99 unsupported type |
- Common MIME types
- Request Example:
[
{
"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":"61191828282",
"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\":\"61191828282\",\"messageId\":\"3EB04F939512D66B1F2DFA\"}"
}
]
}
]- Response Parameter Description
| Parameter Name | Type | Required | Remarks |
|---|---|---|---|
| code | int | Yes | Status code |
| message | String | No | Description |
| data | String | No | Data |
- Response Example:
{
"data": "",
"code": 200,
"message": "success"
}Client Message Status Sync
- Description
Client message status sync
WebHook
Configuration ID <CLIENT_SYNC_MESSAGE_STATUS>
Request Method
POST, Content-Type: application/json
- Request Parameter Description
| Field | Type | Required | Remarks |
|---|---|---|---|
| userId | String | Yes | Agent id |
| taskId | String | No | Task id |
| taskInfoId | String | No | Task detail id |
| messageStatus | int | Yes | Message status: 1 not sent to WA server, 2 sent to WA server, 3 unread, 4 read |
| messageId | String | Yes | Message id |
- Request Example
[
{
"userId":"82",
"taskId":"",
"taskInfoId":"",
"messageStatus": 2,
"messageId": "19282dskdasldjl21"
}
]- Response Parameter Description
| Parameter Name | Type | Required | Remarks |
|---|---|---|---|
| code | int | Yes | Status code |
| message | String | No | Description |
| data | String | No | Data |
- Response Example:
{
"data": "",
"code": 200,
"message": "success"
}