Updated on 2023-09-27 GMT+08:00

Business Request Interface

Description

1. When this interface is invoked for the first time, the nonce information required for authentication can be obtained.

2. After the interface authentication is successful, this interface can be invoked to obtain the intention template matching status from the third-party system.

Interface Method

POST

URL

/chatbot/u-route/api/router_service/recognize

Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

application/json;charset=utf-8

Chatbot-Token

Yes

String

Token returned by the authentication interface.

Request

Table 1 Parameters in the request body

Parameter

Mandatory

Type

Description

request

Yes

requestBody

Request body.

Table 2 requestBody

Parameter

Mandatory

Type

Length

Description

userId

Yes

String

64

User ID.

accesscode

No

String

32

Access code (number that a user dials to access the system).

channel

No

String

32

Channel. (Currently, the value is fixed at OIFDE.)

sentence

Yes

String

1024

Text information entered by a customer.

tenantId

Yes

String

64

Tenant ID.

language

Yes

String

20

Language.

zh_CN: Chinese

en_US: English

context

No

String

64

Context required for intent recognition.

targetIntentCount

No

Integer

4

Number of intentions returned by the chatbot when multiple intentions are required. Generally, this parameter is used when a customer enters one sentence to match multiple intentions.

The value ranges from 1 to 5.

confidence2Top

No

Float

4

Confidence interval.

If multiple intentions are returned, the confidence interval between the subsequent intentions and the first intention with the highest confidence is required. A smaller value indicates a closer proximity between the returned intentions.

The value ranges from 0 to 1.

timeZone

No

String

10

Time zone. The value 8 indicates GMT+8.

Response Parameters

Parameter

Mandatory

Type

Length

Description

errorMsg

No

String

512

Error message.

errorCode

No

String

20

Error code.

intentsResponses

No

Intents[]

-

Intention array, which must be returned when the operation is successful.

nonce

No

String

128

Character string randomly generated by the server. This parameter is returned when the token authentication fails and the status code 401 is also returned.

Table 3 Intents

Parameter

Mandatory

Type

Length

Description

responses

No

String[]

4096

Response returned by the chatbot. The value is a character string array. Multiple values are allowed.

confidence

Yes

Float

4

Confidence.

  • Confidence of the chatbot reply. The value ranges from 0 to 1. For example, if 10 answers are provided for question 1 and six of them are answer 1, the confidence of answer 1 is 0.6.

commands

Yes

String[]

64

Intention command word.

params

No

Map

-

Keyword parameters. The slot information of general intentions is returned through this parameter. An example is {"Number":"3"}.

For details about operations related to general intentions, see Adding Intention Templates.

scenarioName

No

String

64

Intention name.

scenarioType

No

Integer

4

Scenario type.

1: auxiliary scenario

0: business scenario

–1: no scenario

scenarioStatus

No

String

64

Scenario status (not used currently).

Example

  • Request
{
"request":
{
"sentence": "Query the bill of March.",
"targetIntentCount":1,
"confidence2Top":0.2,
"accessCode": "10086",
"channel":"OIFDE",
"tenantId":"NJ_001",
"language":"en_US",
"userId":"123456789"
}
}
  • Successful response
{
"errorCode":"0",
"errorMsg":"",
"intentsResponses":
[
{
"responses":[""],
"confidence":1.0,
"commands":["bill"],
"params":{"Number":"3"},
"scenarioName":"query bills",
"scenarioType":"normal",
"scenarioStatus":"finish"
}
]
}
  • Failed response
401 Unauthorized
{
"errorMsg":"NEED_LOGIN","nonce":"0cf*******************accesaf"
}