Home / DialogFlow / Autogenerated Bots / Dissecting the Dialogflow agent ZIP file
Autogenerated Bots | DialogFlow

Dissecting the Dialogflow agent ZIP file

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

First, I unzipped the ZIP file and loaded it into WebStorm, which is an excellent IDE for working with JavaScript.

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.

Locales

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.

Summary

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.

FREE COURSES

Related Posts

  • Aravind,

    I really appreciate you for the kind of quality content you are building on the DialogFlow. Eventually, most of my searches on DialogFlow are landing to your blog.

    So, I was wondering to see your blog on – what would be the mechanism/best practices to implement CI/CD for a DialogFlow based development project, considering multiple people are building the different intents/actions parallel through DG UI for a single agent, periodically keeping that in an external repo and rollover through Blue Green deployments etc.

    Thanks,
    Ram

    • Right now Dialogflow is so nascent that if you are going to be building moderately complex bots, you will need to build your own tools to help you with all the stuff you are talking about. Before I can write about it, I need to gain a lot more experience as well as see a lot more evidence that what I am saying will work. Sorry I can’t be of more help at the moment.