How to download Dialogflow CX conversation history

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.

Oct 2022 Update

Dialogflow CX now has the conversation history feature, but you can use the tool I have built to calculate the accuracy of your CX 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.

CSV format

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

JSON format

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.

Note: This is my old website and is in maintenance mode. I am publishing new articles only on my new website. 

If you are not sure where to start on my new website, I recommend the following article:

Is Dialogflow still relevant in the era of Large Language Models?

3 Comments

Leave a Reply