samedi 2 novembre 2019

DialogFlow if statement conv.ask in app.intent

i want to run this code in dialogflow ,basically i want to use if condition for example. if my intent one having text response ="xyz" then i want to ask "abc" in another intent

'use strict';

// Import the Dialogflow module from the Actions on Google client library.
const {dialogflow} = require('actions-on-google');

// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');

// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});

 var numr=0;
  app.intent('done',(conv,output)=>{
if(conv.ask ==='Now add 2 more, and say got it')
{numr=1;
return numr;}
 else (conv.ask ==='Now add 4 more, and say got it')
{numr=2;
return numr;}   

      });
   app.intent('Alright',(conv)=>{
         conv.close('your number is '+ numr);
      });



// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

Aucun commentaire:

Enregistrer un commentaire