I am trying to develop Facebook messenger chat bot. I have set my messenger and node server to talk with each other but when i try to send a message from messenger,after it reaches node server it tries to do merge action using node-wit library that in terms gives an error.
C:\Users\username\node_modules\node-wit\lib\wit.js:161 this.converse( ^ TypeError: Cannot read property 'converse' of undefined at C:\Users\username\node_modules\node-wit\lib\wit.js:161:13 at Object.actions.say.merge (C:\Users\username\messenger.js:147:5) at null. (C:\Users\username\node_modules\node-wit\lib\wit.js :230:22) at C:\Users\username\node_modules\node-wit\lib\wit.js:32:9 at process._tickCallback (node.js:355:11)
here is my code:
wit.runActions(
sessionId, // the user's current session
msg, // the user's message
sessions[sessionId].context, // the user's current session state
(error, context) => {
if (error) {
console.log('Oops! Got an error from Wit:', error);
} else {
// Our bot did everything it has to do.
// Now it's waiting for further messages to proceed.
console.log('Waiting for futher messages.');
// Updating the user's current session state
sessions[sessionId].context = context;
}
}
);