Bot Framework v4 bot sample showing echo and integration with QnA Maker. This bot was created using the Bot Framework v4 SDK Templates for Visual Studio and following the instructions from the tutorial Create and deploy a basic bot in the Azure Bot Service Documentation
-
.NET Core SDK version 2.1
# determine dotnet version dotnet --version
Follow the instructions here to create a QnA maker. Once your QnA Maker app is published, select the SETTINGS tab, and scroll down to Deployment details.
Copy the following values from the Postman HTTP example request.
POST /knowledgebases/<knowledge-base-id>/generateAnswer Host: <your-hostname> // NOTE - this is a URL ending in /qnamaker. Authorization: EndpointKey <qna-maker-resource-key>
Then add the values from above to your appsetting.json file:
{ "MicrosoftAppId": "", "MicrosoftAppPassword": "", "QnAKnowledgebaseId": "knowledge-base-id", "QnAAuthKey": "qna-maker-resource-key", "QnAEndpointHostName": "your-hostname" }
- Run the bot from a terminal or from Visual Studio
# run the bot
dotnet run
- Launch Visual Studio
- File -> Open -> Project/Solution
- Navigate to
SampleBot
folder - Select
SampleBot.csproj
file - Press
F5
to run the project
Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
- Install the Bot Framework Emulator version 4.5.0 or greater from here
- Launch Bot Framework Emulator
- File -> Open Bot
- Enter your Bot URL of
http://localhost:3978/api/messages
You can use the create_azure_services.sh bash script in the DeploymentTemplates directory of this project to quickly set up all the required services in Azure.
Otherwise you can use the ARM Templates from the DeploymentTemplates directory of this project.
Once the App Service is created, you can publish the app by right-clicking on the project, choose Publish, then select the App Service created above.
To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions
To test the bot in Azure, navigate in the portal to the Bot Service created above and choose the "Test in Web Chat" blade.