I have a very simple action that just gives me some status and then I want to end it, no conversation, nothing else, just get the status and end it. Right now I'm doing this:
agent.add(message1);
agent.add(message2);
agent.end('done');
I've also tried (as you'll see on the code below just doing agent.end(completeMessage); but assistant keeps waiting for me to do more, my action doesn't end.
I've made a totally simple sample to demostrate, test intent is the one that has the end() call:
Code:
'use strict';
const functions = require('firebase-functions');
const { WebhookClient } = require('dialogflow-fulfillment');
const { Card, Suggestion } = require('dialogflow-fulfillment');
const fetch = require("node-fetch");
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
function welcome(agent) {
agent.add(`Welcome to my agent!`);
}
function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}
function testIntent(agent) {
agent.end('done');
}
intent name
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('test intent', testIntent);
agent.handleRequest(intentMap);
});
Anyone have any ideas of how I can make my action just totally end when I called test intent?
