How to integrate Google Custom Search API with RASA Chatbot

I have created a simple Rasa Chatbot and trained with basic questions but if user ask anything other than what I trained it should search from a website and show it. The bot need to search on the website which I have saved in Google Custom API. This is the website:

How can I do it? If someone has already build something on similar lines, it would be really helpful if you can please please share your repository.

Thank You

Hi @nik12, you can integrate a search in a custom action, as is done in rasa-demo here.

I’m curious what you mean by if the user asks anything other than what I trained - do you mean any literal phrase that is not in training data? or when the intent is predicted with low confidence?

Hi @mloubser, Thanks for replying. What I meant was whenever there is out_of_scope intent then out_of_scope_response action should get triggered and in that action bot should pass that phrase to Google Custom API and accordingly show the result.

In that case you can write a rule for handling out_of_scope; you can also take a look at the fallback docs in case that’s more applicable.