This site is no longer updated.Go to new Conversational Cloud docs

DATA


You can specify additional data to values from the dictionary of entities. To do this, fill in the DATA field in the selected entity.

In JAICP an entity is defined via a set of values that it can take on. You can specify the values via synonyms or patterns.

Each value can be specified with additional reference data by filling the DATA field in JSON or string format.

Syntax

Assume that we have a city entity. Let's add synonyms for the city New York City to the directory: New York, Manhattan, The Big Apple. In the DATA field, we will specify additional data: the official name of the city, country and time zone.

In JSON format:

{
    "name": "New York City",
    "country": "United States",
    "timezone": "EST"
}

In string format:

New York City;United States;EST

How to use

Let's look at the example of an online store that sells vehicles.

Go to the CAILA > Entities > My entities tab on the control panel. Create the vehicle entity with patterns:

(car*|vehicle*)
(bike*|bicycle*)

Then, in the DATA field for each pattern, add additional data in JSON format: a unique product identifier and its main name.

  • for pattern (car*|vehicle*):
{
    "product_id": 1,
    "unique_name": "car"
}
  • for pattern (bike*|bicycle*):
{
    "product_id": 2,
    "unique_name": "bicycle"
}

Now, let's write the script. The client sends a message in which he intends to buy a specific vehicle. The bot will display a message using $parseTree._vehicle.unique_name. Then a request will be made to the site http://example-service/order with a unique id of the vehicle.

theme: /
state: Start
    q!: $regex</start>
    a: Hello! Our store sells different types of vehicles. What do you want?
    
    state: Vehicle
        q!: i want to buy @vehicle
        a: Ok, you want to buy {{$parseTree._vehicle.unique_name}}
        script:
            $http.post("http://example-service/order", {"productId": $parseTree._vehicle.product_id});