The greeting
[prebuilt component](https://docs.cloud.google.com/dialogflow/cx/docs/concept/prebuilt-component.md.txt)
retrieves the caller's phone number
([ANI](https://en.wikipedia.org/wiki/Automatic_number_identification)) if
available. If the system retrieves the phone number, the component
performs a soft authentication using the phone number, validating it against
registered phone numbers. The agent then greets the user with a personalized
message based on their account information.

## Limitations

In addition to the
[common prebuilt component limitations](https://docs.cloud.google.com/dialogflow/cx/docs/concept/prebuilt-component.md.txt#limits),
this prebuilt component includes the following limitations:

- The component assumes that phone numbers are maintained in a Customer Relationship Management (CRM) system or other service.
- Existing customers using an alternate phone number to contact aren't authenticated by this component.

## Sample dialogs

The sample dialogs show common scenarios that this prebuilt component handles.
They demonstrate behavior when the user calls the component using telephony,
which triggers the Default Welcome Intent and the first agent response at the
start of the conversation.

### Authenticated user

The user is identified based on the calling number and receives a personalized
greeting message.

| User Input | Agent Response |
|---|---|
|   | Hi \[Caller First Name\]. Thank you for contacting \[Company Name\], we are committed to your financial health. How can we assist you today? |

### Unidentified user

The system doesn't identify the caller's number, and it greets the user with the
standard greeting message.

| User Input | Agent Response |
|---|---|
|   | Thank you for contacting \[Company Name\], we are committed to your financial health. How can we assist you today? |

## Naming conventions

This prebuilt component uses the following naming conventions:

| Feature | Format | Example |
|---|---|---|
| Flow | \[Component Name\] | Greeting |
| Parameter | \[param_name\] | ani_auth |
| Webhook | prebuilt_components_\[component_name\]:\[webhook_action\] | prebuilt_components_greeting:get_account_details |

## Input parameters

Input parameters configure certain behaviors of the component. One or more
conditions within the flow use these parameters to determine how the
component behaves. You must set flow-scoped parameters on the start page of
the component as described below. You can set session-scoped parameters by
using a calling flow or on the start page of this component.

This prebuilt component accepts the following input parameters:

| Parameter Name | Description | Input Format |
|---|---|---|
| $flow.company_name | Captures the name of the company to be used dynamically in the Greeting prompt. | string |

#### To configure the input parameters for this component, expand for instructions.

1. Open the [Dialogflow CX console](https://dialogflow.cloud.google.com/cx/projects).
2. Choose your Google Cloud project.
3. Select your agent.
4. Select the **Build** tab.
5. Click the imported component in the **Flows** section.
6. Click the Start Page in the **Pages** section.
7. Click the **true** Route in the Start Page.
8. In the Route window, edit the **Parameter Presets** values as needed.
9. Click **Save**.

## Output parameters

Output parameters are session parameters that remain active after exiting the
component. These parameters contain important information collected by the
component.

| Parameter Name | Description | Output Format |
|---|---|---|
| ani_auth | Captures the result of ANI-based authentication. By default, the value is `false`. | boolean |
| auth_level | Indicates the authentication level of the caller. By default, the value is `null`. `-1` indicates that the user was not authenticated by their ANI. `0` indicates that the ANI authentication was a success. | integer |

## Basic setup

To set up this prebuilt component:

1. [Import the prebuilt component](https://docs.cloud.google.com/dialogflow/cx/docs/concept/prebuilt-component.md.txt#import).
2. Configure the provided [flexible webhook](https://docs.cloud.google.com/dialogflow/cx/docs/concept/webhook.md.txt#flexible) with your external services. For more information, see the [Webhook setup](https://docs.cloud.google.com/dialogflow/cx/docs/concept/prebuilt-component/greeting.md.txt#webhook-setup) section.

## Webhook setup

To use this component, configure the included
[flexible webhooks](https://docs.cloud.google.com/dialogflow/cx/docs/concept/webhook.md.txt#flexible) to retrieve
necessary information from your external services.

### Get account details

The component uses the `prebuilt_components_greeting:get_account_details`
webhook to identify the caller using their ANI. If the phone number of the
caller exists in the configured external service, the component retrieves the
relevant information to personalize the experience, including caller name and
email.

#### API request parameters

The component provides the following parameters as inputs to the API request:

| Parameter Name | Description | Output Format |
|---|---|---|
| phone_number | The caller's phone number (ANI). | integer |

#### API response parameters

The component retrieves the following parameters from the API response:

| Parameter Name | Description | Output Format |
|---|---|---|
| user_first_name | The user's first name, used to provide a personalized greeting. | string |
| user_email | The user's email address. | string |

#### To configure the Get Account Details webhook for this component, expand for instructions.

1. Open the [Dialogflow CX console](https://dialogflow.cloud.google.com/cx/projects).
2. Choose your Google Cloud project.
3. Select your agent.
4. Select the **Manage** tab.
5. Click **Webhooks**.
6. Select the prebuilt_components_greeting:get_account_details webhook.
7. Replace the URL in the Dialogflow CX **Webhook URL** field with the endpoint for the service you want to integrate with. Select the proper **Method** in the dropdown.
8. Review and update the **Request body** to form the proper request format for your webhook.
9. Review and update the **Response configuration** to extract specific fields from your webhook's response. Do not modify the parameter names, as these are required by the component to access the returned field values.
10. Review and update the **Authentication** settings as needed.
11. Click **Save**.

### Complete

The prebuilt component and its webhook are now set up and ready to test.