webhook使用说明
此文档是约束用户提供的webhook接口的入参和返回值
接口有两种使用方式
+ 消息触发型:通过对用户消息做匹配触发,答案替换webhook里返回的ansContent
+ 任务推送型:这个需要你对机器人管理系统的任务式对话功能有一定的了解,请求参数是我方在调用你方
接口时候给的入参,请求结果是我方需要你在接口中按格式返回的信息
一、消息触发型
鉴权方式
公式
sign=SHA1(integrationName&appKey×tamp)
其中:
- integrationName: 对接名称,webhook配置的名称
- key: 鉴权密钥,webhook里配置的key
- timestamp: 时间戳,'1970-01-01 00:00:00’至今的秒数
- 数据间需要&符号链接
鉴权数据示例
名称 |
值 |
integrationName |
对接一 |
key |
221b368d7f5f597867f525971f28ff75 |
timestamp |
1496631984 |
计算机签名:
sign = sha1("对接一&221b368d7f5f597867f525971f28ff75&1496631984") ->
96d8271cd705d3f134d215e9b3c27bb73f1132ed
请求地址
- POST HOST/{relative address}
请求参数
Request Body
Path |
Type |
Required |
Description |
timestamp |
Integer |
true |
时间戳 |
sign |
String |
true |
签名 |
integrationName |
String |
true |
对接名称 |
regex |
String |
true |
正则表达式 |
questionContent |
String |
true |
问题内容 |
extra |
Object |
false |
附加参数对象 |
extra.weChatOpenId |
String |
false |
如果为微信渠道,则为微信的openId |
customerExtra |
Object |
false |
客户自定义附加对象 |
customerExtra.customerId |
Integer |
false |
客服系统的用户Id |
请求结果
Path |
Type |
Description |
answerContent |
String |
答案内容 |
示例
$ curl 'HOST/API' -i -X POST -H 'Content-Type: application/json' -d '{
"timestamp" : 1513150103,
"sign" : "ab991af4ef65fc6061cf16c19d7d9d1bc1e12dcb",
"integrationName" : "对接一",
"regex" : "[abc]",
"questionContent" : "问题内容",
"extra" : {
weChatOpenId : "wechatId"
}
}'
返回
{
"answerContent" : "这里是答案"
}
二、任务推送型
签名
- 内容(key + taskNodeId + sessionId + timestamp)
- 方式(md5Hex)
签名参数(数据间直接拼接)
- key: 鉴权密钥,webhook里配置的key
- taskNodeId: 请求体里传,当前任务树走到的节点Id (当webhook在新表单里使用时不参与鉴权为null)
- sessionId: 请求体里传,当前会话的标识Id
- timestamp: 请求体里传,时间戳,'1970-01-01 00:00:00’至今的秒数
鉴权数据示例
名称 |
值 |
taskNodeId |
100 |
sessionId |
100 |
key |
abcde |
timestamp |
1551510709 |
计算机签名:
public String generateSign(){
StringBuilder query = new StringBuilder();
query.append(key);
//taskNodeId不为null时参与鉴权
if (taskNodeId != null) {
query.append(taskNodeId);
}
query.append(sessionId).append(timestamp);
return DigestUtils.md5Hex(query.toString());
}
示例
//任务树里使用时生成的签名
sign = md5Hex(abcde1001001551510709) ->
9195e2a5c1d84b86dc59819f29a0e300
//新表单使用时生成的签名
sign = md5Hex(abcde1001551510709) ->
7c3479422b034a62fff5d23e883f07d8
1.输出样式-完全自定义样式
请求参数
Request Body
Parameter |
Type |
Required |
Description |
taskNodeId |
Integer |
false |
节点ID,当前任务式会话匹配停留的节点Id(当在任务树里使用时必填,在新表单里使用时为空) |
sessionId |
Integer |
true |
会话ID,对话记录的Id |
timestamp |
Long |
true |
时间戳 |
sign |
String |
true |
签名 |
variables |
Map |
false |
变量Map,任务树配置里搜集到的变量 |
customerExtra |
Object |
false |
客户自定义附加对象 |
customerExtra.customerId |
Integer |
false |
客服系统的用户Id |
customerExtra.callerNumber |
String |
false |
语音机器人主叫号码(此字段为语音机器人使用) |
customerExtra.dialogueDesc |
String |
false |
此字段使用比较特殊,是为了满足客户给机器人对话的Webhook传自定义信息的需求 首先要在客服系统里,客户自定义字段内,设置一个名字叫做c_cf_dialogueDesc的自定义字段 可以设置客户的该字段值 之后打开聊天插件,将该字段添加到路径参数里,格式如下 https://xxx.udesk.cn/im_client/?web_plugin_id=41597&c_cf_dialogueDesc=* 这样系统会自动将该参数值以参数dialogueDesc的形式当做webhook的一个请求参数传进去 特殊提醒:客服系统和路径传参都是以c_cf_dialogueDesc参数名进行传值 |
请求结果
Parameter |
Type |
Description |
resCode |
Integer |
响应码【0成功/-1失败】 |
resError |
String |
非用户级别错误信息 |
message |
Message |
用户消息 |
variables |
Map |
变量设置,你可以修改变量表 |
toTaskNodeId |
Integer |
跳转任务节点ID,动作是跳转节点有效 |
routeType |
Integer |
跳转节点类型(1.直接触发 2.等待回复) |
command |
String |
动作指令 |
message
Parameter |
Type |
Required |
Description |
msgType |
String |
true |
消息类型 |
msgContent |
Object |
true |
消息内容 |
msg_type
selective_table
Parameter |
Type |
Description |
title |
String |
标题 |
rowNumber |
Integer |
行数 |
columnNumber |
Integer |
列数 |
optionList |
List<Option> |
选项列表 |
selective_list
Parameter |
Type |
Description |
title |
String |
标题 |
optionList |
List<Option> |
选项列表 |
show_product
Parameter |
Type |
Description |
title |
String |
标题 |
showSize |
Integer |
默认展示数量 |
turnFlag |
Integer |
轮播标识 |
productList |
List<OptionalProduct> |
商品列表 |
custom_card
Parameter |
Type |
Description |
id |
Integer |
主键 |
name |
String |
名称 |
turnFlag |
Integer |
是否轮播标志 0否1是 default 0 换一组的功能 |
showSize |
Integer |
卡片列表显示数量 turnFlag=1有效 |
title |
String |
标题,如果不为空,则显示title卡片 |
cardList |
List |
卡片列表 |
cardList[].id |
Integer |
卡片Id |
cardList[].type |
Integer |
卡片类型 1.富文本卡片 2.FAQ推荐列表卡片 |
cardList[].isHit |
Integer |
卡片是否能点击 type=1有效 0否 1是 |
cardList[].hitType |
Integer |
卡片点击效果 type=1&isHit=1有效 1超链接 2回复消息 回复消息是指在聊天窗替用户提问一串文本 3结构化消息,把hitContent文本内容当做消息发送出去 4 小程序链接 |
cardList[].hitContent |
String |
卡片点击内容 type=1&isHit=1有效 hitType=1是链接地址 hitType=4是小程序跳转链接 |
cardList[].hitShowContent |
String |
hitType=3有效 点击消息发送的消息卡片,如果此字段不为空聊天窗就显示这个,如果为空就显示content |
cardList[].content |
String |
富文本具体内容 type=1有效 |
cardList[].suggestContent |
String |
FAQ推荐卡片的文案type=2有效 |
cardList[].suggestList |
List |
FAQ推荐的问题列表type=2有效 |
cardList[].suggestList[].id |
Integer |
问题的标识id.type=2有效 |
cardList[].suggestList[].content |
String |
问题的内容.type=2有效 |
cardList[].suggestList[].type |
Integer |
问题类型type=2有效 |
optional_product
Parameter |
Type |
Description |
id |
Integer |
ID |
name |
String |
商品名称 |
image |
String |
商品图片 |
url |
String |
商品链接 |
infoList |
List<ProductInfo> |
商品信息 |
product_info
Parameter |
Type |
Description |
info |
String |
文本 |
boldFlag |
String |
加粗标识 |
url |
Integer |
商品链接 |
color |
String |
颜色 |
option
Parameter |
Type |
Description |
id |
String |
选项ID |
value |
String |
选项值 |
示例
## appKey:abcde
## sign:md5Hex(abcde1001001551510709)
$ curl 'http://demo.km.tryudesk.com/goods/full' -X POST -H 'Content-Type: application/json' -d '{
"taskNodeId" : 1,
"sessionId" : 1,
"timestamp" : 1551510709,
"variables" : {
"city":"北京",
"name":"李浩"
},
"sign" : "9195e2a5c1d84b86dc59819f29a0e300",
"pageSize":5,
"pageNum":1
}'
返回
{
"resCode": 0,
"resError": null,
"message": {
"msgType": "custom_card",
"msgContent": {
"id": 1,
"name": null,
"turnFlag": null,
"showSize": null,
"pageType": 1,
"pageNum": 1,
"pageSize": 5,
"total": 10,
"title": "请选择您要查看的订单",
"subTitle": null,
"cardListType": 1,
"chooseType": null,
"multipleChooseShowContent": null,
"chooseTime": null,
"cardList": [
{
"id": "21",
"type": 1,
"isHit": 1,
"hitType": 3,
"hitContent": "HZ234102391923",
"content": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/hzp-4.png\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>日本Fancl芳珂温和清洁卸妆油无添加脸部眼唇无刺激120ml*2瓶</div>\n\t\t\t <div>好化妆品4</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥258.00元</div>\n <div>共2件</div>\n <div>未发货</div>\n </div>\n </div>",
"hitShowContent": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/hzp-4.png\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>日本Fancl芳珂温和清洁卸妆油无添加脸部眼唇无刺激120ml*2瓶</div>\n\t\t\t <div>好化妆品4</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥258.00元</div>\n <div>共2件</div>\n <div>未发货</div>\n </div>\n </div>",
"switchStaffInfo": {
"orderNo": "0.06657132716779857"
}
},
{
"id": "20",
"type": 1,
"isHit": 1,
"hitType": 3,
"hitContent": "HZ23434523566",
"content": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/hzp-3.png\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>Lancome兰蔻小黑瓶100ml全新第二代补水保湿修复面部精华液肌底</div>\n\t\t\t <div>好化妆品3</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥809.00元</div>\n <div>共1件</div>\n <div>运输中</div>\n </div>\n </div>",
"hitShowContent": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/hzp-3.png\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>Lancome兰蔻小黑瓶100ml全新第二代补水保湿修复面部精华液肌底</div>\n\t\t\t <div>好化妆品3</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥809.00元</div>\n <div>共1件</div>\n <div>运输中</div>\n </div>\n </div>",
"switchStaffInfo": {
"orderNo": "0.0775044823922405"
}
},
{
"id": "19",
"type": 1,
"isHit": 1,
"hitType": 3,
"hitContent": "HZ2334232456",
"content": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/hzp-2.png\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>Armani/阿玛尼唇釉红管哑光丝绒口红番茄色405/400/206/415/300</div>\n\t\t\t <div>好化妆品2</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥155.00元</div>\n <div>共1件</div>\n <div>运输中</div>\n </div>\n </div>",
"hitShowContent": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/hzp-2.png\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>Armani/阿玛尼唇釉红管哑光丝绒口红番茄色405/400/206/415/300</div>\n\t\t\t <div>好化妆品2</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥155.00元</div>\n <div>共1件</div>\n <div>运输中</div>\n </div>\n </div>",
"switchStaffInfo": {
"orderNo": "0.32059480118821715"
}
},
{
"id": "18",
"type": 1,
"isHit": 1,
"hitType": 3,
"hitContent": "HZ134133239923",
"content": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/hzp-1.png\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>YSL圣罗兰细管口红哑光复古红小金条21号色显白高阶胡萝卜28号色</div>\n\t\t\t <div>好化妆品1</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥335.00元</div>\n <div>共1件</div>\n <div>已完成</div>\n </div>\n </div>",
"hitShowContent": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/hzp-1.png\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>YSL圣罗兰细管口红哑光复古红小金条21号色显白高阶胡萝卜28号色</div>\n\t\t\t <div>好化妆品1</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥335.00元</div>\n <div>共1件</div>\n <div>已完成</div>\n </div>\n </div>",
"switchStaffInfo": {
"orderNo": "0.6124907173788937"
}
},
{
"id": "17",
"type": 1,
"isHit": 1,
"hitType": 3,
"hitContent": "AJ578203294820",
"content": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/xie-8.jpg\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>New Balance 703系列 嘿</div>\n\t\t\t <div>好鞋子8</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥350.00元</div>\n <div>共10件</div>\n <div>已完成</div>\n </div>\n </div>",
"hitShowContent": "<div style=\"display: flex; margin: 0 20px; padding: 10px 0; border-bottom: 1px solid #C9C9C9;\">\n <div style=\"position: relative; flex: 1;\">\n <img style=\"position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%);\" src=\"https://staging-udesk.oss-cn-beijing.aliyuncs.com/demo/product_card/xie-8.jpg\" alt=\"图片\">\n </div>\n <div style=\"flex: 3; margin: 0 10px;\">\n <div>New Balance 703系列 嘿</div>\n\t\t\t <div>好鞋子8</div>\n </div>\n <div style=\"flex: 1; text-align: center;\">\n <div>¥350.00元</div>\n <div>共10件</div>\n <div>已完成</div>\n </div>\n </div>",
"switchStaffInfo": {
"orderNo": "0.7458115443687116"
}
}
]
},
"showType": null,
"cardListType": null
},
"variables": null,
"toTaskNodeId": null,
"routeType": null,
"command": null
}
2.输出样式-系统预制样式
2.1.气泡列表及横滑卡片
请求参数
Request Body
Parameter |
Type |
Required |
Description |
taskNodeId |
Integer |
true |
节点ID,当前任务式会话匹配停留的节点Id |
sessionId |
Integer |
true |
会话ID,对话记录的Id |
timestamp |
Long |
true |
时间戳 |
sign |
String |
true |
签名 |
variables |
Map |
false |
变量Map,任务树配置里搜集到的变量 |
pageNum |
Integer |
true |
页数 |
pageSize |
Integer |
true |
每页显示多少条 |
customerExtra |
Object |
false |
客户自定义附加对象 |
customerExtra.customerId |
Integer |
false |
客服系统的用户Id |
customerExtra.callerNumber |
String |
false |
语音机器人主叫号码(此字段为语音机器人使用) |
customerExtra.dialogueDesc |
String |
false |
此字段使用比较特殊,是为了满足客户给机器人对话的Webhook传自定义信息的需求 首先要在客服系统里,客户自定义字段内,设置一个名字叫做c_cf_dialogueDesc的自定义字段 可以设置客户的该字段值 之后打开聊天插件,将该字段添加到路径参数里,格式如下 https://xxx.udesk.cn/im_client/?web_plugin_id=41597&c_cf_dialogueDesc=* 这样系统会自动将该参数值以参数dialogueDesc的形式当做webhook的一个请求参数传进去 特殊提醒:客服系统和路径传参都是以c_cf_dialogueDesc参数名进行传值 |
请求结果
Parameter |
Type |
Required |
Description |
code |
Integer |
true |
200表示成功 |
data |
Array |
是 |
商品信息 |
data[].id |
Integer |
是 |
商品id |
data[].img |
String |
是 |
商品图片 |
data[].title |
String |
是 |
商品标题 |
data[].subTitle |
String |
否 |
商品副标题 |
data[].attr1 |
String |
否 |
属性1 |
data[].attr2 |
String |
否 |
属性2 |
data[].attr3 |
String |
否 |
属性3 |
data[].hitContent |
String |
否 |
点击商品发送到机器人的内容 |
paging |
Object |
是 |
分页 |
paging.pageNum |
Integer |
是 |
页数 |
paging.pageSize |
Integer |
是 |
每页数量 |
paging.total |
Integer |
是 |
总数 |
示例
## appKey:abcde
## sign:md5Hex(abcde1001001551510709)
$ curl 'http://demo.km.tryudesk.com/goods' -X POST -H 'Content-Type: application/json' -d '{
"taskNodeId" : 1,
"sessionId" : 1,
"timestamp" : 1551510709,
"sign" : "9195e2a5c1d84b86dc59819f29a0e300",
"pageSize":5,
"pageNum":1
}'
返回
{
"code": 200,
"message": "OK",
"visible": false,
"paging": {
"pageNum": 1,
"pageSize": 5,
"total": 20
},
"data": [{
"id": 21,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/hzp-4.png",
"title": "日本Fancl芳珂温和清洁卸妆油无添加脸部眼唇无刺激120ml*2瓶",
"subTitle": "好化妆品4",
"attr1": "258.00",
"attr2": "2",
"attr3": "未发货",
"hitContent": "HZ234102391923",
"tabId": null
}, {
"id": 20,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/hzp-3.png",
"title": "Lancome兰蔻小黑瓶100ml全新第二代补水保湿修复面部精华液肌底",
"subTitle": "好化妆品3",
"attr1": "809.00",
"attr2": "1",
"attr3": "运输中",
"hitContent": "HZ23434523566",
"tabId": null
},{
"id": 19,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/hzp-2.png",
"title": "Armani/阿玛尼唇釉红管哑光丝绒口红番茄色405/400/206/415/300",
"subTitle": "好化妆品2",
"attr1": "155.00",
"attr2": "1",
"attr3": "运输中",
"hitContent": "HZ2334232456",
"tabId": null
},
{
"id": 18,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/hzp-1.png",
"title": "YSL圣罗兰细管口红哑光复古红小金条21号色显白高阶胡萝卜28号色",
"subTitle": "好化妆品1",
"attr1": "335.00",
"attr2": "1",
"attr3": "已完成",
"hitContent": "HZ134133239923",
"tabId": null
},
{
"id": 17,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/xie-8.jpg",
"title": "New Balance 703系列 嘿",
"subTitle": "好鞋子8",
"attr1": "350.00",
"attr2": "10",
"attr3": "已完成",
"hitContent": "AJ578203294820",
"tabId": null
}
]
}
2.2. 抽屉列表(商品分类列表)
最多放五个分类,商品总数不超过20个,不支持分页
请求参数
Request Body
Parameter |
Type |
Required |
Description |
taskNodeId |
Integer |
true |
节点ID,当前任务式会话匹配停留的节点Id |
sessionId |
Integer |
true |
会话ID,对话记录的Id |
timestamp |
Long |
true |
时间戳 |
sign |
String |
true |
签名 |
variables |
Map |
false |
变量Map,任务树配置里搜集到的变量 |
customerExtra |
Object |
false |
客户自定义附加对象 |
customerExtra.customerId |
Integer |
false |
客服系统的用户Id |
customerExtra.callerNumber |
String |
false |
语音机器人主叫号码(此字段为语音机器人使用) |
customerExtra.dialogueDesc |
String |
false |
此字段使用比较特殊,是为了满足客户给机器人对话的Webhook传自定义信息的需求 首先要在客服系统里,客户自定义字段内,设置一个名字叫做c_cf_dialogueDesc的自定义字段 可以设置客户的该字段值 之后打开聊天插件,将该字段添加到路径参数里,格式如下 https://xxx.udesk.cn/im_client/?web_plugin_id=41597&c_cf_dialogueDesc=* 这样系统会自动将该参数值以参数dialogueDesc的形式当做webhook的一个请求参数传进去 特殊提醒:客服系统和路径传参都是以c_cf_dialogueDesc参数名进行传值 |
请求结果
Parameter |
Type |
Required |
Description |
code |
Integer |
true |
200表示成功 |
data.title |
|
|
标题 |
data.tabList |
Array |
是 |
分类 |
data.tabList[].id |
String |
是 |
分类id |
data.tabList[].name |
String |
是 |
分类名称 |
data.tabDataList |
Attay |
是 |
商品数据 |
data.tabDataList [].tabId |
String |
是 |
所属分类 |
data.tabDataList [].id |
Integer |
是 |
商品id |
data.tabDataList [].img |
String |
是 |
商品图片 |
data.tabDataList [].title |
String |
是 |
商品标题 |
data.tabDataList [].subTitle |
String |
否 |
商品副标题 |
data.tabDataList [].attr1 |
String |
否 |
属性1 |
data.tabDataList [].attr2 |
String |
否 |
属性2 |
data.tabDataList [].attr3 |
String |
否 |
属性3 |
data.tabDataList [].hitContent |
String |
否 |
点击商品发送到机器人咨询的内容 |
paging |
Object |
是 |
分页 |
paging.pageNum |
Integer |
是 |
页数 |
paging.pageSize |
Integer |
是 |
每页数量 |
paging.total |
Integer |
是 |
总数 |
示例
## appKey:abcde
## sign:md5Hex(abcde1001001551510709)
$ curl 'http://demo.km.tryudesk.com/goods/category' -X POST -H 'Content-Type: application/json' -d '{
"taskNodeId" : 1,
"sessionId" : 1,
"timestamp" : 1551510709,
"sign" : "9195e2a5c1d84b86dc59819f29a0e300",
"pageSize":5,
"pageNum":1
}'
返回
{
"code": 200,
"message": "OK",
"visible": false,
"data": {
"title": "请选择您需要的商品",
"tabList": [
{
"id": "1",
"name": "分类一"
},
{
"id": "2",
"name": "分类二"
},
{
"id": "3",
"name": "分类三"
},
{
"id": "4",
"name": "分类四"
},
{
"id": "5",
"name": "分类五"
}
],
"tabDataList": [
{
"id": 21,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/hzp-4.png",
"title": "日本Fancl芳珂温和清洁卸妆油无添加脸部眼唇无刺激120ml*2瓶",
"subTitle": "好化妆品4",
"attr1": "258.00",
"attr2": "2",
"attr3": "未发货",
"hitContent": "HZ234102391923",
"tabId": "1"
},
{
"id": 20,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/hzp-3.png",
"title": "Lancome兰蔻小黑瓶100ml全新第二代补水保湿修复面部精华液肌底",
"subTitle": "好化妆品3",
"attr1": "809.00",
"attr2": "1",
"attr3": "运输中",
"hitContent": "HZ23434523566",
"tabId": "1"
},
{
"id": 19,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/hzp-2.png",
"title": "Armani/阿玛尼唇釉红管哑光丝绒口红番茄色405/400/206/415/300",
"subTitle": "好化妆品2",
"attr1": "155.00",
"attr2": "1",
"attr3": "运输中",
"hitContent": "HZ2334232456",
"tabId": "1"
},
{
"id": 18,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/hzp-1.png",
"title": "YSL圣罗兰细管口红哑光复古红小金条21号色显白高阶胡萝卜28号色",
"subTitle": "好化妆品1",
"attr1": "335.00",
"attr2": "1",
"attr3": "已完成",
"hitContent": "HZ134133239923",
"tabId": "1"
},
{
"id": 17,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/xie-8.jpg",
"title": "New Balance 703系列 嘿",
"subTitle": "好鞋子8",
"attr1": "350.00",
"attr2": "10",
"attr3": "已完成",
"hitContent": "AJ578203294820",
"tabId": "1"
},
{
"id": 16,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/xie-7.jpg",
"title": "Nike Hyperdunk X 黑白",
"subTitle": "好鞋子7",
"attr1": "349.00",
"attr2": "9",
"attr3": "已完成",
"hitContent": "AJ234872023092",
"tabId": "2"
},
{
"id": 15,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/xie-6.jpg",
"title": "Nike LeBron 18 EP 黑紫",
"subTitle": "好鞋子6",
"attr1": "348.00",
"attr2": "8",
"attr3": "已退款",
"hitContent": "AJ234102391923",
"tabId": "2"
},
{
"id": 14,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/xie-5.jpg",
"title": "Adidas D Lillard 2 复活节 兰白高帮新款 特别推荐 阿迪名款 ",
"subTitle": "好鞋子5",
"attr1": "347.00",
"attr2": "7",
"attr3": "未付款",
"hitContent": "AJ23434523566",
"tabId": "2"
},
{
"id": 13,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/xie-4.jpg",
"title": "Air Jordan 1 Low Shadow 影子",
"subTitle": "好鞋子4",
"attr1": "346.00",
"attr2": "6",
"attr3": "未发货",
"hitContent": "AJ2334232456",
"tabId": "2"
},
{
"id": 12,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/xie-3.jpg",
"title": "Air Jordan 1 Mid “Chicago” 白红 小芝加哥",
"subTitle": "好鞋子3",
"attr1": "345.00",
"attr2": "5",
"attr3": "已发货",
"hitContent": "AJ234123239923",
"tabId": "2"
},
{
"id": 11,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/xie-2.jpg",
"title": "【刘耀文同款】Vans Old Skool Black 黑白休闲板鞋",
"subTitle": "好鞋子2",
"attr1": "344.00",
"attr2": "4",
"attr3": "配送中",
"hitContent": "AJ2341553222223",
"tabId": "3"
},
{
"id": 10,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/xie-1.jpg",
"title": "【薇娅推荐】 Converse All Star 70 高帮复古黑 1970s 2018款",
"subTitle": "好鞋子1",
"attr1": "343.00",
"attr2": "3",
"attr3": "已完成",
"hitContent": "AJ23412333456",
"tabId": "3"
},
{
"id": 9,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/8.png",
"title": "某某牌男装 新款polo衫男短袖韩版潮流宽松休闲翻领男士T恤上衣",
"subTitle": "好衣服8",
"attr1": "350.00",
"attr2": "10",
"attr3": "已完成",
"hitContent": "AX578203294820",
"tabId": "3"
},
{
"id": 8,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/7.png",
"title": "某某牌男装 新款polo衫男短袖韩版潮流宽松休闲翻领男士T恤上衣",
"subTitle": "好衣服7",
"attr1": "349.00",
"attr2": "9",
"attr3": "已完成",
"hitContent": "LD234872023092",
"tabId": "3"
},
{
"id": 7,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/6.png",
"title": "某某牌男装 新款polo衫男短袖韩版潮流宽松休闲翻领男士T恤上衣",
"subTitle": "好衣服6",
"attr1": "348.00",
"attr2": "8",
"attr3": "已退款",
"hitContent": "WE234102391923",
"tabId": "3"
},
{
"id": 6,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/5.png",
"title": "某某牌男装 新款polo衫男短袖韩版潮流宽松休闲翻领男士T恤上衣",
"subTitle": "好衣服5",
"attr1": "347.00",
"attr2": "7",
"attr3": "未付款",
"hitContent": "PO23434523566",
"tabId": "4"
},
{
"id": 5,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/4.png",
"title": "某某牌男装 新款polo衫男短袖韩版潮流宽松休闲翻领男士T恤上衣",
"subTitle": "好衣服4",
"attr1": "346.00",
"attr2": "6",
"attr3": "未发货",
"hitContent": "TN2334232456",
"tabId": "4"
},
{
"id": 4,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/3.png",
"title": "某某牌男装 新款polo衫男短袖韩版潮流宽松休闲翻领男士T恤上衣",
"subTitle": "好衣服3",
"attr1": "345.00",
"attr2": "5",
"attr3": "已发货",
"hitContent": "AC234123239923",
"tabId": "4"
},
{
"id": 3,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/2.png",
"title": "某某牌男装 新款polo衫男短袖韩版潮流宽松休闲翻领男士T恤上衣",
"subTitle": "好衣服2",
"attr1": "344.00",
"attr2": "4",
"attr3": "配送中",
"hitContent": "CH2341553222223",
"tabId": "4"
},
{
"id": 2,
"img": "http://pro-km.oss-cn-hangzhou.aliyuncs.com/demo/product_card/1.png",
"title": "某某牌男装 新款polo衫男短袖韩版潮流宽松休闲翻领男士T恤上衣",
"subTitle": "好衣服1",
"attr1": "343.00",
"attr2": "3",
"attr3": "已完成",
"hitContent": "ZH23412333456",
"tabId": "4"
}
]
}
}
2.3.气泡节点列表(物流信息)
请求参数
Request Body
Parameter |
Type |
Required |
Description |
taskNodeId |
Integer |
true |
节点ID,当前任务式会话匹配停留的节点Id |
sessionId |
Integer |
true |
会话ID,对话记录的Id |
timestamp |
Long |
true |
时间戳 |
sign |
String |
true |
签名 |
variables |
Map |
false |
变量Map,任务树配置里搜集到的变量 |
pageNum |
Integer |
true |
页数 |
pageSize |
Integer |
true |
每页显示多少条 |
customerExtra |
Object |
false |
客户自定义附加对象 |
customerExtra.customerId |
Integer |
false |
客服系统的用户Id |
customerExtra.callerNumber |
String |
false |
语音机器人主叫号码(此字段为语音机器人使用) |
customerExtra.dialogueDesc |
String |
false |
此字段使用比较特殊,是为了满足客户给机器人对话的Webhook传自定义信息的需求 首先要在客服系统里,客户自定义字段内,设置一个名字叫做c_cf_dialogueDesc的自定义字段 可以设置客户的该字段值 之后打开聊天插件,将该字段添加到路径参数里,格式如下 https://xxx.udesk.cn/im_client/?web_plugin_id=41597&c_cf_dialogueDesc=* 这样系统会自动将该参数值以参数dialogueDesc的形式当做webhook的一个请求参数传进去 特殊提醒:客服系统和路径传参都是以c_cf_dialogueDesc参数名进行传值 |
请求结果
Parameter |
Type |
Required |
Description |
code |
Integer |
是 |
200表示成功 |
data |
Object |
是 |
|
data.title |
String |
是 |
标题 |
data.subTitle |
String |
是 |
副标题 |
data.dataList |
Array |
是 |
|
data.dataList[].id |
String |
|
|
data.dataList[].status |
String |
|
物流状态 |
data.dataList[].title |
Stringv |
|
标题 |
data.dataList[].subTitle |
String |
|
副标题 |
示例
## appKey:abcde
## sign:md5Hex(abcde1001001551510709)
$ curl 'http://demo.km.tryudesk.com/expressInfo ' -X POST -H 'Content-Type: application/json' -d '{
"taskNodeId" : 1,
"sessionId" : 1,
"timestamp" : 1551510709,
"sign" : "9195e2a5c1d84b86dc59819f29a0e300",
"pageSize":5,
"pageNum":1
}'
返回
{
"code": 200,
"message": "OK",
"visible": false,
"data": {
"title": "请选择您需要的商品",
"subTitle": "圆通快递T2342452342",
"dataList": [
{
"id": "1",
"status": "已签收",
"title": "您的订单已由本人签收, 如有疑问可以联系配送员【段毅, 13800000000】确认,感谢您在京东购物, 欢迎再次光临",
"subTitle": "2020-08-08 18:59:59"
},
{
"id": "2",
"status": "运输中",
"title": "您的订单已到达京东【北京顺和营业部】",
"subTitle": "2020-08-08 18:59:59"
},
{
"id": "3",
"status": "运输中",
"title": "您的订单由京东【北京顺义分拣中心】送往【北京丰华营业部】",
"subTitle": "2020-08-08 18:59:59"
},
{
"id": "4",
"status": "运输中",
"title": "您的订单在京东【北京顺义分拣中心】分拣完成",
"subTitle": "2020-08-08 18:59:59"
},
{
"id": "5",
"status": "运输中",
"title": "您的订单由京东【北京李桥接货仓】送往【北京顺义分拣中心】",
"subTitle": "2020-08-08 18:59:59"
},
{
"id": "6",
"status": "已出库",
"title": "您的订单由京东【北京李桥接货仓】分拣完成",
"subTitle": "2020-08-08 18:59:59"
},
{
"id": "7",
"status": "仓库处理中",
"title": "第三方卖家已经开始拣货",
"subTitle": "2020-08-08 18:59:59"
},
{
"id": "8",
"status": "仓库处理中",
"title": "您的订单已进入第三方卖家仓库, 准备出库",
"subTitle": "2020-08-08 18:59:59"
},
{
"id": "9",
"status": "已下单",
"title": "您提交了订单, 请等待第三方卖家系统确认",
"subTitle": "2020-08-08 18:59:59"
}
]
}
}
三、资料库获取型
鉴权方式
公式
sign=sha256Hex(api×tamp)
其中:
- api: 鉴权密钥,webhook里配置的key
- timestamp: 时间戳,'1970-01-01 00:00:00’至今的秒数
- 数据间需要&符号链接
鉴权数据示例
名称 |
值 |
key |
123456 |
timestamp |
1551510709 |
计算机签名:
sign = sha256Hex("123456&1551510709")
请求地址
- POST HOST/{relative address}
请求参数
Request Body
Path |
Type |
Required |
Description |
timestamp |
Integer |
true |
时间戳 |
sign |
String |
true |
签名 |
datumId |
Integer |
false |
知识点id |
datumName |
String |
false |
知识点名称 |
sessionId |
Integer |
true |
会话id |
templateAttributeId |
Integer |
true |
模板属性id |
templateAttributeName |
String |
true |
模板属性名称 |
customer |
Object |
false |
客户自定义附加对象 |
请求结果
Path |
Type |
Description |
resCode |
Integer |
响应码【0成功/-1失败】 |
resError |
String |
错误信息 |
message |
Object |
用户消息 |
message.msgType |
String |
消息类型(可以为空) |
message.msgContent |
String |
消息内容 |
示例
$ curl 'HOST/API' -i -X POST -H 'Content-Type: application/json' -d '{
"timestamp" : 1513150103,
"sign" : "ab991af4ef65fc6061cf16c19d7d9d1bc1e12dcb",
"datumId" : 1,
"datumName" : "知识点名称",
"sessionId" : 123,
"templateAttributeId" : 456,
"templateAttributeName" : "模板属性名称",
"customer" : {
"origin_id" : 666,
"customer_token" : "123456",
"nick_name" : "昵称",
"c_email" : "123@163.com"
}
}'
返回
{
"resCode" : 0,
"resError" : "",
"message" : {
"msgType" : "",
"msgContent" : "消息内容"
}
}