INCS 消息回调
回调说明
- INCS 定义的消息格式
- 使用INCS工作台接收和回复消息时,可以设置该回调
回调请求方式
回调内容
1. 消息创建(message_created)
参数说明
| 参数名 |
类型 |
必传 |
描述 |
| event |
string |
是 |
此处为 "message_created",发送和接收消息时触发该回调 |
| message |
object |
是 |
INCS 定义的消息格式 |
message 结构说明
| 参数名 |
类型 |
必传 |
描述 |
| id |
bigint |
是 |
INCS 消息id |
| auth_id |
int |
是 |
INCS 消息通道id |
| conversation_id |
int |
是 |
INCS 会话id |
| session_type |
int |
是 |
INCS 会话类型:1单聊,2群聊 |
| send_id |
string |
是 |
INCS 发信人id |
| recv_id |
string |
是 |
INCS 收信人id |
| type |
int |
是 |
INCS 定义的消息类型,见下述 |
| custom_type |
int |
是 |
INCS 定义的自定义消息类型,type为110时有值 |
| custom_id |
bigint |
是 |
INCS 定义的自定义消息关联id |
| channel_msg_id |
string |
是 |
消息通道回传的id |
| channel_status |
int |
是 |
发出去的消息状态:0 created, 1 sent, 2 failed, 3 delivered, 4 read |
| content |
string |
是 |
信息体json |
| error |
string |
是 |
错误信息 |
| source |
int |
是 |
消息发送方式:0 INCS,1 API |
| created_at |
datetime string |
是 |
消息创建时间,ISO 8601 格式 |
| updated_at |
datetime string |
是 |
消息更新时间,ISO 8601 格式 |
消息类型(type)
| 枚举值 |
描述 |
| 101 |
文本消息 |
| 102 |
图片消息 |
| 103 |
音频消息 |
| 104 |
视频消息 |
| 105 |
文件消息 |
| 110 |
自定义消息 |
自定义消息类型(custom_type)
| 枚举值 |
描述 |
| 11002 |
whatsapp 模板消息 |
| 11006 |
whatsapp 回复按钮 |
| 11008 |
viber otp |
| 11009 |
rcs 模板消息 |
| 11010 |
rcs 建议回复 |
message 内容示例
1. 101 文本消息
{
"event": "message_created",
"message": {
"id": 260400000076,
"auth_id": 30058,
"conversation_id": 979,
"session_type": 1,
"send_id": "30058_6281519140327",
"recv_id": "staff_1001",
"type": 101,
"custom_type": 0,
"custom_id": 0,
"channel_msg_id": "wamid.HBgNNjI4MTUxOTE0MDMyNxUCABIYIEFDQTgwMEZCMUFERjZDQzhDNUVDQzM0Qzg2Qjg0QkI0AA==",
"channel_status": 0,
"content": {
"content": "Hi"
},
"error": "",
"source": 0,
"created_at": "2026-04-07T12:02:55.000000Z",
"updated_at": "2026-04-07T12:02:55.000000Z"
}
}
2. 102 图片消息
{
"event": "message_created",
"message": {
"id": 260400000079,
"auth_id": 30058,
"conversation_id": 979,
"session_type": 1,
"send_id": "staff_1001",
"recv_id": "30058_6281519140327",
"type": 102,
"custom_type": 0,
"custom_id": 0,
"channel_msg_id": "wamid.HBgNNjI4MTUxOTE0MDMyNxUCABEYEjI2NjgxQjgwMzkyRTQxMzQyMAA=",
"channel_status": 1,
"content": {
"sourcePath": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/images/69d4fca3eede4.png",
"sourcePicture": {
"uuid": "rc-upload-1775565512163-6",
"type": "image/png",
"size": 806876,
"width": 864,
"height": 864,
"url": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/images/69d4fca3eede4.png"
},
"bigPicture": {
"uuid": "rc-upload-1775565512163-6",
"type": "image/png",
"size": 806876,
"width": 864,
"height": 864,
"url": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/images/69d4fca3eede4.png"
},
"snapshotPicture": {
"uuid": "rc-upload-1775565512163-6",
"type": "image/png",
"size": 806876,
"width": 864,
"height": 864,
"url": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/images/69d4fca3eede4.png"
}
},
"error": "",
"source": 0,
"created_at": "2026-04-07T12:46:29.000000Z",
"updated_at": "2026-04-07T12:46:30.000000Z"
}
}
3. 103 音频消息
{
"event": "message_created",
"message": {
"id": 260400000081,
"auth_id": 30058,
"conversation_id": 980,
"session_type": 1,
"send_id": "30058_6281519140327",
"recv_id": "staff_1001",
"type": 103,
"custom_type": 0,
"custom_id": 0,
"channel_msg_id": "wamid.HBgNNjI4MTUxOTE0MDMyNxUCABIYIEFDMzM1Nzc3RjRDQjkxODc1MzAzMUZFMDlDQTU1QjM4AA==",
"channel_status": 0,
"content": {
"uuid": "2067977394126791",
"soundPath": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/audios/2067977394126791.ogg",
"sourceUrl": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/audios/2067977394126791.ogg",
"dataSize": 3040,
"duration": 1,
"soundType": "audio/ogg; codecs=opus"
},
"error": "",
"source": 0,
"created_at": "2026-04-07T12:54:11.000000Z",
"updated_at": "2026-04-07T12:54:11.000000Z"
}
}
5. 104 视频消息
{
"event": "message_created",
"message": {
"id": 260400000082,
"auth_id": 30058,
"conversation_id": 980,
"session_type": 1,
"send_id": "staff_1001",
"recv_id": "30058_6281519140327",
"type": 104,
"custom_type": 0,
"custom_id": 0,
"channel_msg_id": "wamid.HBgNNjI4MTUxOTE0MDMyNxUCABEYEjJDQUE4NjU5RkQyRThEM0ZGRQA=",
"channel_status": 1,
"content": {
"videoUUID": "rc-upload-1775565512163-13",
"videoUrl": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/videos/69d4fecef09fa.mp4",
"videoType": "video/mp4",
"videoSize": 2828720,
"duration": 39,
"snapshotPath": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/videos/69d4fecef09fa.mp4?x-oss-process=video/snapshot,t_0,f_jpg,ar_auto",
"snapshotUUID": "rc-upload-1775565512163-13",
"snapshotSize": 147949,
"snapshotUrl": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/videos/69d4fecef09fa.mp4?x-oss-process=video/snapshot,t_0,f_jpg,ar_auto",
"snapshotWidth": 392,
"snapshotHeight": 850,
"snapshotType": "image/png"
},
"error": "",
"source": 0,
"created_at": "2026-04-07T12:55:46.000000Z",
"updated_at": "2026-04-07T12:55:47.000000Z"
}
}
5. 105 文件消息
{
"event": "message_created",
"message": {
"id": 260400000080,
"auth_id": 30058,
"conversation_id": 979,
"session_type": 1,
"send_id": "staff_1001",
"recv_id": "30058_6281519140327",
"type": 105,
"custom_type": 0,
"custom_id": 0,
"channel_msg_id": "",
"channel_status": 0,
"content": {
"filePath": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/files/69d4fdd3bb80e.xlsx",
"uuid": "rc-upload-1775565512163-8",
"sourceUrl": "https://incs-test.oss-ap-southeast-1.aliyuncs.com/chat/files/69d4fdd3bb80e.xlsx",
"fileName": "Rcs-user.xlsx",
"fileSize": 9095,
"fileType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
},
"error": "",
"source": 0,
"created_at": "2026-04-07T12:51:32.000000Z",
"updated_at": "2026-04-07T12:51:32.000000Z"
}
}
6. 110 自定义消息
{
"senderPhoneNumber": "+628XXXXXXXXX",
"messageId": "5312df2b-54e3-457d-8654-49a4f3ba1a19",
"sendTime": "2024-04-05T13:16:42.183829Z",
"agentId": "test_vhbgamhn_agent@rbm.goog",
"suggestionResponse": {
"postbackData": "user_action_open_url",
"text": "visit our website",
"trackdata": {
"suggestionType": "url_action",
"msgType": "richcard",
"cardIndex": 0,
"suggestionIndex": 0,
"msgId": "019cc232-229a-7353-b860-87709fa4d7d4",
"msgDate": "2026-03-06T08:09:51.895Z",
"template": "2217703609111640005"
},
"type": "ACTION"
}
}
5. Location message
{
"senderPhoneNumber": "+62XXXXXXXXXX",
"messageId": "b0d0ea18-c809-4206-9ca2-5baf02707fe0",
"sendTime": "2025-07-29T06:08:36.741050Z",
"agentId": "test_dev_vhbgamhn_agent@rbm.goog",
"location": {
"longitude": 78.3861501,
"latitude": 17.4370557
}
}