I am having a problem when testing my Google Assistant app (made in DialogFlow). Every time I run the first intent and satisfy the criteria to run the corresponding action, the assistant ends and doesn't allow the user to input a value that may trigger the follow-up intent. The microphone is closed every time instead of continuing the conversation.
Is there a way to set up intents and corresponding webhook to ensure the app doesn't close itself every time a single action is completed?
'use strict';
process.env.DEBUG = 'actions-on-google:*';
const App = require('actions-on-google').DialogflowApp;
const functions = require('firebase-functions');
// x. start custom code
const orderLists = [
{
reference: '0',
clothing: ['shirt', 'top', 'bra'],
deliveryStatus: 'will be delivered before 1pm, make sure youre in!'
},
{
reference: '1',
clothing: ['shirt', 'top', 'bra'],
deliveryStatus: 'is due for delivery on February 2nd.'
},
{
reference: '2',
clothing: ['shirt', 'top', 'bra'],
deliveryStatus: 'is due for delivery on February 3rd.'
},
{
reference: '3',
clothing: ['shirt', 'top', 'bra'],
deliveryStatus: 'was delivered today at 2pm to your default address.'
},
{
reference: '4',
clothing: ['shirt', 'top', 'bra'],
deliveryStatus: 'was left with your neighbour at 22 Waltham Drive, today at 2pm.'
}
]
// a. the action name from the make_name Dialogflow intent
// const NAME_ACTION = 'make_name';
const NAME_ACTION = 'query_order';
const NAME_ACTION2 = 'query_order.query_order-more';
// b. the parameters that are parsed from the make_name intent
// const COLOR_ARGUMENT = 'color';
// const NUMBER_ARGUMENT = 'number';
const ORDERNUMBER_ARGUMENT = 'number';
const min = 0;
const max = 10;
exports.sillyNameMaker = functions.https.onRequest((request, response) => {
const app = new App({request, response});
console.log('Request headers: ' + JSON.stringify(request.headers));
console.log('Request body: ' + JSON.stringify(request.body));
// c. The function that generates the silly name
function queryOrder (app) {
let number = app.getArgument(ORDERNUMBER_ARGUMENT);
app.tell('Order number '+ number + ', ' + orderLists[number].deliveryStatus) + 'Would you like to know more?';
}
function queryOrderItems (app) {
let number = app.getArgument(ORDERNUMBER_ARGUMENT);
app.tell('Order number '+ number + ', ' + orderLists[number].clothing);
}
// d. build an action map, which maps intent names to functions
let actionMap = new Map();
actionMap.set(NAME_ACTION, queryOrder);
let actionMap2 = new Map();
actionMap2.set(NAME_ACTION2, queryOrderItems);
app.handleRequest(actionMap);
app.handleRequest(actionMap2);
});