Currently, there is a bug that prevents dialogs to function properly in threads (webex adapter). This PR adds the missing parentId to the conversationID, so bottkit can recover the conversation and continue with the dialog
Example (this dialog can only happen after applying this PR, otherwise it stops at the first question):
Code for the example:
const MY_DIALOG_ID = 'my-dialog-name-constant';
const convo = new BotkitConversation(MY_DIALOG_ID, controller);
convo.say('Howdy!');
convo.ask('What is your name?', async(response, convo, bot) => {
console.log(`user name is ${ response }`);
}, 'name');
convo.addAction('favorite_color');
convo.addMessage('Awesome {{vars.name}}!', 'favorite_color');
convo.addQuestion('Now, what is your favorite color?', async(response, convo, bot) => {
console.log(`user favorite color is ${ response }`);
},'color', 'favorite_color');
convo.addAction('confirmation' ,'favorite_color');
convo.addQuestion('Your name is {{vars.name}} and your favorite color is {{vars.color}}. Is that right?', [
{
pattern: 'no',
handler: async(response, convo, bot) => {
await convo.gotoThread('favorite_color');
}
},
{
default: true,
handler: async(response, convo, bot) => {
}
}
], 'confirm', 'confirmation');
controller.addDialog(convo);
controller.hears("start a thread", 'message', async(bot, message) => {
await bot.startConversationInThread(message.channel, message.user, message.parentId || message.id);
await bot.beginDialog(MY_DIALOG_ID);
});
Currently, there is a bug that prevents dialogs to function properly in threads (webex adapter). This PR adds the missing parentId to the conversationID, so bottkit can recover the conversation and continue with the dialog
Example (this dialog can only happen after applying this PR, otherwise it stops at the first question):
Code for the example: