botmasterai / botmaster-fulfill

a text-friendly way to integrate actions with your bot. Supply an object of action-functions that can return synchronously or asynchronously and replace text in the response, generate new responses, or do what the response claims to do.
MIT License
4 stars 2 forks source link

Buttons seemingly randomly appear or not when on Messenger on iOS #11

Open duncsand opened 7 years ago

duncsand commented 7 years ago

My buttons action is:

buttons: {
    controller: (params, next) => {
        const buttonTitles = params.content.split(',');
        next().then(() => {
            params.bot.sendDefaultButtonMessageTo(buttonTitles, params.update.sender.id, 'Please select an option or type in your own');
        });
        return '';
    },
},

When I send it the following:

Hello\one,two\

then the buttons seemingly randomly appear or not in Messenger on iOS. It seems more reliable on the web - but more often than not it fails in Messenger on mobile. There's a weird graphical glitch when the messages do appear that makes me suspicious it's a timing issue.

I know that Messenger will ignore quick-reply buttons by design if you send another message after they've been displayed. This makes sense - the quick-reply don't persist past new messages. I suspect that the hello or 'please select an option' messages are getting to Messenger after the button message and therefore the buttons get removed.

NOTE: I originally thought this was related to use of the \ tag, but I've not verified the issue occurs without that tag.