Skip to content Skip to sidebar Skip to footer

Problems With Request And Cheerio In Dialogflow

What I'm trying to do is to be able to use request-promise-native and cheerio in my dialogflow webhook to scrape some articles from a website, I've tried several ways but never bee

Solution 1:

The problem is in the function registered to the scrpwb intent.

You are calling prova_promise, which returns a Promise (which is correct!), but does not itself return a Promise. So the function returns nothing, which is handled immediately by the handler rather than waiting for the Promise to complete.

The solution is simple - make sure it returns a Promise which you can do with something like

  return prova_promise().then((message) => {

and the rest being exactly the same.


Post a Comment for "Problems With Request And Cheerio In Dialogflow"