Chatbot sample for retail


Use this sample get your chatbot up and running for common retail scenarios. In this sample, our chatbot will help users with:

  1. Questions on available discount codes
  2. Checking the status of their order
  3. 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

Use cases

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)

Download samples

Dialogflow NLP agent: (6.4 KB)
The NLP agent that contains intents we will need for this sample

UiPath processes:

  • Discount code (17.4 KB)
    Process for use case 1 that gets discount codes for the customer
  • Order Status (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 (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:
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

Google Dialogflow

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 sample agent into it

UiPath processes & robots

  1. 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
  2. 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:

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

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

  1. In, create a new connection and configure integrations with the Google Dialogflow agent and Orchestrator service that contain the sample NLP agent and processes respectively
  2. Create the following intent to process mappings:
    Intent Process
    Discount codes Discount code fulfilment
    Order status Order Status Fulfilment
    Refund Order Return Fulfilment
  3. 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

:warning: Important
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

Next steps

  • 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

Thanks @Karan this would really help us a lot.


Great work @Karan! Much appreciated.

1 Like

Thank you very much @Karan!

@Karan Can you please tell me if I receive a List of strings(e.g. Items List) from Process. How can I display it properly in Chatbot(Dialog Flow) response.
Thanks in advance.

@gaurav.tiwari - simply format the string in your process as you’d like it to appear in the chat response, and then assign it to the output argument that’s in the Dialogflow intent response.
The discount code fulfilment and order status fulfilment processes in this retail sample provide examples of this

Does UiPath use only Google Dialog flow? Not Microsoft LUIS? UiPath being a windows based product, I was hoping that it will be more compatible with the Microsoft products.

@savantsa - The preview only uses Google Dialogflow
For a Microsoft based solution, please refer to our code-based Microsoft Bot Framework reference implementation, which uses LUIS for NLU: Chatbot-Samples/BotFramework at master · UiPath/Chatbot-Samples · GitHub

@Karan How can we improve the performance between Dialog Flow and UIPath. Sometimes UIPath returned output(I can see job is completed in Orchestrator) but still dialog flow take some time to display the output in bot.

Working on it text appear bit longer which can make user frustrated.Is there any way we can improve this.

1 Like

@gaurav.tiwari - currently, there is no way to improve the time it takes to display the response to the user in the chat from a configuration perspective. If possible, can you share an example video/gif to illustrate the wait, and typically how long you need to wait to see a response after the process has returned an output?

@Karan I have uploaded the video and you can see that for both the operations it’s taking a very longer time. Which will direct impact user experience?

@Karan Is there any other bot available which we can integrate with UI Path. i just want to improve the performance if any other option is available then I’ll try that also.

Thanks for the video @gaurav.tiwari. Looking at it, it seems like the response comes back to the user within a couple of seconds once the process finishes running. To improve the response time, I would recommend finding ways to optimize the process to run faster.

On alternate options, we do have a code-based reference implementation on our GitHub that uses a chatbot built using the Microsoft Bot Framework. However, since a bulk of the time is spent in executing the process, changing the chatbot being integrated won’t help too much. If you’d like to give our reference implementation a try, you can find it here: GitHub - UiPath/Chatbot-Samples: Welcome to the UIPath Chatbot samples repository. Here you will find example of using Microsoft BotFramework to build a chatbot that connects to UiPath RPA.

can you please give some more usecases…so that we can do more practise on the dialogflow and uipath integration.

Hi @ajay_sai - some ideas on use cases of how to extend this sample, as well as other chatbot scenarios to consider can be found here: Chatbot sample for retail
If there are any other samples that you’d like to see beyond retail, let me know :slight_smile:

@Karan, very informative and we’ll explained. Thanks for this. I am trying to implement use case similar to use case 2.
I need some architectural advice. Eg. In your use case 2, Should we store customer order information in a database or Excel or we can directly process it from queue as key value pair?

@SWATI_KAROT - Can you elaborate a bit more on your scenario?

The scenario here is, I have set of PDF files that contains information about different companies. User asks for specific information like CEO of a particular company, say ‘Tell me the CEO of Tesla’. The chatbot should take CEO and Tesla as input and should pass to UIpath Process. The process should trigger and return the required information(i.e perform an OCR and find the CEO from the PDF file).
Now my question is should I preprocess these information(since its static data and wont change over time) and store in Database or excel? Or should i use queues to temporarily store the output and get the data from ‘get transaction item activity’, whenever there is a request from chatbot?

@SWATI_KAROT - Thanks for the clarification! In your scenario, I’d recommend storing this information from the PDF in a db or excel.
In the sample, we use queues to store temporarily store user-specific information that might be need to be needed in process runs triggered in subsequent queries. The source of truth continues to remain in excel

Hope this helps!