logo

Retrieving Conversation Records List

Request URL

  • POST /v1/sessions

Request Parameters

Request fields

PathTypeOptionalDescription
robotIdIntegerfalseRobot ID.
startTimeDateTimefalseStart time in the format yyyy-MM-dd HH:mm:ss, such as 2019-12-31 00:00:00
endTimeDateTimefalseEnd time in the format yyyy-MM-dd HH:mm:ss, such as 2020-01-07 00:00:00
pageNumIntegertrueCurrent page, greater than 0, default is 1
pageSizeIntegertruePage size, greater than 0 and less than 100, default is 10
keywordsStringtrueSearch keywords.
keywordsSourceIntegertrueKeyword query source: 0. All conversation messages (default) 1. Robot messages 2. Customer messages 3. Agent messages 4. Customer ID 5. Customer external ID
conditionListArraytrueFilter condition list
conditionList[].fieldStringtrueFilter condition field name
conditionList[].operatorStringtrueFilter condition operator
conditionList[].valueObjecttrueFilter condition field value, different filter conditions correspond to different value types

Filter Condition Explanation

NameFieldOperatorValue
ChannelplatformisMultiple selection, Array type, available integer values. 0.web 1.WeChat 2.Android 3.iOS 4.Weibo 5.API 6.Multi-merchant 7.WeChat Mini Program 8.Enterprise WeChat
ScenechannelIdisMultiple selection, Array type, scene ID
Source PluginwebPluginNameisMultiple selection, Array type, plugin name
SourcesrcisMultiple selection, Array type, source name
Application NameappIdisString, name value
IP LocationipLocationisString, IP value
Customer Message CountcustomerMsgCountgreater_than,less_than,is,betweenInteger, numeric value, for example, the value type of between is "0,8"
Direct Response CountdirectResponseCountsame as abovesame as above
Suggested Question CountsuggestQuestionCountsame as abovesame as above
Unsuggested Question CountunSuggestQuestionCountsame as abovesame as above
Robot Message CountrobotMsgCountsame as abovesame as above
Matched Answer CountrobotRepliedCountsame as abovesame as above
Unknown AnswersunknownQuestionCountsame as abovesame as above
Useful Answer CountusefulResponseCountsame as abovesame as above
Useless Answer CountuselessResponseCountsame as abovesame as above
Switch to HumanisSwitchStaffisInteger, 0. No 1. Yes
EvaluationsurveyOptionisString, evaluation values are combined with semicolons. 1. Not evaluated 2. Satisfied 3. Average 4. Dissatisfied For example: "1,2,3"

Response

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result description
pagingObjectPagination information
paging.pageNumIntegerPage number
paging.pageSizeIntegerPage size
paging.totalIntegerTotal count
dataArrayConversation information
data[].idIntegerSession ID
data[].startTimeStringStart time of the conversation
data[].endTimeStringEnd time of the conversation
data[].totalCountIntegerTotal number of conversations
data[].customerMsgCountIntegerCustomer message count
data[].robotMsgCountIntegerRobot message count
data[].robotRepliedCountIntegerRobot matched response count
data[].unknownQuestionCountIntegerUnknown answer count
data[].usefulResponseCountIntegerUseful answer count
data[].uselessResponseCountIntegerUseless answer count
data[].surveyOptionIntegerEvaluation 1. Not evaluated 2. Satisfied 3. Average 4. Dissatisfied
data[].isSwitchStaffIntegerWhether switched to human 0. No 1. Yes
data[].appNameStringApplication name
data[].channelIdIntegerScene ID
data[].channelNameStringScene
data[].directResponseCountIntegerDirect response count
data[].suggestQuestionCountIntegerSuggested question count
data[].unSuggestQuestionCountIntegerUnsuggested question count
data[].customerObjectCustomer information object
data[].customer.idIntegerCustomer ID
data[].customer.nicknameStringCustomer name
data[].customer.ipStringIP address
data[].customer.provinceStringProvince
data[].customer.cityStringCity
data[].customer.platformStringChannel
data[].customer.srcStringSource
data[].customer.srcUrlStringSource URL
data[].customer.webPluginNameStringSource plugin
data[].customer.orgNameStringCompany name
data[].customer.emailStringCustomer email
data[].customer.phoneStringCustomer phone
data[].customer.tagsStringCustomer tags
data[].customer.descStringDescription
data[].customer.levelStringCustomer level
data[].customer.generatedChannelStringCustom channel information
data[].customer.loginUrlStringAccess landing page
data[].customer.sessionUrlStringConversation initiation page
data[].customer.dialogueDescStringConversation description

Example

$ curl 'https://km.udesk.cn/api/v1/sessions?email=admin@udesk.cn&timestamp=1529402458&sign=29beefc01662bd040a74880346f3da4491a357cf' -i 
-X POST -H 'Content-Type: application/json' -d '{
	"robotId":83,
	"startTime": "2019-12-31 00:00:00",
	"endTime": "2020-01-07 23:59:59",
	"pageNum": 1,
	"pageSize": 2,
	"keywordsSource":0,
	"keywords":"",
	"conditionList":[{"field":"customerMsgCount","operator":"greater_than","value":"0"}]
}'
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "paging": {
        "pageNum": 1,
        "pageSize": 2,
        "total": 4088
    },
    "data": [
        {
            "id": 457955,
            "robotId": 83,
            "startTime": "2019-11-27 18:41:23",
            "endTime": "2019-11-27 18:43:05",
            "totalCount": 8,
            "ipLocation": null,
            "customerMsgCount": 4,
            "robotMsgCount": 4,
            "robotRepliedCount": 2,
            "unknownQuestionCount": 1,
            "usefulResponseCount": 0,
            "use

lessResponseCount": 0,
            "surveyOption": 1,
            "surveyComment": null,
            "isSwitchStaff": 0,
            "appName": "test 1·",
            "channelId": 82,
            "channelName": null,
            "customer": {
               "id": 1415457662,
               "nickname": "",
               "ip": "",
               "province": "New York",
                "city": "New York",
                "level": "normal",
                "platform": "web",
                "src": "",
                "srcUrl": "",
                "webPluginName": "",
                "sessionUrl": ""
            },
            "callId": null,
            "dialogueDesc": null,
            "directResponseCount": 2,
            "suggestQuestionCount": 0,
            "unSuggestQuestionCount": 0
        },
        {
            "id": 457954,
            "robotId": 83,
            "startTime": "2019-11-27 18:23:27",
            "endTime": "2019-11-27 18:24:37",
            "totalCount": 4,
            "ipLocation": null,
            "customerMsgCount": 2,
            "robotMsgCount": 2,
            "robotRepliedCount": 0,
            "unknownQuestionCount": 0,
            "usefulResponseCount": 0,
            "uselessResponseCount": 0,
            "surveyOption": 1,
            "surveyComment": null,
            "isSwitchStaff": 0,
            "appName": "test 1·",
            "channelId": 82,
            "channelName": null,
            "customer": null,
            "callId": null,
            "dialogueDesc": null,
            "directResponseCount": 0,
            "suggestQuestionCount": 0,
            "unSuggestQuestionCount": 0
        }
    ]
}

Retrieving Conversation Record Details

Request URL

  • GET /v1/sessions/:id/logs

Request Parameters

Path parameters

ParameterTypeOptionalDescription
idintfalseConversation record ID.

Query parameters

ParameterTypeOptionalDescription
pageNumIntegertrueCurrent page, greater than 0, default is 1
pageSizeIntegertruePage size, greater than 0 and less than 100, default is 10

Response

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result description
pagingObjectPagination information
paging.pageNumIntegerPage number
paging.pageSizeIntegerPage size
paging.totalIntegerTotal count
dataArrayConversation record messages
data[].idIntegerConversation message ID
data[].userTypeIntegerSender type of the record, 1. Robot 2. User
data[].contentStringRecord content
data[].sessionIdIntegerConversation ID
data[].createTimeStringRecord creation time
data[].sourceIntegerlog source
data[].leadingWordStringLeading word
data[].sessionLogSuggestFoundResponseListArraySuggested question list
data[].sessionLogSuggestFoundResponseList[].idIntegerID
data[].sessionLogSuggestFoundResponseList[].logIdIntegerRecord conversation ID
data[].sessionLogSuggestFoundResponseList[].questionIdIntegerQuestion ID
data[].sessionLogSuggestFoundResponseList[].questionContentStringQuestion content

Example

$ curl 'https://km.udesk.cn/api/v1/sessions/457955/logs?pageNum=1&pageSize=2&email=admin@udesk.cn&timestamp=1529402455&sign=d4be213127c62bb5b53dea5f5e52eaad06b2362f'
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "paging": {
        "pageNum": 1,
        "pageSize": 2,
        "total": 9
    },
    "data": [
        {
            "id": 849457,
            "userType": 1,
            "content": "Urobot welcome\n \n",
            "sessionId": 457955,
            "createTime": "2019-11-27 18:41:23"
        },
        {
            "id": 849458,
            "userType": 2,
            "content": "How to change the bank's reserved mobile phone number",
            "sessionId": 457955,
            "createTime": "2019-11-27 18:41:28",
            "queryResult": 4,
            "source": 1
        }
    ]
}