1 问答接口

1.1 获取token

  • 接口地址
/v10/commons/integration/token
  • 接口请求示例
curl -X POST \
  http://robot.easemob.com/v10/commons/integration/token \
  -H 'content-type: application/json' \
  -d '{
  "password": "123abc",
  "username": "ceshi@163.com"
}'
  • 接口请求参数说明
password :密码
username :用户名
  • 接口返回的ResponseBody
{
    "status": "OK",
    "errorCode": null,
    "errorDescription": null,
    "entity": {
        "expires": 1520829328572,
        "role": "admin",
        "roleId": "07b53966-f080-11e7-92c2-6c92bf21d70d",
        "tenantId": 48,
        "userId": "72a3e752-29f5-482f-bdb6-67587e995b6b",
        "status": "OK",
        "token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjZXNoaUAxNjMuY29tIiwiaXNzIjoiZWFzZW1vYi1yb2JvdCIsInRlbmFudElkIjo0OCwiZXhwIjoxNTIwODI5MzI4LCJpYXQiOjE1MjAyMjQ1MjgsInVzZXJJZCI6IjcyYTNlNzUyLTI5ZjUtNDgyZi1iZGI2LTY3NTg3ZTk5NWI2YiIsImp0aSI6IjlkMzJkN2NlLTEzM2QtNDRiZC04Mzk3LWVmYzczZDdiNjI5ZiIsInVzZXJuYW1lIjoiY2VzaGlAMTYzLmNvbSJ9.Dk0AcN6fvv1ob5NDdA6_e4_YK5qRz9L_HxvTOlJt5gA",
        "username": "ceshi@163.com"
    },
    "first": null,
    "last": null,
    "size": null,
    "number": null,
    "numberOfElements": null,
    "totalPages": null,
    "totalElements": null
}
  • 接口返回字段说明
userId:用户id
tenantId:租户id
role:角色
roleId:角色id

1.2 获取所有机器人信息列表

  • 接口地址
/v10/tenants/{tenantId}/robots
  • 接口请求示例
curl -X GET \
  http://robot.easemob.com/v10/tenants/9/robots?page=0&size=4 \
  -H 'token: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjaGl4aWFveXUyMTFAMTYzLmNvbSIsImlzcyI6ImVhc2Vtb2Itcm9ib3QiLCJ0ZW5hbnRJZCI6OSwiZXhwIjoxNTIxMTY5MzM4LCJpYXQiOjE1MjA1NjQ1MzgsInVzZXJJZCI6IjFmYmNhNjE5LTZlMWItNDg2Yi1hOTdhLWE4MDc0ZjRlNzIxMSIsImp0aSI6IjQ0ZmFiYzk5LWI5MzctNDZmZi05ZTcyLTAzNDYyOWE5MDllMSIsInVzZXJuYW1lIjoiY2hpeGlhb3l1MjExQDE2My5jb20ifQ.2c7noYiWadTT84gnN4rmuyFcVRquJjt7RgaxMJgt5KE'
  • 请求参数说明
tenantId:租户id
robotId:机器人id
page:页码,从0开始,即获取第一页的内容,page=0,可以不传该参数
size:页面显示条数,可以不传
  • 接口返回的ResponseBody

{
    "status": "OK",
    "errorCode": null,
    "errorDescription": null,
    "entity": [
        {
            "id": 11,
            "robotId": "701b1c34-5018-49d5-a0e6-a8cfdcea9157",
            "tenantId": 9,
            "nicename": null,
            "type": "RobotApi",
            "status": "Enable",
            "avatar": null,
            "name": "默认机器人",
            "father": null,
            "mother": null,
            "school": null,
            "description": null,
            "sex": "male",
            "cityCode": null,
            "height": null,
            "weight": null,
            "blood": null,
            "createDateTime": "2018-01-04 20:21:04",
            "lastUpdateDateTime": "2018-01-04 20:21:04"
        },
        {
            "id": 12,
            "robotId": "6819571e-2f03-49ea-a962-0019fbc0301c",
            "tenantId": 9,
            "nicename": null,
            "type": "RobotApi",
            "status": "Enable",
            "avatar": null,
            "name": "潘多拉",
            "father": null,
            "mother": null,
            "school": null,
            "description": null,
            "sex": null,
            "cityCode": null,
            "height": null,
            "weight": null,
            "blood": null,
            "createDateTime": "2018-01-04 20:21:30",
            "lastUpdateDateTime": "2018-01-04 20:21:30"
        }
    ],
    "first": true,
    "last": true,
    "size": 4,
    "number": 0,
    "numberOfElements": 3,
    "totalPages": 1,
    "totalElements": 3
}
  • 接口返回字段说明
robotId:机器人id
tenantId:租户id
name:机器人名字
status:机器人状态:Enable:可用;

1.3 问答接口

  • 接口地址
/v10/tenants/{tenantId}/knowledge/robots/{robotId}/ask
  • 说明
    • 问答接口请求及response有两种情况,第一种是请求中的问题是普通类型(text类型),第二种情况是请求中的问题为点击菜单类型(上次答案是菜单,通过点击菜单按钮发送的请求)。

1.3.1 一般情况

  • 接口地址
/v10/tenants/{tenantId}/knowledge/robots/{robotId}/ask
  • 接口请求示例
curl - X POST\
  http: //robot.easemob.com/v10/tenants/48/knowledge/robots/743be0a7-ed27-476e-aa50-d28881392a89/ask \
    -H 'content-type: application/json'\ -
    H 'token: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjZXNoaUAxNjMuY29tIiwiaXNzIjoiZWFzZW1vYi1yb2JvdCIsInRlbmFudElkIjo0OCwiZXhwIjoxNTIwODI5MzI4LCJpYXQiOjE1MjAyMjQ1MjgsInVzZXJJZCI6IjcyYTNlNzUyLTI5ZjUtNDgyZi1iZGI2LTY3NTg3ZTk5NWI2YiIsImp0aSI6IjlkMzJkN2NlLTEzM2QtNDRiZC04Mzk3LWVmYzczZDdiNjI5ZiIsInVzZXJuYW1lIjoiY2VzaGlAMTYzLmNvbSJ9.Dk0AcN6fvv1ob5NDdA6_e4_YK5qRz9L_HxvTOlJt5gA'\ -
    d '{
"knowledgeId": "",
"question": "今天天气怎么样",
"strategyTransData": {
    "labels": ["VIP", "普通会员",
        "白金卡"
    ],
    "regions": [{
        "province": "辽宁省",
        "city": "沈阳市"
    }],
    "robotId": "743be0a7-ed27-476e-aa50-d28881392a89",
    "tenantId": 48
},
"tenantId": 48,
"type": "TEXT",
"userId": "72a3e752-29f5-482f-bdb6-67587e995b6b"
}'
  • 请求参数说明
knowledgeId:知识规则id,通常为空,注意:当用户上一次的问题返回的答案为菜单类型,用户点击该菜单或者将该菜单作为新的问题时,必须传入该字段
question:问题
strategyTransData:策略相关(不使用策略服务器,可以不传)。各个字段的意义如下:
                  labels:用户的标签字段数组,这个与策略存储的标签进行比较,例如可以是:vip/普通会员等;
                  regions:用户的地址信息,包含省市    
robotId:机器人id
tenantId:租户id
type:问题类型:text:文档类型;MENU_CLICK:点击菜单
userId:用户id
msg:文本答案
  • 接口返回ResponseBody
{
    "status": "OK",
    "errorCode": null,
    "errorDescription": null,
    "entity": {
        "userId": "72a3e752-29f5-482f-bdb6-67587e995b6b",
        "tenantId": 48,
        "question": "今天天气怎么样",
        "tag": null,
        "answerType": "BEST_ANSWER",
        "answerSource": "rule",
        "content": {
            "msg": "晴朗,阳光明媚",
            "type": "txt"
        },
        "dlgFinished": false,
        "sessionId": "11009dd6-9ee0-42db-b15b-8142c407787d",
        "satisfactionCommentInvitation": false,
        "msgId": "710 a98b8 - 893 c - 4418 - 90 f0 - 2 d76d1f4224a "
    },
    "first": null,
    "last": null,
    "size": null,
    "number": null,
    "numberOfElements": null,
    "totalPages": null,
    "totalElements": null
}
  • 接口返回参数说明
question:问题
robotId:机器人id
tenantId:租户id
type:问题类型
userId:用户id
msg:文本答案
answerType:答案匹配类型(DEFAULT:默认回复;BEST_ANSWER:最佳匹配答案;RECOMMENDATE_QUESTIONS:推荐问题;REPEAT:重复问题;SENSITIVE_WORD_INTERCEPTION:敏感词拦截)
answerSource:答案来源(DEFAULT:默认回复;FREECHAT:闲聊;INTENTION:意图识别;HUMAN_FIRST_ROUND:首次转出服务;HUMAN:转出服务;RULE:知识规则;MENU:菜单;RECOMMENDATE:推荐问题)
type:答案类型;对应的值说明:news:图文;txt:文本;img:图片;
menu:菜单;recommend:推荐问题;human:转出服务
satisfactionCommentInvitation:满意度评价邀请状态,true显示邀请,false不显示邀请
sessionId:会话id
msgId:消息id

1.3.2 当用户上一次的问题返回的答案为菜单类型,用户点击该菜单或者将该菜单作为新的问题时

  • 接口地址
/v10/tenants/{tenantId}/knowledge/robots/{robotId}/ask
  • 接口请求示例
curl - X POST\
  http: //robot.easemob.com/v10/tenants/9/knowledge/robots/6819571e-2f03-49ea-a962-0019fbc0301c/ask \
    -H 'content-type: application/json'\ -
    H 'token: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjaGl4aWFveXUyMTFAMTYzLmNvbSIsImlzcyI6ImVhc2Vtb2Itcm9ib3QiLCJ0ZW5hbnRJZCI6OSwiZXhwIjoxNTIxMTY5MzM4LCJpYXQiOjE1MjA1NjQ1MzgsInVzZXJJZCI6IjFmYmNhNjE5LTZlMWItNDg2Yi1hOTdhLWE4MDc0ZjRlNzIxMSIsImp0aSI6IjQ0ZmFiYzk5LWI5MzctNDZmZi05ZTcyLTAzNDYyOWE5MDllMSIsInVzZXJuYW1lIjoiY2hpeGlhb3l1MjExQDE2My5jb20ifQ.2c7noYiWadTT84gnN4rmuyFcVRquJjt7RgaxMJgt5KE'\ -
    d '{
"knowledgeId": "e519ab18-2f02-4f85-a40c-7d7018a6a1b7",
"question": "",
"strategyTransData": {
    "labels": ["VIP", "普通会员",
        "白金卡"
    ],
    "regions": [{
        "province": "辽宁省",
        "city": "沈阳市"
    }],
    "robotId": "743be0a7-ed27-476e-aa50-d28881392a89",
    "tenantId": 48
},
"tenantId": 48,
"type": "MENU_CLICK",
"userId": "72a3e752-29f5-482f-bdb6-67587e995b6b"
}
'
  • 接口请求参数说明
knowledgeId:知识规则id,通常为空,注意:当用户上一次的问题返回的答案为菜单类型,用户点击该菜单或者将该菜单作为新的问题时,必须传入该字段
question:问题
strategyTransData:策略相关(不使用策略服务器,可以不传),各个字段的意义如下:
                  labels:用户的标签字段数组,这个与策略存储的标签进行比较,例如可以是:vip/普通会员等;
                  regions:用户的地址信息,包含省市    
robotId:机器人id
tenantId:租户id
type:问题类型:text:文本类型;MENU_CLICK:点击菜单
userId:用户id
msg:文本答案
  • 接口返回ResponseBody
{
    "status": "OK",
    "errorCode": null,
    "errorDescription": null,
    "entity": {
        "msgId": "1df6c51f-1b18-4cf5-ac7e-3f06fdb2c05d",
        "userId": "72a3e752-29f5-482f-bdb6-67587e995b6b",
        "tenantId": 9,
        "question": "",
        "tag": null,
        "answerType": "BEST_ANSWER",
        "answerSource": "menu",
        "content": {
            "texts": [{
                "knowledgeId": "ee93f5d2-4f26-4a53-b43c-d324e3579eb4",
                "text": "第二级菜单"
            }],
            "title": "请选择以下菜单:",
            "titile": "请选择以下菜单:",
            "type": "menu"
        },
        "dlgFinished": false,
        "sessionId": "4d8e7f3b-73d8-41c0-bbec-36899f506acd",
        "satisfactionCommentInvitation": false,
        "msgId": "710 a98b8 - 893 c - 4418 - 90 f0 - 2 d76d1f4224a "
    },
    "first": null,
    "last": null,
    "size": null,
    "number": null,
    "numberOfElements": null,
    "totalPages": null,
    "totalElements": null
}
  • 接口返回参数说明
knowledgeId:菜单id 
question:问题
robotId:机器人id
tenantId:租户id
type:问题类型
userId:用户id
answerType:答案匹配类型(DEFAULT:默认回复;BEST_ANSWER:最佳匹配答案;RECOMMENDATE_QUESTIONS:推荐问题;REPEAT:重复问题;SENSITIVE_WORD_INTERCEPTION:敏感词拦截)
answerSource:答案来源(DEFAULT:默认回复;FREECHAT:闲聊;INTENTION:意图识别;HUMAN_FIRST_ROUND:首次转出服务;HUMAN:转出服务;RULE:知识规则;MENU:菜单;RECOMMENDATE:推荐问题)
type:答案类型;对应的值说明:news:图文;txt:文本;img:图片;
menu:菜单;recommend:推荐问题;human:转出服务
satisfactionCommentInvitation:满意度评价邀请状态,true显示邀请,false不显示邀请
sessionId:会话id
msgId: 消息Id
texts:菜单数组
text:菜单标题
title:标题

1.4 问答接口返回消息格式

1.4.1 答案为图片

  • 接口返回ResponseBody
{
    "userId": "8de05700-77e9-478a-a733-dd4e9457b753",
    "tenantId": 28468,
    "question": "测试图片",
    "tag": null,
    "answerType": "BEST_ANSWER",
    "content": {
        "size": {
            "width": 1836,
            "height": 374
        },
        "url": "cac07ee0-031b-4ebe-ae08-718de258541c",
        "filename": "13123123.png",
        "type": "img"
    },
    "dlgFinished": false,
    "sessionId": "4d8e7f3b-73d8-41c0-bbec-36899f506acd",
    "satisfactionCommentInvitation": false,
    "msgId": "710a98b8-893c-4418-90f0-2d76d1f4224a"
}
  • 接口返回参数说明
question:问题
robotId:机器人id
tenantId:租户id
userId:用户id
answerType:答案匹配类型(DEFAULT:默认回复;BEST_ANSWER:最佳匹配答案;RECOMMENDATE_QUESTIONS:推荐问题;REPEAT:重复问题;SENSITIVE_WORD_INTERCEPTION:敏感词拦截)
answerSource:答案来源(DEFAULT:默认回复;FREECHAT:闲聊;INTENTION:意图识别;HUMAN_FIRST_ROUND:首次转出服务;HUMAN:转出服务;RULE:知识规则;MENU:菜单;RECOMMENDATE:推荐问题)
type:答案类型;对应的值说明:news:图文;txt:文本;img:图片;
menu:菜单;recommend:推荐问题;human:转出服务;satisfactionCommentInvitation:满意度评价邀请状态,true显示邀请,false不显示邀请
sessionId:会话id
msgId: 消息id
url:图片id  
width:图片宽度picurl:原图
height:图片高度
filename:文件名
  • 获取图片
/v10/tenants/{租户id}/material/medias/{图片id}/stream
如:http://robot.easemob.com/v10/tenants/1/material/medias/fe6ffb8c-cade-4855-a8c6-416a1b9d9f3f/stream

1.4.2 答案为图文消息

  • 接口返回ResponseBody
{
    "userId": "8de05700-77e9-478a-a733-dd4e9457b753",
    "tenantId": 28468,
    "question": "测试图文",
    "tag": null,
    "answerType": "BEST_ANSWER",
    "content": {
        "articles": [
            {
                "title": "图文消息测试",
                "digest": "图文消息正面",
                "description": "图文消息正面",
                "url": "1d164a15-bf4e-4aa0-9c99-4d80015a95b0",
                "thumbUrl": " 5fc4c71a-69e5-4840-880c-2b0087ec0651",
                "picurl": " 5fc4c71a-69e5-4840-880c-2b0087ec0651",
                "createdTime": 1514280696000,
                "date": "2017-12-26 17:31:36"
            }
        ],
        "type": "news"
    },
    "dlgFinished": false,
    "sessionId": "4d8e7f3b-73d8-41c0-bbec-36899f506acd",
    "satisfactionCommentInvitation": false,
    "msgId": "710 a98b8 - 893 c - 4418 - 90 f0 - 2 d76d1f4224a "
}
  • 接口返回参数说明
question:问题
description:描述
robotId:机器人id
tenantId:租户id
userId:用户id
answerType:答案匹配类型(DEFAULT:默认回复;BEST_ANSWER:最佳匹配答案;RECOMMENDATE_QUESTIONS:推荐问题;REPEAT:重复问题;SENSITIVE_WORD_INTERCEPTION:敏感词拦截)
answerSource:答案来源(DEFAULT:默认回复;FREECHAT:闲聊;INTENTION:意图识别;HUMAN_FIRST_ROUND:首次转出服务;HUMAN:转出服务;RULE:知识规则;MENU:菜单;RECOMMENDATE:推荐问题)
type:答案类型;对应的值说明:news:图文;txt:文本;img:图片;
menu:菜单;recommend:推荐问题;human:转出服务;satisfactionCommentInvitation:满意度评价邀请状态,true显示邀请,false不显示邀请
sessionId:会话id
msgId: 消息id
url:文章地址id
thumbUrl:缩略图id
picurl:原图id
digest:摘要
  • 获取文章

    /v10/tenants/{租户id}/material/news/articles/{文章地址id}/html
    如:http://robot.easemob.com/v10/tenants/81/material/news/articles/1d164a15-bf4e-4aa0-9c99-4d80015a95b0/html
    
  • 获取缩略图

    /v10/tenants/{租户id}/material/medias/{缩略图id }/stream/thumbnail
    如:http://robot.easemob.com//v10/tenants/1/material/medias/fe6ffb8c-cade-4855-a8c6416a1b9d9f3f/stream/thumbnail
    
  • 获取原图

    /v10/tenants/{租户id}/material/medias/{原图id}/stream
    如:http://robot.easemob.com/v10/tenants/1/material/medias/fe6ffb8c-cade-4855-a8c6-416a1b9d9f3f/stream
    

1.4.3 答案为文本

  • 接口返回ResponseBody
{
    "status": "OK",
    "errorCode": null,
    "errorDescription": null,
    "entity": {
        "userId": "72a3e752-29f5-482f-bdb6-67587e995b6b",
        "tenantId": 48,
        "question": "今天天气怎么样",
        "tag": null,
        "answerType": "BEST_ANSWER",
        "answerSource": "rule",
        "content": {
            "msg": "晴朗,阳光明媚",
            "type": "txt"
        },
        "dlgFinished": false,
        "sessionId": "11009dd6-9ee0-42db-b15b-8142c407787d",
        "satisfactionCommentInvitation": false,
         "msgId": "710 a98b8 - 893 c - 4418 - 90 f0 - 2 d76d1f4224a "
    },
    "first": null,
    "last": null,
    "size": null,
    "number": null,
    "numberOfElements": null,
    "totalPages": null,
    "totalElements": null
}
  • 接口返回参数说明
question:问题
robotId:机器人id
tenantId:租户id
userId:用户id
answerType:答案匹配类型(DEFAULT:默认回复;BEST_ANSWER:最佳匹配答案;RECOMMENDATE_QUESTIONS:推荐问题;REPEAT:重复问题;SENSITIVE_WORD_INTERCEPTION:敏感词拦截)
answerSource:答案来源(DEFAULT:默认回复;FREECHAT:闲聊;INTENTION:意图识别;HUMAN_FIRST_ROUND:首次转出服务;HUMAN:转出服务;RULE:知识规则;MENU:菜单;RECOMMENDATE:推荐问题)
type:答案类型;对应的值说明:news:图文;txt:文本;img:图片;
menu:菜单;recommend:推荐问题;human:转出服务
satisfactionCommentInvitation:满意度评价邀请状态,true显示邀请,false不显示邀请
sessionId:会话id
msgId: 消息id
msg:文本消息

1.4.4 答案为转人工

  • 接口返回ResponseBody
{
    "status": "OK",
    "errorCode": null,
    "errorDescription": null,
    "entity": {
        "msgId": "ea096d4a-35dd-426e-a43c-60b77facea4c",
        "userId": "robot-plugin-visitor-4ff90c38-759c-4d19-9f81-922518b8fdd6",
        "tenantId": 364,
        "question": "测试",
        "tag": null,
        "answerType": "BEST_ANSWER",
        "answerSource": "RULE",
        "content": {
            "transferPrompt": "转人工提示语",
            "enableTransferPrompt": true,
            "properties": {
                "name": "测试技能组",
                "value": "测试技能组"
            },
            "type": "human"
        },
        "multiTurnDialogueId": "",
        "multiTurnDialogueStarted": false,
        "multiTurnDialogueFinished": false,
        "sessionId": "9fc65e41-c1a7-4db2-8d21-483ed42fc89b",
        "satisfactionCommentInvitation": false,
        "resourceId": "3e88d05c-55ae-4e32-b0b3-ca7edda5cb3b",
        "resourceType": "RULE",
        "subType": "DEFAULT",
        "domain": "_new_faq_",
        "intention": "doit",
        "robotIntent": null
    },
    "first": null,
    "last": null,
    "size": null,
    "number": null,
    "numberOfElements": null,
    "totalPages": null,
    "totalElements": null
}
  • 接口返回参数说明
question:问题
robotId:机器人id
tenantId:租户id
userId:用户id
answerType:答案匹配类型(DEFAULT:默认回复;BEST_ANSWER:最佳匹配答案;RECOMMENDATE_QUESTIONS:推荐问题;REPEAT:重复问题;SENSITIVE_WORD_INTERCEPTION:敏感词拦截)
answerSource:答案来源(DEFAULT:默认回复;FREECHAT:闲聊;INTENTION:意图识别;HUMAN_FIRST_ROUND:首次转出服务;HUMAN:转出服务;RULE:知识规则;MENU:菜单;RECOMMENDATE:推荐问题)
type:答案类型;对应的值说明:news:图文;txt:文本;img:图片;human:转出服务;menu:菜单;recommend:推荐问题
satisfactionCommentInvitation:满意度评价邀请状态,true显示邀请,false不显示邀请
sessionId:会话id
msgId:消息id
transferPrompt:转人工提示语
enableTransferPrompt:转人工提示语开关
properties:转人工参数(在 "机器人设置 -> 转人工设置 -> 添加转人工参数" 中配置)
properties.name:转人工参数名称
properties.value:转人工参数值

1.4.5 答案为菜单(带转人工按钮)

  • 接口返回ResponseBody
{
    "status": "OK",
    "errorCode": null,
    "errorDescription": null,
    "entity": {
        "msgId": "afad0280-76bf-4141-a416-df8724c9e78b",
        "userId": "robot-plugin-visitor-4ff90c38-759c-4d19-9f81-922518b8fdd6",
        "tenantId": 364,
        "question": "测试菜单",
        "tag": null,
        "answerType": "BEST_ANSWER",
        "answerSource": "RULE",
        "content": {
            "texts": [
                {
                    "knowledgeId": "3dd329e4-ad56-43e2-a941-cb910b336caf",
                    "text": "测试菜单-A"
                },
                {
                    "knowledgeId": "cad1b5c9-7148-40d2-a70f-742cb2613143",
                    "text": "测试菜单-B"
                },
                {
                    "knowledgeId": "MenuBtn-TransferToHuman-46e6d385-38f2-4eac-a44f-18ff79b236ad",
                    "text": "转人工"
                }
            ],
            "title": "测试菜单",
            "type": "menu"
        },
        "multiTurnDialogueId": "",
        "multiTurnDialogueStarted": false,
        "multiTurnDialogueFinished": false,
        "sessionId": "9fc65e41-c1a7-4db2-8d21-483ed42fc89b",
        "satisfactionCommentInvitation": false,
        "resourceId": "16ddfffc-35d4-4f48-b15c-385866fbc099",
        "resourceType": "RULE",
        "subType": "DEFAULT",
        "domain": "_new_faq_",
        "intention": "alex",
        "robotIntent": null
    },
    "first": null,
    "last": null,
    "size": null,
    "number": null,
    "numberOfElements": null,
    "totalPages": null,
    "totalElements": null
}
  • 接口返回参数说明
question:问题
robotId:机器人id
tenantId:租户id
type:问题类型
userId:用户id
type:答案类型;对应的值说明:news:图文;txt:文本;img:图片;
menu:菜单;human:转出服务;recommend:推荐问题
satisfactionCommentInvitation:满意度评价邀请状态,true显示邀请,false不显示邀请
sessionId:会话id
msgId:消息id
texts:菜单或推荐问题
texts.knowledgeId 菜单或推荐问题ID
texts.text 菜单或推荐问题名称
  • 转人工说明
"texts":[
    {
        "knowledgeId": "MenuBtn-TransferToHuman-46e6d385-38f2-4eac-a44f-18ff79b236ad",
        "text": "转人工"
    }
]

此JSON代表该菜单在本层级支持用户点击转人工,text内容可以在 "机器人设置 -> 转人工设置 -> 转人工按钮文字" 中配置,用户点击后,可以参考 1.3.2 中的格式返回给机器人。

1.4.6 答案为默认回复(带转人工按钮)

  • 接口返回ResponseBody
{
    "status": "OK",
    "errorCode": null,
    "errorDescription": null,
    "entity": {
        "msgId": "e954be92-21fb-4d14-ba0b-a3aa5df7f3e6",
        "userId": "robot-plugin-visitor-4ff90c38-759c-4d19-9f81-922518b8fdd6",
        "tenantId": 364,
        "question": "3453",
        "tag": null,
        "answerType": "DEFAULT",
        "answerSource": "DEFAULT",
        "content": {
            "transferToHumanId": "DefaultBtn-TransferToHuman-0c730d1d-bf43-4bfd-9759-740070664b9c",
            "suggestionTransferToHumanLabel": "转人工",
            "msg": "抱歉,我无法理解您的问题。",
            "type": "txt"
        },
        "multiTurnDialogueId": "",
        "multiTurnDialogueStarted": false,
        "multiTurnDialogueFinished": false,
        "sessionId": "9fc65e41-c1a7-4db2-8d21-483ed42fc89b",
        "satisfactionCommentInvitation": false,
        "resourceId": null,
        "resourceType": null,
        "subType": "DEFAULT",
        "domain": "_default_dm_",
        "intention": null,
        "robotIntent": null
    },
    "first": null,
    "last": null,
    "size": null,
    "number": null,
    "numberOfElements": null,
    "totalPages": null,
    "totalElements": null
}
  • 接口返回参数说明
question:问题
robotId:机器人id
tenantId:租户id
type:问题类型
userId:用户id
msg:文本答案
answerType:答案匹配类型(DEFAULT:默认回复;BEST_ANSWER:最佳匹配答案;RECOMMENDATE_QUESTIONS:推荐问题;REPEAT:重复问题;SENSITIVE_WORD_INTERCEPTION:敏感词拦截)
answerSource:答案来源(DEFAULT:默认回复;FREECHAT:闲聊;INTENTION:意图识别;HUMAN_FIRST_ROUND:首次转出服务;HUMAN:转出服务;RULE:知识规则;MENU:菜单;RECOMMENDATE:推荐问题)
type:答案类型;对应的值说明:news:图文;txt:文本;img:图片;
menu:菜单;human:转出服务;recommend:推荐问题
satisfactionCommentInvitation:满意度评价邀请状态,true显示邀请,false不显示邀请
sessionId:会话id
msgId:消息id
transferToHumanId: 默认回复转人工ID 
suggestionTransferToHumanLabel:转人工按钮文字(在 "机器人设置 -> 转人工设置 -> 转人工按钮文字" 中配置)

1.4.7 答案为推荐问题

  • 接口返回ResponseBody
{
    "status": "OK",
    "errorCode": null,
    "errorDescription": null,
    "entity": {
        "msgId": "632b248b-126a-442c-b6f6-23a333e45087",
        "userId": "8de05700-77e9-478a-a733-dd4e9457b753",
        "tenantId": 9,
        "question": "测试菜单1",
        "tag": null,
        "answerType": "RECOMMENDATE_QUESTIONS",
        "answerSource": "RECOMMENDATE",
        "content": {
            "texts": [{
                "knowledgeId": "74fdbfca-6396-45a7-bd66-2febd3423d39",
                "text": "测试菜单"
            }, {
                "knowledgeId": "87fbd7ae-1797-4147-96af-7168ae382f84",
                "text": "测试菜单2"
            }],
            "title": "您是不是要咨询以下问题:",
            "type": "recommend"
        },
        "dlgFinished": false,
        "sessionId": "590eee58-7185-4320-b6e7-e4b3d68977c3",
        "satisfactionCommentInvitation": true
    },
    "first": null,
    "last": null,
    "size": null,
    "number": null,
    "numberOfElements": null,
    "totalPages": null,
    "totalElements": null
}
  • 接口返回参数说明
msgId:消息id
userId:访客id
tenantId:租户id
question:问题
answerType:答案匹配类型(DEFAULT:默认回复;BEST_ANSWER:最佳匹配答案;RECOMMENDATE_QUESTIONS:推荐问题;REPEAT:重复问题;SENSITIVE_WORD_INTERCEPTION:敏感词拦截)
answerSource:答案来源(DEFAULT:默认回复;FREECHAT:闲聊;INTENTION:意图识别;HUMAN_FIRST_ROUND:首次转出服务;HUMAN:转出服务;RULE:知识规则;MENU:菜单;RECOMMENDATE:推荐问题)
knowledgeId:知识规则id
text:知识规则名字
title:标题
type:type:答案类型;对应的值说明:news:图文;txt:文本;img:图片;
menu:菜单;human:转出服务;recommend:推荐问题
dlgFinished:多伦会话结束标志(false:未结束;true:结束)
sessionId:会话id
satisfactionCommentInvitation:满意度邀请状态(false:不显示;true:显示)