Closed rewasa closed 7 years ago
now accept facebook hook the token
but now I've following error
TypeError: Cannot read property 'replace' of undefined
at fixer (/home/vcap/app/node_modules/node-red-contrib-chatbot/lib/facebook/messenger-bot.js:92:20)
at /home/vcap/app/node_modules/node-red-contrib-chatbot/lib/facebook/messenger-bot.js:111:36
at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at /home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:330:12)
at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:271:10)
at expressInit (/home/vcap/app/node_modules/node-red/node_modules/express/lib/middleware/init.js:33:5)
at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:312:13)
at /home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:330:12)
at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:271:10)
at query (/home/vcap/app/node_modules/node-red/node_modules/express/lib/middleware/query.js:44:5)
at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:312:13)
at /home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:330:12)
at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:271:10)
at Function.handle (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:176:3)
at EventEmitter.handle (/home/vcap/app/node_modules/node-red/node_modules/express/lib/application.js:173:10)
at mounted_app (/home/vcap/app/node_modules/node-red/node_modules/express/lib/application.js:229:10)
at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:312:13)
at /home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:330:12)
at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:271:10)
at expressInit (/home/vcap/app/node_modules/node-red/node_modules/express/lib/middleware/init.js:33:5)
at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:312:13)
at /home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:330:12)
at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:271:10)
at query (/home/vcap/app/node_modules/node-red/node_modules/express/lib/middleware/query.js:44:5)
at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:312:13)
at /home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:330:12)
at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:271:10)
at Function.handle (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:176:3)
at EventEmitter.handle (/home/vcap/app/node_modules/node-red/node_modules/express/lib/application.js:173:10)
at app (/home/vcap/app/node_modules/node-red/node_modules/express/lib/express.js:38:9)
at Server.<anonymous> (/home/vcap/app/node_modules/node-red/red.js:133:51)
at emitTwo (events.js:87:13)
at Server.emit (events.js:172:7)
at HTTPParser.parserOnIncoming (_http_server.js:537:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:97:23)
***************.eu-gb.mybluemix.net - [07/02/2017:10:04:16.041 +0000] "POST /redbot/facebook HTTP/1.1" 500 260 22 "-" "-" "***************:12427 x_forwarded_for:"***************" x_forwarded_proto:"https" vcap_request_id:17bf7619-e007-44eb-47a0-70dc63e0fef8 response_time:0.009849297 app_id:04836d9e-d154-48f2-8e44-3666f7192073 x_global_transaction_id:"3510339949"
@rewasa I'll check it, thanks for the feedback
Getting the same error, 'Error, wrong validation token' corrected when I restarted my Node.
Now receiving 'TypeError: Cannot read property 'replace' of undefined'. I shall try to debug it.
@thiagopromano I'm working on it
@thiagopromano @rewasa I've a fix for that, can you try this beta version (I've to fix more bugs before a release)
npm install node-red-contrib-chatbot@0.6.20-beta-1
Thanks for the feedback
I ran some tests and req.body is undefined.
I had the same problem in another project where I was missing to use a Body Parser Middleware such as body-parser.
Isn't it better to use RED.httpNode.get() and RED.httpNode.post() like https://github.com/node-red/node-red/blob/0a96259ddfacb10713d1419c155b40123dc54100/nodes/core/io/21-httpin.js to set the listeners?
I'll try the beta. Thanks!
No good, req.body is still undefined.
Now receiving
TypeError: Cannot read property 'entry' of undefined at Bot._.extend._handleMessage (/home/vcap/app/node_modules/node-red-contrib-chatbot/lib/facebook/messenger-bot.js:129:23)
I'm pretty sure it has to do with a missing body-parser.
Thanks!
same problem with Heroku. When I view the log, the Facebook web hook URL shows up something like Webhook URL: http://localhost:30595/redbot/facebook.
@thiagopromano ok I've cleaned up the code, I was able to verify the token in my local machine, can you try this?
npm install node-red-contrib-chatbot@0.6.20-beta-2
@thiagopromano released node-red-contrib-chatbot@0.6.20
I've this message on site https://*****/redbot/facebook
but token, access token and app secret in Facebook Receiver is correct. Redbot runs on a bluemix host.