-2

I want to create Chatbot in Dialogflow to read content from a website and make interactions accordingly is it possible if yes then how?

1 Answers1

1

It is, you can use Cheerio and request etc to web scrape. And then you can run code on the pages you have scraped.

add these to the top of your code

const cheerio = require('cheerio');
const req = require('request');

and then add these to the dependencies

"cheerio": "^1.0.0-rc.2"
"request": "^2.88.0"

then scrape a webpage

req('www.google.co.uk', function(err, resp, html) {
        if (err) {
          console.log(err);
          reject(err);
        } else {
          const $ = cheerio.load(html, {
            normalizeWhitespace: true,
            xmlMode: true
          });

and then do whatever with the code. cheerio borrows the jQuery syntax. more on that here http://zetcode.com/javascript/cheerio/