Giter VIP home page Giter VIP logo

botkit-messenger-express-demo's People

Contributors

mvaragnat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

botkit-messenger-express-demo's Issues

Cannot send message

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) {

not getting any result while using conversation ?

Simple here is working fine but when I am using conversation not getting any attachment response on
messenger.

This is what I was trying

    controller.hears(["location"], "message_received", function(bot, message) {

        bot.startConversation(message, function(err, convo) {

            convo.ask({
                text: "Where are you honey?",
                quick_replies: [{
                    "content_type": "location",
                }]
            }, function(response, convo) {
                if (response.attachments[0].type == "location") {
                    coordinates = response.attachments[0].payload.coordinates;
                    //responseStore.toDatabase('Location', coordinates, response);
                    convo.say("got it, latitude" + response.attachments[0].payload.coordinates.lat + "and longitude" + response.attachments[0].payload.coordinates.lat);
                    //aTopic(response, convo);
                } else {
                    convo.say("no no no");
                    //anotherTopic(response, convo);
                }
                convo.next();
            });
        });
    }); 

I am doing anything wrong ?

or can you please suggest some of the best solutions for using custom express server with botkit framework?

quick replies not supported

In simplifying the botkit.js file I believe you have dropped support for quick_replies. Any idea of adding this back or should I do it?

No handler for conversationStarted

I am using WIT with Howdy. Trying to test a simple 'greeting' intent with botkit and the botkit fails with 'No handler for conversationStarted' message at 'botkit/lib/CoreBot.js:808 worker.send(message, cb);'

I am able to get the intent right from WIT and what I want to do is to ask the user his/her name.

controller.hears([greetingEntityName], 'message_received', wit.hears, function (bot, message) {
controller.storage.users.get(message.user, function(err, user) {
if (user && user.name) {
bot.reply(message, 'Hi ' + user.name + '. Welcome!');
} else {
bot.startConversation(message, function(err, convo) {
if(!err) {
convo.say('Hi There!');
convo.ask('What is your name?', function(response, convo){
console.log(response);
convo.next();
}, {'key':'nickname'});

                convo.on('end', function(convo) {
                    if (convo.status == 'completed') {
                        bot.reply(message, 'OK');
                    } else {
                        bot.reply(message, 'Not OK');
                    }
                }); 
            }                    
        });
    }
});

});

Routing Question

You are using routes in this demo like you would use routing if you were serving files on a typical web site. How does the routing work inside messenger? Can you elaborate on what the routes do?

TypeError: Cannot read property 'length' of undefined

// this function processes the POST request to the webhook
var handler = function(obj) {
controller.debug('Message received from FB')
var message
if (obj.entry) {
for (var e = 0; e < obj.entry.length; e++) {
for (var m = 0; m < obj.entry[e].messaging.length; m++) {
var facebook_message = obj.entry[e].messaging[m]
// /console.log(facebook_message)
// normal message
if (facebook_message.message) {
message = {
text: facebook_message.message.text,
user: facebook_message.sender.id,
channel: facebook_message.sender.id,
timestamp: facebook_message.timestamp,
seq: facebook_message.message.seq,
mid: facebook_message.message.mid,
attachments: facebook_message.message.attachments
}
....
...

I don't know why length is coming zero at obj.entry[e].messaging.length;

I am regularly getting this error message while receiving request from Facebook
'
Is there an issue with custom code or botkit framework ?

Conversation does not move on

Hello,

I implemented the demo and slightly modified it (eg. use messenger_profile API). Now I wanted to make the Cookie-Example from Botkit work. It looks like this:

module.exports = function(controller) {

  controller.hears(['cookies'], 'message_received', function(bot, message) {

      bot.startConversation(message, function(err, convo) {

          convo.say('Did someone say cookies!?!!');
          convo.ask('What is your favorite type of cookie?', function(response, convo) {
              convo.say('Golly, I love ' + response.text + ' too!!!');
              convo.next();
          });
      });
  });

};

Once I write something like "Give me cookies". I get the "Did someone say cookies!?!!!" response. But then it does not move on to the next convo.ask.

I got this in the terminal:

TypeError: Cannot read property 'mids' of undefined
    at Object.<anonymous> (/botkit/node_modules/botkit/lib/Facebook.js:19:49)

When I comment controller.trigger('message_delivered', [bot, message]) out from the botkit.js file the TypeError is gone but the convo does not move on.

Can anybody help me?

conversation not working

debug: GOT A MESSAGE HOOK
{ sender: { id: '1115548341849219' },
  recipient: { id: '944059262358972' },
  timestamp: 1466237246219,
  message:
   { mid: 'mid.1466237246212:73a893daf6ed018644',
     seq: 3608,
     text: 'structured' } }
debug: RECEIVED MESSAGE
debug: CUSTOM FIND CONVO 1115548341849219 1115548341849219
debug: I HEARD [ 'structured' ]
info: [Start]  0  Task for  1115548341849219 in 1115548341849219
debug: CREATED A CONVO FOR 1115548341849219 1115548341849219
info: >   [Start]  0  Conversation with  1115548341849219 in 1115548341849219
debug: No handler for conversationStarted
debug: WEBHOOK SUCCESS {"recipient_id":"1115548341849219","message_id":"mid.1466237247342:164bf9399321b86037"}
debug: WEBHOOK SUCCESS {"recipient_id":"1115548341849219","message_id":"mid.1466237247358:d729042da9662abb97"}

conversation get started but then convo.ask does not give any result.

controller.hears(['structured'], 'message_received', function(bot, message) {
    bot.startConversation(message, function(err, convo) {

        convo.ask({
            attachment: {
                'type': 'template',
                'payload': {
                    'template_type': 'generic',
                    'elements': [
                        {
                            'title': 'Classic White T-Shirt',
                            'image_url': 'http://petersapparel.parseapp.com/img/item100-thumb.png',
                            'subtitle': 'Soft white cotton t-shirt is back in style',
                            'buttons': [
                                {
                                    'type': 'web_url',
                                    'url': 'https://petersapparel.parseapp.com/view_item?item_id=100',
                                    'title': 'View Item'
                                }
                            ]
                        }
                    ]
                }
            }
        }, function(response, convo) {
            convo.next();
        });
    });
});

@mvaragnat

Does this support work with the lastest version botkit and does it support all the facebook api

Hello,

I would like to use express.js to build my bot using botkit; the problem is I don't know how to proceed. At first I was thinking to use express I will just have to install it in my botkit project and use it as normal node.js app and that's all; but with what the first issue is describing as problem, it sounds like to have botkit project work with express there a lot to configure and also features problem.

Help me understand how I can use express with botkit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.