Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Webex adapter: Allow dialogs in threads #2198

Merged
merged 1 commit into from
Mar 23, 2022
Merged

Conversation

monzonj
Copy link
Contributor

@monzonj monzonj commented Feb 13, 2022

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):
image

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);
    });

@jmcombs
Copy link

jmcombs commented Mar 8, 2022

I wish they'd review and approve this already.

@benbrown benbrown self-assigned this Mar 23, 2022
@benbrown
Copy link
Contributor

hi @jmcombs and @monzonj! Sorry for the delay. I'll work on getting this rolled into a release.

@benbrown benbrown merged commit a9e0052 into howdyai:main Mar 23, 2022
@benbrown
Copy link
Contributor

This has been published!

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants