Teneo Developers

Engine API

Requests and responses

Requests to engine are sent over http(s). Both GET and POST requests are allowed, but POST requests are preferred. The Content-Type should be application/x-www-form-urlencoded.

Request parameters

Requests to engine usually contain the following main URL parameters:

ParameterDescription
userinputOptional. The natural language utterance of the user.
viewtypeRequired. Tells engine which jsp template to use for the error response. Use value tieapi.

In addition to the URL parameters above, any other parameter can be included in the request. These can be used to provide additional information to your bot. A pre-processing script in your solution can be used to store them in a variable. More details on that here: Pre-processing.

Response

The engine response is returned in JSON and can consist of the following fields:

KeyDescription
statusAlways present. Status code. 0 = success, -1 = error, 1 = logout
inputOptional. Map containing input details included in the request.
outputOptional. Map containing engine output details.
messageOptional. String containing message for responses with status other than 0.
sessionIdOptional. String containing the engine sessionId. See Session Management.

Input object

KeyDescription
textString containing the input of the user as processed by engine.
parametersMap containing the additional parameters that were included in the request.

Output object

KeyDescription
textString containing the answer text of the output node.
emotionString containing the value of the emotion field of the output node.
linkString containing the output hyperlink field of the output node.
parametersMap containing the output node's output parameters.

Example

Example of a request that contains the following parameters:

ParameterValue
userinputWhat time is it?
usertimezoneCEST
viewtypetieapi

Request

curl -X POST \ https://some.teneo/engine-url/ \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'userinput=What%20time%20is%20it%3F&usertimezone=CEST&viewtype=tieapi'

Response

json

1{
2    "status": 0,
3    "input": {
4        "text": "What time is it?",
5        "parameters": {
6            "usertimezone": "CEST"
7        }
8    },
9    "output": {
10        "text": "Good afternoon! It's 15:26.",
11        "emotion": "happy",
12        "link": "https://example.com",
13        "parameters": {
14            "displayWidget" : "{\"type\":\"clock\",\"time\":\"15:26\"}"
15        }
16    },
17    "sessionId": "31992FA776A35DABA3291A4EE1031B5F"
18}
19
20

Input and output parameters are strings. If a parameter contains JSON, like the value of the output parameter 'displayWidget' above, the JSON is escaped. When interacting with the Teneo engine directly, you will need to unscape and parse the JSON manually. When using the SDK's, manually parsing the values is not needed as the SDK's handle that for you.

Error response

json

1{
2    "status": -1,
3    "input": {
4        "text": "What time is it?",
5        "parameters": {
6            "usertimezone": "CEST"
7        }
8    },
9    "message": "Teneo backend error",
10    "sessionId": "31992FA776A35DABA3291A4EE1031B5F"
11}
12
Next page
Session management
Was this page helpful?