Check value into fulfillment dialogflow response The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow to check if PHP array is associative or sequential?How to Sort Multi-dimensional Array by Value?How do I check if a string contains a specific word?PHP array delete by value (not key)Fulfillment data dialogflow v2DialogFlow - Multiple fulfillment responses do not workDialogflow webhook fulfillment not returning responseDialogflow - Not getting response that is configured in the Fulfillment Inline EditorDialogflow fulfillment using HTTP responsesDialogflow Fulfillment: Fixing Chatbot Response
Does Parliament hold absolute power in the UK?
Sub-subscripts in strings cause different spacings than subscripts
different output for groups and groups USERNAME after adding a username to a group
Why can't wing-mounted spoilers be used to steepen approaches?
Can we generate random numbers using irrational numbers like π and e?
Are there continuous functions who are the same in an interval but differ in at least one other point?
Is 'stolen' appropriate word?
Presidential Pardon
Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time?
Identify 80s or 90s comics with ripped creatures (not dwarves)
Keeping a retro style to sci-fi spaceships?
Variable with quotation marks "$()"
What can I do if neighbor is blocking my solar panels intentionally?
Student Loan from years ago pops up and is taking my salary
How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time
Huge performance difference of the command find with and without using %M option to show permissions
Can withdrawing asylum be illegal?
University's motivation for having tenure-track positions
What do I do when my TA workload is more than expected?
Button changing its text & action. Good or terrible?
Can the DM override racial traits?
Why are PDP-7-style microprogrammed instructions out of vogue?
How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?
Accepted by European university, rejected by all American ones I applied to? Possible reasons?
Check value into fulfillment dialogflow response
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow to check if PHP array is associative or sequential?How to Sort Multi-dimensional Array by Value?How do I check if a string contains a specific word?PHP array delete by value (not key)Fulfillment data dialogflow v2DialogFlow - Multiple fulfillment responses do not workDialogflow webhook fulfillment not returning responseDialogflow - Not getting response that is configured in the Fulfillment Inline EditorDialogflow fulfillment using HTTP responsesDialogflow Fulfillment: Fixing Chatbot Response
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Im building a booking restaurant assistant with dialogflow.
I success make dialog and store the reservation info into mysql with a fulfillment php response. The problem is check the right reservation time (for example if a guest say 15.00 and restaurant is open only till 20.00.
thies my fulfillment php code:
header( 'Access-Control-Allow-Headers: *' );
header( 'Access-Control-Allow-Origin: *' );
header( "Access-Control-Allow-Credentials: true" );
header( 'Content-Type: application/json' );
include('../phpseclib/Net/SSH2.php');
include('../JOSE/JWT.php');
include('../JOSE/URLSafeBase64.php');
$postdata = file_get_contents( "php://input" );
$input = json_decode( $postdata, true );
$link = mysqli_connect('xxxxxxxxxx');
$intent = $input[ 'queryResult' ][ 'intent' ][ 'displayName' ];
$giorno = $input[ 'queryResult' ][ 'parameters' ][ 'giorno' ];
$oggi = substr($giorno, 5, 5);
$pieces = explode("-", $oggi);
$oggi = $pieces[1]." ".$mese;
$guest = $input['queryResult']['parameters']['guest'];
$tempo = $input['queryResult']['parameters']['time'];
$jwt_string = $input['originalDetectIntentRequest']['payload']['user']['idToken'];
$jwt = JOSE_JWT::decode($jwt_string);
file_put_contents('../public/filename.txt', print_r($jwt,true));
$myFile = "../public/filename.txt";
$lines = file($myFile);//file in to an array
$nome = str_replace("[name] => ", "", $lines[17]);
$telefono = str_replace("[email] => ", "", $lines[15]);
$query = "INSERT INTO quinto_prenota (COGNOME, RECAPITO, GIORNO, ORARIO, C_ADULTI, C_BAMBINI, ARRIVATI) VALUES ('".$nome."','".$telefono."','".substr($giorno, 0, 10)."','".substr($tempo, -14, 5)."','".$guest."','0','0')" or die("Error in the consult.." . mysqli_error($link));
$link->query($query);
mysqli_close($link);
$message = '<html><head><title>Benvenuto</title></head><body><h1 align="center">PRENOTAZIONE AVVENUTA!</h1><p>Gentile '.$nome.', ti confermiamo la prenotazione per '.$guest.' persone alle ore '.substr($tempo, -14, 5).' del giorno '.$oggi.'.</p><p>Ti preghiamo di essere puntuale o comunque di avvisarci in caso di ritardo al numero 06 3338768,<br>Grazie.</p><p align="center">www.ilquintoquarto.it</p></body></html>';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=utf-8';
$headers[] = "From: info@ilquintoquarto.itrn";
mail($telefono, 'Nuova prenotazione confermata al Quinto Quarto', $message, implode("rn", $headers));
$message = '<html><head><title>Prenotazione</title></head><body><h1 align="center">HAI UNA NUOVA PRENOTAZIONE</h1><p>Il Sig. '.$nome.' ha effettuato una prenotazione per '.$guest.' persone alle ore '.substr($tempo, -14, 5).' del giorno '.$oggi.'.</p><p align="center">www.ilquintoquarto.it/z</p></body></html>';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=utf-8';
$headers[] = "From: info@ilquintoquarto.itrn";
mail("info@ilquintoquarto.it", 'Nuova prenotazione da Assistant', $message, implode("rn", $headers));
echo "
'fulfillmentText': 'Grazie ".$nome.", ti confermo la prenotazione per ".$guest." persone alle ore ".substr($tempo, -14, 5)." del giorno ".$oggi.", abbiamo inviato una conferma al tuo indirizzo email! Per ogni variazione ti preghiamo di contattarci al numero 06 333 87 68 tutti i giorni dopo le ore 18.',
'fulfillmentMessages': [
'text':
'text':['Grazie ".$nome.", ti confermo la prenotazione per ".$guest." persone alle ore ".substr($tempo, -14, 5)." del giorno ".$oggi.", abbiamo inviato una conferma al tuo indirizzo email! Per ogni variazione ti preghiamo di contattarci al numero 06 333 87 68 tutti i giorni dopo le ore 18.']
],
'source':'webhook'
";
php dialogflow
add a comment |
Im building a booking restaurant assistant with dialogflow.
I success make dialog and store the reservation info into mysql with a fulfillment php response. The problem is check the right reservation time (for example if a guest say 15.00 and restaurant is open only till 20.00.
thies my fulfillment php code:
header( 'Access-Control-Allow-Headers: *' );
header( 'Access-Control-Allow-Origin: *' );
header( "Access-Control-Allow-Credentials: true" );
header( 'Content-Type: application/json' );
include('../phpseclib/Net/SSH2.php');
include('../JOSE/JWT.php');
include('../JOSE/URLSafeBase64.php');
$postdata = file_get_contents( "php://input" );
$input = json_decode( $postdata, true );
$link = mysqli_connect('xxxxxxxxxx');
$intent = $input[ 'queryResult' ][ 'intent' ][ 'displayName' ];
$giorno = $input[ 'queryResult' ][ 'parameters' ][ 'giorno' ];
$oggi = substr($giorno, 5, 5);
$pieces = explode("-", $oggi);
$oggi = $pieces[1]." ".$mese;
$guest = $input['queryResult']['parameters']['guest'];
$tempo = $input['queryResult']['parameters']['time'];
$jwt_string = $input['originalDetectIntentRequest']['payload']['user']['idToken'];
$jwt = JOSE_JWT::decode($jwt_string);
file_put_contents('../public/filename.txt', print_r($jwt,true));
$myFile = "../public/filename.txt";
$lines = file($myFile);//file in to an array
$nome = str_replace("[name] => ", "", $lines[17]);
$telefono = str_replace("[email] => ", "", $lines[15]);
$query = "INSERT INTO quinto_prenota (COGNOME, RECAPITO, GIORNO, ORARIO, C_ADULTI, C_BAMBINI, ARRIVATI) VALUES ('".$nome."','".$telefono."','".substr($giorno, 0, 10)."','".substr($tempo, -14, 5)."','".$guest."','0','0')" or die("Error in the consult.." . mysqli_error($link));
$link->query($query);
mysqli_close($link);
$message = '<html><head><title>Benvenuto</title></head><body><h1 align="center">PRENOTAZIONE AVVENUTA!</h1><p>Gentile '.$nome.', ti confermiamo la prenotazione per '.$guest.' persone alle ore '.substr($tempo, -14, 5).' del giorno '.$oggi.'.</p><p>Ti preghiamo di essere puntuale o comunque di avvisarci in caso di ritardo al numero 06 3338768,<br>Grazie.</p><p align="center">www.ilquintoquarto.it</p></body></html>';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=utf-8';
$headers[] = "From: info@ilquintoquarto.itrn";
mail($telefono, 'Nuova prenotazione confermata al Quinto Quarto', $message, implode("rn", $headers));
$message = '<html><head><title>Prenotazione</title></head><body><h1 align="center">HAI UNA NUOVA PRENOTAZIONE</h1><p>Il Sig. '.$nome.' ha effettuato una prenotazione per '.$guest.' persone alle ore '.substr($tempo, -14, 5).' del giorno '.$oggi.'.</p><p align="center">www.ilquintoquarto.it/z</p></body></html>';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=utf-8';
$headers[] = "From: info@ilquintoquarto.itrn";
mail("info@ilquintoquarto.it", 'Nuova prenotazione da Assistant', $message, implode("rn", $headers));
echo "
'fulfillmentText': 'Grazie ".$nome.", ti confermo la prenotazione per ".$guest." persone alle ore ".substr($tempo, -14, 5)." del giorno ".$oggi.", abbiamo inviato una conferma al tuo indirizzo email! Per ogni variazione ti preghiamo di contattarci al numero 06 333 87 68 tutti i giorni dopo le ore 18.',
'fulfillmentMessages': [
'text':
'text':['Grazie ".$nome.", ti confermo la prenotazione per ".$guest." persone alle ore ".substr($tempo, -14, 5)." del giorno ".$oggi.", abbiamo inviato una conferma al tuo indirizzo email! Per ogni variazione ti preghiamo di contattarci al numero 06 333 87 68 tutti i giorni dopo le ore 18.']
],
'source':'webhook'
";
php dialogflow
add a comment |
Im building a booking restaurant assistant with dialogflow.
I success make dialog and store the reservation info into mysql with a fulfillment php response. The problem is check the right reservation time (for example if a guest say 15.00 and restaurant is open only till 20.00.
thies my fulfillment php code:
header( 'Access-Control-Allow-Headers: *' );
header( 'Access-Control-Allow-Origin: *' );
header( "Access-Control-Allow-Credentials: true" );
header( 'Content-Type: application/json' );
include('../phpseclib/Net/SSH2.php');
include('../JOSE/JWT.php');
include('../JOSE/URLSafeBase64.php');
$postdata = file_get_contents( "php://input" );
$input = json_decode( $postdata, true );
$link = mysqli_connect('xxxxxxxxxx');
$intent = $input[ 'queryResult' ][ 'intent' ][ 'displayName' ];
$giorno = $input[ 'queryResult' ][ 'parameters' ][ 'giorno' ];
$oggi = substr($giorno, 5, 5);
$pieces = explode("-", $oggi);
$oggi = $pieces[1]." ".$mese;
$guest = $input['queryResult']['parameters']['guest'];
$tempo = $input['queryResult']['parameters']['time'];
$jwt_string = $input['originalDetectIntentRequest']['payload']['user']['idToken'];
$jwt = JOSE_JWT::decode($jwt_string);
file_put_contents('../public/filename.txt', print_r($jwt,true));
$myFile = "../public/filename.txt";
$lines = file($myFile);//file in to an array
$nome = str_replace("[name] => ", "", $lines[17]);
$telefono = str_replace("[email] => ", "", $lines[15]);
$query = "INSERT INTO quinto_prenota (COGNOME, RECAPITO, GIORNO, ORARIO, C_ADULTI, C_BAMBINI, ARRIVATI) VALUES ('".$nome."','".$telefono."','".substr($giorno, 0, 10)."','".substr($tempo, -14, 5)."','".$guest."','0','0')" or die("Error in the consult.." . mysqli_error($link));
$link->query($query);
mysqli_close($link);
$message = '<html><head><title>Benvenuto</title></head><body><h1 align="center">PRENOTAZIONE AVVENUTA!</h1><p>Gentile '.$nome.', ti confermiamo la prenotazione per '.$guest.' persone alle ore '.substr($tempo, -14, 5).' del giorno '.$oggi.'.</p><p>Ti preghiamo di essere puntuale o comunque di avvisarci in caso di ritardo al numero 06 3338768,<br>Grazie.</p><p align="center">www.ilquintoquarto.it</p></body></html>';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=utf-8';
$headers[] = "From: info@ilquintoquarto.itrn";
mail($telefono, 'Nuova prenotazione confermata al Quinto Quarto', $message, implode("rn", $headers));
$message = '<html><head><title>Prenotazione</title></head><body><h1 align="center">HAI UNA NUOVA PRENOTAZIONE</h1><p>Il Sig. '.$nome.' ha effettuato una prenotazione per '.$guest.' persone alle ore '.substr($tempo, -14, 5).' del giorno '.$oggi.'.</p><p align="center">www.ilquintoquarto.it/z</p></body></html>';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=utf-8';
$headers[] = "From: info@ilquintoquarto.itrn";
mail("info@ilquintoquarto.it", 'Nuova prenotazione da Assistant', $message, implode("rn", $headers));
echo "
'fulfillmentText': 'Grazie ".$nome.", ti confermo la prenotazione per ".$guest." persone alle ore ".substr($tempo, -14, 5)." del giorno ".$oggi.", abbiamo inviato una conferma al tuo indirizzo email! Per ogni variazione ti preghiamo di contattarci al numero 06 333 87 68 tutti i giorni dopo le ore 18.',
'fulfillmentMessages': [
'text':
'text':['Grazie ".$nome.", ti confermo la prenotazione per ".$guest." persone alle ore ".substr($tempo, -14, 5)." del giorno ".$oggi.", abbiamo inviato una conferma al tuo indirizzo email! Per ogni variazione ti preghiamo di contattarci al numero 06 333 87 68 tutti i giorni dopo le ore 18.']
],
'source':'webhook'
";
php dialogflow
Im building a booking restaurant assistant with dialogflow.
I success make dialog and store the reservation info into mysql with a fulfillment php response. The problem is check the right reservation time (for example if a guest say 15.00 and restaurant is open only till 20.00.
thies my fulfillment php code:
header( 'Access-Control-Allow-Headers: *' );
header( 'Access-Control-Allow-Origin: *' );
header( "Access-Control-Allow-Credentials: true" );
header( 'Content-Type: application/json' );
include('../phpseclib/Net/SSH2.php');
include('../JOSE/JWT.php');
include('../JOSE/URLSafeBase64.php');
$postdata = file_get_contents( "php://input" );
$input = json_decode( $postdata, true );
$link = mysqli_connect('xxxxxxxxxx');
$intent = $input[ 'queryResult' ][ 'intent' ][ 'displayName' ];
$giorno = $input[ 'queryResult' ][ 'parameters' ][ 'giorno' ];
$oggi = substr($giorno, 5, 5);
$pieces = explode("-", $oggi);
$oggi = $pieces[1]." ".$mese;
$guest = $input['queryResult']['parameters']['guest'];
$tempo = $input['queryResult']['parameters']['time'];
$jwt_string = $input['originalDetectIntentRequest']['payload']['user']['idToken'];
$jwt = JOSE_JWT::decode($jwt_string);
file_put_contents('../public/filename.txt', print_r($jwt,true));
$myFile = "../public/filename.txt";
$lines = file($myFile);//file in to an array
$nome = str_replace("[name] => ", "", $lines[17]);
$telefono = str_replace("[email] => ", "", $lines[15]);
$query = "INSERT INTO quinto_prenota (COGNOME, RECAPITO, GIORNO, ORARIO, C_ADULTI, C_BAMBINI, ARRIVATI) VALUES ('".$nome."','".$telefono."','".substr($giorno, 0, 10)."','".substr($tempo, -14, 5)."','".$guest."','0','0')" or die("Error in the consult.." . mysqli_error($link));
$link->query($query);
mysqli_close($link);
$message = '<html><head><title>Benvenuto</title></head><body><h1 align="center">PRENOTAZIONE AVVENUTA!</h1><p>Gentile '.$nome.', ti confermiamo la prenotazione per '.$guest.' persone alle ore '.substr($tempo, -14, 5).' del giorno '.$oggi.'.</p><p>Ti preghiamo di essere puntuale o comunque di avvisarci in caso di ritardo al numero 06 3338768,<br>Grazie.</p><p align="center">www.ilquintoquarto.it</p></body></html>';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=utf-8';
$headers[] = "From: info@ilquintoquarto.itrn";
mail($telefono, 'Nuova prenotazione confermata al Quinto Quarto', $message, implode("rn", $headers));
$message = '<html><head><title>Prenotazione</title></head><body><h1 align="center">HAI UNA NUOVA PRENOTAZIONE</h1><p>Il Sig. '.$nome.' ha effettuato una prenotazione per '.$guest.' persone alle ore '.substr($tempo, -14, 5).' del giorno '.$oggi.'.</p><p align="center">www.ilquintoquarto.it/z</p></body></html>';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=utf-8';
$headers[] = "From: info@ilquintoquarto.itrn";
mail("info@ilquintoquarto.it", 'Nuova prenotazione da Assistant', $message, implode("rn", $headers));
echo "
'fulfillmentText': 'Grazie ".$nome.", ti confermo la prenotazione per ".$guest." persone alle ore ".substr($tempo, -14, 5)." del giorno ".$oggi.", abbiamo inviato una conferma al tuo indirizzo email! Per ogni variazione ti preghiamo di contattarci al numero 06 333 87 68 tutti i giorni dopo le ore 18.',
'fulfillmentMessages': [
'text':
'text':['Grazie ".$nome.", ti confermo la prenotazione per ".$guest." persone alle ore ".substr($tempo, -14, 5)." del giorno ".$oggi.", abbiamo inviato una conferma al tuo indirizzo email! Per ogni variazione ti preghiamo di contattarci al numero 06 333 87 68 tutti i giorni dopo le ore 18.']
],
'source':'webhook'
";
php dialogflow
php dialogflow
asked Mar 8 at 12:23
DigitalXPDigitalXP
88416
88416
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063169%2fcheck-value-into-fulfillment-dialogflow-response%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063169%2fcheck-value-into-fulfillment-dialogflow-response%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown