javascript - Storing user response in a variable - facebook messenger bot js -


i'm working on node.js facebook messenger bot , need store user response message bot sends called later, presumably through use of variable.

// defines 'text' message sent user let text = event.message.text  // if user's text contains 'savings', 'saving', 'calculator', or 'calculator, following conditions occur: if (text.search("saving") >= 0 || text.search("saving") >= 0 || text.search("calculator") >= 0 || text.search("calculator") >= 0) {     sendtextmessage(sender, "how save?");     // here want store response how money user wants save } 

any appreciated!

the simplest thing store in object psid key:

let cache[psid] = value;

the problem using variable isn't particularly stable. if node process crashes lose cache. should ideally use external key value store. redis option that's super easy , running.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -