microsoft / BotFramework-DirectLineJS

JavaScript client library for Microsoft Bot Framework's Direct Line protocol
MIT License
194 stars 127 forks source link

Automated Tests With BotFramework-DirectLineJS #378

Closed karinaSC closed 2 years ago

karinaSC commented 2 years ago

Hello guys.

I have a bot that uses the hotline, and I would like to know if with this package (https://github.com/microsoft/BotFramework-DirectLineJS) I can write an automated one? if yes, where to enter my hotline secret information to communicate with my bot?

Thank you

stevkan commented 2 years ago

@karinaSC - I am unfamiliar with Hotline or its uses, so I can't advise you on whether it can be used with DirectLineJS or not. Can you provide a link to this product?

What I can say is DirectLineJS is used specifically for building client applications with the purpose of connecting a chat interface with a BotFramework built bot. The only credentials it takes is for establishing a connection with the "middle layer", the Azure Bot Service Connector. So, given that, I would guess that it wouldn't work.

But, again, I'm unfamiliar with Hotline so I can't say this definitively.

karinaSC commented 2 years ago

sorry @stevkan i meant "directLine" not Hotline.

what I would like to know, is where I enter my DirectLine secret here in this package, so I can start talking to the bot and running tests. Its possible?

stevkan commented 2 years ago

Have you looked over the DirectLineJS README.md file? If not, the instructions are there on how to create a DirectLine object and what properties need to be passed into it.

Unless I'm much mistaken, I believe that is what you are looking for. Does that help?

karinaSC commented 2 years ago

Yes, but see how I'm using the directline object.

When running it returns nothing.

image
stevkan commented 2 years ago

A few things to check that may be interfering:

Curiously, when running in Node, you may want to change the secret parameter to token, instead. For some reason (in my testing), if I use secret the client connects and receives the bot's response, but then immediately shuts down. This doesn't happen when I use token.

To be clear, this setup isn't going to do much of anything other than connect and show that a response was received because there is no user interface to work with the DirectLine object.

I attached a file that gives a simple demonstration of using DirectLineJS in a custom HTML client to give you an idea on setup. Obviously, there would need to be some changes if you wanted to run in Node. But this can help point the way. Be sure to add in your DirectLine secret.

directline-chat.zip

stevkan commented 2 years ago

Closing due to inactivity.