Botmock Dialogflow Export
Note: The deprecated version of this exporter can be found in the
Table of Contents
Running the following commands should allow you to generate restorable content from your Botmock project.
git clone firstname.lastname@example.org:Botmock/botmock-dialogflow-export.git
mv ./sample.env ./.envand edit
.envto contain your token and project ids
- To include all the dependent flows please add the option
includeJumpBlocksin the options of the exporter.
- To make all the responses triggered from a fullfilment API then add the option
useWebhookForAllResponsesin the options of the exporter.
The export is going to create an output folder. This folder consists of two folders:
This folder contains all the intent json files that Dialogflow agent needs. You will compress this "upload" folder to a .zip file which will be uploaded in Dialogflow.
This folder will contains three files
- blocks.json file contains all message blocks of your Botmock project and thier payload.
- conditions.json file contains all the intent names and each intent has message block ids connected with conditions.
- functions.json contain functions to get response of an intent based on user's input. This file uses condition.json, blocks.json and @botmock/utils to evaluate and return response.
These files will be handy if you are planning on using Dialogflow's fulfillment api.
Botmock's Dialogflow exporter supports CONDITIONAL RESPONSES via webhooks
Please follow the botmock-dialogflow-webhook-example to learn how you can get started quickly with a nodeJS server already setup with our SDK
Botmock Project Structure
To translate Botmock projects into Dialogflow agents, we make certain assumptions about Botmock project structure:
Intents should be used on connectors in the flow as often as is meaningful. Doing so helps the script break up responses across different intent files so as to bypass the repsonse type limits Dialogflow has in place.
If there is no intent on the connector from the root message to the first message in the Botmock flow, the script creates one and merges into it all utterances from the default Dialogflow Welcome Intent.
When using quick replies or suggestion chips in a project, some intent utterances should be designed to exactly match the content of the options in the content block.
Approach to importing
The script maps input context to the path of intents on connectors in the Botmock flow to control conversation paths. In other words, in the flow, a message downstream of a particular intent will require that intent as input context in the created file. Similarly, output contexts are set by the intents on connectors that go out of particular messages.
Note that Dialogflow has a limit of 5 input contexts per intent. Projects should be structured to take account of this fact.
Note also that Dialogflow has a limit of 100 characters in the name of any intent file. The script will begin to use random bytes in file names to prevent this limit from being exceeded.
Handling import errors
If Dialogflow issues an error on import, note that you may have to manually edit
.json files contained in output.