当应用订阅此事件后,如果在 3chat 中创建了消息,则会调用 Webhook 推送该事件至响应的开发者服务器。
BUTLER_MESSAGE_CREATED{
"headers":{
// 租户ID
"TENANT_ID":[
"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
]
"STAFF_ID":[
"123123"
]
// 时间戳
"x-nct-time":[
"1750351569887"
]
// 业务类型代码
"business-type":[
"15016"
]
}{
"requestId": "03703d30-50f2-4103-bdb6-8aa331f36cc5", // 请求唯一标识符
"businessType": 15016, // 业务类型代码
"data": {
// 消息实体唯一 ID
"id": "51901704862228480",
// 发送者 ID,如果senderType==1, 则 senderId=【联系人id】; 如果senderType==2,则senderId=【平台发送者id】;如果senderType==3,则senderId=【Agent智能体id】
"senderId": "51901681609007100",
// 工作空间 ID
"workSpaceId": "a4872870-3cde-47f2-830f-a5f07801790b",
// 发送者类型: -1=未知,0=系统消息, 1=联系人, 2=人工客服,3=AI客服
"senderType": 1, // 应为枚举字符串,不是数字
// 发送时间(Unix 时间戳)- 必需字段
"sendTime": 1770489117,
// 消息内容 - 符合 SessionMessageDTO.content
"content": "介绍下你们的业务",
// 渠道 ID - 应为字符串,不是对象
"channelId": {
"id": "d56sxk7g0rzhazsuqdqz0d5u"
},
// 对话 ID - 应为字符串,不是对象
"conversationId": {
"id": "aqxqpddc36lyaeysxhhuekih"
},
// 会话 ID - 应为字符串,不是对象
"sessionId": {
"id": "kiaa9exjdwdcnzrzqgjp0a32"
},
// 是否为有效回复
"isEffectiveReply": true,
// 邮件信息
"email": {
"from": "abc@xinheyun.com",
"fromName": "析建军",
"to": [
"abc@xinheyun.com",
"abc@xinheyun.com",
"abc@xinheyun.com"
],
"cc": [
"abc@xinheyun.com",
"abc@xinheyun.com"
],
"bcc": [
"abc@xinheyun.com"
],
"subject": "产品咨询"
},
// 附件列表
"attachments": [
{
"key": "idolor",
"name": "琴梓涵.png",
"contentType": "image/png",
"url": "https://mature-printer.com/",
"size": 3132
}
],
// 智能体执行日志记录 - 记录智能体在处理消息过程中的各种操作,包括语言识别、知识召回、任务执行等
"agentLogs": [
{
// 语言判断
"type": "language",
"message": "中文",
"status": "certain", // agent确定语言
// "status": "uncertain", // agent不确定语言
"timestamp": 1762915391425
},
{
// 记忆唤醒
"type": "recall",
"message": "记忆内容:1,2,3",
"timestamp": 1762915391425
},
{
// 意图 & task 选择
"type": "task",
"name": "查询订单",
"timestamp": 1762915391425
},
{
// 知识库检索
"type": "knowledge",
"kb": [
{
"chunk_id": "7ae93248fe9",
"content":"Q:测试公司是做什么的?\nA:测试公司提供面向企业测试服务",
"created_at": 1763640658,
"document_id": "dd06afb5-7e33-4953-9247-113879e4653",
"document_name":"测试知识库.md",
"enabled": true,
"lang": "zh",
"score": 0.7226141428807815,
"source": "Document"
}
],
"timestamp": 1762915391425
},
{
//MCP tool调用
"type": "tool",
"name": "新建订单",
"costTime": 5,
"timestamp": 1762915391425
},
{
//MCP tool调用 - 状态行
"type": "tool",
"name": "新建订单",
"costTime": 5,
"status": "success", // tool 执行成功
// "status": "failed", // tool 执行失败
"timestamp": 1762915391425
},
{
// 内部 tool 调用
"type": "internalTool",
"entity": {
"name": "visitor",
"values": ["小牙仔", "13812345678"]
},
"timestamp": 1762915391425
},
{
// 特殊 task 执行
"type": "systemTask",
"name": "收集信息",
"message": "记录xx,xx,xx",
"timestamp": 1762915391425
}
],
// 创建时间戳 - 符合 SessionMessageDTO.createdTime
"createdTime": 1770489117249,
// 更新时间戳 - 符合 SessionMessageDTO.updatedTime
"updatedTime": 1747115523185,
// 原始JSON中不存在但SessionMessageDTO允许的可选字段:
"thirdId": "external_message_id", // 可选的第三方消息ID
"replyMessageId": "reply_message_id", // 可选的回复消息ID
"processedBy": "AI_AGENT" // 标记回复该消息的类型(HUMAN_AGENT=人工回复, AI_AGENT=AI回复, UNKNOWN=未标记)
}
}