I am trying to get all the parameters at once in dialogflow using dialogflow-fulfillment library instead of using action-google.
Is it possible to do so?
My code is like -:
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));
let conv= agent.conv();
function welcome(agent) {
let date = new Date();
var curHr = date.getHours();
if(curHr.toString() < 12)
{
agent.add('Hello, Good Morning!');
}
else{
agent.add('Hello, Hope you are having good day!');
}
}
function fein(agent){
const fein = agent.parameters.fein;
const name = agent.parameters['business-name'];
conv.user.storage = {
fein: fein
};
agent.add(conv.user.storage.fein.toString());
}
But not able to fetch the output.
I am not sure I am doing it the right way, Please help how to get it done.