Skip to main content

INCS 消息回调

回调说明

  • INCS 定义的消息格式
  • 使用INCS工作台接收和回复消息时,可以设置该回调

回调请求方式

  • POST

回调内容

  • 回调分为 消息创建消息状态更新 回调

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.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"
    }
}
1.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"
    }
}
1.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"
    }
}
1.4. 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"
    }
}
1.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"
    }
}
1.6.1 110 自定义消息-whatsapp模板消息
{
    "event": "message_created",
    "message": {
        "id": 260400000085,
        "auth_id": 30058,
        "conversation_id": 972,
        "session_type": 1,
        "send_id": "staff_1001",
        "recv_id": "30058_85268415026",
        "type": 110,
        "custom_type": 11002,
        "custom_id": 15775,
        "channel_msg_id": "wamid.HBgLODUyNjg0MTUwMjYVAgARGBIzRUMxQzAxQzMwMTNFRkVBN0UA",
        "channel_status": 1,
        "content": {
            "data": {
                "id": 15775,
                "enterprise_id": 100006,
                "auth_id": 30058,
                "account_id": "269238056283774",
                "template_id": "2773590159650487",
                "namespace_id": "",
                "name": "11qwer",
                "language": "en",
                "category": "AUTHENTICATION",
                "correct_category": "",
                "has_params": 1,
                "status": "APPROVED",
                "quality": "",
                "components": [
                    {
                        "type": "BODY",
                        "text": "*123456* is your verification code. For your security, do not share this code.",
                        "add_security_recommendation": true,
                        "example": {
                            "body_text": [
                                [
                                    "123456"
                                ]
                            ]
                        }
                    },
                    {
                        "type": "FOOTER",
                        "text": "Expires in 5 minutes.",
                        "code_expiration_minutes": 5
                    },
                    {
                        "type": "BUTTONS",
                        "buttons": [
                            {
                                "type": "URL",
                                "text": "Copy code",
                                "url": "https://www.whatsapp.com/otp/code/?otp_type=COPY_CODE&code_expiration_minutes=5&code=otp{{1}}",
                                "example": [
                                    "https://www.whatsapp.com/otp/code/?otp_type=COPY_CODE&code_expiration_minutes=5&code=otp123456"
                                ]
                            }
                        ]
                    }
                ],
                "error": "",
                "created_at": "2026-03-11 16:27:33",
                "updated_at": "2026-03-11 16:27:41",
                "deleted_at": null,
                "status_updated_at": "2026-03-11 16:27:41",
                "quality_updated_at": null,
                "category_updated_at": null,
                "custom_type": 11002,
                "raw_params": [
                    {
                        "type": "body",
                        "parameters": [
                            {
                                "type": "text",
                                "text": 123456
                            }
                        ]
                    },
                    {
                        "type": "button",
                        "sub_type": "url",
                        "index": "0",
                        "parameters": [
                            {
                                "type": "text",
                                "text": 123456
                            }
                        ]
                    }
                ]
            }
        },
        "error": "",
        "source": 1,
        "created_at": "2026-04-07T13:09:39.000000Z",
        "updated_at": "2026-04-07T13:09:40.000000Z"
    }
}
1.6.2 110 自定义消息 - whatsapp 回复按钮
{
    "event": "message_created",
    "message": {
        "id": 260400000086,
        "auth_id": 30058,
        "conversation_id": 981,
        "session_type": 1,
        "send_id": "30058_6281519140327",
        "recv_id": "staff_1001",
        "type": 110,
        "custom_type": 11006,
        "custom_id": 260400000084,
        "channel_msg_id": "wamid.HBgNNjI4MTUxOTE0MDMyNxUCABIYIEFDNTRDNTVERTE2M0QxNjhGQjQ4RTE4Q0YyMUE1QjE3AA==",
        "channel_status": 0,
        "content": {
            "data": {
                "custom_type": 11006,
                "replying_to": "Thank you for subscribing",
                "text": "1111"
            }
        },
        "error": "",
        "source": 0,
        "created_at": "2026-04-07T13:11:29.000000Z",
        "updated_at": "2026-04-07T13:11:29.000000Z"
    }
}

2. 消息状态更新(message_status_updated)

参数说明
参数名 类型 必传 描述
event string 此处为 "message_status_updated",发送后触发该回调
message_id bigint INCS 消息ID
message_status int INCS 消息状态:1 sent, 2 failed, 3 delivered, 4 read
error string 当消息状态为2时的错误信息描述
updated_at datetime string 消息更新时间,ISO 8601 格式
回调示例
{
    "event": "message_status_updated",
    "message_id": 260400000084,
    "message_status": 4,
    "error": "",
    "updated_at": "2026-04-07T13:11:27.000000Z"
}