Have bot search a particular wiki website and speak the result to user

Hello,
I have been trying to get this to work but with no luck so far. I am trying to get the chatbot to search for particular things on an individual wiki site that I’m an administrator of. But I cannot seem to figure this out.
For instance let’s use a few generic examples:
Bot: what can I find for you?
User: apples
Bot (searches the wiki for the page on apples, finds the infobox, and returns an answer to user reading the information from the infobox on the site ) Apples are a fruit found in etc. etc. etc.

Then have the ability if the user wants to learn more about this individual query, return the website link to them where they just heard this snippet from.

Having an issue trying to get this to work and completely unsure how to even get about coding this right. Any help is greatly appreciated.

you should tell about what you tried and what kind of issue you had.

I’ve not tried, but I guess there are 2 ways:

  • you use API Block to query keyword your wiki. Your wiki must have query API and its response must be JSON formatted.
  • or use custom code block to retrieve GET request with query string to your wiki like “GET https://www.your-wiki.site/search/xxxxxx”. but for this, some HTTP client module should be called or write by your self. I don’t know if this is possible.

First one is pretty easy if your wiki supports API and JSON response. If not, it can be possible to create API and json converter by yourself outside such as AWS API Gateway and Lambda, or heroku.

I’m totally not sure if second one is possible because I have tried to use Axios, which is very popular JS HTTP client module, in Custom code block, but it didn’t work before.