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

BotkitConversation ignores {type: typing} messages #1646

Closed
benbrown opened this issue May 8, 2019 · 1 comment
Closed

BotkitConversation ignores {type: typing} messages #1646

benbrown opened this issue May 8, 2019 · 1 comment
Labels
4.0.2 this issue will be addressed in 4.0.2 bug Web-related
Milestone

Comments

@benbrown
Copy link
Contributor

benbrown commented May 8, 2019

The BotkitConversation class has a few issues that prevent non-message type events from passing through.

First of all, messages without text or attachments are ignored. Need to fix this, at least, to also allow messages with a type set:
https://github.com/howdyai/botkit/blob/master/packages/botkit/src/conversation.ts#L657

Second, the makeOutgoing method does not currently copy forward the type field.
https://github.com/howdyai/botkit/blob/master/packages/botkit/src/conversation.ts#L787

@benbrown benbrown added bug 4.0.2 this issue will be addressed in 4.0.2 labels May 8, 2019
@benbrown benbrown added this to the 4.0.2 milestone May 8, 2019
@benbrown
Copy link
Contributor Author

benbrown commented May 8, 2019

Once resolved, the WebAdapter typing feature can be used in a BotkitConversation like this:

    let typing = new BotkitConversation('typing', controller);

    typing.say('I am going to type for a while now...');
    typing.addAction('typing');

    // start the typing indicator
    typing.addMessage({type: 'typing'}, 'typing');
    // trigger a gotoThread, which gives us an opportunity to delay the next message
    typing.addAction('next_thread','typing');

    typing.addMessage('typed!','next_thread');

   // use the before handler to delay the next message 
    typing.before('next_thread',  async() => {
        return new Promise((resolve, reject) => {
            // simulate some long running process
            setTimeout(resolve, 3000);
        });
    });

    controller.addDialog(typing);

    controller.hears('typing dialog', 'message', async(bot, message) => {
        await bot.beginDialog('typing');
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.0.2 this issue will be addressed in 4.0.2 bug Web-related
Projects
None yet
Development

No branches or pull requests

1 participant