Building a chatbot🤖 with Watson Assistant to automate online shopping 
Tags: javascript, database, chatbot, cloud
Published: 2020-11-23 01:40:54

During the pandemic, online shopping experienced explosive growth. Chatbots and automation have quickly become key technologies in helping the companies meets their customers needs during these difficult times. 

# What is a chatbot?
As per definition, a chatbot is a computer program that uses AI and natural language processing (NLP) to automate responses to user queries, simulating human conversation. Chatbots are some of the most exciting new tools in the customer experience environment.

>*I recently attended IBM worksop to build an AI-powered back end system that can take the daily essentials orders through an online mode and set up automated order processing & inventory management system using Watson Assistant & IBM DB2.*

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9uyqmbpp1thlzdk5rpfh.jpg)
The idea is to have the system processes the incoming text requests by converting them to formatted orders lists. Then, this system can be connected to the inventory database for optimizing supply chain management. This solution can be applied to different inventories, for example grocery shopping, any kind of online orders and online shopping which is expanding due to pandemic.

## Steps to follow:
- Build a chatbot using [Watson Assistant](https://cloud.ibm.com/catalog/services/watson-assistant)
- Connect chatbot to a [DB2 database](https://cloud.ibm.com/catalog/services/db2)
- Deploy to a user interface

### Let's get started with following steps: 
#### Step 1. Create an IBM Cloud account
[IBM Cloud account](https://www.ibm.com/cloud): Create an IBM Cloud account.

#### Step 2. Clone the [repo](https://github.com/IBM/online_order_processing_during_pandemics)
Clone the repo locally. In your terminal run:
```
git clone https://github.com/IBM/online_order_processing_during_pandemics

```

#### Step 3. Setup Watson Assistant
Create Watson Assistant service, in Watson Assistant resource page click on `Service credentials` and create `New credential` and import the skill in Watson Assistant resource page, by clicking on `Manage` and `Launch Watson Assistant`:  
The following step would be to create or import the skill. Navigate to the folder `assistant_skill` in the repo and download the file by name `Order_Processing_Skill.json` into your local system, this is how it looks: 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wlqgo9vhc083ha4831j7.png)



The skill created includes defined Intents, Entities & Dialog flows which can be ingested into any Watson Assistant service. 

We need to click and select the file Order_Processing_Skill.json and hit Import, and make sure that JSON file must be an actions skill.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xyjhmadxdyztfk9ozyqy.png)


Once imported, we can review the `Intents, Entities & Dialog` options.


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/fxas7h6nsa26a7p9c0tx.png)

#### Step 4. Setup IBM Db2 and Create a [Db2 service](https://cloud.ibm.com/catalog/services/db2).

Click on Service credentials and by clicking New Credentials generate it. 


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/h3lg8tdtrvw0rhjw5wbi.png)

You need to add the Credentials to the Application, Open the watson-assistant-credentials.json file in the repo and add the following: Watson Assistant `apikey`, `url` and the `assistant-id`.

Open the ibm-db2-credentials.json file and paste the `Db2 Credentials` and save the file.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vr9edsr02can9xb2qvp3.png)

``` bash
{
    "apikey": "<YOUR_API_KEY_HERE>",
    "url": "<URL_HERE>",
    "assistant-id": "<ASSISTANT_ID_HERE>"
}
```

I want to share some resources with you so you can [Get the detailed instructions-click here]( https://developer.ibm.com/technologies/artificial-intelligence/patterns/online-order-processing-system-during-pandemic/) or watch the [workshop-recording](https://www.crowdcast.io/e/online-order-processing-2).


To connect with me please check my [Github](https://github.com/ivanadokic), [LinkedIn](https://www.linkedin.com/in/ivana-dokic/) or [Twitter](https://twitter.com/LloydPile). 

Thank you for reading!