适用读者:负责实现 webhook AI 员工服务端(接收平台推送、回写消息)的工程师
协议版本:v1(2026-05-21)
访客
│ ① 发消息
▼
平台
│ ② event POST (Bearer 鉴权)
▼
你的 Webhook URL
│ ③ AI 计算
▼
你的服务端
│ ④ POST /ai-employee/send-message (Bearer 鉴权)
▼
平台
│ ⑤ 推送回复
▼
访客access_token 做双向 Bearer 鉴权。webhook_url:你的服务端入口(HTTPS,接收平台 POST 事件)access_token:随机字符串(建议 ≥ 32 字节), 双向鉴权凭据/ai-employee/send-message 接口推送 AI 的回复| 项 | 值 |
|---|---|
| Method | POST |
| Content-Type | application/json |
| Authorization | Bearer {access_token} |
| Body 编码 | UTF-8 JSON(JSON_UNESCAPED_UNICODE) |
| 超时 | 10 秒 |
| 字段 | 类型 | 说明 |
|---|---|---|
event_type | string | new_message / assign / reassign |
project_id | int | 项目 ID |
chat_user_id | string | 访客 ID(24 位 ObjectId) |
channel | int | 渠道枚举,见 附录 A |
session_id | string | 会话 ID(已混淆编码) |
current_assign_sys_user_id | int | 当前接待人 sys_user_id(即你这个 webhook AI 员工的 sys_user_id) |
chat_user_info | object | 访客资料快照(昵称/手机/邮箱等,结构按渠道不同) |
msg_list | array | 仅 new_message 事件携带,见 2.4 |
new_message — 访客发了新消息msg_listassign — 首次分配