我正在尝试开发Facebook Messenger聊天机器人。我已经设置了我的信使和节点服务器以便彼此交谈,但是当我尝试从信使发送消息时,在它到达节点服务器之后,它尝试使用node-wit库进行合并操作,这在术语中给出了错误。
C:\ Users \用户名\ node_modules \节点的智慧\ lib中\ wit.js:161 this.converse( ^ TypeError:无法读取undefined的属性'converse' 在C:\ Users \ username \ node_modules \ node-wit \ lib \ wit.js:161:13 at Object.actions.say.merge(C:\ Users \ username \ messenger.js:147:5) 在null。 (C:\ Users \用户名\ node_modules \节点的智慧\ lib中\ wit.js :230:22) 在C:\ Users \ username \ node_modules \ node-wit \ lib \ wit.js:32:9 at process._tickCallback(node.js:355:11)
这是我的代码:
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;
}
}
);
答案 0 :(得分:0)
尝试将节点升级到版本6.这是与版本相关的问题。让我知道升级后它是否正常工作。