Below are is the web services service to call up to interact with the bot.
Asking a question
To ask a question (any type of text sent by the customer) to the Bot specify the standard "RFAQ" node in the request and pass the text of the question in the "hda_sematic_question" parameter.
Syntax:
where “brainURL” is the url configured in the bot configuration stored in “botconfigurations” collection in mongoDB
Query string parameters:
Name | Description |
---|---|
hda_semantic_question | Text that will be passed to the bot to be interpreted |
...
Text Response:
...
language | json |
---|
...
Type: JSON
The “node” object must contain the “contents” object. This object must contain the “content” array. This array of objects must contain the text response sent back to the customer. The “contentType” property identifies the content of the text response and can assume one of the following values:
“TEXT_CONTENT_RICH” for formatted text
“READABLE_PLAIN” for only plain text
The “text” property must contain the response sent back to the customer.
In “web” chat, the “TEXT_CONTENT_RICH” response (if present) will be considered, if not present the “READABLE_PLAIN” response will be considered.
In other chat types (whatsapp, messenger, instagram channel), the “READABLE_PLAIN” response will be considered.
Code Block | ||
---|---|---|
| ||
{ "node":{ "serviceNamebrain_id":"enghouse-brain-botn_22367", "serviceVersionbrain_version":"15.10.0-SNAPSHOT", "contentsid":{"n_22367_725744298", "key":"TEST_NODE_MSG", "contentserviceName":["enghouse-brain-bot", "serviceVersion":"1", "contents":{ "content":[ "bargein":"true", { "bargein":"true", "brain_id":"c_22367_13", "contentType":"VIDEOTEXT_CONTENT_RICH", "id":"c_22367_13_178288251241735189", "usePreviousText":"false", }, "text":"Questo è un contenuto di <b>test</b>." { }, "bargein":"true", { "bargein":"true", "brain_id":"c_22367_32", "contentType":"TEXTREADABLE_CONTENT_RICHPLAIN", "id":"c_22367_32_417351891418502948", "usePreviousText":"false", "text":"Questo è un contenuto di <b>test</b>*test*." }, ] { } "bargein":"true", "brain_id":"c_22367_2", "contentType":"READABLE_PLAIN", "id":"c_22367_2_1418502948", } } |
Menu Response:
Type: JSON
The “node” object must contain the “actions” object. This object must conatin the “action” object. The “command” property of this object must be set to “menu” and the “actions” object must contain the “action” array with the menu options.
In the example the menu has 3 child actions, each action has a command : "load-item" or "open-url".
For each menu item are specified : a label ( "content" ) and a target /target url.
“targetUrl”: url to call when the user selects the item. Relative url where the base is stored in the "brainUrl" parameter of the connector configuration saved in the database
“open-url”:( e.g. "https://www.google.com" ) : url to open ( browser/client side) when the user selects the item. Use the array of object “param” in the “param” property to specify the object with the properties “name”: “where” and “text”:”_blank” to indicate where to open the link
Code Block | ||
---|---|---|
| ||
{ "node":{ "usePreviousTextbrain_id":"falsen_22369", "brain_version":"5.10.0-SNAPSHOT", "textid":"Questo è un contenuto di *test*." n_22369_698945808", "key":"TEST_MENU", "serviceName":"enghouse-brain-bot", } "serviceVersion":"1", ]"contents":{ } } } |
Menu Response:
Code Block | ||
---|---|---|
| ||
{"content":[ { "node":{ "brain_idbargein":"n_22369true", "brain_version":"5.10.0-SNAPSHOT", "brain_id":"nc_22369_6989458083", "key "contentType":"TESTTEXT_CONTENT_MENURICH", "serviceName":"enghouse-brain-bot", "serviceVersionid":"1c_22369_3_1619889357", "contents":{ "contentusePreviousText":["false", { "text":"Choose an option" "bargein":"true", } ] "brain_id":"c_22369_1" }, "actions":{ "contentTypeaction":"VIDEO",{ "brain_id":"c_22369_1_494762750a_34423", "usePreviousTextcommand":"falsemenu", }"content":"", {"id":"a_34423_1259541208", "bargein"order":"true1", "brain_id"runAt":"c_22369_3-1", "contentTypetarget":"TEXT_CONTENT_RICH", "idactions":"c_22369_3_1619889357",{ "usePreviousTextaction":"false", [ "text":"Choose an option" { } ] "brain_id":"a_34424", }, "actions":{ "actioncommand":{"load-item", "brain_id":"a_34423", "commandcontent":"menuOPTION 1", "content":"", "id":"a_3442334424_12595412081211377995", "order":"1", "runAt":"-1", "targetrunAt":"-1", "actions":{ "target":"TEST_M_1", "action":[ "node_ref":{ { "brain_idkey":"aTEST_M_344241", "commandtargetUrl":"load-item",/enghouse-brain-bot/1/TEST_M_1?referrerActionId=34424" "content":"OPTION 1",} "id":"a_34424_1211377995"}, "order":"1",{ "runAtbrain_id":"-1a_34425", "targetcommand":"TEST_M_1load-item", "node_refcontent":{"OPTION 2", "keyid":"TESTa_M34425_1308197190", "targetUrlorder":"/enghouse-brain-bot/1/TEST_M_1?referrerActionId=34424"2", }"runAt":"-1", }, "target":"TEST_MENU_2", { "node_ref":{ "brain_id "key":"aTEST_MENU_344252", "commandtargetUrl":"load-item",/enghouse-brain-bot/1/TEST_MENU_2?referrerActionId=34425" } "content":"OPTION 2", }, "id":"a_34425_308197190", { "order":"2 "brain_id":"a_34426", "runAtcommand":"open-1url", "targetcontent":"TEST_MENU_2PAT WEBSITE", "node_ref":{id":"a_34426_1665019718", "keyorder":"TEST_MENU_23", "targetUrlrunAt":"/enghouse-brain-bot/1/TEST_MENU_2?referrerActionId=34425"1", }"target":"https://www.pat.eu", }, "params":{ { "param":[ "brain_id":"a_34426", { "command":"open-url", "contentname":"PAT WEBSITEmethod", "id "text":"a_34426_1665019718GET", "order":"3", }, "runAt":"-1", { "target":"https://www.pat.eu", "paramsname":{ "where", "param":[ { "name":"method","text":"_blank" } "text":"GET" ] }, } { } "name":"where", "text":"_blank" } ] } } ] }, "params":{ "param":{ "name":"display", "text":"v" } } } } } } |
Calling a specific node
This service must be called whenever it is specified by a previous response. For example, in the case of a menu, one of the options can specify a node url to be called in the "targetUrl" parameter if the option is chosed by the user.
Syntax:
HTTP GET http://{brain-host}:{port}/brain/autojson/{brain-service}/{node}
headers = {
cookie: <BRAINSID_SessionCookie>
};
Example
Response:
Code Block | ||
---|---|---|
| ||
{ "node":{ ] "brain_id":"n_22370",}, "brain_versionparams":"5.10.0-SNAPSHOT",{ "id":"n_22370_1287493518", "keyparam":"TEST_M_1",{ "serviceName":"enghouse-brain-bot", "serviceVersionname":"1display", "contents":{ "contenttext":["v" { } "bargein":"true",} } "brain_id":"c_22370_3", } "contentType":"TEXT_CONTENT_RICH", "id":"c_22370_3_266538648", "usePreviousText":"false", "text":"Option 1 selected" }} } |
Calling a specific node
This service must be called whenever it is specified by a previous response. For example, in the case of a menu, one of the options can specify a node url to be called in the "targetUrl" parameter if the option is chosen by the user.
Syntax:
HTTP GET {brainURL}/targetURL
headers = {
cookie: <BRAINSID_SessionCookie>
};
Example
Response:
Code Block | ||
---|---|---|
| ||
{ "node":{ "brain_id":"n_22370", "brain_version":"5.10.0-SNAPSHOT", { "id":"n_22370_1287493518", "bargeinkey":"trueTEST_M_1", "serviceName":"enghouse-brain-bot", "brain_idserviceVersion":"c_22370_1", "contents":{ "contentTypecontent":"VIDEO",[ { "id":"c_22370_1_962092860", "usePreviousTextbargein":"falsetrue", } "brain_id":"c_22370_3", ] "contentType":"TEXT_CONTENT_RICH", } } } |
Redirect to operator
The human escalation is triggered by a redirect-to-operator action. It is possible to specify the target queue, the requested service level and skills.
Example
Code Block | ||
---|---|---|
| ||
{ "node":{ "brain_id":"n_22357c_22370_3_266538648", "brain_version "usePreviousText":"5.10.0-SNAPSHOTfalse", "id "text":"n_22357_1488672544",Option 1 selected" "key":"REDIRECT_TO_OPERATOR",} "serviceName":"enghouse-brain-bot", ] "serviceVersion":"1", } "contents":{ } } |
Redirect to operator
The human escalation is triggered by a redirect-to-operator action. It is possible to specify the target queue, the requested service level and skills.
Example
Code Block | ||
---|---|---|
| ||
{ "contentnode":[ { "bargein"brain_id":"truen_22357", "brain_idversion":"c_22357_2", 5.10.0-SNAPSHOT", "contentTypeid":"READABLEn_22357_PLAIN1488672544", "key":"REDIRECT_TO_OPERATOR", "idserviceName":"c_22357_2_942788559enghouse-brain-bot", "serviceVersion":"1", "usePreviousTextcontents":"false"{ "content":[ }, { "bargein":"true", "brain_id":"c_22357_12", "contentType":"VIDEOREADABLE_PLAIN", "id":"c_22357_12_506882387942788559", "usePreviousText":"false" }, { "bargein":"true", "brain_id":"c_22357_3", "contentType":"TEXT_CONTENT_RICH", "id":"c_22357_3_1607223715", "usePreviousText":"false", "text":"<div><b>Ti sto mettendo in contatto con un operatore, un attimo di pazienza...</b></div><div><br></div>" } ] }, "params":{ "param":{ "name":"isPlayerVisible", "text":"true" } }, "actions":{ "action":{ "brain_id":"a_34422", "command":"redirect-to-operator", "content":"", "id":"a_34422_891966757", "order":"1", "runAt":"-1", "target":"", "params":{ "param":[ { "name":"skills", "text":"ENGLISH,ITALIAN" }, { "name":"serviceLevel", "text":"GOLD" }, { "name":"queue", "text":"QUEUE1" } ] } } } } } |