As of this writing, there is no simple way to see the conversation history of your Dialogflow CX bot. Unfortunately this means you don’t have a good idea of how people are interacting with your bot.
In this tutorial, I explain how you can use existing Google software to download the history of your Dialogflow CX bot.
Enable StackDriver logging
First, in the settings of your bot, click on the “Enable StackDriver Logging” in your Dialogflow CX bot’s agent settings.
Note: the logs are only collected AFTER you check this box. That is why, in my Dialogflow Tips, I tell people that this is the first thing they should do.
Filter for Dialogflow logs
Once the user has interacted with your CX bot, click on the link next to the “Enable StackDriver logging” checkbox. This will take you to StackDriver logs explorer.
Note: You can also export StackDriver logs to BigQuery, but it is not very friendly for technical non-programmers when compared to the approach I am describing here.
In the Logs Explorer, use the Log name Filter button on the top. You see that Dialogflow is one of the filter options.
Check the Dialogflow option (which will automatically check the “requests” checkbox).
Choose a time range
When you first choose the filter and click on the Add button, you will probably see that the logs are empty unless your bot already has a lot of user interaction.
Now choose an appropriate time range (the link is on the top right of the page, below the search bar) such as 7 days and click on Apply button.
Now you will see more logs appear below.
Download the logs
Click on Actions button above the logs and choose “Download logs”
Now choose the maximum number of log entries to download. And then choose either CSV or JSON as the download format. Then click the Download button.
The CSV format has a lot of columns, and looks like below.
A few things to note about the CSV format
- there are a lot of columns, and the number of columns is proportional to the depth of the object hierarchy of the log format (which is chosen by Dialogflow and isn’t something you can configure)
- the request and response logs appear on alternate rows
- the response JSON just has [Object object] and doesn’t have the full details
The JSON format has more details and is better structured (because the “queryResult” field includes the input query).
View conversation transcript
If you download the logs in JSON format, you can use the BotFlo app to convert the StackDriver JSON logs it into a CSV format which will make it easy for you to view the conversation transcript.
Now paste the JSON into the text area and click on the Update Preview button
You will see the JSON converted to a CSV format which lists the relevant information. Regular intents will be marked in Green, while fallbacks (sys.no-match-default) will be marked in red.
If you click on the View Transcript button, it will display the transcript of the conversation on the right hand side. Note that in the bot’s response, the first box indicates the intent which was matched.
Also notice that the color of the match indicates whether it was a regular intent or the fallback no-match-default event.
Download CSV file
The BotFlo CX History tool also allows you to download the whole conversation history into a CSV format.
You can then import it into a tool like Airtable and look at the responses as well as use it to calculate the accuracy of the intent mapping.
And within Airtable, you can easily filter by Mapped Intent Name = sys.no-match-default to find the specific user utterances which did not get mapped to the expected intent.
I wasn’t sure I would need a separate tool to help analyze the logs because of their availability within the stackdriver tool. I really underestimated how difficult they would be to sift through. I found that the accuracy toolset creates a very easy-to-read and useful organization out of the downloaded logs.
It allows me to quickly identify where intents were not understood, a score that reflects extent to which they are accurate, and a popup tool that allows an easy view of the conversation context for an entry. I appreciated being able to download the csv and filter by “no-match” events so that I could identify where to train the bot more robustly. As CX does not have a built-in training feature, this is an absolute necessity. I loved being able to see the dialog off to the side in the preview of the tool.
It saved so much time in identifying where a problem was occurirng.This tool is great and the functionality should be built into Dialogflow. Since it isn’t, there’s no better way to quickly and easily identify where your bot needs more intent training. Thank you Aravind for being so willing to share your talents with the wider community.
University of Nebraska-Lincoln