Skip to content

Conversation context gets lost when postback listener is set #193

@rrsilaya

Description

@rrsilaya

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions