Coder Social home page Coder Social logo

Persistent menu problem about bootbot HOT 32 CLOSED

charca avatar charca commented on May 13, 2024 3
Persistent menu problem

from bootbot.

Comments (32)

temrysh avatar temrysh commented on May 13, 2024 4

@pferdefleisch
It is a facebook issue, lots of bots affected.

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024 3

In response to your ps., you may just be subscribed to a bunch of different callbacks.
The two most interesting ones for most bots would be message and message_postbacks. You set them up in your app settings under Messenger / Settings / Webhooks / Edit events.
https://developers.facebook.com/docs/messenger-platform/webhook-reference#setup

For example, there is a callback that hits your webhook on delivery, when the message is read and one (called message_echoes) that responds with the message you sent every time. So if you have all of those on, that sounds like about 4 requests per message.

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024 3

@pferdefleisch, I know that deleting the conversation fixes it, but in case of real users using the bot, you understand that this is not a solution.

from bootbot.

temrysh avatar temrysh commented on May 13, 2024 3

https://developers.facebook.com/bugs/643632455833864

Hi all,

The postback issue should only happen right after updating your persistent menus.

After calling POST /messenger_profile, the menu is updated on our backend. However, it takes time for the changes to propagate to our client side (unless it you delete and enter the thread again). Therefore, when users tap on it, they are triggering mutation calls on stale data, which we throw exceptions.

This is the major reason for postback failures according to our logs. Please let me know if you're experiencing it in other cases.

Abby

from bootbot.

missym-pt avatar missym-pt commented on May 13, 2024 3

Hi, dont know if Im posting my question in the right place (im just a junior). Im having a problem with a postback button in a persistent menu. It only works one time, and then it stops responding untill the page gets refreshed. Im using fbmq (https://github.com/conbus/fbmq) but I dont think the problem is my code now because after trying almost every solution I found, i was inspecting the network requests in the browser, and the first time the button is clicked, the request to "https://www.facebook.com/messages/commerce/postback/?cta_id=...=&dpr=1" responds ok 200 but after that and until the browser is refreshed the exact same request gets 500 Internal Server Error and theres a facebook error page in response tab. Can someone please confirm me if this is really a facebook problem?
Thank u so much.

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024 2

I am using a persistent menu in a different application in a different language and I rolled the response handlers without a framework and I am not receiving postbacks from the persistent menu. Not even to my local tunnel.

I don't know if your issue is a facebook bug, but my previous issue and current one definitely are facebook bugs. :/

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024 1

Are you folks sure you're following this?
persistent_menu_-_messenger_platform

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024 1

@giacomocerquone that's quite a jump in logic.

I'll be working on bots quite a bit more in the near future and I'll try to add something to at least make this easier to debug. I am still really leaning on this being a Facebook issue. Was just talking to a friend who built a bot for Pioneers fest that is having a ton of persistent menu problems. He was making the same arguments as @sotirelisc here.

Adding some kind of logging of request body here would be my first step.

I hope I get time and we can close this soon. I also hope @giacomocerquone is right and it's a bootbot bug because the alternative is pretty crap.

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024

Hello, I've been having the same issue for some days now and been struggling to find a legit reason. The only way to correct it is to delete the conversation on Messenger and start all over. It's okay for me, but I can't have my users do it every time. Maybe it's a Facebook problem?

from bootbot.

giacomocerquone avatar giacomocerquone commented on May 13, 2024

Yeah I thought it too, but as I said other bots don't have this problem so I don't know...
You have the app deployed on heroku too?

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024

@giacomocerquone, sorry for the late response. Yes, it's on Heroku.

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024

I also had a strange issue where my persistent menu postbacks weren't being captured. I was running an ngrok local tunnel.
I couldn't even catch them on bot.on("postback", (payload, chat) => {

I finally fixed it by copy pasting a @Charca's sample menu code. This means that either:

  • I had a typo (but there were three keywords that could have been misspelled, all short and I looked at them 20 times)
  • There is a problem in the bootbot persistent menu creation code (very, very unlikely)
  • There is a random bug in the way incoming postbacks are handled (even less likely)
  • FB has a bug in the way they handle the creation of persistent menus and there was some kind of latency bug, who knows...

I am leaning on the last one because I have been using the platform for a bit and have had strange random bugs with things like Get Started which uses a similar API. The platform is full of strange bugs as you can see if you ever try to change your webhook... and this smells like one of them.

I know this is speculation and may not add to the discussion, and unfortunately I was participating in a bot hackathon and didn't have time to really get to the bottom of the issue.

from bootbot.

giacomocerquone avatar giacomocerquone commented on May 13, 2024

Correct for the subscription to different callbacks set up on developers.facebook.com.

Regarding the main issue here, thanks for your contribution! I actually forgot to post the code but I did subscribed to bot.on("postback", (payload, chat) => { too (and used a regex inside) but our problems are not actually the same.
If I understood correctly, in your situation no callback was being called while to me and @sotirelisc randomly sometimes it doesn't work, sometimes it works only on pc and not in messenger and sometimes it just works.

I'd say it's a facebook problem, but I don't get why other bots don't have it (verified on this one) or maybe it's just facebook that when the bot is not published insert it in some sort of a low priority queue (just saying random sh*t 😆).

The way I will test this situation is:

  1. Tunneling the app and see what happens
  2. If above doesn't work too, I'll roll out, through express, the shortest script possible that plays directly with the facebook api and set up a menu

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024

@giacomocerquone, I will try to run some tests, too. I'm afraid Heroku has something to do with this. Free sleeping dyno, right?

from bootbot.

giacomocerquone avatar giacomocerquone commented on May 13, 2024

@sotirelisc Right, I do believe it too anyway

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024

@giacomocerquone, do you have nested persistent menu items? If so, can you verify that the issue exists only at the non-nested items?

from bootbot.

giacomocerquone avatar giacomocerquone commented on May 13, 2024

@sotirelisc My persistent menu is not nested!
Ps. sorry If I still haven't tested anything but I'm very very busy lately

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024

@giacomocerquone, when you find time, try adding a nested item. Check if the problem doesn't exist there.

from bootbot.

giacomocerquone avatar giacomocerquone commented on May 13, 2024

Yes, I read it and I've always used the button like this:
bot.setGetStartedButton((payload, chat) => { chat.say('Welcome to BootBot. What are you looking for?'); });

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024

Try to delete the conversation in your messenger client.
My persistent menu postbacks started working after I did that. Very unsatisfying fix.

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024

@pferdefleisch, so you're saying this is more likely a Facebook issue?

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024

Yes. I think it is most likely a Facebook issue. With the fixes being:

  • Make sure you add a get started button before your menu
  • Delete the conversation with the bot and reconnect with it
  • Do this from the page, not https://m.me or your app
  • Try to delete the menu with deletePersistentMenu and add it back again. Probably do this with get started too.

I don't remember if you can see what the responses are for these functions, but facebook will send you a 400 if your request is malformed. Make sure you're getting 200's back.

If all of this happens and you still have issues, report back here!

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024

I haven't run into this on something in the wild so, if it is a Facebook bug, I don't know how making it work on one conversation would affect other conversation with other users. This is all speculation. I have only run into this in a staging/dev environment luckily so that's as far as my experience goes.

Maybe I was overly optimistic when I wrote "fixes". What I meant was "This is what I have done in staging/dev to fix this problem when I was the only user interacting with the bot"

from bootbot.

Jimlnth avatar Jimlnth commented on May 13, 2024

I don't know for sure, but it seems to me that this problem could be related to Convo. On some bots I created previously without any conversation (by using Convo I mean), the menu buttons are working perfectly fine. In the bot I'm working on atm, I used the conversations and I have the same problem that @giacomocerquone described. Are you in the same case or am I misled ?

Besides, I observed some wierd pattern to "workaround" this bug. As soon as I am changing anything in the code and updating the bot - I mean, a CTRL+S with Nodemon - the buttons will immediately stop working. If I refresh the facebook page or messenger (just refreshing it, not deleting the conversation) then the buttons are working again.

Feel free to tell me if I'm wrong somewhere but these are my observations until now. I'm working with ngrok.

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024

@Jimlnth I've had issues, even without using conversations and even in another framework I'm working on in another language.

Maybe what you're referring to is related to #24

I would much rather it be a bootbot bug though, because then we could fix it, so any more info you have, steps, etc, would be greatly appreciated.

from bootbot.

Jimlnth avatar Jimlnth commented on May 13, 2024

Well, could be. I doubt it because in my case the buttons are not working even before I start a conversation (given that I changed the code without refreshing the page) and because I am not even trying to use the menu buttons during a conversation but rather before or after.

As I said, besides my feedback I don't have a lot more to say. My previous bots were built on the same environment and are still working cool. The only thing different here for me is the addition of Convo (that's why I am looking at him with suspicious eyes, but of course I could be wrong). I still doubt it's really a facebook bug because I tried some bots on messenger and the menu buttons are working, even with Convo-like features.

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024

@Charca, have you not been around lately?

from bootbot.

Charca avatar Charca commented on May 13, 2024

Sorry folks, I'm in the middle of moving to another country and I couldn't really follow up with the issues. I've been following this convo and it was my understanding that this was a problem with Facebook's Webhook API, right? It doesn't seem to be the same thing as #24 (which is an actual Bootbot bug).

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024

@Charca, it's still not certain that it is 100% a Facebook issue. Personally, I haven't come across this problem in other bots. As I stated before, in my case, it doesn't happen on nested persistent menu items, only on the standalones.

from bootbot.

sotirelisc avatar sotirelisc commented on May 13, 2024

An easy workaround I found: Make every item on your persistent menu nested. Tested and works!

from bootbot.

giacomocerquone avatar giacomocerquone commented on May 13, 2024

@sotirelisc if this is true then it's likely a bootbot problem (and I hope so honestly, I don't know how much time it would take for facebook developers to fix it)

from bootbot.

mraaroncruz avatar mraaroncruz commented on May 13, 2024

Closing this issue and linking to it in the new Troubleshooting section (coming soon).

from bootbot.

Related Issues (20)

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.