Retrieve a List of Common Question Templates
Request Address
- GET /v1/robots/:id/commonQuestionModels
Request Parameters
Path Parameters
Parameter | Type | Optional | Description |
---|
id | Integer | false | Robot ID. |
Query Parameters
Parameter | Type | Optional | Description |
---|
pageNum | Integer | true | Page number, default is 1. |
pageSize | Integer | true | Number of records per page, default is 20. |
searchType | Integer | true | 1. Search by the name field 2. Search by the modelKey field. |
searchWord | String | true | Search keyword. |
Request Result
Path | Type | Description |
---|
code | Integer | Execution result code. |
message | String | Execution result description. |
data | Array | Template list information. |
data[].id | Integer | Template ID. |
data[].robotId | Integer | Robot ID. |
data[].name | String | Template name. |
data[].description | String | Template description. |
data[].modelKey | String | Template identification key modelKey (can be passed during session initialization). |
Example
$ curl 'https://km.udesk.cn/api/v1/robots/83/commonQuestionModels?email=admin@udesk.cn×tamp=1540881364&sign=4708c26e84801bf4508a44cfbc110c02dceab794' -i
Response
{
"code" : 200,
"message" : "OK",
"visible" : false,
"data" : [ {
"id" : 88,
"robotId" : 83,
"name" : "Default Recommendation 1",
"description" : "Default recommendation",
"modelKey" : "0"
}, {
"id" : 69,
"robotId" : 83,
"name" : "king",
"description" : "Guidance into...",
"modelKey" : "hey hey hey"
}, {
"id" : 118,
"robotId" : 83,
"name" : "Test",
"description" : "dd",
"modelKey" : "dc"
} ]
}
Request Failure Reasons
Message | Description |
---|
"Failed to convert value of type 'java.lang.String' to required type 'int' | Exception in integer parameter value |
Retrieve FAQ Question List
Request Address
- POST /v1/questions/search
Request Parameters
Request Fields
Path | Type | Optional | Description |
---|
pageNum | Integer | true | Page number, default is 1. |
pageSize | Integer | true | Number of records per page, default is 20. |
robotId | Integer | false | Robot ID. |
categoryId | Integer | true | Category ID. |
searchWord | String | true | Search keyword. |
searchType | Integer | true | Search type 1: All questions (questions and similar phrases) 2: Standard questions (excluding similar phrases) 3: Answer (default) 4: All |
type | Integer | true | Question type 1: Question 3: Process 4: Chat 0: All (default) |
order | Integer | true | Sort by update time 1: Ascending (default) 2: Descending. |
isWorking | Integer | true | Whether effective 1: All (default) 2: Valid 3: Invalid. |
channelIdList | Array | true | Scene list. |
Request Result
Path | Type | Description |
---|
code | Integer | Execution result code. |
message | String | Execution result description. |
data | Array | Question list information |
data[].id | Integer | Main question ID. |
data[].robotId | Integer | Robot ID. |
data[].categoryId | Integer | Category ID. |
data[].content | String | Question content. |
data[].type | Integer | Question type. |
data[].keyword | String | Forced recall word. |
data[].suggestType | Integer | Suggestion type 1: Close 2: Intelligent recommendation 3: Manual recommendation. |
data[].availableTimeType | Integer | Effective time 0: Permanently invalid 1: Permanently valid 2: Custom validity period. |
data[].startTime | String | Effective time. |
data[].endTime | String | Expiration time. |
data[].createTime | String | Creation time. |
data[].updateTime | String | Update time. |
data[].answer | Object | Question answer. |
data[].answer.id | Integer | Answer ID. |
data[].answer.content | String | Answer content. |
data[].answer.type | Integer | Question answer type |
data[].suggestList | Array | Question answer suggestion list. |
data[].suggestList[].id | Integer | Suggestion ID. |
data[].suggestList[].content | String | Suggestion content. |
Example
$ curl 'https://km.udesk.cn/api/v1/questions/search?email=admin@udesk.cn×tamp=1529402458&sign=29beefc01662bd040a74880346f3da4491a357cf' -i -X POST -H 'Content-Type: application/json' -d '{
"pageNum" : 1,
"pageSize" : 10,
"robotId" : 102,
"categoryId" : null,
"searchWord" : "world",
"searchType" : 3,
"type" : 1,
"order" : 2,
"isWorking" : 1,
"channelIdList" : null
}'
Response
{
"code": 200,
"message": "OK",
"visible": false,
"exception": null,
"paging": {
"pageNum": 1,
"pageSize": 10,
"total": 2
},
"data": [
{
"id": 8657,
"robotId": 102,
"categoryId": 343,
"content": "Where is peace in the world",
"type": 1,
"keyword": "peace",
"suggestType": 3,
"availableTimeType": null,
"startTime": null,
"endTime": null,
"createTime": "2018-05-30 17:06:13",
"updateTime": "2018-10-31 13:57:47",
"answer": {
"id": 4442,
"content": "<p>No</p>\n<p><audio style=\"display: none;\" controls=\"controls\"></audio></p>\n<p><audio style=\"display: none;\" controls=\"controls\"></audio></p>",
"type": 2
},
"suggestList": [
{
"id": 9253,
"content": "The moonlight in front of the bed"
},
{
"id": 9257,
"content": "How to speak English"
}
]
},
{
"id": 8656,
"robotId": 102,
"categoryId": 343,
"content": "Is the world at peace",
"type": 1,
"keyword": "peace",
"suggestType": 3,
"availableTimeType": null,
"startTime": null,
"endTime": null,
"createTime": "2018-05-30 17:05:53",
"updateTime": "2018-10-30 18:23:12",
"suggestList": [
{
"id": 8657,
"content": "Where is peace in the world"
},
{
"id": 9259,
"content": "Where do you want to go"
}
]
}
]
}
Retrieve FAQ Question Details
Request Address
Request Parameters
Path Parameters
Parameter | Type | Optional | Description |
---|
id | int | false | Question ID. |
Request Result
Path | Type | Description |
---|
code | Integer | Execution result code. |
message | String | Execution result description. |
data | Object | Question information. |
data.id | Integer | Main question ID. |
data.robotId | Integer | Robot ID. |
data.categoryId | Integer | Category ID. |
data.content | String | Question content. |
data.type | Integer | Type 1: Regular question 2: Similar question 3: Process entry question 4: Chat. |
data.keyword | String | Forced recall word for the question. |
data.suggestType | Integer | Suggestion type 1: Close 2: Smart recommendation 3: Manual recommendation. |
data.availableTimeType | Integer | Effective time 0: Permanently invalid 1: Permanently valid 2: Custom validity period. |
data.startTime | String | Effective time start. |
data.endTime | String | Effective time end. |
data.createTime | String | Creation time. |
data.updateTime | String | Update time. |
data.needLearnCount | Integer | Number of learning needed. |
data.answer | Object | Question answer. |
data.answer.id | Integer | Answer ID. |
data.answer.content | String | Answer content. |
data.answer.type | Integer | Answer type 1: Plain text 2: Rich text 3: Voice 4. Link 5. Image |
data.answer.attachmentList[] | Array | Attachments. |
data.answer.attachmentList[].name | String | Attachment name. |
data.answer.attachmentList[].address | String | Attachment address. |
data.answer.attachmentList[].size | Long | Attachment size (in bytes). |
data.suggestList | Array | Question recommendation list. |
data.suggestList[].id | Integer | Recommended question ID. |
data.suggestList[].content | String | Recommended question content. |
data.suggestList[].type | Integer | Recommended question type 1: Regular question 2: Similar question 3: Process entry question 4: Chat. |
data.suggestList[].orders | Integer | Recommended question order. |
data.channelList | Array | Scene list. |
data.channelList[].id | Integer | Scene ID. |
data.channelList[].robotId | Integer | Robot ID. |
data.channelList[].name | String | Scene name. |
data.channelList[].description | String | Scene description. |
data.channelList[].type | Integer | Type 1: Default 2: Non-default. |
Example
$ curl 'https://km.udesk.cn/api/v1/questions/1232?email=admin@udesk.cn×tamp=1529402455&sign=d4be213127c62bb5b53dea5f5e52eaad06b2362f' -i -H 'Accept: application/json'
Response
{
"code": 200,
"message": "OK",
"visible": false,
"exception": null,
"paging": null,
"data": {
"id": 1232,
"robotId": 83,
"categoryId": 295,
"content": "What should I do if there is an abnormality in repayment?",
"type": 1,
"keyword": "",
"suggestType": 1,
"availableTimeType": 1,
"startTime": null,
"endTime": null,
"createTime": "2018-02-28 18:32:23",
"updateTime": "2018-06-13 15:20:04",
"needLearnCount": null,
"answer": {
"id": 727,
"content": "If you encounter an abnormality during or after the repayment process, please keep the operation screenshots and contact customer service for help as soon as possible!",
"type": 2,
"attachmentList": [
{
"name": "1.xlsx",
"address": "https://staging-udesk.oss-cn-beijing.aliyuncs.com/Data/6/1.xlsx",
"size": 18183
},
{
"name": "2.xlsx",
"address": "https://staging-udesk.oss-cn-beijing.aliyuncs.com/Data/6/2.xlsx",
"size": 18184
},
]
},
"suggestList": null,
"channelList": [
{
"id": 82,
"robotId": 83,
"name": "System Default Scene",
"description": "System Default Scene",
"type": 1
}
]
}
}
Request Failure Reasons
{
"code": 400,
"message": "{Specific error message}",
"visible": false
}
message | description |
---|
"The problem does not exist or has been deleted!" | The problem does not exist or has been deleted |
Create a New FAQ Question
Request Address
Interface Description
- This interface supports creating FAQ questions and greetings in the FAQ library
Flow creation is not supported at present
Request Parameters
Request Fields
Path | Type | Optional | Description |
---|
robotId | Integer | false | Robot ID. |
categoryId | Integer | false | Category ID. |
content | String | false | Question content. Not exceeding 200 characters. |
type | Integer | false | Question type 1. Regular question 4. Chat |
answer | Object | false | Answer |
answer.content | String | true | Answer content. |
answer.type | Integer | true | Text type 2. Rich text 3. Voice 4. Link 5. Image (types 3, 4, and 5 are URL addresses) |
answer.attachmentList[] | Array | true | Attachments |
answer.attachmentList[].name | String | true | Attachment name |
answer.attachmentList[].address | String | true | Attachment address |
answer.attachmentList[].size | Long | true | Attachment size (in bytes) |
channelList | Array | false | Scene list. Can be obtained in system settings -> robot management -> scene management |
channelList[].id | Integer | false | Scene ID. |
availableTimeType | Integer | true | Effective time 0 represents permanently invalid, 1 represents permanently valid, 2 represents custom validity period. |
startTime | String | true | Effective start time of the question. Required if availableTimeType=3 |
endTime | String | true | Effective end time of the question. Required if availableTimeType=3 |
keyword | String | true | Keywords: comma-separated. |
suggestType | Integer | false | Recommendation type 1: Close 2: Smart recommendation 3: Manual recommendation. |
suggestsList | Array | true | Recommended question list |
suggestsList[].id | Integer | true | Recommended question ID. |
isSwitchStaff | Integer | true | Whether to enable recommendation to switch to human staff. 0: Off 1: On |
Request Result
Parameter | Type | Description |
---|
code | Integer | Execution result code |
message | String | Execution result description |
data | Object | Question information |
data.id | Integer | Main question ID. |
data.robotId | Integer | Robot ID. |
data.categoryId | Integer | Category ID. |
data.content | String | Question content. |
data.type | Integer | Question type 1. Regular question 4. Chat. |
data.keyword | String | Forced recall word for the question. |
data.availableTimeType | Integer | Question effective time 0 represents permanently invalid, 1 represents permanently valid, 2 represents custom validity period. |
data.startTime | String | Question start effective time. |
data.endTime | String | Question end effective time. |
data.createTime | String | Question creation time. |
data.updateTime | String | Question update time. |
data.answer | Object | Question answer. |
data.answer.id | Integer | Question answer ID. |
data.answer.content | String | Question answer content. |
data.answer.type | Integer | Question answer type 1: Plain text 2: Rich text 3: Voice 4: Link 5: Image |
data.answer.attachmentList[] | Array | Attachments |
data.answer.attachmentList[].name | String | Attachment name |
data.answer.attachmentList[].address | String | Attachment address |
data.answer.attachmentList[].size | Long | Attachment size (in bytes) |
data.suggestType | Integer | Question recommendation type 1: Close 2: Smart recommendation 3: Manual recommendation. |
data.suggestList | Array | Question recommendation list |
data.suggestList[].id | Integer | Recommended question ID |
data.suggestList[].content | String | Recommended question content. |
data.suggestList[].type | Integer | Recommended question type 1: Regular question 3: Process entry question |
data.channelList | Array | Question scene list. |
data.channelList[].id | Integer | Question scene id. |
data.channelList[].robotId | Integer | Robot Id. |
data.channelList[].name | String | Scene name. |
data.channelList[].description | String | Scene description. |
data.channelList[].type | Integer | Scene type 1: Default 2: Non-default. |
Example
$ curl 'https://km.udesk.cn/api/v1/questions?email=admin@udesk.cn×tamp=1529402459&sign=814452f1c81d0f43303a30c4a6fd1c894d152ef3' -i -X POST -H 'Content-Type: application/json' -d '{
"robotId" : 102,
"categoryId" : 343,
"content" : "How to apply for an ID card",
"type" : 1,
"mainId" : 0,
"availableTimeType" : 1,
"startTime" : null,
"endTime" : null,
"keyword" : "ID card, identification",
"suggestType" : 1,
"suggestsList" : null,
"isSwitchStaff" : null,
"flow" : null
}'
Response
{
"code": 200,
"message": "OK",
"visible": false,
"exception": null,
"paging": null,
"data": {
"id": 9458,
"robotId": 102,
"categoryId": 343,
"content": "How to apply for an ID card",
"type": 1,
"keyword": "ID card, identification",
"suggestType": 1,
"availableTimeType": 1,
"startTime": null,
"endTime": null,
"createTime": "2018-10-31 11:12:39",
"updateTime": "2018-10-31 11:12:39",
"answer": {
"id": 5142,
"content": "Search it on Baidu, you'll know.",
"type": 1
},
"suggestList": null,
"channelList": [
{
"id": 105,
"robotId": 102,
"name": "System Default Scene",
"description": "System Default Scene",
"type": 1
}
]
}
}
Request Failure Reasons
{
"code": 400,
"message": "{Specific error message}",
"visible": false
}
message | description |
---|
Your knowledge base has reached its limit. To upgrade the knowledge base capacity, please contact Udesk | The FAQ quantity of the knowledge base has reached its limit |
"The robot does not exist or has been deleted!" | The robot does not exist or has been deleted |
"Category doesn't belong to the Robot!" | Category does not belong to the robot |
"Scene does not exist or has been deleted! Scene ID:{id}" | The scene does not exist or has been deleted! Scene ID:{id} |
"The scene does not belong to the robot! Scene ID:{id}" | The scene does not belong to the robot! Scene ID:{id} |
Start time of effective time cannot be empty | Effective time cannot be empty |
Duplicate with existing problems! Problem Id:{id} | Duplicate with existing problems |
"【answer.content】Answer cannot be empty" | Answer cannot be empty |
"【channelList】org.hibernate.validator.constraints.NotEmpty.message" | Select at least one scene |
"Similar questions do not meet the requirements (similar questions can not be null characters and the length can not be greater than 200 characters!)" | Similar questions do not meet the requirements (similar questions cannot be null characters and the length cannot be greater than 200 characters!) |
"【...】javax.validation.constraints.NotNull.message" | 【Specific field】cannot be empty |
Delete FAQ Question
Request Address
Request Parameters
Path Parameters
Parameter | Type | Optional | Description |
---|
id | Integer | false | Question ID. |
Request Result
- None, when the deletion is successful, the HTTP response code is 204.
Example
$ curl 'https://km.udesk.cn/api/v1/questions/9362?email=admin@udesk.cn×tamp=1529402460&sign=87e3763301d72ad81aacc823883c3c96a5fcbcfc' -i -X DELETE -H 'Content-Type: application/json'
Edit FAQ Question
Request Address
Request Parameters
Path Parameters
Parameter | Type | Optional | Description |
---|
id | Integer | false | Question ID. |
Request Fields
Path | Type | Optional | Description |
---|
id | Integer | true | Question ID. |
categoryId | Integer | false | Category ID. |
content | String | false | Question content. Not exceeding 200 characters. |
type | Integer | true | Question type. 1: Regular question 4: Chat |
answerUpdateRequest | Object | false | Question answer. |
answerUpdateRequest.id | Integer | false | Answer ID. |
answerUpdateRequest.content | String | false | Answer content. |
answerUpdateRequest.type | Integer | true | Answer type 2: Rich text 3: Voice 4: Link 5: Image (types 3, 4, and 5 are URL addresses) |
answerUpdateRequest.attachmentList[] | Array | Attachments | |
answerUpdateRequest.attachmentList[].name | String | Attachment name | |
answerUpdateRequest.attachmentList[].address | String | Attachment address | |
answerUpdateRequest.attachmentList[].size | Long | Attachment size (in bytes) | |
simpleChannelList | Array | false | Scene list. Can be obtained in system settings -> robot management -> scene management |
simpleChannelList[].id | Integer | false | Scene ID. |
availableTimeType | Integer | true | Effective time 0 represents permanently invalid, 1 represents permanently valid, 2 represents custom validity period. |
startTime | String | true | Effective start time of the question. Required if availableTimeType=3 |
endTime | String | true | Effective end time of the question. Required if availableTimeType=3 |
keyword | String | true | Question keywords. |
suggestType | Integer | true | Question recommendation type 1: Close 2: Smart recommendation 3: Manual recommendation. |
suggestsList | Array | true | Recommended question list |
suggestsList[].id | Integer | true | Recommended question ID. |
isSwitchStaff | Integer | true | Recommendation to switch to human staff. |
Request Result
Path | Type | Description |
---|
code | Integer | Execution result code |
message | String | Execution result description |
data | null | true |
Example
$ curl 'https://km.udesk.cn/api/v1/questions/9458?email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X PUT -H 'Content-Type: application/json' -d '{
"id":9458,
"categoryId" : 343,
"content" : "How to apply for an ID card",
"type": 1,
"answerUpdateRequest" : {
"id": 5142,
"content" : "Search it on Google, you'll know.",
"type" : 1
},
"simpleChannelList" : [ {
"id" : 105
} ],
"availableTimeType" : 1,
"startTime" : null,
"endTime" : null,
"suggestType" : 1,
"suggestsList" : null,
"isSwitchStaff" : null
}'
Response
{
"code" : 200,
"message" : "OK",
"visible" : false,
"data" : null
}
Request Failure Reasons
{
"code": 400,
"message": "{Specific error message}",
"visible": false
}
message | description |
---|
Your knowledge base has reached its limit. To upgrade the knowledge base capacity, please contact Udesk | The FAQ quantity of the knowledge base has reached its limit |
"The robot does not exist or has been deleted!" | The robot does not exist or has been deleted |
"Category doesn't belong to the Robot!" | Category does not belong to the robot |
"Scene does not exist or has been deleted! Scene ID:{id}" | The scene does not exist or has been deleted! Scene ID:{id} |
"The scene does not belong to the robot! Scene ID:{id}" | The scene does not belong to the robot! Scene ID:{id} |
Start time of effective time cannot be empty | Effective time cannot be empty |
Duplicate with existing problems! Problem Id:{id} | Duplicate with existing problems |
"【answer.content】Answer cannot be empty" | Answer cannot be empty |
"【channelList】org.hibernate.validator.constraints.NotEmpty.message" | Select at least one scene |
"Similar questions do not meet the requirements (similar questions can not be null characters and the length can not be greater than 200 characters!)" | Similar questions do not meet the requirements (similar questions cannot be null characters and the length cannot be greater than 200 characters!) |
"【...】javax.validation.constraints.NotNull.message" | 【Specific field】cannot be empty |
Request URL
- GET /v1/faq/similar/{questionId}
Request Parameters
Path parameters
Parameter | Type | Optional | Description |
---|
questionId | Integer | false | Main question ID. |
pageNum | Integer | true | Default is 1 |
pageSize | Integer | true | Default is 10 per page |
Request fields
Path | Type | Optional | Description |
---|
Response
Path | Type | Description |
---|
code | Integer | Execution result code |
message | String | Execution result description |
data | Array | Returned data |
data[].id | Integer | Similar question ID |
data[].content | String | Similar question content |
paging | Object | Pagination information |
paging.pageNum | Integer | Page number |
paging.pageSize | Integer | Items per page |
paging.total | Long | Total items count |
Example
$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X GET -H 'Content-Type: application/json'
Response
{
"code" : 200,
"message" : "OK",
"visible" : false,
"data" : [{
"id": 78234,
"content": "Example of a similar question 1"
},{
"id": 78235,
"content": "Example of a similar question 2"
}],
"paging": {
"pageNum": 1,
"pageSize": 10,
"total": 773
}
}
API for Adding Similar Questions
Request URL
- POST /v1/faq/similar/{questionId}
Request Parameters
Path parameters
Parameter | Type | Optional | Description |
---|
questionId | Integer | false | Main question ID. |
Request fields
Path | Type | Optional | Description |
---|
content | String | false | Question content. |
Response
Path | Type | Description |
---|
code | Integer | Execution result code |
message | String | Execution result description |
data | Object | Returned data |
data.id | Integer | Similar question ID |
data.content | String | Similar question content |
Example
$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X POST -H 'Content-Type: application/json'
-d'{
"content" : "Example of a similar question 1"
}'
Response
{
"code" : 200,
"message" : "OK",
"visible" : false,
"data" : {
"id": 78234,
"content": "Example of a similar question 1"
}
}
Editing Similar Question API List
Request URL
- PUT /v1/faq/similar/{questionId}
Request Parameters
Path parameters
Parameter | Type | Optional | Description |
---|
questionId | Integer | false | Main question ID. |
Request fields
Path | Type | Optional | Description |
---|
id | Integer | false | Similar question ID. |
content | String | false | Similar question content. |
Response
Path | Type | Description |
---|
code | Integer | Execution result code |
message | String | Execution result description |
data | Object | Returned data |
data.id | Integer | Similar question ID |
data.content | String | Similar question content |
Example
$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X PUT -H 'Content-Type: application/json'
-d'{
"id": "78234",
"content" : "Example of a similar question 1"
}'
Response
{
"code" : 200,
"message" : "OK",
"visible" : false,
"data" : {
"id": 78234,
"content": "Example of a similar question 1"
}
}
Deleting Similar Question API List
Request URL
- DELETE /v1/faq/similar/{questionId}
Request Parameters
Path parameters
Parameter | Type | Optional | Description |
---|
questionId | Integer | false | Main question ID. |
Request parameters
Parameter | Type | Optional | Description |
---|
similar | Integer | false | Similar question ID. |
Request fields
Path | Type | Optional | Description |
---|
Response
Path | Type | Description |
---|
code | Integer | Execution result code |
message | String | Execution result description |
data | null | None |
Example
$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?similarId=78234&email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X DELETE -H 'Content-Type: application/json'
Response
{
"code" : 200,
"message" : "OK",
"visible" : false
}