# Environment Data Structure

## Environment schema

### Answer  <a href="#answer" id="answer"></a>

The answer table stores the settings for the response that are created in the virtual agent. The answer can be identified by a name (for example “Welcome”), a description and tags related to the answer subject. It also can be configured to be evaluable and/or transactional.&#x20;

This table is used on Virtual Agents where Automated Learning is not used; if you want the AL's counterpart, go to [question](#document-1).

| **Column Name**      | **Data Type** | **Not Null** | **Description**                                                                                                                  |
| -------------------- | ------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| **uuid**             | varchar(36)   | Yes          | UUID representing a. Answer                                                                                                      |
| **name**             | varchar(80)   | Yes          | Name identifying the Answer title. This name is only visible in the Cockpit.                                                     |
| **description**      | text          | No           | The Answer's description                                                                                                         |
| **evaluable**        | tinyint(1)    | No           | Shows if the message can be evaluated by the user                                                                                |
| **transactional**    | tinyint(1)    | No           | Show if the response is transactional                                                                                            |
| **removed**          | tinyint(1)    | Yes          | True if the answer was deleted. This may be reverted.                                                                            |
| **created\_at**      | datetime      | No           | The date this object was created                                                                                                 |
| **updated\_at**      | datetime      | No           | The date this object was last updated                                                                                            |
| **created\_by**      | varchar(36)   | No           | UUID representing the user who created this object                                                                               |
| **updated\_by**      | varchar(36)   | No           | UUID representing the user who updated this object                                                                               |
| **bot\_uuid**        | varchar(36)   | Yes          | ID representing a virtual agent, related to the virtual agent table                                                              |
| **webhook**          | varchar(255)  | Yes          | API URL that will be called when this response is executed                                                                       |
| **headers**          | longtext      | No           | Freeform headers to configure webhooks.                                                                                          |
| **execution\_limit** | int(3)        | No           | An Integer lnumber representing the maximum ammount of times this answer will be presented in sequence. If 0, there is no limit. |

### Answer Template

The answer\_template is the content of an answer that was created in either the [answer ](#answer)table or the [question ](#question)table, but never in both. Either can have many records in the answer\_template table, since each channel that a particular answer is delivered to may have a custom template. The content is the answer that will be sent to the user. For example, the name of the answer is “Welcome” and the content is “Hello, I’m a virtual assistant”

| **Column Name**       | **Data Type** | **Not Null** | **Description**                                                                                                       |
| --------------------- | ------------- | ------------ | --------------------------------------------------------------------------------------------------------------------- |
| **uuid**              | varchar(36)   | Yes          | UUID representing the answer template                                                                                 |
| **content**           | text          | No           | JSON representing the selected template. This JSON can vary depending on what was selected by the user in the Cockpit |
| **answer\_uuid**      | varchar(36)   | No           | UUID representing the answer this template belongs to. If this field is filled, question\_uuid is not.                |
| **question\_uuid**    | varchar(36)   | No           | UUID representing the answer this template belongs to. If this field is filled, answer\_uuid is not.                  |
| **channel\_uuid**     | varchar(36)   | No           | UUID representing the channel this answer template refers to.                                                         |
| **channel\_type\_id** | bigint(20)    | No           | ID identifying the type of the channel. Those are mapped at the channel\_type table.                                  |
| **type**              | varchar(20)   | Yes          | The selected template type                                                                                            |
| **removed**           | tinyint(1)    | Yes          | True if the answer template was deleted. This may be reverted.                                                        |
| **technical\_text**   | text          | No           | Technical text in JSON format                                                                                         |
| **created\_at**       | datetime      | No           | The date this object was created                                                                                      |
| **updated\_at**       | datetime      | No           | The date this object was last updated                                                                                 |
| **created\_by**       | varchar(36)   | No           | UUID representing the user who created this object                                                                    |
| **updated\_by**       | varchar(36)   | No           | UUID representing the user who updated this object                                                                    |

### API Key

The api\_key table stores API keys used to validate Syntphony CAI’s service calls.

| **Column Name**   | **Data Type** | **Not Null** | **Description**             |
| ----------------- | ------------- | ------------ | --------------------------- |
| **api\_key**      | varchar(50)   | Yes          | Stores the safety key value |
| **created\_date** | datetime      | Yes          | When this key was created   |

### Automated Test

The automated\_tests stores general information about automated tests. To execute an automated test, the user must fill a spreadsheet and insert it in the Cockpit. Once executed, the results are stored in the automated\_tests\_execution table.

| **Column Name**   | **Data Type** | **Not Null** | **Description**                                                                        |
| ----------------- | ------------- | ------------ | -------------------------------------------------------------------------------------- |
| **uuid**          | varchar(36)   | Yes          | This automated test's UUID                                                             |
| **bot\_uuid**     | varchar(36)   | Yes          | UUID of the bot being tested.                                                          |
| **channel\_uuid** | varchar(36)   | Yes          | UUID of the channel where the tests will be run.                                       |
| **user\_uuid**    | varchar(36)   | Yes          | UUId of the user that created this test.                                               |
| **name**          | varchar(200)  | No           | The automated test's name                                                              |
| **utterances**    | int(11)       | No           | Number of examples in the test                                                         |
| **removed**       | tinyint(1)    | No           | True if the object was deleted. This may be reverted, but the executions will be lost. |
| **created\_at**   | datetime      | No           | The date this object was created                                                       |
| **updated\_at**   | datetime      | No           | The date this object was last updated                                                  |

### Automated Tests Execution

The automated tests execution table stores the results of an automated tests, by attempt. In previous versions, this data was located within the automated test itself and was overwritten on execution.

| **Column Name**           | **Data Type**  | **Not Null** | **Description**                                                                       |
| ------------------------- | -------------- | ------------ | ------------------------------------------------------------------------------------- |
| **uuid**                  | varchar(36)    | Yes          | UUID of this execution                                                                |
| **automated\_test\_uuid** | varchar(36)    | Yes          | UUID of the automated test that produced this result                                  |
| **avg\_score**            | decimal(12,10) | Yes          | Shows the average confidence level.                                                   |
| **precision\_score**      | decimal(12,10) | Yes          | Shows the precise confidence level.                                                   |
| **status**                | varchar(10)    | Yes          | A text status of wether this execution is yet to run, is executing, is finished, etc. |
| **updated\_at**           | datetime       | No           | The date this object was last updated                                                 |

### Automated Test Utterance

An automated\_test\_utterance is a single instance of exemple provided for an automated test. They belong to automated\_tests.&#x20;

<table data-header-hidden><thead><tr><th width="204">Column Name</th><th>Data Type</th><th>Not Null</th><th>Description</th></tr></thead><tbody><tr><td><strong>Column Name</strong></td><td><strong>Data Type</strong></td><td><strong>Not Null</strong></td><td><strong>Description</strong></td></tr><tr><td><strong>uuid</strong></td><td>varchar(36)</td><td>Yes</td><td>ID representing the example</td></tr><tr><td><p><strong>automated_test_</strong></p><p><strong>uuid</strong></p></td><td>varchar(36)</td><td>No</td><td>UUID of the automated test this exampel belongs to</td></tr><tr><td><strong>description</strong></td><td>text</td><td>No</td><td>A short description of this example</td></tr><tr><td><strong>utterance</strong></td><td>text</td><td>No</td><td>The tested phrase</td></tr><tr><td><p><strong>expected_</strong></p><p><strong>category</strong></p></td><td>varchar(200)</td><td>No</td><td>Category expected to be matched</td></tr><tr><td><strong>expected_value</strong></td><td>varchar(255)</td><td>No</td><td>Value expected to be matched</td></tr><tr><td><strong>expected_answer</strong></td><td>text</td><td>No</td><td>Textual answer expected to be returned by the VA on this automated_tests channel</td></tr><tr><td><strong>removed</strong></td><td>tinyint(1)</td><td>No</td><td>True if the object was deleted. This may be reverted.</td></tr><tr><td><strong>created_at</strong></td><td>datetime</td><td>No</td><td>The date this object was created</td></tr><tr><td><strong>updated_at</strong></td><td>datetime</td><td>No</td><td>The date this object was last updated</td></tr><tr><td><strong>created_by</strong></td><td>varchar(36)</td><td>No</td><td>UUID representing the user who created this object</td></tr><tr><td><strong>updated_by</strong></td><td>varchar(36)</td><td>No</td><td>UUID representing the user who updated this object</td></tr></tbody></table>

### Automated Test Utterance **Execution**

The automated\_test\_utterance\_execution table stores the individual execution results per utterance.

<table data-header-hidden><thead><tr><th>Column Name</th><th width="200">Data Type</th><th>Not Null</th><th>Description</th></tr></thead><tbody><tr><td><strong>Column Name</strong></td><td><strong>Data Type</strong></td><td><strong>Not Null</strong></td><td><strong>Description</strong></td></tr><tr><td><strong>uuid</strong></td><td>varchar(36)</td><td>Yes</td><td>UUID of this utterance execution</td></tr><tr><td><strong>automated_test_utterance_uuid</strong></td><td>varchar(36)</td><td>Yes</td><td>UUID of the automated test's utterance this execution refers to</td></tr><tr><td><strong>automated_test_execution_uuid</strong></td><td>varchar(36)</td><td>Yes</td><td>UUID of the automated tests</td></tr><tr><td><strong>given_category</strong></td><td>varchar(200)</td><td>No</td><td>Category given on this execution</td></tr><tr><td><strong>given_value</strong></td><td>text</td><td>No</td><td>Value given on this execution</td></tr><tr><td><strong>given_answer</strong></td><td>text</td><td>No</td><td>Textual answer  returned by the VA on this automated_test's channel execution</td></tr><tr><td><strong>session_code</strong></td><td>varchar(200)</td><td>No</td><td>UUID of the session code</td></tr><tr><td><strong>score</strong></td><td>decimal(12,10)</td><td>Yes</td><td>Score of this execution</td></tr><tr><td><strong>proccess_time</strong></td><td>int(11)</td><td>No</td><td>Proccessed time in millis</td></tr><tr><td><strong>description</strong></td><td>text</td><td>No</td><td>An optional description.</td></tr></tbody></table>

### Bot

This table stores all information from a virtual agent(VA), internally named bot. There is a homonym table in the admin data structure, which stores the bot's permission access and envorinment relations, while this one stores Cockpit data and it's logical functions.

| **Column Name**             | **Data Type** | **Not Null** | **Description**                                       |
| --------------------------- | ------------- | ------------ | ----------------------------------------------------- |
| **uuid**                    | varchar(36)   | Yes          | This bot's UUID                                       |
| **name**                    | varchar(50)   | Yes          | This bot's Name                                       |
| **locale**                  | varchar(6)    | Yes          | The main locale used by this bot                      |
| **description**             | text          | No           | A freeform description for this bot                   |
| **image**                   | mediumblob    | No           | Stores this bot's image or it's url                   |
| **image\_content\_type**    | varchar(50)   | No           | The bot's image's content type                        |
| **bot\_analytic\_api\_key** | varchar(50)   | No           | An API key which allows the bot to be tracked by it   |
| **removed**                 | tinyint(1)    | No           | True if the object was deleted. This may be reverted. |
| **created\_at**             | datetime      | No           | The date this object was created                      |
| **updated\_at**             | datetime      | No           | The date this object was last updated                 |
| **created\_by**             | varchar(36)   | Yes          | UUID representing the user who created this object    |
| **updated\_by**             | varchar(36)   | No           | UUID representing the user who updated this object    |

### Bulk Training

Bulk trainings contains bulk-inserted intents and utterances. This table refers to the bulk as a whole and it's execution status. Each individual intent and utterance are stored in bulk\_training\_item.

| **Column Name** | **Data Type**                    | **Not Null** | **Description**                                    |
| --------------- | -------------------------------- | ------------ | -------------------------------------------------- |
| **uuid**        | varchar(36)                      | Yes          | UUID of this bulk training                         |
| **bot\_uuid**   | varchar(36)                      | Yes          | UUID from the bot this file was submitted          |
| **type**        | enum('INTENTS','UTTERANCES')     | Yes          | Type of the bulk insertion, defaulted to INTENTS.  |
| **percentage**  | int(11)                          | Yes          | Active progress for this bulk training's worker    |
| **status**      | enum('PENDING','FINISH','ERROR') | Yes          | This bulk training's status.                       |
| **result**      | longtext                         | No           | Inserted objects                                   |
| **file\_name**  | text                             | No           | Name of the submitted file.                        |
| **created\_at** | datetime                         | No           | The date this object was created                   |
| **created\_by** | varchar(36)                      | No           | UUID representing the user who created this object |

### Bulk Training Item

The bulk\_training\_item represents one line of a provided file in a bulk\_training.

<table data-header-hidden><thead><tr><th width="207">Column Name</th><th width="191">Data Type</th><th>Not Null</th><th>Description</th></tr></thead><tbody><tr><td><strong>Column Name</strong></td><td><strong>Data Type</strong></td><td><strong>Not Null</strong></td><td><strong>Description</strong></td></tr><tr><td><strong>uuid</strong></td><td>varchar(36)</td><td>Yes</td><td>UUID of this item.</td></tr><tr><td><strong>bulk</strong><em><strong>_</strong></em><strong>training</strong><em><strong>_</strong></em><strong>uuid</strong></td><td>varchar(36)</td><td>Yes</td><td>UUID from the bulk training this item refers to</td></tr><tr><td><strong>bot_uuid</strong></td><td>varchar(36)</td><td>Yes</td><td>UUID from the bot this bulk training refers to</td></tr><tr><td><strong>intent</strong></td><td>varchar(255)</td><td>Yes</td><td>A text containing an intent name</td></tr><tr><td><strong>utterance</strong></td><td>varchar(1000)</td><td>Yes</td><td>An example/utterance for the intent above</td></tr><tr><td><strong>created_at</strong></td><td>datetime</td><td>No</td><td>The date this object was created</td></tr><tr><td><strong>created_by</strong></td><td>varchar(36)</td><td>No</td><td>UUID representing the user who created this object</td></tr></tbody></table>

### Channel

The channel table stores channel data creation. It is possible to identify to which virtual agent the channel is associated, the channel name and type.

| **Column Name**       | **Data Type**       | **Not Null** | **Description**                                                     |
| --------------------- | ------------------- | ------------ | ------------------------------------------------------------------- |
| **uuid**              | varchar(36)         | Yes          | This channel's UUID                                                 |
| **bot\_uuid**         | varchar(36)         | Yes          | UUID of the bot this channel belongs to.                            |
| **channel\_type\_id** | bigint(20) unsigned | Yes          | ID identifying the channel type, related to the channel\_type table |
| **name**              | varchar(45)         | Yes          | This channel's name                                                 |
| **description**       | text                | No           | A freeform description                                              |
| **removed**           | tinyint(1)          | No           | True if the object was deleted. This may be reverted.               |
| **created\_at**       | datetime            | No           | The date this object was created                                    |
| **updated\_at**       | datetime            | No           | The date this object was last updated                               |
| **created\_by**       | varchar(36)         | No           | UUID representing the user who created this object                  |
| **updated\_by**       | varchar(36)         | No           | UUID representing the user who updated this object                  |

### Channel Type

The channel\_type table stores the types of channels. Within each classification, there are of channels types, such as:&#x20;

* Smart Speakers & Social Robots: Amazon Echo e Google Home&#x20;
* Smart Assistants: Alexa, Cortana e Siri&#x20;
* Messaging Platform: Facebook, Twitter e Skype
* Synthetic Reality: ARCore e Samsung Gear VR&#x20;
* Mobile/Tablet/Desktop: Andriod, iOS e Web
* Cognitive Contact Center: IVR e VR&#x20;

| **Column Name**                 | **Data Type**       | **Not Null** | **Description**                                                                         |
| ------------------------------- | ------------------- | ------------ | --------------------------------------------------------------------------------------- |
| **id**                          | bigint(20) unsigned | Yes          | ID representing the type of channel                                                     |
| **channel\_classification\_id** | bigint(20) unsigned | Yes          | ID identifying the channel classification, related to the channel\_classification table |
| **name**                        | varchar(50)         | Yes          | The channel type's name                                                                 |
| **image**                       | varchar(30)         | No           | Stores the image that is being used to represent the channel type                       |
| **created\_at**                 | datetime            | No           | The date this object was created                                                        |
| **updated\_at**                 | datetime            | No           | The date this object was last updated                                                   |
| **created\_by**                 | varchar(36)         | No           | UUID representing the user who created this object                                      |
| **updated\_by**                 | varchar(36)         | No           | UUID representing the user who updated this object                                      |

### Channel Classification

The channel\_classification table stores the classifications of channels, each one identified by an ID. These groups are:&#x20;

* Smart Speakers & Social Robots
* Smart Assistants
* Messaging Platform
* Synthetic Reality
* Mobile/Tablet/Desktop
* Cognitive Contact Center&#x20;

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                    |
| --------------- | ------------------- | ------------ | -------------------------------------------------- |
| **id**          | bigint(20) unsigned | Yes          | ID representing this channel classification        |
| **name**        | varchar(50)         | Yes          | Name of this classification                        |
| **created\_at** | datetime            | No           | The date this object was created                   |
| **updated\_at** | datetime            | No           | The date this object was last updated              |
| **created\_by** | varchar(36)         | No           | UUID representing the user who created this object |
| **updated\_by** | varchar(36)         | No           | UUID representing the user who updated this object |

### Configuration

The configuration tables stores environment's configuration keys. Those may be bot-specific, if a bot\_uuid is provided, otherwise they behave as global configurations for the whole environment.

| **Column Name** | **Data Type** | **Not Null** | **Description**                                                                |
| --------------- | ------------- | ------------ | ------------------------------------------------------------------------------ |
| **uuid**        | varchar(36)   | Yes          | UUID representing a custom configuration key                                   |
| **bot\_uuid**   | varchar(36)   | No           | UUID representing a bot that this configuration reflect, if it's bot-specific. |
| **key**         | varchar(50)   | Yes          | The configuration' key                                                         |
| **value**       | varchar(255)  | No           | The configuration's key value                                                  |
| **description** | varchar(300)  | No           | Parameter description                                                          |
| **enabled**     | tinyint(1)    | No           | True, if this configuration is enabled                                         |
| **eraseable**   | tinyint(1)    | No           | True, if this configuration may be fully erased                                |
| **created\_at** | datetime      | No           | The date this object was created                                               |
| **updated\_at** | datetime      | No           | The date this object was last updated                                          |
| **created\_by** | varchar(36)   | No           | UUID representing the user who created this object                             |
| **updated\_by** | varchar(36)   | No           | UUID representing the user who updated this object                             |

### Entity

The entity table stores configurations for entities created in the virtual agent. An example would be the entity “sport”.

| **Column Name** | **Data Type** | **Not Null** | **Description**                                                                                |
| --------------- | ------------- | ------------ | ---------------------------------------------------------------------------------------------- |
| **uuid**        | varchar(36)   | Yes          | UUID representing the entity                                                                   |
| **bot\_uuid**   | varchar(36)   | Yes          | UUID of the VA the entity belongs to                                                           |
| **name**        | varchar(255)  | Yes          | The entity's name                                                                              |
| **metadata**    | varchar(200)  | No           | Contains the entity's metadata values, related to the VA's NLP if distinct from Syntphony NLP. |
| **enabled**     | tinyint(1)    | No           | True, if the object is enabled. This may be reverted.                                          |
| **removed**     | tinyint(1)    | Yes          | True if the object was deleted. This may not be reverted.                                      |
| **created\_at** | datetime      | No           | The date this object was created                                                               |
| **updated\_at** | datetime      | No           | The date this object was last updated                                                          |
| **created\_by** | varchar(36)   | Yes          | UUID representing the user who created this object                                             |
| **updated\_by** | varchar(36)   | No           | UUID representing the user who updated this object                                             |

### Document

The document table stores documents supplied by a user to properly configure the Automated Learning functionality. This structure stores data regarding a document and their path to your private bucket.

| **Column Name**       | **Data Type** | **Not Null** | **Description**                                              |
| --------------------- | ------------- | ------------ | ------------------------------------------------------------ |
| **uuid**              | varchar(36)   | Yes          | UUID representing the document                               |
| **bot\_uuid**         | varchar(36)   | Yes          | UUID of the VA the document belongs to                       |
| **storage\_filename** | varchar(40)   | Yes          | Path to this document's file.                                |
| **training\_status**  | varchar(30)   | No           | The status of this document regarding it's training proccess |
| **filename**          | varchar(255)  | Yes          | Name of the document                                         |
| **enabled**           | tinyint(1)    | No           | True, if the object is enabled. This may be reverted.        |
| **removed**           | tinyint(1)    | Yes          | True if the object was deleted. This may not be reverted.    |
| **created\_at**       | datetime      | No           | The date this object was created                             |
| **updated\_at**       | datetime      | No           | The date this object was last updated                        |
| **created\_by**       | varchar(36)   | Yes          | UUID representing the user who created this object           |
| **updated\_by**       | varchar(36)   | No           | UUID representing the user who updated this object           |

### Entity Value

The entity\_value table stores the entity content. So, in the entity “sport”, the values would be “football”, “basketball” or “tennis”.

| **Column Name**  | **Data Type** | **Not Null** | **Description**                                          |
| ---------------- | ------------- | ------------ | -------------------------------------------------------- |
| **uuid**         | varchar(36)   | Yes          | UUID of this entity value                                |
| **entity\_uuid** | varchar(36)   | Yes          | UUID of the entity this value belongs to                 |
| **value**        | varchar(255)  | Yes          | The value of this object                                 |
| **type**         | varchar(20)   | Yes          | <p>Contains the entity value: Synonym or Pattern<br></p> |
| **created\_at**  | datetime      | No           | The date this object was created                         |
| **updated\_at**  | datetime      | No           | The date this object was last updated                    |
| **created\_by**  | varchar(36)   | Yes          | UUID representing the user who created this object       |
| **updated\_by**  | varchar(36)   | Yes          | UUID representing the user who updated this object       |

### Entity Sample

The entity\_sample table stores words that has a similar meaning to the entity value. For example, if the entity value is “football”, it could store “soccer” or “association football”.

| **Column Name**                   | **Data Type** | **Not Null** | **Description**                                    |
| --------------------------------- | ------------- | ------------ | -------------------------------------------------- |
| **uuid**                          | varchar(36)   | Yes          | UUID of this sample                                |
| **entity\_value*****\_*****uuid** | varchar(36)   | Yes          | UUID of the empty value this object is sampling    |
| **value**                         | varchar(255)  | Yes          | The provided synonym or pattern                    |
| **created\_at**                   | datetime      | No           | The date this object was created                   |
| **updated\_at**                   | datetime      | No           | The date this object was last updated              |
| **created\_by**                   | varchar(36)   | Yes          | UUID representing the user who created this object |
| **updated\_by**                   | varchar(36)   | Yes          | UUID representing the user who updated this object |

### Entity System

The entity\_system table contains a map of all existing system entities.

| **Column Name** | **Data Type** | **Not Null** | **Description**           |
| --------------- | ------------- | ------------ | ------------------------- |
| **id**          | bigint(20)    | Yes          | This system entity's UUID |
| **name**        | varchar(255)  | Yes          | This system entity's name |

### Facebook Configuration

The facebook\_configuration stores the chat configuration in a Facebook page.

| **Column Name**         | **Data Type** | **Not Null** | **Description**                                      |
| ----------------------- | ------------- | ------------ | ---------------------------------------------------- |
| **page\_id**            | varchar(45)   | No           | The facebook page's ID, identified by it's URL       |
| **page\_name**          | varchar(45)   | No           | The facebook page's name                             |
| **hub\_token**          | varchar(100)  | Yes          | Verification code to be used with facebook's webhook |
| **page\_access\_token** | varchar(225)  | No           | Verification code to validate page access            |
| **channel\_uuid**       | varchar(36)   | Yes          | UUIID representing the channel in the channel table  |

### Facebook User

The facebook\_user table stores the data of the facebook user who interacted with the virtual agent.

| **Column Name**       | **Data Type** | **Not Null** | **Description**                                      |
| --------------------- | ------------- | ------------ | ---------------------------------------------------- |
| **user\_id**          | varchar(20)   | Yes          | ID that identifies the facebook user who interacted. |
| **create\_date**      | datetime      | No           | Record creation date                                 |
| **user\_blocked**     | tinyint(2)    | No           | Shows if the user is blocked                         |
| **last\_interaction** | datetime      | No           | Shows the user's last interaction date and time      |

### Input

The input table contains possible Wait input cells within a dialog flow and their call to actions.

| **Column Name**                | **Data Type** | **Not Null** | **Description**                                     |
| ------------------------------ | ------------- | ------------ | --------------------------------------------------- |
| **uuid**                       | varchar(36)   | Yes          | This input's UUID                                   |
| **bot\_uuid**                  | varchar(36)   | Yes          | UUID of the bot the input refers to                 |
| **type\_id**                   | bigint(20)    | Yes          | This input type ID, refers to the input\_type table |
| **description**                | mediumtext    | No           | A freeform description                              |
| **pattern**                    | mediumtext    | No           | This input's pattern                                |
| **call\_to*****\_*****action** | mediumtext    | No           | This input's call to action                         |
| **remember\_input**            | tinyint(4)    | No           | Wether this input is to be stored                   |
| **stored**                     | varchar(100)  | No           | This input's stored value                           |
| **created\_at**                | datetime      | No           | The date this object was created                    |
| **updated\_at**                | datetime      | No           | The date this object was last updated               |
| **created\_by**                | varchar(36)   | No           | UUID representing the user who created this object  |
| **updated\_by**                | varchar(36)   | No           | UUID representing the user who updated this object  |

### Input Type

A map of all existing Input types.

| **Column Name** | **Data Type** | **Not Null** | **Description**  |
| --------------- | ------------- | ------------ | ---------------- |
| **id**          | bigint(20)    | Yes          | This type's ID   |
| **type**        | varchar(100)  | Yes          | This type's name |

### Intents

The intents table stores the configuration of intents created in the virtual agent.

| **Column Name** | **Data Type** | **Not Null** | **Description**                                                     |
| --------------- | ------------- | ------------ | ------------------------------------------------------------------- |
| **uuid**        | varchar(36)   | Yes          | This Intent's UUID                                                  |
| **bot\_uuid**   | varchar(36)   | Yes          | UUID of the bot this intent belongs to                              |
| **name**        | varchar(255)  | Yes          | The intent's Name                                                   |
| **description** | text          | No           | The intent's description                                            |
| **metadata**    | varchar(200)  | No           | The intent's metada, present on some NLPs. Absent in Syntphony NLP. |
| **enabled**     | tinyint(1)    | Yes          | Wether the intent is enabled                                        |
| **removed**     | tinyint(1)    | Yes          | Wether the intent was deleted                                       |
| **created\_at** | datetime      | No           | The date this object was created                                    |
| **updated\_at** | datetime      | No           | The date this object was last updated                               |
| **created\_by** | varchar(36)   | No           | UUID representing the user who created this object                  |
| **updated\_by** | varchar(36)   | No           | UUID representing the user who updated this object                  |

{% hint style="info" %}
**To learn more how to use** [**Intents**](https://docs.eva.bot/user-guide/using-eva/develop-your-bot/dialog-cells/intent-cells) **in Syntphony CAI**
{% endhint %}

### NLP Engine

The nlp\_engine stores NLP integration data.

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                            |
| --------------- | ------------------- | ------------ | -------------------------------------------------------------------------- |
| **id**          | bigint(20) unsigned | Yes          | ID representing a cognitive engine                                         |
| **engine**      | varchar(20)         | Yes          | Shows the cognitive engine used: Syntphony NLP, DialogFlow, Watson or Luis |
| **metadata**    | text                | Yes          | Shows the cognitive engine metada values                                   |
| **created\_at** | datetime            | No           | The date this object was last created                                      |
| **updated\_at** | datetime            | No           | The date this object was last updated                                      |
| **created\_by** | varchar(36)         | No           | UUID representing the user who created this object                         |
| **updated\_by** | varchar(36)         | No           | UUID representing the user who last updated this object                    |

### Question

The question table stores questions related to the Automated Learning functionality. It relates to a document in which it should have it's text consulted for replies. This table has fields akin to [Answer ](#answer)and is it's counterpart for AL using agents.

| **Column Name**    | **Data Type** | **Not Null** | **Description**                                            |
| ------------------ | ------------- | ------------ | ---------------------------------------------------------- |
| **uuid**           | varchar(36)   | Yes          | UUID representing the Question                             |
| **bot\_uuid**      | varchar(36)   | Yes          | UUID of the VA the Question belongs to                     |
| **document\_uuid** | varchar(36)   | Yes          | UUID of the Document this Question refers to.              |
| **name**           | varchar(255)  | No           | This Question's name                                       |
| **description**    | varchar(255)  | No           | The Answer's description                                   |
| **webhook**        | varchar(255)  | No           | API URL that will be called when this response is executed |
| **headers**        | text          | No           | Freeform headers to configure webhooks.                    |
| **transactional**  | tinyint(1)    | No           | Show if the response is transactional                      |
| **evaluable**      | tinyint(1)    | No           | Shows if the message can be evaluated by the user          |
| **enabled**        | tinyint(1)    | No           | True, if the object is enabled. This may be reverted.      |
| **removed**        | tinyint(1)    | Yes          | True if the object was deleted. This may not be reverted.  |
| **created\_at**    | datetime      | No           | The date this object was created                           |
| **updated\_at**    | datetime      | No           | The date this object was last updated                      |
| **created\_by**    | varchar(36)   | Yes          | UUID representing the user who created this object         |
| **updated\_by**    | varchar(36)   | No           | UUID representing the user who updated this object         |

### Question Variable

The question table stores variables associated to questions. A question may have more than on variable assigned to it. Variables are freeform samples of queries for a question such as "What is a Virtual Agent?" or "Where can i find documentations about Virtual Agents?".

| **Column Name**        | **Data Type** | **Not Null** | **Description**                                 |
| ---------------------- | ------------- | ------------ | ----------------------------------------------- |
| **uuid**               | varchar(36)   | Yes          | UUID representing the Variable                  |
| **question\_uuid**     | varchar(36)   | Yes          | UUID of the Question  this variable belongs to  |
| **question\_variable** | varchar(255)  | No           | The variable itself, coming as a freeform text. |

### Satisfaction

The satisfaction table stores the user's assessment of virtual agent attendance. At the end of the session, the user is asked to evaluate the virtual agent service and comment their experience. This table can generate the following reports:

Satisfaction survey result: shows the result of the satisfaction survey, that allows to analyse the level of user satisfaction with a grading system.

Volume of answer: total amount of responses from the satisfaction survey

Solved questions: number of users who had their questions answered

| **Column Name**    | **Data Type** | **Not Null** | **Description**                                 |
| ------------------ | ------------- | ------------ | ----------------------------------------------- |
| **uuid**           | varchar(36)   | Yes          | Column identifier                               |
| **session\_code**  | varchar(50)   | Yes          | Code representing a session                     |
| **evaluation**     | tinyint(4)    | Yes          | The user's evaluation as a score                |
| **answered**       | tinyint(1)    | Yes          | Indicates if users had their questions answered |
| **user\_comments** | varchar(500)  | No           | Any user written comments                       |
| **create\_date**   | datetime      | Yes          | Creation date                                   |

### Session <a href="#technicallog" id="technicallog"></a>

The session table has all the services made by the virtual agent. No matter how many questions the user has asked during a session, only one record will appear for each session. This table can generate reports such as:

Average daily sessions: how many sessions are run per day.

Volume of session: total sessions. It can be broke down in different time frames, such as month or timeframe/total sessions.

Channel/session evolution: a line graph showing the evolution of the number of sessions, making possible to see if there was a increase or decrease.

<table data-header-hidden><thead><tr><th width="206">Column Name</th><th>Data Type</th><th>Not Null</th><th>Description</th></tr></thead><tbody><tr><td><strong>Column Name</strong></td><td><strong>Data Type</strong></td><td><strong>Not Null</strong></td><td><strong>Description</strong></td></tr><tr><td><strong>session_code</strong></td><td>varchar(50)</td><td>Yes</td><td>UUID/GUID code that represents a user session</td></tr><tr><td><strong>create_date</strong></td><td>datetime</td><td>Yes</td><td>Session creation date</td></tr><tr><td><strong>expire_date</strong></td><td>datetime</td><td>No</td><td>Session expiration date</td></tr><tr><td><strong>business_key</strong></td><td>varchar(100)</td><td>No</td><td><p>The business key is defined by the customer. It is used to identify the customer. Examples of business key: phone and customer ID.</p><p>This field is optional and may have no value.</p></td></tr><tr><td><strong>session_type</strong></td><td>varchar(10)</td><td>Yes</td><td>Shows the session status: created, updated or expired</td></tr><tr><td><strong>bot_uuid</strong></td><td>varchar(36)</td><td>Yes</td><td>UUID of the bot this session is running on</td></tr><tr><td><strong>channel_uuid</strong></td><td>varchar(36)</td><td>No</td><td>UUID of the channel this session is running on</td></tr><tr><td><strong>operating_system</strong></td><td>varchar(20)</td><td>No</td><td>Identifies the operating system</td></tr><tr><td><strong>operating_system_version</strong></td><td>varchar(30)</td><td>No</td><td>Identifies the operating system version</td></tr><tr><td><strong>browser</strong></td><td>varchar(50)</td><td>No</td><td>Shows the used browser </td></tr><tr><td><strong>browser_version</strong></td><td>varchar(30)</td><td>No</td><td>Shows the used browser version</td></tr><tr><td><strong>user_ref</strong></td><td>varchar(50)</td><td>Yes</td><td>User reference, shows where the user accessed from. This value is dependent on the channel being used, for example: WEB uses IP, IVR uses the customer`s contact phone and Facebook uses facebook user ID</td></tr><tr><td><strong>locale</strong></td><td>varchar(6)</td><td>No</td><td>Identifies the language and country</td></tr><tr><td><strong>test</strong></td><td>tinyint(1)</td><td>Yes</td><td>Informs if the sessions is an automated test request or if it is from the user.</td></tr></tbody></table>

### Tags <a href="#user-interactions" id="user-interactions"></a>

The tags table stores the tags created in the virtual agent. Tags helps to identify objects, and they are shared between all objects with same-named tags in a bot.&#x20;

| **Column Name** | **Data Type** | **Not Null** | **Description**                       |
| --------------- | ------------- | ------------ | ------------------------------------- |
| **uuid**        | varchar(36)   | Yes          | The tag's UUID                        |
| **bot\_uuid**   | varchar(36)   | Yes          | UUID of the bot containing this bot   |
| **name**        | varchar(80)   | Yes          | The tag's name                        |
| **created\_at** | datetime      | No           | The date this object was created      |
| **updated\_at** | datetime      | No           | The date this object was last updated |

### Tag Use

The tag\_uses table stores tag data and which repository it is related to, allowing to identify the tag, repository type and which repository ID the tag is related to. They must connect to an object among entity, answer, intent, service or flow; but may not connect to more than one.

| **Column Name**    | **Data Type** | **Not Null** | **Description**                                                                                                                                                                                                                                                   |
| ------------------ | ------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **id**             | bigint(20)    | Yes          | This tag uses's ID                                                                                                                                                                                                                                                |
| **tag\_uuid**      | varchar(36)   | Yes          | UUID of the tag this connection represents                                                                                                                                                                                                                        |
| **tag\_type\_id**  | int(11)       | Yes          | <p>ID identifying the type of tag according to the element that contains it, where:</p><p>1 - Intent<br>2 - Entity<br>3 - Answer<br>4 - Flow<br>5 - Prototype<br>6 - Service<br>7 - Question<br>8 - Rest Connector<br>9 - Generative Service<br>10 - Document</p> |
| **answer\_uuid**   | varchar(36)   | No           | UUID of an answer, if the connected object is an answer. Otherwise always empty.                                                                                                                                                                                  |
| **entity\_uuid**   | varchar(36)   | No           | UUID of an entity, if the connected object is an entity. Otherwise always empty.                                                                                                                                                                                  |
| **flow\_uuid**     | varchar(36)   | No           | UUID of a flow, if the connected object is a flow. Otherwise always empty.                                                                                                                                                                                        |
| **intent\_uuid**   | varchar(36)   | No           | UUID of an intent, if the connected object is an intent. Otherwise always empty.                                                                                                                                                                                  |
| **question\_uuid** | varchar(36)   | No           | Unused in version 4.0.0                                                                                                                                                                                                                                           |
| **service\_uuid**  | varchar(36)   | No           | UUID of a service, if the connected object is a service. Otherwise always empty.                                                                                                                                                                                  |
| **created\_at**    | datetime      | No           | The date this object was created                                                                                                                                                                                                                                  |
| **updated\_at**    | datetime      | No           | The date this object was last updated                                                                                                                                                                                                                             |

### Technical Log

The technical\_log table stores technical information from user questions, such as response times and service calls, information about calls and execution errors on a non-volatile fashion. When the response from the Syntphony CAI chat service returns an error, it also sends a UUID for troubleshooting, found within this table.&#x20;

{% hint style="warning" %}
This table is currently disabled at Syntphony CAI 4.1.0.

The structure is present, but no logs will be registered until further notice.
{% endhint %}

| **Column Name**      | **Data Type** | **Not Null** | **Description**                                                                                                                                                                                         |
| -------------------- | ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **id**               | bigint(20)    | Yes          | ID that identifies a log                                                                                                                                                                                |
| **session\_code**    | varchar(50)   | No           | Code representing a session. May be absent if the log does not refer to a conversation.                                                                                                                 |
| **log\_code**        | varchar(50)   | Yes          | <p>Log code that is returned by Syntphony CAI when an error is generated. <br>This field is also outputted by the console logs.</p><p>This field may be used to search and the troubleshoot issues.</p> |
| **type**             | tinyint(4)    | Yes          | <p>Indicates wether this log represents an error, a warning or an information.</p><p>0 = error</p><p>1 = warning</p><p>2 = information</p>                                                              |
| **message**          | text          | No           | The log's message                                                                                                                                                                                       |
| **stacktrace**       | varchar(1000) | No           | Contains a stacktrace if this log was that of an error                                                                                                                                                  |
| **module\_type**     | varchar(50)   | Yes          | Represents which architecture module generated the log                                                                                                                                                  |
| **create\_date**     | datetime      | Yes          | The date this object was created                                                                                                                                                                        |
| **processing\_time** | int(11)       | No           | Processing time in milliseconds                                                                                                                                                                         |

### Training

The training table stores a virtual agent training proccess whenever it **is not** using Automated Learning. When a user trains a virtual agent in the Cockpit, the ongoing and resulting data are stored in this table.

| **Column Name** | **Data Type** | **Not Null** | **Description**                                                                       |
| --------------- | ------------- | ------------ | ------------------------------------------------------------------------------------- |
| **uuid**        | varchar(36)   | Yes          | This training's UUID                                                                  |
| **version**     | varchar(5)    | Yes          | Indicates how many times this virtual agent was trained, using a version number       |
| **status**      | varchar(40)   | Yes          | <p>Shows the training status, where:</p><p>1 – training<br>2 – ready<br>3 – error</p> |
| **user\_uuid**  | varchar(36)   | Yes          | UUID of the user responsible for starting this training proccess                      |
| **accuracy**    | tinyin(4)     | Yes          | The training accuracy value                                                           |
| **bot\_uuid**   | varchar(36)   | Yes          | UUID of the virtual agent this training is running to                                 |
| **updatedAt**   | datetime      | No           | The date this object was last updated                                                 |
| **error\_msg**  | varchar(255)  | No           | Stores any error message that may be prompted for the Cockpit administrator           |

### Training AL

The training\_al table stores a virtual agent training proccess whenever it **is** using Automated Learning. When a user trains a virtual agent in the Cockpit, the ongoing and resulting data are stored in this table.

| **Column Name**      | **Data Type** | **Not Null** | **Description**                                                                                                                      |
| -------------------- | ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| **uuid**             | varchar(36)   | Yes          | This training's UUID                                                                                                                 |
| **bot\_uuid**        | varchar(36)   | Yes          | UUID of the virtual agent this training is running to                                                                                |
| **user\_uuid**       | varchar(36)   | Yes          | UUID of the user responsible for starting this training proccess                                                                     |
| **version**          | varchar(5)    | Yes          | Indicates how many times this virtual agent was trained, using a version number                                                      |
| **status\_document** | varchar(40)   | Yes          | <p>Shows the training status regarding docs, where:</p><p>1 – training<br>2 – ready<br>3 – error<br>4 – forbidden<br>5 – partial</p> |
| **status\_faq**      | varchar(40)   | Yes          | <p>Shows the training status regarding FAQs, where:</p><p>1 – training<br>2 – ready<br>3 – error</p>                                 |
| **error\_document**  | varchar(255)  | No           | Stores any error message that may be prompted for the Cockpit administrator regarding documents                                      |
| **error\_faq**       | varchar(255)  | No           | Stores any error message that may be prompted for the Cockpit administrator regarding FAQs                                           |
| **updatedAt**        | datetime      | No           | The date this object was last updated                                                                                                |

### Training AL Document

The training\_al\_documents table stores a virtual agent's training proccess detail document-wise, describing each's document's status regarding this one training proccess.

| **Column Name**                | **Data Type** | **Not Null** | **Description**                                                                                        |
| ------------------------------ | ------------- | ------------ | ------------------------------------------------------------------------------------------------------ |
| **uuid**                       | varchar(36)   | Yes          | This relationship's UUID                                                                               |
| **training\_al\_uuid**         | varchar(36)   | Yes          | UUID of a training\_al this status refers to.                                                          |
| **document\_uuid**             | varchar(36)   | Yes          | UUID of the document this status refers to.                                                            |
| **document\_training\_status** | varchar(30)   | No           | <p>Shows the training status, where:</p><p>1 – training<br>2 – ready<br>3 – error<br>4 – forbidden</p> |
| **error\_document**            | tinyin(255)   | No           | The training accuracy value                                                                            |

### Transactional Service

The transactional\_service table stores the transactional calls performed during a session. One may identify which service was called and the answer content by the webhook field.

| **Column Name** | **Data Type** | **Not Null** | **Description**                                                    |
| --------------- | ------------- | ------------ | ------------------------------------------------------------------ |
| **uuid**        | varchar(36)   | Yes          | The Transactional Service's UUID                                   |
| **bot\_uuid**   | varchar(36)   | Yes          | UUID representing of the bot containing this Transactional Service |
| **name**        | varchar(50)   | Yes          | Service call name                                                  |
| **webhook**     | text          | Yes          | API URL to be called                                               |
| **content**     | text          | Yes          | Content that will be used in the transactional call                |
| **headers**     | longtext      | No           | Any Headers required to be used in the API call                    |
| **description** | text          | No           | A service call description                                         |
| **removed**     | tinyint(1)    | No           | True if this transaction service was deleted.                      |
| **created\_at** | datetime      | No           | The date this object was created                                   |
| **updated\_at** | datetime      | No           | The date this object was last updated                              |
| **created\_by** | varchar(36)   | No           | UUID representing the user who created this object                 |
| **updated\_by** | varchar(36)   | No           | UUID representing the user who last updated this object            |

### User Interaction

The user\_interaction table stores each one of the users interactions, be the question asked or the answer sent by the virtual agent. The interactions between user and virtual agent are stored and identified by the session code. It is also possible to identify whether it was a user or a virtual agent interaction. This table can generate the following reports:

**Volume of questions**: total amount of questions asked by users

**Number of questions** per channel: total number of user questions per channel

**Question evolution**: a graph showing the number of questions from the users evolution.

**Average question per user**: shows the average number of questions per user.

**Top 10 words**: ranking with the 10 most typed words by users

| **Column Name**      | **Data Type**  | **Not Null** | **Description**                                                                                                                                                                                                                     |
| -------------------- | -------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **uuid**             | varchar(36)    | Yes          | UUID  identifying the interaction between virtual agent and user                                                                                                                                                                    |
| **create\_date**     | datetime       | Yes          | The date this object was created                                                                                                                                                                                                    |
| **session\_code**    | varchar(50)    | Yes          | Code representing a session                                                                                                                                                                                                         |
| **user\_sent**       | tinyint(4)     | Yes          | Identifies if this interaction is a user message                                                                                                                                                                                    |
| **answer\_uuid**     | varchar(36)    | No           | UUID of the delivered answer that prompted the interaction.                                                                                                                                                                         |
| **question\_uuid**   | varchar(36)    | No           | Unused in Syntphony CAI 4.0.0                                                                                                                                                                                                       |
| **text**             | text           | No           | Shows the conversation content                                                                                                                                                                                                      |
| **confidence**       | decimal(12,10) | No           | Shows the level of confidence returned by the NLP                                                                                                                                                                                   |
| **user\_sent\_uuid** | varchar(36)    | No           | Identifies to which user UUID the response was sent. It is related to the UUID column on the user\_interaction table. When a response is sent to the user, this field will be filled with the question that generated the response. |
| **evaluation**       | tinyint(1)     | No           | Deprecated in Syntphony CAI 4.0.0, will be removed in the future. Refer to [Satisfaction ](#satisfaction-1)instead.                                                                                                                 |
| **entities**         | varchar(200)   | No           | Names of the entities that were identified, separated by commas (i.e "entityName1,entityName2")                                                                                                                                     |
| **intent**           | varchar(100)   | No           | Name of the intent  that was identified                                                                                                                                                                                             |

### Utterance <a href="#satisfaction" id="satisfaction"></a>

The utterances table stores intent examples. When a user creates an intent in the virtual agent, he must add sentences that can appear in a conversation with the virtual agent. Those are these sentences.

| **Column Name**  | **Data Type** | **Not Null** | **Description**                                                                |
| ---------------- | ------------- | ------------ | ------------------------------------------------------------------------------ |
| **uuid**         | varchar(36)   | Yes          | The Utterance's UUID                                                           |
| **intent\_uuid** | varchar(36)   | Yes          | UUID of the intent this utterance is exemplifying                              |
| **bot\_uuid**    | varchar(36)   | Yes          | UUID of the bot this utterance belongs to                                      |
| **example**      | varchar(1000) | Yes          | The exemple's text                                                             |
| **metadata**     | varchar(100)  | No           | Metadata present in fomr NLP imported utterances. Empty on Syntphony CAI NLPs. |
| **created\_at**  | datetime      | No           | The date this object was created                                               |
| **updated\_at**  | datetime      | No           | The date this object was last updated                                          |
| **created\_by**  | varchar(36)   | No           | UUID representing the user who created this object                             |
| **updated\_by**  | varchar(36)   | No           | UUID representing the user who updated this object                             |

### Whatsapp User

This table stores data regarding the 'user' your infobip whatsapp channel is using.

| **Column Name**   | **Data Type** | **Not Null** | **Description**                  |
| ----------------- | ------------- | ------------ | -------------------------------- |
| **phone number**  | bigint(15)    | Yes          | The Phone number to be used      |
| **create\_date**  | datetime      | No           | The date this object was created |
| **scenario\_key** | varchar(100)  | No           | Your whatsapp scenario key.      |

### Relationship tables

### Bot-Nlp Engine Relationship

The bot\_nlp\_engine table stores information connecting a bot to an instance of a chosen nlp\_engine.

| **Column Name**       | **Data Type** | **Not Null** | **Description**                                    |
| --------------------- | ------------- | ------------ | -------------------------------------------------- |
| **bot\_uuid**         | varchar(36)   | Yes          | The VA's UUID                                      |
| **nlp\_engine\_uuid** | varchar(36)   | Yes          | The engine's UUID                                  |
| **created\_at**       | datetime      | No           | The date this object was created                   |
| **updated\_at**       | datetime      | No           | The date this object was last updated              |
| **created\_by**       | varchar(36)   | No           | UUID representing the user who created this object |
| **updated\_by**       | varchar(36)   | No           | UUID representing the user who updated this object |

### Nlp Engine-Entity System Relationship

The nlp\_engine\_entity\_system table connects System Entities to Nlp Engines. When the Cockpit user configures the usage of a System Entity on a given bot, this connection is created. When connected, an System Entity is enabled for the NLP, while it's absence means it is disabled.

| **Column Name**        | **Data Type**       | **Not Null** | **Description**        |
| ---------------------- | ------------------- | ------------ | ---------------------- |
| **nlp\_engine\_id**    | bigint(20) unsigned | Yes          | The NLP Engine's ID    |
| **entity\_system\_id** | bigint(20)          | Yes          | The System Entity's ID |
