美洽通过 Webhooks 功能将工作台的对话、顾客数据,以回调方式主动同步到你的服务器,你可以基于收到的数据做进一步处理。
主题
当主题对应的事件被触发时,美洽会向 Webhook URL 发送请求,你可前往APIs查看请求的完整数据结构。
主题名称 | 业务数据 | 触发事件 |
创建对话 conversation.created | Conversation | 创建对话 |
结束对话 conversation.closed | Conversation | 手动或自动结束对话 |
更新对话 conversation.updated | Conversation | 客服修改对话小结 |
首次分配客服 conversation.scheduled | Conversation | 首次分配客服 |
创建顾客 client.created | Client | 创建顾客、访客转化为顾客 |
更新顾客 client.updated | Client | 在工作台更新顾客参数 |
删除顾客 client.deleted | Client | 删除顾客 |
通话结束 cdr.hangup | Cdr | 通话结束 |
机器人通话结束 call_robot.hangup | Cdr | 机器人通话结束 |
请求
请求中,美洽会在 HTTP Header 中增加 Meiqia-Signature
,企业需要校验该签名,以验证数据安全性,以下是签名校验的具体流程:
- 读取 HTTP 请求的 Body,将其转换为字符串
body_str
; - 将
body_str
和secret
拼接成需要加密的字符串encrypted_str
,body_str
在前,secret
在后; - 对
encrypted_str
进行 SHA1 加密得到signature_str
; - 将
sign_str
和 HTTP Header 中的Meiqia-Signature
的值进行比对。
请求示例
POST /api/meiqia/notify HTTP/1.1
Host: 127.0.0.1:5005
User-Agent: Go-http-client/1.1
Content-Length: 3140
Content-Type: application/json; charset=utf-8
Meiqia-Sign: 44cb7f1e544d8830ab0e1feb959b94b3e02eb7e9
Accept-Encoding: gzip
{
"id": "sub_09e4bee581ffbcd347fcf634e0f99df8_1632648830", //美洽定义的请求唯一标识
"event": "conversation.updated", //本次请求对应的主题
"enterprise_token": "09e4bee581ffbcd347fcf634e0f99df8", //美洽定义的企业 token
"created_at": 1632648830, //请求的创建时间
"conversation": { //请求的业务数据
"enterprise_id": 97631,
"dev_client_id": null,
"page_from_url": "",
"search_engine": ""
}
}
响应
状态码 | 描述 |
200 | 成功,美洽将订阅的主题成功推送到 Webhook URL |
如果没有返回状态码,那么美洽认为本次推送通知失败,暂无重试机制。
通话记录模型
参数 | 类型 | 说明 |
call_uuid | String | 通话唯一标识ID |
call_type | String | 通话类型:外呼,来电,呼出转接,呼入转接 |
start_time | String | 通话开始时间 |
end_time | String | 通话结束时间 |
states | String | 通话状态: 外呼状态:主叫未接、被叫未接、接听(双方接听) 来电状态:ivr、队列放弃、振铃未接、接听 |
answer_way | String | 接听方式 |
hangup_disposition | String | 挂断方 |
wait_time | Integer | 振铃等待时长 |
queue_wait_time | Integer | 队列等待时长 |
duration | Integer | 总时长 |
agent_id | Integer | 客服ID |
work_num | String | 客服工号 |
agent_phone | String | 客服呼叫坐席账号 |
agent_evaluated | Integer | 客服被评价的分数 |
customer_phone | String | 顾客号码 |
customer_attribution | String | 顾客号码归属地 |
customer_duration | Integer | 顾客通话时长 |
trunk_number | String | 中继号码 |
trunk_number_name | String | 中继号码别名 |
record_path | String | 录音文件 |
ent_token | String | 企业token |
user_data | String | 用户自定义数据 |
机器人通话记录模型
名称 | 类型 | 是否必须 | 备注 | 其他信息 |
---|---|---|---|---|
Billsec | integer | 非必须 | format: int64 | |
answer_at | string | 非必须 | 应答时间 | format: date-time |
answer_state | string | 必须 | 应答状态:answered:正常接通|not_connected:未接通 | |
billsec | string | 非必须 | 计费时长 | |
business_id | string | 非必须 | 业务ID | |
call_state | string | 必须 | 呼叫状态:synthesis:待合成|pending:待开始|calling:呼叫中|called:已呼叫|timeout:已超时|replay:待重播|terminated:已终止 | |
callee | string | 必须 | 被叫号码 | |
callee_attribution | string | 非必须 | 被叫号码归属地 | |
caller | string | 必须 | 主叫号码 | |
end_at | string | 必须 | 挂机时间 | format: date-time |
id | integer | 非必须 | format: int64 | |
intent_tag | integer [] | 非必须 | 意图标签ID | item 类型: integer |
├─ | 非必须 | |||
record_file | string | 非必须 | 录音文件 | |
redirect | string | 非必须 | ||
ring_time | string | 非必须 | ||
skill_name | string | 必须 | 话术模版名称 | |
start_at | string | 必须 | 呼叫开始时间 | format: date-time |
task_name | string | 必须 | 任务名称 | |
uuid | string | 必须 |
常见问题
美洽 Webhooks 请求时服务器地址是什么?
127.0.0.1