Skip to content

ssemyan/SampleAzureBot

Repository files navigation

SampleBot

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

Prerequisites

  • .NET Core SDK version 2.1

    # determine dotnet version
    dotnet --version

    QnA Maker Setup

    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" 
    }
    

To run the sample

  • Run the bot from a terminal or from Visual Studio

From a terminal

# run the bot
dotnet run

From Visual Studio

  • Launch Visual Studio
  • File -> Open -> Project/Solution
  • Navigate to SampleBot folder
  • Select SampleBot.csproj file
  • Press F5 to run the project

Testing the bot using Bot Framework Emulator

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

Connect to the bot using Bot Framework Emulator

  • Launch Bot Framework Emulator
  • File -> Open Bot
  • Enter your Bot URL of http://localhost:3978/api/messages

Deploy the bot to Azure

Set up Azure Services

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

Test the bot in Azure

To test the bot in Azure, navigate in the portal to the Bot Service created above and choose the "Test in Web Chat" blade.

Further reading

About

Bot Framework v4 sample showing echo and integration with QnA Maker in Azure

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published