“User Input” plugin allows you to ask your bot users questions, grab the data from their answers and save it to user attributes. But there’s more to it than just that – you can combine this plugin and “Google Site Search” plugin to create an even better user experience by integrating web content into your bot.
Here’s what the result might look like:
This plugin combination is most effective when put into the “Default Answer” block as it will allow your bot to cover user input that is not recognized by AI thus making it possible to cover 100% of input.
Below is the guide we put together to help you implement Google Site Search into your bot with the help of “User Input” plugin.
Step 1 – Creating “User Input”
First of all, create a card with “User Input” plugin and put down the message you want the user to see when they call out the search, as well as the attribute the answer is going to be saved to.
Note that in order for the feature to work properly, “User Input” should always be activated BEFORE “Google Site Search”.
After that card you might want to create a text card and a “Typing…” plugin to show your bot is responsive.
Step 2 – Creating “Google Site Search”
This is where the attribute you’ve saved in User Input comes in handy. You can use it in the following three fields of the plugin:
- Search Request – this is where the connection point between User Input and Google Site Search plugins
- Subscription Title – users will be able to see the text typed in there on the last card
- Image Title – users will be able to see the text typed in there on the image of the last card
Google Site Search also allows you to set up the amount of search results displayed in the gallery (up to 9) as well as let the users subscribe to the search results or share it.
Yet, in order to connect your plugin with Google you need to create a Google API Key and a Search Engine ID. Here’s how you do it:
- Creating Google API Key
- Open this link to go to Google APIs dashboard.
- On the page, click the “Create Project” button if you haven’t a project yet and follow the instructions on the screen. If you have a project already, you may skip this step.
- Once you’ve created a project, click the “Enable API” button on the API Manager Dashboard that you see in front of you.
- In the API Library, look for “Other popular APIs” column, select “Custom search API” and click “Enable” at the top to get it working.
- Once the API is enabled, click the “Create credentials” button to the right and follow the instructions – you should have the key in mere seconds.
- Now that you have the key, copy and paste it into the “Google API Key” field.
- Creating Search Engine ID
- Open this link to go to Google’s Custom Search Engine setup page.
- On the next page, click “Add”, specify the sites your bot will search on as well as the language (if needed) and click “Create”.
- Click “Setup” in the menu to the left. On the “Basic” tab in the “Details” section click “Search engine ID”.
- This is the ID you need to copy and paste into the “Search Engine ID” field.
Now that both plugins are set, you can go and test this feature on your bot.