Use this sample get your chatbot up and running for common retail scenarios. In this sample, our chatbot will help users with:
- Questions on available discount codes
- Checking the status of their order
- Processing refund requests for orders not yet shipped
Through this sample, we will cover:
- Conditionally responding to a user, based on information extracted by your process
- Tracking information captured from the user and from the process across several process runs
Before we start configuring our chatbot, let’s briefly walk through the steps we’ll take to help users with the three questions we’ve identified
Use case 1: Questions on available discount codes
Our first use case is simple - when a customer asks about discount codes, we start a process that goes into the line of business application retrieves a list of discount codes, and stores them in an output argument, to be sent to the customer.
Use case 2: Checking the status of a customers order
The second use case demonstrates:
- Using information in the customers message in our process
- Creating conditional dialogue
- Tracking information using queues
When a customer asks for the status of their order, we first ask the customer for their email address. We then use the email address to lookup their account, and find related orders. If they have any orders pending delivery, we’ll store information about these orders in an output argument, to be sent to the customer. We’ll also track the IDs of these orders in an Orchestrator queue item, in case the customer wants to request a refund for one or more of them.
However, if the customer does not have any orders pending delivery, we’ll store the most recently delivered order in an output argument instead, to be sent to the customer as confirmation
Use case 3: Processing refund requests for orders not yet shipped
This final use case demonstrates:
- Using follow up intents to use information previously provided by customers
- Using queue items to get information about the customer from previous RPA runs (or even previous chat sessions!)
If the customer has delayed orders (identified from use case 2) and requests to cancel one of them by saying something like “cancel the 3rd order”, we’ll use the customers email to first get the IDs of their delayed orders from the queue item created in use case 2, and then submit the refund request for the specified order. Finally, we’ll have the chatbot respond to the customer with a confirmation of the order ID that was cancelled, and the amount being refunded.
To ensure customers are only able to request refunds once they’ve checked their order status, we’ll create the intent to request a refund as a follow up intent to the intent to check status (in use case 2). Instead of asking the user for their email again, we’ll simply reuse the information previously provided by the user by using the context of the intent to check status (in use case 2)
Dialogflow NLP agent:
UiPath_RetailSample.zip (6.4 KB)
The NLP agent that contains intents we will need for this sample
Discount code fulfilment.zip (17.4 KB)
Process for use case 1 that gets discount codes for the customer
Order Status Fulfilment.zip (20.6 KB)
Process for use case 2 that gets delayed customer orders and stores them in a queue item for quick access in refund requests
This process demonstrates conditionally responding to the user based on criteria like order status
Order Return Fulfilment.zip (19.6 KB)
Process for use case 3 that submits a refund request for the customer
This process demonstrates using customer data collected during other process runs by storing them in queue items
Note: These sample processes are meant to demonstrate the primary use cases above, and do not handle edge-case scenarios
Sample Data - Retail.xlsx (19.4 KB)
An Excel document that mimics a line of business application that is not accessible via APIs.
It contains tables for Customers, Orders and Discounts, along with a few sample rows of data to
Use the steps below to configure your Google Dialogflow NLP agent, UiPath processes and robots, and intent to process mappings for fulfilment
Create a new Google Dialogflow agent, go into its settings, navigate to the Export and Import tab and use the Import from zip option to import UiPath_RetailSample.zip sample agent into it
UiPath processes & robots
- Update the process_dataSource input argument in all three processes to the location of the Sample Data – Retail.xlsx document, and publish them to orchestrator
- Ensure that you have at least one unattended robot configured and connected.
Tip: Verify this by trying to start a process job from Orchestrator. If your job is picked up by a robot and executed, then your unattended robot is correctly configured
For use cases 2 and 3, you will additionally need to:
- Create a Queue in orchestrator as follows:
a. Name: “Retail chatbot queue”
b. Unique Reference: Yes
Note: If you’re creating this queue in any folder other than Default, you’ll need to update the folder in the queue activities in the Order Status Fulfilment and Order Return Fulfilment processes respectively
- Assign the Robot role permissions to delete transactions
In our sample, we delete a queue item once a refund is requested for it.
As a result, you will need to make sure that your robots have the permission to delete transactions
UiPath chatbot connector
- In chatbot.uipath.com, create a new connection and configure integrations with the Google Dialogflow agent and Orchestrator service that contain the sample NLP agent and processes respectively
- Create the following intent to process mappings:
Intent Process Discount codes Discount code fulfilment Order status Order Status Fulfilment Refund Order Return Fulfilment
- Enable the Test widget by:
a. Going into the Launch tab in the chatbot connector and click Connect on the Web tile
b. In the dialog that appears, enter a name for your chatbot, a greeting message, click on the button to copy the HTML embed code and then click Save and close.
c. Click Test on the web tile to open a new tab with your web widget
Run your sample!
All that’s left to do now is to ask your chatbot for help! Below are a few examples of things you can say:
|Things to say||Use case|
|“What discounts can I get?”
“What coupon codes can I use?”
“Can I get discount coupons?”
|Discount code fulfilment|
|“Where’s my package?”
“What’s the status of my order?”
|Order status fulfilment|
|As a follow up to order status:
“I’d like a refund”
“Can I get a refund on the first item?”
|Order return fulfilment|
Before each run of the sample, make sure all existing items in the queue are deleted.
When using queues in production, you’ll need to implement logic to update queue items instead of deleting them
- Extend this chatbot with additional use cases.
For example, if a customer has no orders pending delivery but has not received their package, help them report a missing shipment
- Use the concepts demonstrated in this sample to build your own chatbots:
- Build internal chatbot scenarios like IT helpdesks, RPA CoE helpdesks, etc.,
- Build external facing chatbots for scenarios like sales quote generation, recommend products for a customer, upsell products/services, and more