# Google Cloud Dialogflow V2 Client - Class Conversation (2.4.0)

2.4.0 (latest) 2.3.1 2.2.1 2.1.2 2.0.1 1.17.2 1.16.0 1.15.1 1.14.0 1.13.0 1.12.3 1.11.0 1.10.2 1.9.0 1.8.0 1.7.2 1.6.0 1.5.0 1.4.0 1.3.2 1.2.0 1.1.1 1.0.1 Reference documentation and code samples for the Google Cloud Dialogflow V2 Client class Conversation.

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.

Generated from protobuf message `google.cloud.dialogflow.v2.Conversation`

## Namespace

Google \\ Cloud \\ Dialogflow \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. Identifier. The unique identifier of this conversation. Format: `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>`. |
| `↳ lifecycle_state` | `int` Output only. The current state of the Conversation. |
| `↳ conversation_profile` | `string` Required. The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects/<Project ID>/locations/<Location ID>/conversationProfiles/<Conversation Profile ID>`. |
| `↳ phone_number` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.ConversationPhoneNumber` Output only. It will not be empty if the conversation is to be connected over telephony. |
| `↳ start_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The time the conversation was started. |
| `↳ end_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The time the conversation was finished. |
| `↳ conversation_stage` | `int` 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](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__VIRTUAL_AGENT_STAGE); Otherwise, defaults to [ConversationStage.HUMAN_ASSIST_STAGE](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_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](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__HUMAN_ASSIST_STAGE), it skips [ConversationStage.VIRTUAL_AGENT_STAGE](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__VIRTUAL_AGENT_STAGE) stage and directly goes to [ConversationStage.HUMAN_ASSIST_STAGE](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__HUMAN_ASSIST_STAGE). |
| `↳ telephony_connection_info` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.TelephonyConnectionInfo` Output only. The telephony connection information. |
| `↳ initial_conversation_profile` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.ConversationProfile` Optional. Output only. The initial conversation profile to be used to configure this conversation, which is a copy of the conversation profile config read at conversation creation time. |
| `↳ ingested_context_references` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Output only. The context reference updates provided by external systems. |
| `↳ initial_generator_contexts` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Output only. A map with generator name as key and generator context as value. |

### getName

Output only. Identifier. The unique identifier of this conversation.

Format: `projects/<Project ID>/locations/<Location
ID>/conversations/<Conversation ID>`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Output only. Identifier. The unique identifier of this conversation.

Format: `projects/<Project ID>/locations/<Location
ID>/conversations/<Conversation ID>`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLifecycleState

Output only. The current state of the Conversation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [LifecycleState](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.LifecycleState). |

### setLifecycleState

Output only. The current state of the Conversation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [LifecycleState](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.LifecycleState). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getConversationProfile

Required. The Conversation Profile to be used to configure this
Conversation. This field cannot be updated.

Format: `projects/<Project ID>/locations/<Location
ID>/conversationProfiles/<Conversation Profile ID>`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setConversationProfile

Required. The Conversation Profile to be used to configure this
Conversation. This field cannot be updated.

Format: `projects/<Project ID>/locations/<Location
ID>/conversationProfiles/<Conversation Profile ID>`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPhoneNumber

Output only. It will not be empty if the conversation is to be connected
over telephony.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.ConversationPhoneNumber|null` |   |

### hasPhoneNumber

### clearPhoneNumber

### setPhoneNumber

Output only. It will not be empty if the conversation is to be connected
over telephony.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.ConversationPhoneNumber` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getStartTime

Output only. The time the conversation was started.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasStartTime

### clearStartTime

### setStartTime

Output only. The time the conversation was started.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEndTime

Output only. The time the conversation was finished.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasEndTime

### clearEndTime

### setEndTime

Output only. The time the conversation was finished.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getConversationStage

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](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__VIRTUAL_AGENT_STAGE);
Otherwise, defaults to
[ConversationStage.HUMAN_ASSIST_STAGE](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_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](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__HUMAN_ASSIST_STAGE),
it skips
[ConversationStage.VIRTUAL_AGENT_STAGE](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__VIRTUAL_AGENT_STAGE)
stage and directly goes to
[ConversationStage.HUMAN_ASSIST_STAGE](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__HUMAN_ASSIST_STAGE).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ConversationStage](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage). |

### setConversationStage

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](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__VIRTUAL_AGENT_STAGE);
Otherwise, defaults to
[ConversationStage.HUMAN_ASSIST_STAGE](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_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](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__HUMAN_ASSIST_STAGE),
it skips
[ConversationStage.VIRTUAL_AGENT_STAGE](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__VIRTUAL_AGENT_STAGE)
stage and directly goes to
[ConversationStage.HUMAN_ASSIST_STAGE](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage#_Google_Cloud_Dialogflow_V2_Conversation_ConversationStage__HUMAN_ASSIST_STAGE).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ConversationStage](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.ConversationStage). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTelephonyConnectionInfo

Output only. The telephony connection information.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.TelephonyConnectionInfo|null` |   |

### hasTelephonyConnectionInfo

### clearTelephonyConnectionInfo

### setTelephonyConnectionInfo

Output only. The telephony connection information.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Conversation.TelephonyConnectionInfo` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getInitialConversationProfile

Optional. Output only. The initial conversation profile to be used to
configure this conversation, which is a copy of the conversation profile
config read at conversation creation time.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.ConversationProfile|null` |   |

### hasInitialConversationProfile

### clearInitialConversationProfile

### setInitialConversationProfile

Optional. Output only. The initial conversation profile to be used to
configure this conversation, which is a copy of the conversation profile
config read at conversation creation time.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.ConversationProfile` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIngestedContextReferences

Output only. The context reference updates provided by external systems.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setIngestedContextReferences

Output only. The context reference updates provided by external systems.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getInitialGeneratorContexts

Output only. A map with generator name as key and generator context as
value.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setInitialGeneratorContexts

Output only. A map with generator name as key and generator context as
value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |