项目作者: tkhang1999

项目描述 :
COVID19 Status Webhook for Dialogflow Chatbot
高级语言: JavaScript
项目地址: git://github.com/tkhang1999/COVID19-status-webhook.git
创建时间: 2020-04-28T10:43:40Z
项目社区:https://github.com/tkhang1999/COVID19-status-webhook

开源协议:

下载


COVID19 Status Webhook

Introduction

This is the Webhook service to feed the Dialogflow COVID19 Status Chatbot.
Given an input country, it returns the COVID-19 status of that country by making a request to the
COVID19 API provided by disease.sh.

Deployment

The service is deployed at https://covid19statuswebhook-yu781szi.b4a.run/

Host the service locally

  1. $ npm install
  2. $ npm start

Make a POST request

You may make a POST request to the URL: https://covid19statuswebhook-yu781szi.b4a.run/webhook or localhost:3000/webhook (if hosted locally) using Postman.

Sample request body:

  1. {
  2. "queryResult": {
  3. "parameters": {
  4. "country": "singapore"
  5. }
  6. }
  7. }

Sample response:

  1. {
  2. "fulfillmentMessages": [
  3. {
  4. "text": {
  5. "text": [
  6. "Country: Singapore \r\n\nCases: 62,493 \r\nToday Cases: 0 \r\n\nDeaths: 35 \r\nToday Deaths: 0 \r\n\nRecovered: 62,140 \r\nToday Recovered: 0 \r\n\nActive: 318 \r\nCritical: 4 \r\nTests: 13,287,834 \r\n\nUpdated Time: Jun 25, 2021, 11:34:46 AM GMT+8"
  7. ]
  8. }
  9. }
  10. ]
  11. }

Chatbot Demo

You can have a try with the COVID19 Status Chatbot on Telegram at t.me/COVID19_Status_Chatbot.

The bot is able to return the COVID19 status globally as well as for most countries.
Because the webhook is deployed on a free dyno, it will sleep after a half hour of inactivity.
Hence, if you do not receive any reply after a chat, please try one more time.


Chatbot Demo