I'm creating a dialogflow bot, for the fulfillment of the bot I am using a node server (on google cloud functions) to retrieve data through a function returning a promise
I've tried adding a agent.setFollowupEvent('ExtendTimeOut');
because I read here that this would extend the timeout (of 5 secs)
but I don't really know where to put it and it doesn't seem to work.
I'm currently using the db.collection("details").where("keywords", "array-contains", keyword)
to retrieve data from Firestore
DB Structure:
users
|__> userID
|__> user properties
|__> [Array of keywords (ex. fifa, gta, etc)]
Dialogflow fulfillment function:
function GetUserDetails(agent) {
var keyword = agent.parameters.any //keyword to search for
return new Promise( function( resolve, reject ){
db.collection("details").where("keywords", "array-contains", keyword)
.get()
.then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
console.log("Contact data:", doc.data());
agent.add("these are the user details for " + doc.data()["name"]));
agent.add(doc.data()["username"]);
agent.add(doc.data()["useremail"]);
});
resolve()
})
.catch(function(error) {
reject( error );
console.log("Error getting documents: ", error);
});
});
}
let intentMap = new Map();
intentMap.set('GetUserDetails', GetUserDetails);;
agent.handleRequest(intentMap);
Does anyone know how to speed up the data retrieval or extend this timeout?