bootbot
bootbot copied to clipboard
Conversation context gets lost when postback listener is set
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?