This will demonstrate how to have your Watson Assistant provide a user with the latest count of confirmed cases for COVID-19. This will work for any country, state, or city. The information is sourced from an open API provided by covidtracking.com and sourced from information from CDC and WHO.
- Watson Assistant Skill
- IBM Cloud Function
- Create a new Cloud Function with a NODE.JS runtime
- Copy/paste the Javascript code from
covid19-webhook-function.js
into the Function - Click on
Endpoint
, copy down the URL from the CURL command (includingblocking=true
) and the API Key
- Create a Skill, import from the Content Catalog the intent named
Covid_Case_Count
- Go to Options > Webhook, paste in the URL
- Click Add authorization, paste in API Key
- Create a Dialog node that recognizes this intent
- Click on Dialog settings, enable Webhook
- Add parameter key
stateCode
to call out to webhook (this can either be collected by your Assistant or hard coded in). Acceptable values include "NY", "CT", etc. To find a full list, visit https://covidtracking.com/api
- In Assistant responds section, if assistant recognizes the return variable, respond with something along the lines of:
In the State of New York, approximately $webhook_result_2.message.positive people have been tested positive for COVID-19.
Instead of hard coding the state you can use a context variable instead. - Highly Recommended: Include a disclaimer message in case this data is inaccurate. Something along the lines of:
Please note that this data is sourced from the CDC and World Health Organization but inaccuracies may exist.
- Include an error message in the
anything_else
such asSorry, I'm unable to retrieve this information at this time. Please visit covidtracking.com/api for the latest update.
Navigate to the right side of Watson Assistant, click on Try it
, type in "how many cases of COVID-19 are there in New York?" and make sure you get the appropriate response back. You can double check this response with information directly from covidtracking.com to ensure it is accurate.