# Chatots for Cultural Venues: A Topic-Based Approach
## 2 Materials and Methods
### Mapping of Structured Information to Google DialogFlow Elements
#### 2.3.2 Automating Mapping of Data to DialogFlow Information Elements  
The DialogFlow engine allows for exporting and importing chatbot agents; this feature can be used to automatically create an appropriate representation for the chatbot, which can then be directly imported into the engine and thus become operational. More specifically, the format used for importing a chatbot agent is a zip file, where each chatbot intent is represented as a distinct JSON file within the zip file. The representation of the chatbot discussed in this paper is available at [[https://github.com/costasvassilakis/museumChatbot](https://github.com/costasvassilakis/museumChatbot)]([https://github.com/costasvassilakis/museumChatbot](https://github.com/costasvassilakis/museumChatbot)) (accessed on 13 July 2023). To create the representation of the chatbot in a format that is directly importable to the DialogFlow engine, the following procedure must be executed:  
1. initialize an empty directory on the file system;
2. for each intent created by the algorithm, create a JSON representation of the intent according to the schema of the DialogFlow engine and store the representation in a file, within the created directory;
3. create a zip file containing all the files within the populated directory. In step 2, the creation of the intent representation needs to comply with the JSON schema used by the DialogFlow engine; the documentation of this schema provided by the Google Cloud platform has been analyzed and the mapping procedure has been crafted accordingly. (The documentation is provided at [[https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.intents#Intent](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.intents#Intent)]([https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.intents#Intent](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.intents#Intent)) (accessed on 13 July 2023). It should be noted that the documentation actually pertains to the GoogleCloud API, not the export/import procedures of the DialogFlow engine. Small discrepancies have been identified, e.g., the name of the intent is listed as 'displayName' in the documentation while in the JSON files it is listed as 'name'. The schemas have been analyzed and compared and the automatic generation procedure has been tailored accordingly). The full presentation of the DialogFlow engine's JSON schema is beyond the scope of this paper. Table 2 lists the most important elements of the JSON schema, describing the functionality of each element. \begin{table}
\begin{tabular}{c c} \hline \hline
**Element** & **Description** \\ \hline id & A UUID uniquely identifying the intent in the context of the agent. \\ \hline parentId & The id of the parent intent. Specified only when the intent is a follow-up intent. \\ \hline name & The title of the intent. \\ \hline \hline \multirow{8}{*}{responses} & An array of elements providing the content of the intent. The most notable part of this element is the ‘messages’ \\  & subcomponent, for which two notable subtypes are identified: \\  & 1. & Elements of the ‘responses[]\_messages’ subcomponent for which the ‘type’ property has the value ‘suggestion\_chips’: \\  & these provide the navigation links to other intents; \\  & 2. & Elements of the ‘responses[]\_messages’ subcomponent for which the ‘type’ property has a numeric value (starting from zero and counting onwards): each such element has a ‘title’ and a ‘speech’ field, providing the title and the spoken/displayed information related to the intent. The full spoken/displayed content of the intent comprises all these elements in the order prescribed by the value of the ‘type’ property. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Elements of the DialogFlow engine’s JSON schema. Listing 5 presents the algorithm used for mapping intents created by the algorithm in Listing 1 to DialogFlow representation; this representation can be then imported to the DialogFlow platform. **Listing 5.