How can I reset or clear the context at the end of my story or when the user wants to restart the process ? I already have a reset function of my own ... Not very effective ! Can you please explain me what I have to do ? Thank you very much
reset({sessionId,context}) {
return new Promise(function(resolve, reject) {
context = null;
return resolve(context);
});
}
And for the session, I do that :
var findOrCreateSession = (fbid) => {
let sessionId;
Object.keys(sessions).forEach(k => {
if (sessions[k].fbid === fbid) {
sessionId = k;
}
});
if (!sessionId) {
console.log("je cree une session car yen a pas");
sessionId = new Date().toISOString();
sessions[sessionId] = {
fbid: fbid,
context: {}
};
}
return sessionId;
};
How can I kill the session at the end of the story and/or kill context and reset the process please !