Win $20,000. Help build the future of education. Answer the call. Learn more

Integrate a COVID-19 crisis communication chatbot on a website

This tutorial takes you through building a simple Node.js application that is connected to a COVID-19 chatbot using the Watson Assistant APIs. The steps are taken from this assistant-simple repository and adopted for 2020 Call for Code challenge. You can use this tutorial as a starting template for the COVID-19 challenge.

Learning objectives

In this tutorial, you will:

  1. Learn how to create a simple Node.js application.
  2. Connect the application to a chatbot using the IBM Watson Assistant APIs.
  3. Test and run the application locally.
  4. Deploy the application on IBM Cloud as a Cloud Foundry application.

Here is a demo of the final application:

Chatbot demo


  1. Sign up for an IBM Cloud account.
  2. Download the IBM Cloud CLI. You will use it to push your Node.js application to the cloud.
  3. Create a COVID-19 chatbot and connect it to data sources 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.

      Watson Assistant 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.

Estimated time

This tutorial will take you about 30 minutes to complete.

Architecture diagram

The following diagram shows the workflow for a website chatbot that answers questions about COVID-19.

Crisis Comms Architecture diagram

  1. The user visits a website with the COVID-19 chatbot and asks a question.
  2. The Node.js web server calls Watson Assistant service hosted in IBM Cloud.
  3. Watson Assistant uses natural language understanding and machine learning to extract entities and intents of the user’s question.
  4. The COVID-19 FAQ is sourced from trusted CDC data.
  5. Watson Assistant invokes an OpenWhisk open source-powered IBM Cloud Function.
  6. IBM Cloud Function calls Watson Discovery service running in IBM Cloud.
  7. Watson Discovery scans news articles and responds with relevant articles.
  8. Watson Assistant invokes an OpenWhisk open source-powered IBM Cloud Function.
  9. IBM Cloud Function calls the COVID-19 API to get statistics.
  10. Watson Assistant replies to the user inquiry.
  11. The Node.js web server displays the chat answer to the user.


The following steps assume that you have created an assistant, imported the COVID skills, and have the Watson Assistant service credentials available. If you haven’t, complete this tutorial first.

Configure the application

  1. Clone the repository and cd into starter-kit/covid-simple.

  2. Copy the .env.example file to a file called .env

     cp .env.example .env
  3. Open the .env file and add the service credentials that you obtained in the previous step.

    The following example .env file configures the apikey and url for a Watson Assistant service instance hosted in the US East region:

    • If your service instance uses username and password credentials, add the ASSISTANT_USERNAME and ASSISTANT_PASSWORD variables to the .env file.

      The following example .env file configures the username, password, and url for a Watson Assistant service instance hosted in the US South region:


      However, if your credentials contain an IAM API key, copy the apikey and url 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": ""
  4. Add the ASSISTANT_ID to the previous properties:


Running locally

  1. Install the dependencies:

     npm install
  2. Run the application:

     npm start
  3. View the application in a browser at localhost:3000.

Deploy to IBM Cloud as a Cloud Foundry application

  1. Log in to IBM Cloud with the IBM Cloud CLI:

     ibmcloud login
  2. Target a Cloud Foundry organization and space:

     ibmcloud target --cf
  3. Edit the manifest.yml file. Change the name field to something unique.
    For example, - name: covid-assistant-simple-yourname.

  4. Deploy the application

     ibmcloud app push
  5. View the application online at the app URL. For example,

Take on COVID-19

You now know how to build a chatbot using Watson Assistant and a website on IBM Cloud that users to interact with the chatbot. You can see some other Watson Assistant sample applications in the official documentation.

It’s your turn to use these technologies to help tackle this pandemic and make a difference by accepting the COVID-19 challenge!