Return and refund prebuilt component

The return and refund prebuilt component verifies the user's authentication level. After the user authenticates, the component provides information about the user's most recent or past orders. The user can then select to return multiple items in an order and choose options including refund and return methods.

This component uses the Retail authentication prebuilt component to authenticate users. It also uses Generators for post-call summarization and FAQs.

Limitations

In addition to the common prebuilt component limitations, this prebuilt component has the following limitations:

  • This component doesn't encrypt any data.

Sample dialogs

These 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.

Store return for a single product

  1. The user has been previously authenticated.
  2. The agent confirms which items from the most recent order to return and collects the reason for the return.
  3. The user selects to return the items at a store.
  4. The agent provides a list of the nearest stores.
  5. The user selects a store.
  6. The agent generates a shipping label that is sent to the user's registered channels.
User Input Agent Response
Are you calling about your most recent order number ending with 12345 containing 2 lamp placed on 2023-11-10?
yes
To confirm, you are interested in returning the Google lamp. Is this correct?
yes
We can see that the available quantity of the product that you have selected is 2. Please specify the quantity of products you wish to return.
two
Please specify the reason for return. You may say something like: item defective or doesn't work, no longer needed, size or fit issue, wrong item was sent, item arrived too late, bought by mistake or say others.
others
Please state the reason for your return.
poor quality
To verify, the reason for return is poor quality. Is this correct?
yes
Please let us know where you would like to receive your refund. You can say something like store credit or source account.
source account
Thank you for verifying that you would like your refund to be returned to the original payment method.

As a last step, how would you like to return the product? You can say something like: Return at store or Drop off at location or Schedule for pickup.
return at store
Let's find a store near you.
The agent collects the user's ZIP code using the Zip code collection prebuilt component.
Here is the list of locations near the zip code you entered.
Address 1: Google Texas, 500 W 2nd St, Suite 2900 Austin, Texas 78701, US.
Address 2: Google California, 19510 Jamboree Road, Irvine, California 92612, US.

Please say or enter the address number that you want to select, or say "next" to show more store addresses.
1
To confirm, you have selected Google Texas, 500 W 2nd St, Suite 2900 Austin, Texas 78701, US. Is that correct?
yes
Perfect. We have sent a shipping label and ticket number to your registered phone number and email. Please print it out and attach it to your package and drop your return off within 30 days.
Once we receive the item at our warehouse, it will take 3 to 5 business days for your refund to appear in your account. Please note: The refund amount will be excluding the shipping and handling charges.
Thank you for calling.

Naming conventions

This prebuilt component uses the following naming conventions:

Feature Format Example
Flow [Component Name] Return & Refund
Entity Type prebuilt_components_[component_name]_[entity_type] prebuilt_components_return_refund_mode_of_return
Webhook prebuilt_components_[component_name]:[webhook_action] prebuilt_components_return_refund:post_return_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. You can set session-scoped parameters 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
$session.params.phone_number (optional) The user's local phone number, without the country code, used to identify the user. string
$session.params.all_recent_order_id (optional) A list of order IDs associated with the authenticated user, sorted by the order placement date in descending order. The first element of the array represents the most recent order. If the user has no orders, the value of this parameter is null. List (string)
$session.params.email (optional) The email registered with the account. string
$session.params.user_first_name (optional) The user's first name, used to greet and confirm ownership of the account. string

This prebuilt component lets you configure the behavior of the component, including retries, using the following optional parameters:

Parameter Name Description Format
$flow.max_retry_another_account_counter Specifies the number of retries allowed when selecting whether to continue with an alternate account. The default value is 2. integer
$flow.max_retry_order_number Specifies the number of retries allowed when providing the last five digits of an order number. The default value is 3. integer
$flow.max_retry_another_order Specifies the number of retries allowed when selecting another order for return in cases where the order ID is not found or the order is not eligible for return. The default value is 2. integer
$flow.max_retry_select_order_number Specifies the number of retries allowed when providing the full order number in cases where multiple orders share the same last five digits. The default value is 2. integer
$flow.max_product_display_counter Specifies the maximum number of products to present in a single turn. The default value is 2. integer
$flow.max_product_display Specifies the maximum number of products to present over the entire conversation. The default value is 9. integer
$flow.max_retry_product_number_counter Specifies the maximum number of retries allowed when selecting a product to return. The default value is 2. integer
$flow.max_product_return_confirm_counter Specifies the maximum number of retries allowed when confirming the selected product. The default value is 2. integer
$flow.max_retry_return_reason_counter Specifies the number of retries allowed when confirming the reason for return. The default value is 2. integer
$flow.order_product_return_reason_others Specifies the value of the prebuilt_components_return_refund_reason entity indicating that the user has selected "others" return reason. The default value is "others". string
$flow.max_retry_select_quantity Specifies the maximum number of retries allowed when selecting the quantity of product to return. The default value is 2. integer
$flow.max_store_display_counter Specifies the maximum number of stores to present in a single turn. The default value is 1. integer
$flow.max_store_display Specifies the maximum number of stores to present over the entire conversation. The default value is 10. integer
$flow.max_retry_store_number_counter Specifies the maximum number of retries allowed when selecting a store. The default value is 2. integer
$flow.max_retry_store_selection Specifies the number of retries allowed when confirming the store selection. The default value is 2. integer
$flow.max_retry_another_zip_code Specifies the maximum number of retries allowed when providing a zip code. The default value is 2. integer
$flow.order_payment_mode_COD Specifies the value of the order_payment_mode field returned by the get_order_details webhook indicating a cash on delivery (COD) payment method. The default value is "COD". string
$flow.order_payment_mode_store_credit Specifies the value of the order_payment_mode field returned by the get_order_details webhook indicating a store credit payment method. The default value is "store_credit". string
$flow.order_refund_mode_source_account Specifies the value of the prebuilt_components_return_refund_mode_of_refund entity indicating that the user selected to refund to their source account. The default value is source_account. string
$flow.order_return_location_scheduled_for_pickup Specifies the value of the prebuilt_components_exchange_order_location entity indicating that the user selected to schedule a pickup for the return. The default value is scheduled_for_pickup. string

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

  1. Open the Dialogflow CX console.
  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.

This prebuilt component provides the following output parameters:

Parameter Name Description Output Format
phone_number The user's local phone number, without the country code, used to identify the user. string
all_recent_order_id A list of order IDs associated with the authenticated user, sorted by the order placement date in descending order. The first element of the array represents the most recent order. If the user has no orders, the value of this parameter is null. List (string)
email The email registered with the account. string
user_first_name The user's first name, used to greet and confirm ownership of the account. string
transfer_reason Indicates the reason the flow exited, if it was not successful. The returned value is one of the following:

agent: the user requested a human agent at some point during the conversation.

denial_of_information: the user declined to share information requested by the component.

max_no_input: the conversation reached the maximum number of retries for no-input events. See no-input built-in events.

max_no_match: the conversation reached the maximum number of retries for no-match events. See no-match built-in events.

webhook_error: a webhook error occurred. See webhook.error built-in event.

webhook_not_found: a webhook URL was unreachable. See webhook.error.not-found built-in event.
string

Generators

This component uses Generators to enable specific parts of the conversation.

FAQ

The FAQ generator handles frequently asked questions about returns and exchanges, including the following:

  • Is there a deadline for the return process?
  • Can I exchange a gift item?
  • The product price and the refund amount is different. Why is that?

Summarization

The Summarization generator creates a post-call summary describing the conversation handled by the component.

Basic setup

To set up this prebuilt component, follow these steps:

  1. Import the prebuilt component.
  2. Configure the provided flexible webhooks with settings describing your external services. For more information, see the Webhook setup section.

Webhook setup

To use this component, configure the included flexible webhooks to retrieve the necessary information from your external services.

Authentication

If you haven't previously configured external services required for authentication, you must configure them to let you authenticate users for this component. For more information, see the Retail authentication webhook setup.

Get order details

The component uses the prebuilt_components_return_refund:get_order_details webhook to retrieve order details for a specified order.

API request parameters

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

Parameter Name Description Input Format
$flow.order_id The order ID to retrieve details for. string

API response parameters

The component retrieves the following parameters from the API response:

Parameter Name Description Output Format
order_date Date the order was placed, in YYYY-MM-DD format. string
order_product_count The number of unique products within an order. integer
order_payment_mode Indicates the payment mode used when placing the order. string
returnable_product_id A list of product IDs for returnable products within the order. List (string)
returnable_product_name A list of product names for returnable products within the order. List (string)
returnable_product_brand_name A list of brand names for returnable products within the order. List (string)
returnable_product_quantity A list of quantities for returnable products within the order. List (string)

To configure the Get order details webhook for this component, expand for instructions.

  1. Open the Dialogflow CX console.
  2. Choose your Google Cloud project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Webhooks.
  6. Select the prebuilt_components_return_refund:get_order_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.

Get duplicate order details

The component uses the prebuilt_components_retail_services:get_duplicate_order_details webhook to retrieve detailed information to distinguish between orders when multiple order numbers have the same last five digits.

API request parameters

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

Parameter Name Description Input Format
$flow.duplicate_order_id A list containing the last five digits of order numbers shared between one or more orders for the user. List (string)

API response parameters

The component retrieves the following parameters from the API response:

Parameter Name Description Output Format
all_order_date A list of order dates for duplicate orders with the specified last five digits in YYYY-MM-DD format. Each element in this list corresponds to the same element in the all_order_time list. List (string)
all_order_time A list of order times for duplicate orders with the specified last five digits in HH:MM format. Each element in this list corresponds to the same element in the all_order_date list. List (string)

To configure the Get duplicate order details webhook for this component, expand for instructions.

  1. Open the Dialogflow CX console.
  2. Choose your Google Cloud project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Webhooks.
  6. Select the prebuilt_components_retail_services:get_duplicate_order_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.

Get store details

The prebuilt_components_return_refund:get_store_details webhook retrieves the list of stores near the user's provided ZIP code.

API request parameters

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

Parameter Name Description Input Format
$flow.zip_code The user's ZIP code to search for nearby stores. string

API response parameters

The component retrieves the following parameters from the API response:

Parameter Name Description Output Format
store_id A list of store IDs. List (string)
store_address A list of store addresses corresponding to each element of the store_id list. List (string)

To configure the Get store details webhook for this component, expand for instructions.

  1. Open the Dialogflow CX console.
  2. Choose your Google Cloud project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Webhooks.
  6. Select the prebuilt_components_return_refund:get_store_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.

Post return details

The component uses the prebuilt_components_return_refund:post_return_details webhook to submit a return.

API request parameters

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

Parameter Name Description Input Format
$session.params.phone_number The user's local phone number, without the country code, used to identify the user. string
$flow.order_id Order ID to submit a ticket for. string
$flow.return_product_id_list A list of product IDs that the user wants to return. List (string)
$flow.return_product_quantity_list A list of product quantities that the user wants to return, corresponding to each element in $flow.return_product_id_list. List (string)
$flow.return_reason_list A list of return reasons for each returned product, corresponding to each element in $flow.return_product_id_list. List (string)
$flow.order_return_location The selected mode for the return. Valid values are defined by the prebuilt_components_exchange_order_location entity. string
$flow.order_return_store_id The store ID for the store selected by the user for a store return. string
$flow.order_refund_mode The payment mode for the refund. Valid values are defined by the prebuilt_components_return_refund_mode_of_return entity. If no refund is required, this value is null. string

API response parameters

The component retrieves the following parameters from the API response:

Parameter Name Description Output Format
order_return_ticket_id The ticket ID for the submitted return. string

To configure the Post return details webhook for this component, expand for instructions.

  1. Open the Dialogflow CX console.
  2. Choose your Google Cloud project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Webhooks.
  6. Select the prebuilt_components_return_refund:post_return_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.

Send COD refund information

The component uses the prebuilt_components_return_refund:send_COD_refund_information webhook to send return-related payment information to the user.

API request parameters

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

Parameter Name Description Input Format
$session.params.phone_number The user's local phone number, without the country code, used to identify the user. string
$flow.order_id The order ID to submit a ticket for. string
$flow.channel The specific channel to send information to. Valid values are defined by the prebuilt_components_channel_email_phone entity. By default, phone and email are supported. string

To configure the Send COD refund information webhook for this component, expand for instructions.

  1. Open the Dialogflow CX console.
  2. Choose your Google Cloud project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Webhooks.
  6. Select the prebuilt_components_return_refund:send_COD_refund_information 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 webhooks are now set up and ready to test.