In this presentation, Nishant Kumar of Valuebound has discussed “Action-on-Google with Drupal”. In this step-by-step guide, you will learn “how to use Action-on-Google for a new project and an existing one?” as well as “integrating Google voice assistance with Drupal 8.”
----------------------------------------------------------
Get Socialistic
Our website: http://valuebound.com/
LinkedIn: http://bit.ly/2eKgdux
Facebook: https://www.facebook.com/valuebound/
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Action on google with Drupal
1. Actions on GOOGLE with Drupal
Nishant Kumar
https://drupal.org/u/nishantkumar155
@nishantkumar
2. ● How to use Action-on-Google for a new project and an
existing one?
● How to integrate Google voice assistance with Drupal 8.
Agenda
3. How to use Action-on-Google for a new project and an
existing one?
By leveraging this application, we can use electronic gadgets to
trigger voice command that can control Drupal command.
● Clear cache
● Count no of node
● Send email
● Run external as well as internal cron
● And many more to control your Drupal application to respond
or insite defined action
4. How to integrate Google voice assistance with Drupal 8
1->Go to https://console.actions.google.com
15. class test extends ControllerBase {
/**
* SymfonyComponentHttpFoundationRequestStack definition.
*
* @var SymfonyComponentHttpFoundationRequestStack
*/
protected $requestStack;
/**
* The logger factory.
*
* @var DrupalCoreLoggerLoggerChannelFactoryInterface
*/
protected $loggerFactory;
/**
* Constructs a new DefaultController object.
*/
16. public function __construct(RequestStack $request_stack, LoggerChannelFactoryInterface
$loggerFactory) {
$this->requestStack = $request_stack;
$this->loggerFactory = $loggerFactory;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('request_stack'),
$container->get('logger.factory')
);
}
17. /**
* Handlerequest.
*
* @return mixed
* Return Hello string.
*/
public function handleRequest() {
$this->loggerFactory->get('droogle')->info('droogle triggered');
$this->processRequest();
$data = [
'speech' => 'Cache Rebuild Completed for the Site by bisu',
'displayText' => 'Cache Rebuild Completed nishant',
'data' => '',
'contextOut' => [],
'source' => 'uniworld',
];
return JsonResponse::create($data, 200);
}
protected function sent_mail(){
}
18. protected function processRequest() {
$params = $this->requestStack->getCurrentRequest();
// Here we will process the request to get intent
$to = "neera.prajapati@valuebound.com";
$subject = "Drush cleared";
$txt = "Drush cleared!";
$headers = "From: nishant@valuebound.com" . "rn" ;
"CC: somebodyelse@example.com";
drupal_flush_all_caches();
mail($to,$subject,$txt,$headers);
// and fulfill the action.
}
}