Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation context gets lost when postback listener is set #193

Open
rrsilaya opened this issue Aug 16, 2020 · 0 comments
Open

Conversation context gets lost when postback listener is set #193

rrsilaya opened this issue Aug 16, 2020 · 0 comments

Comments

@rrsilaya
Copy link

Hi. I have code like this:

chat.conversation((convo) => {
  function handlePaginatedMessage(convo) {
    // ...
    const chunk = 'long message';
    const dialog = {
      text: chunk,
      buttons: [{
        type: 'postback',
        title: 'Read More',
        payload: 'READ_MORE',
      }]
    };

    const callbacks = [{
      event: 'postback:READ_MORE',
      callback: () => {
        // code here
      },
    }];

    convo.ask(dialog, () => {}, callbacks);
  }

  handlePaginatedMessage(convo);
});

I also have a listener to postback events i.e.:

bot.on('postback', callback);

However, after the bot asks the user, the context gets lost and the postback goes with the global postback listener instead of the conversation callbacks.

Am I doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant