botkit-messenger-express-demo icon indicating copy to clipboard operation
botkit-messenger-express-demo copied to clipboard

Cannot send message

Open deathg0d opened this issue 7 years ago • 4 comments

Trying to use this demo in my existing project with the latest Botkit. My 'facebook_optin' is working fine. But when I send any other message from facebook I get the following error:

TypeError: Cannot set property 'stage' of undefined at Object.Botkit.botkit.receiveMessage (... CoreBot.js:108:33)

Line 108 in CoreBot.js looks like the following:

botkit.receiveMessage = function(bot, message) {
        message._pipeline.stage = 'receive'; // <------------------- this is line 108
        botkit.middleware.receive.run(bot, message, function(err, bot, message) {
            if (err) {

deathg0d avatar Sep 24 '17 09:09 deathg0d

Same issue here when updating from ^0.5.2 → ^0.6.4 and using interactive buttons.

davidvexel avatar Oct 10 '17 22:10 davidvexel

@davidvexel I solved this by using controller.ingest(bot, facebook_message); instead of controller.receiveMessage(bot, message); Remember to use facebook_message and not facebook_message.message. Hope it works for you too.

deathg0d avatar Oct 11 '17 05:10 deathg0d

thanks @deathg0d, I'm using it on Slack, wondering if it's the same work around.

davidvexel avatar Oct 11 '17 18:10 davidvexel

Hey folks,

Just to let you know that

  1. I'm not actively maintaining that repo anymore
  2. Since Botkit, Slack API, FB API evolve very quickly, there is a high probability of obsolescence of some parts of the code.

=> If you find a solution to your issue, please consider a PR! I'll happily merge it. This repo is aimed at helping beginners, so let's make it better

mvaragnat avatar Oct 12 '17 07:10 mvaragnat