0
votes

I'm working on a project using Bot Framework. Now one of the requirements of the project is the capability to search for a QnA result using the QnA Maker Generate Answer API "https://{QnA-Maker-endpoint}/knowledgebases/{knowledge-base-ID}/generateAnswer". We have a Search Box on a Web Page which then passes the "Question" variable to the JSON body which returns the result. I wanted to see if there is a way to display the API result on the actual Chat Bot window.

Thank you!

1
Then you can take user input means question into chat window finally return the answer on chat window as well. So yes you could do that.Md Farid Uddin Kiron
Thank you @MdFaridUddinKiron, do you have any idea how I could get the question into the chat window?samueljohnpaul
Accepting / upvoting an answer serves the greater Stack Overflow community and anyone with a similar question. If you feel my answer was sufficient, please "accept" and upvote it. If not, let me know how else I can help!Steven Kanberg

1 Answers

1
votes

If you use BotFramework-WebChat, v4, you can achieve this quite easily. The 04.api/d.post-activity-event demonstrates a similar use case.

Essentially, after the button is pressed, when an answer is successfully returned from QnA the page will emit an event. The event will make use of Web Chat's store.dispatch() method to post an activity to Web Chat that will then send to the bot. The activity can be a message, event, postBack, or messageBack type, as documented here.

Hope of help!