# Dialogflow API . projects . locations . conversations

## Instance Methods

Returns the messages Resource.

Returns the participants Resource.

Returns the suggestions Resource.

Close httplib2 connections.

Completes the specified conversation. Finished conversations are purged from the database after 30 days.

Creates a new conversation. Conversations are auto-completed after 24 hours. Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage. For Automated Agent Stage, there will be a dialogflow agent responding to user queries. For Assist Stage, there's no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation. If Conversation.conversation_profile is configured for a dialogflow agent, conversation will start from `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And during `Automated Agent Stage`, once an Intent with Intent.live_agent_handoff is triggered, conversation will transfer to Assist Stage.

Retrieves the specific conversation.

Data ingestion API. Ingests context references for an existing conversation.

Returns the list of all conversations in the specified project.

Retrieves the next page of results.

### Method Details

`close()`

    Close httplib2 connections.

`complete(name, body=None, x__xgafv=None)`

    Completes the specified conversation. Finished conversations are purged from the database after 30 days.

    Args:
      name: string, Required. Resource identifier of the conversation to close. Format: `projects//locations//conversations/`. (required)
      body: object, The request body.
        The object takes the form of:

    { # The request message for Conversations.CompleteConversation.
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Represents a conversation. A conversation is an interaction between an agent, including live agents and Dialogflow agents, and a support customer. Conversations can include phone calls and text-based chat sessions.
      "conversationProfile": "A String", # Required. The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects//locations//conversationProfiles/`.
      "conversationStage": "A String", # Optional. The stage of a conversation. It indicates whether the virtual agent or a human agent is handling the conversation. If the conversation is created with the conversation profile that has Dialogflow config set, defaults to ConversationStage.VIRTUAL_AGENT_STAGE; Otherwise, defaults to ConversationStage.HUMAN_ASSIST_STAGE. If the conversation is created with the conversation profile that has Dialogflow config set but explicitly sets conversation_stage to ConversationStage.HUMAN_ASSIST_STAGE, it skips ConversationStage.VIRTUAL_AGENT_STAGE stage and directly goes to ConversationStage.HUMAN_ASSIST_STAGE.
      "endTime": "A String", # Output only. The time the conversation was finished.
      "ingestedContextReferences": { # Output only. The context reference updates provided by external systems.
        "a_key": { # Represents a section of ingested context information.
          "contextContents": [ # Required. The list of content updates for a context reference.
            { # Contents ingested.
              "answerRecord": "A String", # If the context content was generated from a tool call, specify the answer record associated with the tool call. Format: `projects//locations//answerRecords/`.
              "content": "A String", # Required. The information ingested in a single request.
              "contentFormat": "A String", # Required. The format of the ingested string.
              "ingestionTime": "A String", # Output only. The time when this information was incorporated into the relevant context reference.
            },
          ],
          "createTime": "A String", # Output only. The time the context reference was first created.
          "languageCode": "A String", # Optional. The language of the information ingested, defaults to "en-US" if not set.
          "updateMode": "A String", # Required. The mode in which context reference contents are updated.
        },
      },
      "lifecycleState": "A String", # Output only. The current state of the Conversation.
      "name": "A String", # Output only. Identifier. The unique identifier of this conversation. Format: `projects//locations//conversations/`.
      "phoneNumber": { # Represents a phone number for telephony integration. It allows for connecting a particular conversation over telephony. # Output only. It will not be empty if the conversation is to be connected over telephony.
        "countryCode": 42, # Output only. Desired country code for the phone number.
        "phoneNumber": "A String", # Output only. The phone number to connect to this conversation.
      },
      "startTime": "A String", # Output only. The time the conversation was started.
      "telephonyConnectionInfo": { # The information about phone calls connected via phone gateway to the conversation. # Output only. The telephony connection information.
        "dialedNumber": "A String", # Output only. The number dialed to connect this call in E.164 format.
        "extraMimeContents": [ # Output only. The mime content from the initial SIP INVITE.
          { # The mime content from the initial SIP INVITE.
            "content": "A String", # Optional. The content payload.
            "mimeType": "A String", # Optional. The mime type of the content.
          },
        ],
        "sdp": "A String", # Optional. SDP of the call. It's initially the SDP answer to the incoming call, but maybe later updated for the purpose of making the link active, etc.
        "sipHeaders": [ # Output only. The SIP headers from the initial SIP INVITE.
          { # The SIP headers from the initial SIP INVITE.
            "name": "A String", # Optional. The name of the header.
            "value": "A String", # Optional. The value of the header.
          },
        ],
      },
    }

`create(parent, body=None, conversationId=None, x__xgafv=None)`

    Creates a new conversation. Conversations are auto-completed after 24 hours. Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage. For Automated Agent Stage, there will be a dialogflow agent responding to user queries. For Assist Stage, there's no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation. If Conversation.conversation_profile is configured for a dialogflow agent, conversation will start from `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And during `Automated Agent Stage`, once an Intent with Intent.live_agent_handoff is triggered, conversation will transfer to Assist Stage.

    Args:
      parent: string, Required. Resource identifier of the project creating the conversation. Format: `projects//locations/`. (required)
      body: object, The request body.
        The object takes the form of:

    { # Represents a conversation. A conversation is an interaction between an agent, including live agents and Dialogflow agents, and a support customer. Conversations can include phone calls and text-based chat sessions.
      "conversationProfile": "A String", # Required. The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects//locations//conversationProfiles/`.
      "conversationStage": "A String", # Optional. The stage of a conversation. It indicates whether the virtual agent or a human agent is handling the conversation. If the conversation is created with the conversation profile that has Dialogflow config set, defaults to ConversationStage.VIRTUAL_AGENT_STAGE; Otherwise, defaults to ConversationStage.HUMAN_ASSIST_STAGE. If the conversation is created with the conversation profile that has Dialogflow config set but explicitly sets conversation_stage to ConversationStage.HUMAN_ASSIST_STAGE, it skips ConversationStage.VIRTUAL_AGENT_STAGE stage and directly goes to ConversationStage.HUMAN_ASSIST_STAGE.
      "endTime": "A String", # Output only. The time the conversation was finished.
      "ingestedContextReferences": { # Output only. The context reference updates provided by external systems.
        "a_key": { # Represents a section of ingested context information.
          "contextContents": [ # Required. The list of content updates for a context reference.
            { # Contents ingested.
              "answerRecord": "A String", # If the context content was generated from a tool call, specify the answer record associated with the tool call. Format: `projects//locations//answerRecords/`.
              "content": "A String", # Required. The information ingested in a single request.
              "contentFormat": "A String", # Required. The format of the ingested string.
              "ingestionTime": "A String", # Output only. The time when this information was incorporated into the relevant context reference.
            },
          ],
          "createTime": "A String", # Output only. The time the context reference was first created.
          "languageCode": "A String", # Optional. The language of the information ingested, defaults to "en-US" if not set.
          "updateMode": "A String", # Required. The mode in which context reference contents are updated.
        },
      },
      "lifecycleState": "A String", # Output only. The current state of the Conversation.
      "name": "A String", # Output only. Identifier. The unique identifier of this conversation. Format: `projects//locations//conversations/`.
      "phoneNumber": { # Represents a phone number for telephony integration. It allows for connecting a particular conversation over telephony. # Output only. It will not be empty if the conversation is to be connected over telephony.
        "countryCode": 42, # Output only. Desired country code for the phone number.
        "phoneNumber": "A String", # Output only. The phone number to connect to this conversation.
      },
      "startTime": "A String", # Output only. The time the conversation was started.
      "telephonyConnectionInfo": { # The information about phone calls connected via phone gateway to the conversation. # Output only. The telephony connection information.
        "dialedNumber": "A String", # Output only. The number dialed to connect this call in E.164 format.
        "extraMimeContents": [ # Output only. The mime content from the initial SIP INVITE.
          { # The mime content from the initial SIP INVITE.
            "content": "A String", # Optional. The content payload.
            "mimeType": "A String", # Optional. The mime type of the content.
          },
        ],
        "sdp": "A String", # Optional. SDP of the call. It's initially the SDP answer to the incoming call, but maybe later updated for the purpose of making the link active, etc.
        "sipHeaders": [ # Output only. The SIP headers from the initial SIP INVITE.
          { # The SIP headers from the initial SIP INVITE.
            "name": "A String", # Optional. The name of the header.
            "value": "A String", # Optional. The value of the header.
          },
        ],
      },
    }

      conversationId: string, Optional. Identifier of the conversation. Generally it's auto generated by Google. Only set it if you cannot wait for the response to return a auto-generated one to you. The conversation ID must be compliant with the regression formula `a-zA-Z*` with the characters length in range of [3,64]. If the field is provided, the caller is responsible for 1. the uniqueness of the ID, otherwise the request will be rejected. 2. the consistency for whether to use custom ID or not under a project to better ensure uniqueness.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Represents a conversation. A conversation is an interaction between an agent, including live agents and Dialogflow agents, and a support customer. Conversations can include phone calls and text-based chat sessions.
      "conversationProfile": "A String", # Required. The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects//locations//conversationProfiles/`.
      "conversationStage": "A String", # Optional. The stage of a conversation. It indicates whether the virtual agent or a human agent is handling the conversation. If the conversation is created with the conversation profile that has Dialogflow config set, defaults to ConversationStage.VIRTUAL_AGENT_STAGE; Otherwise, defaults to ConversationStage.HUMAN_ASSIST_STAGE. If the conversation is created with the conversation profile that has Dialogflow config set but explicitly sets conversation_stage to ConversationStage.HUMAN_ASSIST_STAGE, it skips ConversationStage.VIRTUAL_AGENT_STAGE stage and directly goes to ConversationStage.HUMAN_ASSIST_STAGE.
      "endTime": "A String", # Output only. The time the conversation was finished.
      "ingestedContextReferences": { # Output only. The context reference updates provided by external systems.
        "a_key": { # Represents a section of ingested context information.
          "contextContents": [ # Required. The list of content updates for a context reference.
            { # Contents ingested.
              "answerRecord": "A String", # If the context content was generated from a tool call, specify the answer record associated with the tool call. Format: `projects//locations//answerRecords/`.
              "content": "A String", # Required. The information ingested in a single request.
              "contentFormat": "A String", # Required. The format of the ingested string.
              "ingestionTime": "A String", # Output only. The time when this information was incorporated into the relevant context reference.
            },
          ],
          "createTime": "A String", # Output only. The time the context reference was first created.
          "languageCode": "A String", # Optional. The language of the information ingested, defaults to "en-US" if not set.
          "updateMode": "A String", # Required. The mode in which context reference contents are updated.
        },
      },
      "lifecycleState": "A String", # Output only. The current state of the Conversation.
      "name": "A String", # Output only. Identifier. The unique identifier of this conversation. Format: `projects//locations//conversations/`.
      "phoneNumber": { # Represents a phone number for telephony integration. It allows for connecting a particular conversation over telephony. # Output only. It will not be empty if the conversation is to be connected over telephony.
        "countryCode": 42, # Output only. Desired country code for the phone number.
        "phoneNumber": "A String", # Output only. The phone number to connect to this conversation.
      },
      "startTime": "A String", # Output only. The time the conversation was started.
      "telephonyConnectionInfo": { # The information about phone calls connected via phone gateway to the conversation. # Output only. The telephony connection information.
        "dialedNumber": "A String", # Output only. The number dialed to connect this call in E.164 format.
        "extraMimeContents": [ # Output only. The mime content from the initial SIP INVITE.
          { # The mime content from the initial SIP INVITE.
            "content": "A String", # Optional. The content payload.
            "mimeType": "A String", # Optional. The mime type of the content.
          },
        ],
        "sdp": "A String", # Optional. SDP of the call. It's initially the SDP answer to the incoming call, but maybe later updated for the purpose of making the link active, etc.
        "sipHeaders": [ # Output only. The SIP headers from the initial SIP INVITE.
          { # The SIP headers from the initial SIP INVITE.
            "name": "A String", # Optional. The name of the header.
            "value": "A String", # Optional. The value of the header.
          },
        ],
      },
    }

`get(name, x__xgafv=None)`

    Retrieves the specific conversation.

    Args:
      name: string, Required. The name of the conversation. Format: `projects//locations//conversations/`. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Represents a conversation. A conversation is an interaction between an agent, including live agents and Dialogflow agents, and a support customer. Conversations can include phone calls and text-based chat sessions.
      "conversationProfile": "A String", # Required. The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects//locations//conversationProfiles/`.
      "conversationStage": "A String", # Optional. The stage of a conversation. It indicates whether the virtual agent or a human agent is handling the conversation. If the conversation is created with the conversation profile that has Dialogflow config set, defaults to ConversationStage.VIRTUAL_AGENT_STAGE; Otherwise, defaults to ConversationStage.HUMAN_ASSIST_STAGE. If the conversation is created with the conversation profile that has Dialogflow config set but explicitly sets conversation_stage to ConversationStage.HUMAN_ASSIST_STAGE, it skips ConversationStage.VIRTUAL_AGENT_STAGE stage and directly goes to ConversationStage.HUMAN_ASSIST_STAGE.
      "endTime": "A String", # Output only. The time the conversation was finished.
      "ingestedContextReferences": { # Output only. The context reference updates provided by external systems.
        "a_key": { # Represents a section of ingested context information.
          "contextContents": [ # Required. The list of content updates for a context reference.
            { # Contents ingested.
              "answerRecord": "A String", # If the context content was generated from a tool call, specify the answer record associated with the tool call. Format: `projects//locations//answerRecords/`.
              "content": "A String", # Required. The information ingested in a single request.
              "contentFormat": "A String", # Required. The format of the ingested string.
              "ingestionTime": "A String", # Output only. The time when this information was incorporated into the relevant context reference.
            },
          ],
          "createTime": "A String", # Output only. The time the context reference was first created.
          "languageCode": "A String", # Optional. The language of the information ingested, defaults to "en-US" if not set.
          "updateMode": "A String", # Required. The mode in which context reference contents are updated.
        },
      },
      "lifecycleState": "A String", # Output only. The current state of the Conversation.
      "name": "A String", # Output only. Identifier. The unique identifier of this conversation. Format: `projects//locations//conversations/`.
      "phoneNumber": { # Represents a phone number for telephony integration. It allows for connecting a particular conversation over telephony. # Output only. It will not be empty if the conversation is to be connected over telephony.
        "countryCode": 42, # Output only. Desired country code for the phone number.
        "phoneNumber": "A String", # Output only. The phone number to connect to this conversation.
      },
      "startTime": "A String", # Output only. The time the conversation was started.
      "telephonyConnectionInfo": { # The information about phone calls connected via phone gateway to the conversation. # Output only. The telephony connection information.
        "dialedNumber": "A String", # Output only. The number dialed to connect this call in E.164 format.
        "extraMimeContents": [ # Output only. The mime content from the initial SIP INVITE.
          { # The mime content from the initial SIP INVITE.
            "content": "A String", # Optional. The content payload.
            "mimeType": "A String", # Optional. The mime type of the content.
          },
        ],
        "sdp": "A String", # Optional. SDP of the call. It's initially the SDP answer to the incoming call, but maybe later updated for the purpose of making the link active, etc.
        "sipHeaders": [ # Output only. The SIP headers from the initial SIP INVITE.
          { # The SIP headers from the initial SIP INVITE.
            "name": "A String", # Optional. The name of the header.
            "value": "A String", # Optional. The value of the header.
          },
        ],
      },
    }

`ingestContextReferences(conversation, body=None, x__xgafv=None)`

    Data ingestion API. Ingests context references for an existing conversation.

    Args:
      conversation: string, Required. Resource identifier of the conversation to ingest context information for. Format: `projects//locations//conversations/`. (required)
      body: object, The request body.
        The object takes the form of:

    { # The request message for ConversationsService.IngestContextReferences.
      "contextReferences": { # Required. The context references to ingest. The key is the name of the context reference and the value contains the contents of the context reference. The key is used to incorporate ingested context references to enhance the generator.
        "a_key": { # Represents a section of ingested context information.
          "contextContents": [ # Required. The list of content updates for a context reference.
            { # Contents ingested.
              "answerRecord": "A String", # If the context content was generated from a tool call, specify the answer record associated with the tool call. Format: `projects//locations//answerRecords/`.
              "content": "A String", # Required. The information ingested in a single request.
              "contentFormat": "A String", # Required. The format of the ingested string.
              "ingestionTime": "A String", # Output only. The time when this information was incorporated into the relevant context reference.
            },
          ],
          "createTime": "A String", # Output only. The time the context reference was first created.
          "languageCode": "A String", # Optional. The language of the information ingested, defaults to "en-US" if not set.
          "updateMode": "A String", # Required. The mode in which context reference contents are updated.
        },
      },
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # The response message for ConversationsService.IngestContextReferences.
      "ingestedContextReferences": { # All context references ingested.
        "a_key": { # Represents a section of ingested context information.
          "contextContents": [ # Required. The list of content updates for a context reference.
            { # Contents ingested.
              "answerRecord": "A String", # If the context content was generated from a tool call, specify the answer record associated with the tool call. Format: `projects//locations//answerRecords/`.
              "content": "A String", # Required. The information ingested in a single request.
              "contentFormat": "A String", # Required. The format of the ingested string.
              "ingestionTime": "A String", # Output only. The time when this information was incorporated into the relevant context reference.
            },
          ],
          "createTime": "A String", # Output only. The time the context reference was first created.
          "languageCode": "A String", # Optional. The language of the information ingested, defaults to "en-US" if not set.
          "updateMode": "A String", # Required. The mode in which context reference contents are updated.
        },
      },
    }

`list(parent, filter=None, pageSize=None, pageToken=None, x__xgafv=None)`

    Returns the list of all conversations in the specified project.

    Args:
      parent: string, Required. The project from which to list all conversation. Format: `projects//locations/`. (required)
      filter: string, Optional. A filter expression that filters conversations listed in the response. Only `lifecycle_state` can be filtered on in this way. For example, the following expression only returns `COMPLETED` conversations: `lifecycle_state = "COMPLETED"` For more information about filtering, see [API Filtering](https://aip.dev/160).
      pageSize: integer, Optional. The maximum number of items to return in a single page. By default 100 and at most 1000.
      pageToken: string, Optional. The next_page_token value returned from a previous list request.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # The response message for Conversations.ListConversations.
      "conversations": [ # The list of conversations. There will be a maximum number of items returned based on the page_size field in the request.
        { # Represents a conversation. A conversation is an interaction between an agent, including live agents and Dialogflow agents, and a support customer. Conversations can include phone calls and text-based chat sessions.
          "conversationProfile": "A String", # Required. The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects//locations//conversationProfiles/`.
          "conversationStage": "A String", # Optional. The stage of a conversation. It indicates whether the virtual agent or a human agent is handling the conversation. If the conversation is created with the conversation profile that has Dialogflow config set, defaults to ConversationStage.VIRTUAL_AGENT_STAGE; Otherwise, defaults to ConversationStage.HUMAN_ASSIST_STAGE. If the conversation is created with the conversation profile that has Dialogflow config set but explicitly sets conversation_stage to ConversationStage.HUMAN_ASSIST_STAGE, it skips ConversationStage.VIRTUAL_AGENT_STAGE stage and directly goes to ConversationStage.HUMAN_ASSIST_STAGE.
          "endTime": "A String", # Output only. The time the conversation was finished.
          "ingestedContextReferences": { # Output only. The context reference updates provided by external systems.
            "a_key": { # Represents a section of ingested context information.
              "contextContents": [ # Required. The list of content updates for a context reference.
                { # Contents ingested.
                  "answerRecord": "A String", # If the context content was generated from a tool call, specify the answer record associated with the tool call. Format: `projects//locations//answerRecords/`.
                  "content": "A String", # Required. The information ingested in a single request.
                  "contentFormat": "A String", # Required. The format of the ingested string.
                  "ingestionTime": "A String", # Output only. The time when this information was incorporated into the relevant context reference.
                },
              ],
              "createTime": "A String", # Output only. The time the context reference was first created.
              "languageCode": "A String", # Optional. The language of the information ingested, defaults to "en-US" if not set.
              "updateMode": "A String", # Required. The mode in which context reference contents are updated.
            },
          },
          "lifecycleState": "A String", # Output only. The current state of the Conversation.
          "name": "A String", # Output only. Identifier. The unique identifier of this conversation. Format: `projects//locations//conversations/`.
          "phoneNumber": { # Represents a phone number for telephony integration. It allows for connecting a particular conversation over telephony. # Output only. It will not be empty if the conversation is to be connected over telephony.
            "countryCode": 42, # Output only. Desired country code for the phone number.
            "phoneNumber": "A String", # Output only. The phone number to connect to this conversation.
          },
          "startTime": "A String", # Output only. The time the conversation was started.
          "telephonyConnectionInfo": { # The information about phone calls connected via phone gateway to the conversation. # Output only. The telephony connection information.
            "dialedNumber": "A String", # Output only. The number dialed to connect this call in E.164 format.
            "extraMimeContents": [ # Output only. The mime content from the initial SIP INVITE.
              { # The mime content from the initial SIP INVITE.
                "content": "A String", # Optional. The content payload.
                "mimeType": "A String", # Optional. The mime type of the content.
              },
            ],
            "sdp": "A String", # Optional. SDP of the call. It's initially the SDP answer to the incoming call, but maybe later updated for the purpose of making the link active, etc.
            "sipHeaders": [ # Output only. The SIP headers from the initial SIP INVITE.
              { # The SIP headers from the initial SIP INVITE.
                "name": "A String", # Optional. The name of the header.
                "value": "A String", # Optional. The value of the header.
              },
            ],
          },
        },
      ],
      "nextPageToken": "A String", # Token to retrieve the next page of results, or empty if there are no more results in the list.
    }

`list_next()`

    Retrieves the next page of results.

            Args:
              previous_request: The request for the previous page. (required)
              previous_response: The response from the request for the previous page. (required)

            Returns:
              A request object that you can call 'execute()' on to request the next
              page. Returns None if there are no more items in the collection.