The Google site search plugin allows you to display target content from your website without the need to develop a complete JSON API. This makes the whole process of integrating web content into your chatbot much easier. Google also crawls websites for new content very regularly, which results in swift updates of your bots content.
One thing we love, is that the plugin supports parameters provided by the User Input plugin. This is great to provide search functionality and show your users the exact content they are looking for.
Here’s an example of what this could look like:
- use Image Title to define a text to show on the image of the last card
- set up the amount of items to show in the gallery
- allow users to subscribe to their search results (use the Digest plugin to deliver the feeds, users have subscribed to)
to add saved parameters in the following fields:
- Search Request
- Subscription Management Card
- Title Image Title
Here’s how you set up the Google site search plugin:
Creating an CSE ID
- To start we will need to click the link provided right below the CSE ID field.
- On the next page click Add, specify the website(s) your bot should search on and adapt the search language if needed — then click Create.
- You will then need to click on the Control Panel button and copy the value for your search engine ID by clicking the corresponding button in the Details section.
- This is your CSE ID you can now paste into your bot’s Google site search plugin.
Creating an API Token
- Please open the link shown right below the API Token field.
- On the next page click Create project in case you don’t have created one yet and follow the instructions. If you already have a project, you can go on to the next step.
- Now click on the Enable button and then select the Credentials tab in the left bottom.
- There you will need to create new credentials by using the Create credentials → API key → Server Key and click Create.
- Now you should see your API Key, copy it and paste it into the API Token field in the plugin.
How to make it possible for your users to search?
All you need to do is to call the user input plugin to save parameters before calling the Google site search plugin. You can put them in same block, or in different blocks, as long as the user input is activated before the search plugin everything should work just fine.
The free amount of searches is unfortunately limited to 100 a day by Google. If you need more than that you would have to buy a larger plan here.