Upload conversation data

Conversational Insights uses conversation data that you have uploaded to a Cloud Storage bucket. You can provide your conversation data to the API as either audio data (like phone call recordings) or as JSON-formatted text files.

Conversation transcript data

Text conversation data must be supplied in JSON-formatted files, where each file contains data for a single conversation. The following describes the required JSON format.

Conversation

The top-level object for conversation data.

Field Type Description
conversation_info ConversationInfo { } Optional. Metadata for the conversation.
entries Entry [ ] Required. The chronologically ordered conversation messages.

ConversationInfo

The metadata for a conversation.

Field Type Description
categories Category [ ] Optional. Custom categories for the conversation data.

Category

Conversation data category. If you provide categories with your conversation data, they will be used to identify topics in your conversations. If you do not provide categories, the system will automatically categorize conversations based on the content.

Field Type Description
display_name string Required. A display name for the category.

Entry

Data for a single conversation message.

Field Type Description
text string Required. The text for this conversation message.
user_id integer Required. A number that identifies the conversation participant. Each participant should have a single user_id, used repeatedly if they participate in multiple conversations.
role string Required. The conversation participant role. One of: "AGENT", "AUTOMATED_AGENT", "CUSTOMER", "END_USER".
start_timestamp_usec integer Required. The timestamp for the start of this conversation turn in microseconds of UTC time since Unix epoch.

Example

The following shows an example of a conversation data file.

{
  "conversation_info":{
    "categories":[
      {
        "display_name":"Category 1"
      }
    ]
  },
  "entries": [
    {
      "start_timestamp_usec": 1000000,
      "text": "Hello, I'm calling in regards to ...",
      "role": "CUSTOMER",
      "user_id": 1
    },
    {
      "start_timestamp_usec": 5000000,
      "text": "Yes, I can answer your question ...",
      "role": "AGENT",
      "user_id": 2
    }
  ]
}

Upload conversations to Cloud Storage

You must provide your conversation data in a Cloud Storage bucket contained within your Google Cloud project. When creating the bucket:

  • Be sure that you have selected the Google Cloud project you use for Dialogflow.
  • Use the Standard Storage class.
  • Set the bucket location to a location nearest to your location. You will need the location ID (for example, us-west1) when providing the conversation data, so take note of your choice.
  • You will also need the bucket name when providing the conversation data.

Follow the Cloud storage quickstart instructions to create a bucket and upload files.