I recently built an app which lets you do full text search across all your Dialogflow intents, as well as filter on input and output contexts.
In the process, I needed to get a good understanding of what the Dialogflow agent ZIP files contain. Here is a summary of things I learnt. This could be useful if you wish to use the agent ZIP file to build out your own Dialogflow tooling.
ZIP file structure
The folder structure looks like this:
The agent.json file has metadata about the agent itself, while package.json has versioning information.
UserSays and Response JSON files
On expanding the intents folder, we see the following:
Notice that for each intent, there is a JSON file corresponding to the userSays and another corresponding to the response.
If you use different English locales in your agent, you will see one userSays file per locale.
Locale Specific Responses
However, all the locale specific responses are still added into the single Response JSON file:
The UserSays file
The user says file contains the following fields:
The structure of the user says JSON file is quite simple to follow.
Here data is an array of JSON objects - and each data object corresponds to the different userSays declared in your intent. Inside, you see a field called text which contains the actual user says text.
Response JSON file
The response JSON file is more complex. It has information about
- input contexts (lines 5-7)
- whether the contexts will be reset when this intent is mapped (line 10)
- the output contexts and their lifespans (lines 11-17)
- parameters defined in the intent (lines 18-25)
- the actual response messages (lines 26-32)
- does this intent use a webhook (line 38)
- whether the webhook is used for slot filling (line 39)
- events which may be used to trigger the intent (line 42)
Inside the response JSON files, the different platforms (channels) are distinguished by the platform field.
Within the platforms themselves, the individual message types are distinguished by using the type field.
Using the information you can extract from the agent ZIP file, you can do some cool stuff like build a full text search tool, and perhaps tools for analyzing your agent, or to add some source control to your agent ZIP file.