1

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;
      }
    }
  );
hussein shaib
  • 108
  • 1
  • 9
  • 1
    The reason you don't get an answer is because it's not possible to understand how your app works. Also your code snippet is 1:1 copied from a working tutorial. So your problem have to be at another position. – Ernst Robert Apr 27 '16 at 23:58

1 Answers1

0

Try upgrading your node to version 6. It is a version related problem. Let me know if it works fine after upgrading.

Amit Kumar
  • 51
  • 4