The Google search features give your chatbot the ability to search for answers on Google and your website and automatically correct misspelled user questions. To get the required information, follow the steps below.
- Register at https://programmablesearchengine.google.com/.
- Create a search and setup it is as you want. We recommend to add only your website and Wikipedia if you want your chatbot to reply to general questions, leave disabled the option Search the entire web. Use the setting Entities to exclude invalid results.
- Go to Edit search engine > Setup > Basic and copy the Search engine ID value, paste it in MsgSmartly Admin .
- To get the API key visit https://developers.google.com/custom-search/v1/overview and click Get a key.
The Entities setting analyze the user’s message and recognize and extract entities like cities, events, dates, and more. Use it to exclude invalid results returned by Google search. To enable this setting follow the steps below.
- Log in to https://console.cloud.google.com with your Google account and select the project of your Dialogflow Agent.
- Enter Cloud Natural Language API in the search bar at the top, select Cloud Natural Language API and enable the API .
- Enable the billing by clicking Left menu > Billing and by enabling a billing account with a valid payment method. Enable billing for the project of your Dialogflow agent.
- The Google search is performed only if the chatbot does not know the answer to the user’s question and if the length of the question message is greater than 2 characters.
- If the Google search returns a result, the Dialogflow context google-search is automatically activated. The context contains the attribute link which is the website’s link of the Google search result. Use the context to create a new intent that provides the link, if the user sends a message like tell me more or I want to know more.