integrate Google Assistant
Blog

How to integrate Google Assistant with Drupal 8

The demand for Voice technology is rising and it is likely to revolutionize the way publishing websites engage with their audience. The Internet-connected virtual assistant is seeing a significant rise, but the question is how publishers can use this tech to grow their audience base and ultimately increase revenue? Here, we will explore how to use Actions on Google for a new project and an existing one followed up by an integration with Drupal 8 website.

Let’s have a look.

Integrating Actions on Google with a device

Integrating Actions on Google with an electronic gadget or smart speakers allow us to trigger voice command to control various Drupal commands such as:

  • Clearing cache
  • Count number of node 
  • Sending an email
  • Run external as well as internal cron
  • Control Drupal application to respond or insite defined action
  • Integrating Google voice assistance with Drupal 8

1->Go to https://console.actions.google.com

  •     Create new Add/import project.
  •     Enter your project name and Country /region. 

Google Assistant app

 

  • Add a new project

Add project on Google Assistant

Create actions on Dialog Flow 

  • Build a Dialog Flow, you will land to given page as per below screenshot.

Google Assistant - Dialogflow

  • Now create a new intent and enter the following details as shown in the screenshot      

Google Assistant - Dialogflow2

Fill below field

  1. User says
  2. Response → Default → “voice control text which can speak”
  3. Select the field of Fulfillment and then save.
  • Now click on Fulfillment.
  • Enable Webhook
  • Enter URL of your controller and save 

Google Assistant_webhook

Module development in Drupal 8

We are creating this module to hit '/ok-google-test’ page and return test reply setup after performing the process.

Create a custom module and a routing file:

Create Controller:

Now go to your bot.
console.dialogflow.com/api-client/#/agent/a128xxxx-711a-4c7f-b6b6-dxxxxxxxxxxx/integrations

You will see the similar screen where you can say clear caches.

Google Assistant_Console dialog flow

With this integration,  we can interact with our voice-enabled devices to use various Drupal functionalities, like cache clear, external cron run, sending mail, and others. Hope now you can integrate Actions on Google with your Drupal website. If you have any suggestions or queries please do comment below.

Below given is the presentation on "Integration of Google Assistant with Drupal".