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

Send args with sendMessageToBot() ? #82

Open
souwei opened this issue Jul 25, 2018 · 1 comment
Open

Send args with sendMessageToBot() ? #82

souwei opened this issue Jul 25, 2018 · 1 comment

Comments

@souwei
Copy link

souwei commented Jul 25, 2018

Hello there, was wondering if there was any way to send arguments alongside the message with .sendMessageToBot();

something like the following:

const msg = {
    message: 'hello',
    args: { entities: ['bla1', 'bla2'], intents: 'test' }
}

.sendMessageToBot(msg, "Bot says hello to you too");

I am using args in my dialogs to handle logic

(session, args, next) => {
    if (args.something) {
        do something 
    }
    else {
        do something else
    }
}

Thank you.

@microsoftly
Copy link
Owner

I like the idea for testing particular dialogs, but I think it misses the main purpose of the framework.

The test framework is meant to be a programatic way of interacting with a bot. Any dialog should be reachable via sending an IMessage to the bot. If a particular dialog has args passed in, they can be populated by simulating a conversation upto that point or instantiating the bot with the conversation at that point.

If you want to test a single dialog, you would likely need to export it in such a way that it can be attached to a test bot and beginDialog or an equivalent could be used to start the dialog with the args you're looking for.

It also looks like you're trying to mock out an NLP service like luis.ai. You can use something like nock to mock the outbound requests and inbound responses. I started working on just that service but put it on hold due to time constraints during my day job. Check it out -> https://github.com/microsoftly/luis-mocker. I'd be more than happy to try to help guide you along if you're interested in contributing there.


as an aside, it could be possible to do what you're looking for and I'm not seeing a clear way right now. If you can propose an implementation that could do this in a sane way, I'd be happy to consider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants