Using DialogFlow ES EventInput on Laravel + SQLite

I’m new to DialogFlow API and created Laravel sandbox app, that takes some query data and sends it to a database. I would like to use HTTP Protocol to start a conversation via EventQuery, but could not figure out the whole way to do it.

There is a JavaScript app that uses hardcoded event query parameters and sends it to a simple UI. This is almost it, but without db.

EventQuery class: https://github.com/googleapis/google-cloud-php-dialogflow/blob/master/src/V2/EventInput.php

Laravel sandbox app: https://phpsandbox.io/e/x/gziyh?layout=EditorPreview&defaultPath=%2F&theme=dark&showExplorer=no&openedFiles=

JavaScript app with eventQuery: https://github.com/fitwist/chatbot-app

How do I send an EventQuery request, made of form data, send data to SQLite at the same time and continue the dialogue in simple UI?

Possible template:

<?php 
namespace GoogleCloudDialogflowV2;

use GoogleProtobufInternalGPBType;
use GoogleProtobufInternalRepeatedField;
use GoogleProtobufInternalGPBUtil;

class EventInput extends GoogleProtobufInternalMessage
{

private $name = '';
private $parameters = null;
private $language_code = '';

public function __construct($data = NULL) {
GPBMetadataGoogleCloudDialogflowV2Session::initOnce();
parent::__construct($data);
}

public function getName()
{
return $this->name;
}

public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;

return $this;
}

public function getParameters()
{
return isset($this->parameters) ? $this->parameters : null;
}

public function hasParameters()
{
return isset($this->parameters);
}

public function clearParameters()
{
unset($this->parameters);
}

public function setParameters($var)
{
GPBUtil::checkMessage($var, GoogleProtobufStruct::class);
$this->parameters = $var;

return $this;
}

public function getLanguageCode()
{
return $this->language_code;
}

public function setLanguageCode($var)
{
GPBUtil::checkString($var, True);
$this->language_code = $var;

return $this;
}

}
?>

<!DOCTYPE html>
<html>


<section class="container grey-text">
<h4 class="center">Add a Pizza</h4>
<form class="white" action="add.php" method="POST">
<label>Your Email</label>
<input type="text" name="email">
<label>Your Name</label>
<input type="text" name="name">
<label>Company</label>
<input type="text" name="company">
<div class="center">
<input type="submit" name="submit" value="Submit" class="btn brand z-depth-0">
</div>
</form>
</section>
</html>

I would appreciate any of your help, because the struggle has already taken three months.

from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/3ixlpj3
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.