- Overview
- Video
- The idea
- How it works
- Diagrams
- Documents
- Datasets
- Technology
- Getting started
- Resources 11.License
In times of crisis, communications systems are often overwhelmed with people trying to find basic information about testing, symptoms, community response, and other resources. When communication lines get clogged, people who need real help can't get through. Chatbots help respond to tens, even hundreds, of thousands of messages a day.
Whether via text, phone, websites, or communication apps, conversing with chatbots and other AI-enabled resources can play a critical role in helping communities quickly understand crucial information and free up customer service resources to focus on higher-level issues.
IBM Watson Assistant service helps you build, train, and deploy conversational interactions into any application, device, or channel. Creating a chatbot using Watson Assistant can help address the issues that our users face while trying to gather accurate, relevant information. Whether you're trying to learn the latest news about Covid-19 or learn where there's testing in your area, a chatbot can play a major role in helping communities quickly understand crucial information and free up customer service resources to focus on higher-level issues.
COVID-19 has citizens looking for answers about symptoms and testing sites as well as current status of schools, transportation, and other public services. Using Watson Assistant, this Call for Code has designed a virtual assistant to respond to common questions about COVID-19, scan COVID-19 news articles using Watson Discovery and respond to COVID statistics inquires with data from trusted sources and capture the untrained data and store in the Cloudant DB for future anlaysis and auto training of modules used in the assistant.
It can:
- Respond by sharing consistent, accurate COVID-19 information
- Help citizens quickly and easily access the latest information through their channel of choice – only text collaborative tool
- Free valuable resources by automating answers to common COVID-19 questions
- Dynamically update information with the latest developments and recommendations
The challenge for you is to build out from this framework to create a more complete solution.
- User visits a website with the COVID-19 chatbot and asks a question.
- Node.js web server calls the Watson Assistant service hosted in IBM Cloud.
- Watson Assistant uses natural language understanding and machine learning to extract entities and intents of the user question.
- Source COVID-19 FAQ information from trusted CDC data.
- Watson Assistant invokes an OpenWhisk open source powered IBM Cloud Function.
- IBM Cloud Function calls the Watson Discovery service running in IBM Cloud.
- Watson Discovery scans news articles and responds with relevant articles.
- Watson Assistant invokes an OpenWhisk open source powered IBM Cloud Function.
- IBM Cloud Function calls the COVID-19 API to get statistics.
- Watson Assistant replies to the user inquiry.
- Node.js web server displays the chat answer to the user.
In this tutorial, you will:
- Learn how to create a simple Node.js application.
- Connect the application to a chatbot using the IBM Watson Assistant APIs.
- Test and run the application locally.
- Deploy the application on IBM Cloud as a Cloud Foundry application.
Here is a demo of the final application:
- Sign up for an IBM Cloud account.
- Download the IBM Cloud CLI. You will use it to push your Node.js application to the cloud.
- You should already have a Watson Assistant service created when you deployed the COVID bot. You need to get the credentials from that chatbot to use in your Node.js application:
- Log in to your IBM Cloud account.
- Go to resources and open your Watson Assistant service instance.
- You will be taken to Watson Assistant launch page. Click Service Credentials to view the service credentials.
- You will use these credentials to populate the
.env
file when configuring the application below. Copy and save the JSON somewhere or leave this window open.
This tutorial will take you about 30 minutes to complete.
The following steps assume that you have created an assistant, imported the COVID skills, and have the Watson Assistant service credentials available.
-
Clone the repository and cd into
crisis-communication-chat-bot
. -
Copy the .env.example file to a file called .env
cp .env.example .env
-
Open the .env file and add the service credentials that you obtained in the previous step.
The following example .env file configures the
apikey
andurl
for a Watson Assistant service instance hosted in the US East region:ASSISTANT_IAM_APIKEY=X4rbi8vwZmKpXfowaS3GAsA7vdy17Qhxxxxxxxx ASSISTANT_URL=https://gateway-wdc.watsonplatform.net/assistant/api
- If your service instance uses
username
andpassword
credentials, add theASSISTANT_USERNAME
andASSISTANT_PASSWORD
variables to the .env file.
The following example .env file configures the
username
,password
, andurl
for a Watson Assistant service instance hosted in the US South region:ASSISTANT_USERNAME=522be-7b41-ab44-dec3-xxxxxxxx ASSISTANT_PASSWORD=A4Z5BdGENxxxx ASSISTANT_URL=https://gateway.watsonplatform.net/assistant/api
However, if your credentials contain an IAM API key, copy the
apikey
andurl
to the relevant fields.{ "apikey": "ca2905e6-7b5d-4408-9192-xxxxxxxx", "iam_apikey_description": "Auto generated apikey during resource-key ...", "iam_apikey_name": "auto-generated-apikey-62b71334-3ae3-4609-xxxxxxxx", "iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Manager", "iam_serviceid_crn": "crn:v1:bluemix:public:iam...", "url": "https://gateway-syd.watsonplatform.net/assistant/api" }
ASSISTANT_IAM_APIKEY=ca2905e6-7b5d-4408-9192-xxxxxxxx
- If your service instance uses
-
Add the
ASSISTANT_ID
to the previous properties:ASSISTANT_ID=522be-7b41-ab44-dec3-xxxxxxxx
-
Install the dependencies:
npm install
-
Run the application:
npm start
-
View the application in a browser at
localhost:3000
.
-
Log in to IBM Cloud with the IBM Cloud CLI:
ibmcloud login
-
Target a Cloud Foundry organization and space:
ibmcloud target --cf
-
Edit the manifest.yml file. Change the name field to something unique.
For example,- name: covid-crisis-communication-chatbot-yourname
. -
Deploy the application
ibmcloud app push
-
View the application online at the app URL. For example, covid-crisis-communication-chatbot-yourname.mybluemix.net.
This tool is intended to provide information based on currently available CDC and other public information to help you make decisions about seeking appropriate medical care. This system is not intended for the diagnosis or treatment of disease or other conditions, including COVID-19, and you should not provide any personally identifying or private health information.
This Watson Assistant bot is populated with data that is sourced from the following resources:
- Most static responses provide information found on the CDC's COVID FAQ Page: https://www.cdc.gov/coronavirus/2019-ncov/faq.html
- Dynamic infection and death counts are sourced from Johns Hopkins University via the following API: https://www.covid19api.com/
- Dynamic news stories are sourced from Watson Discovery's news feed. Additional information on that service can be found here: https://www.ibm.com/watson/services/discovery-news/
Dynamic news stories are sourced from Watson Discovery's Additional Source. Additional information on that service can be found here: https://www.cdc.gov/coronavirus/2019-ncov/
Dynamic news stories are sourced from Watson Discovery's Additional Source. Additional information on that service can be found here: https://www.who.int/emergencies/diseases/novel-coronavirus-2019/
Dynamic news stories are sourced from Watson Discovery's Additional Source. Additional information on that service can be found here: https://www.worldometers.info/coronavirus/
This solution starter is made available under the Apache 2 License.