jgorset / facebook-messenger

Definitely the best way to make Bots on Facebook Messenger with Ruby
MIT License
962 stars 211 forks source link

res.send(200) not sent for stickers #197

Closed samt07 closed 6 years ago

samt07 commented 6 years ago

Hi all

I am developing a bot using nodejs on fb messenger. While testing it, I found that when a user sends a sticker, the facebook messenger sends that message as attachments with sticker_id key. After parsing that message, when I send the res.send(200), facebook doesn't seem to recognize it. Does anyone know how to fix this issue?

server.post('/', (req, res, next) => {
  f.incoming(req, res, msg => { //this function parses the input message from facebook and returns message object and sender id
    const {
      message,
      sender
    } = msg
    console.log(msg); //this gets printed with message object which includes the sticker_id and sender id
    if(message.text) {
            f.txt(sender, 'Hi there');
        }else {
            console.log('we are in else block..');
            f.txt(sender, `I couldn't get you. Sorry :(`);
      }
  });
        res.send(200);//this is not working
    return next();
});
jgorset commented 6 years ago

Hi @samt07! These are issues for a Ruby gem, so you'll probably have more luck asking this at StackOverflow.