Calling interaction


When a request is sent by the user via the front, it is analysed by the service in order to find an interaction to execute.
If he succeeded, the service will then make an interaction call.
To do so, he sends a message to the target which countains the interaction ID and its parameters values.

Here is the content of this call :


callService -> Target
   {
      "id_interaction": "coffee",
      "type": "call",
      "id_session": "59ecea3cdc890",
      "parameters": {
         "sucre": {
            "archetype": "int",
            "values": [
               {
                  "source_kind": "builtin",
                  "value": 3
               }
            ]
         }
      },
      "request_language": "fr-fr",
      "request_text": "coffee with 3 sugars",
      "id_front": 7,
      "id_request": 11
   }

Main fields Description
id_session The ID of the session
id_request The ID of the request which led to the call
id_interaction The ID of the selected interaction
parameters Value of the selected interaction's parameters (see the details below).
Each parameter is identified by its name as defined when the inteaction was sent.
id_front ID of the front which has made the request

Describing a parameter

Each parameter is identified by its ID.
   {
      "archetype": "int",
      "values": [
         {
            "source_kind": "builtin",
            "value": 3
         }
      ]
   }
Field Description
archetype Name of the archetype
values Values given to this parameter. If the parameter is optionnal and no value has been found, the field is then null.
values.source_kind Can value : "builtin", "regexp", or "dict".
Indicates which source helped in finding the value.
Is only used for the sake of readability.
values.value Value found. The format depends on the parameter type. (see below)

Describing a value

The format is different if it is a "dict", "regexp" or "builtin".

Dict

"values": [
   {
      "source_kind": "dict",
      "value": {
         "id": "purple",
         "found": "violet",
         "requested": "violet"
      }
   }
]

If the tolerance of typing errors is activated, "found" can be different from "requested".

"values": [
   {
      "source_kind": "dict",
      "fault_tolerant_search": true,
      "value": {
         "id": "purple",
         "found": "violet",
         "requested": "viollet"
      }
   }
]

Regexp

"color_id": {
   "archetype": "color",
   "values": [
      {
         "source_kind": "regexp",
         "value": {
            "id": "hexa",
            "capture": {
               "color": "#456"
            },
            "regexp": "(?P\\#[0-9a-fA-F]{3,6})"
         }
      }
   ]
}

Note : Special characters are eluded by JSON formatting.
Here the original regexp is :

      (?P\#[0-9a-fA-F]{3,6})
   

Builtin

Though the global structure is the same, the structure of the field "value" is different for each builtin.

   {
      "archetype": "int",
      "values": [
         {
            "source_kind": "builtin",
            "value": 3
         }
      ]
   }
   {
      "archetype": "text",
      "values": [
         {
            "source_kind": "builtin",
            "value": "a blue cat"
         }
      ]
   }
   "archetype": "date_time",
   "values": [
      {
         "source_kind": "builtin",
         "value": {
            "day": 3,
            "hour": 14,
            "minute": 45,
            "month": 7,
            "year": 2018
         }
      }
   ]

API connection address :

TCP : golem.ai:3003
Web Socket : golem.ai:3004/ws
Web Socket Sécurisé (WSS) : golem.ai:3005/ws
HTTP : golem.ai:3004/http
HTTPS : golem.ai:3005/http