$caila.addClientEntityRecords
Adds a record for a certain client to existing records of an entity.
Syntax
The arguments accepted by the method are the name of the entity where the record is to be added, and also the record parameters.
- ECMAScript 5
- ECMAScript 6
$caila.addClientEntityRecords("EntityName", [{"type": "synonyms", "rule": [$parseTree.text], "value": $parseTree.text}]);
In the ECMAScript 6 runtime, the method is asynchronous:
await $caila.addClientEntityRecords("EntityName", [{"type": "synonyms", "rule": [$parseTree.text], "value": $parseTree.text}]);
Parameter | Type | Mandatory | Description |
---|---|---|---|
EntityName | string | Yes | Name of the entity where the record is to be added. |
type | string | Yes | The method used to specify the record value. Takes the following values: synonyms or pattern . |
value | string | Yes | The value associated with the record. Corresponds to the DATA field. |
rule | array<string> | Yes | The set of rules describing the values that will be added as a record. For example: $parseTree._<SlotName> . |
clientId | string | No | Client ID. |
classifierToken | string | No | API key used to access an external trained classifier. |
How to use
Add a contact:
- ECMAScript 5
- ECMAScript 6
state: AddContact
intent!: /AddContact
script:
$caila.addClientEntityRecords("Contact", [{"type": "synonyms", "rule": $parseTree._Name, "value": $parseTree._Number}]);
a: OK, contact {{$parseTree._Name}} added with a number {{$parseTree._Number}}
state: AddContact
intent!: /AddContact
scriptEs6:
await $caila.addClientEntityRecords("Contact", [{"type": "synonyms", "rule": $parseTree._Name, "value": $parseTree._Number}]);
a: OK, contact {{$parseTree._Name}} added with a number {{$parseTree._Number}}