In this exercise you will learn how to register your bot and deploy it to Azure so others can use it.
The following software is required for completing this exercise:
- A code editor like Visual Studio Code (preferred), or Visual Studio 2017 Community or higher
- An Azure subscription
- An account in the LUIS Portal
- Git command line interface
- An Skype account (optional)
In this task you will generate an App ID and App Password, and register your bot.
-
Sign in to the Bot Framework Portal.
-
Click the My bots button and next click the Create a bot button (if you have other bots) or the Register buton.
-
Upload the logo.png as Custom Icon.
-
Type Help Desk Bot as Display Name. Enter a globally unique App Name in the Bot Handle.
-
For Long Description you can enter This bot will try to help you to solve common issues and can raise tricky ones as tickets. This is the description that will appear in search results, so it should accurately describe what the bot does.
-
On the Configuration section, click on the Create Microsoft AppID and Password button and a new page should open. If required, sign in again with the same credentials you use in the Bot Framework portal. In this page, you should see the App name you have entered previously and an App ID which was automatically generated. Save the App ID for later and click on the Generate an app password to continue.
-
You should see a popup which contains an automatically generated password for your bot. Notice that this is the only time it will be displayed. Store it securely for later. Click Ok to close the popup.
-
Click on the Finish and go back to Bot Framework button. You may notice the page will close and you will go back to the Bot registration page. Now, you have the App ID auto-completed in the page.
-
Scroll down and confirm your agreement of the Terms of Use, Privacy Statement, and Code of Conduct. Click on the Register button. A confirmation message should appear, click Ok. And next you should see your bot's dashboard with a few channels available.
In this task you will learn how to deploy and configure your app to enable it to communicate with the Bot framework channels.
-
Sign in to the Azure portal. Click on the New button on the left bar, next click on the Web + Mobile and then choose Web App.
-
Enter an App name, choose a Subscription and a Resource Group. You can use the same resource group you've used for the Cosmos DB and Search services. Click Create.
-
Open the previously created App Service if you are not there already. Click on Application Settings on the left menu. Navigate to the App settings and add the following keys and replace with the values described (you should have these values in your bot source code).
Key Description AZURE_SEARCH_ACCOUNT Use the Azure Search account name AZURE_SEARCH_INDEX Use the Azure Search index name AZURE_SEARCH_KEY Use the Azure Search key MICROSOFT_APP_ID Use the Bot App ID MICROSOFT_APP_PASSWORD Use the Bot Password LUIS_MODEL_URL Use the LUIS model URL TICKET_SUBMISSION_URL Use your App Service URL (eg. https://help-desk-bot.azurewebsites.net/) After you entered the key and values you should have a similar result as the image below.
-
Navigate to the Deployment section and click on the Deployment credentials on the left bar. Type a Username and Password and confirm the password entered again on Confirm Password. Next click on the Save button.
-
Navigate to the Deployment section and click on the Deployment options on the left menu. Next click on the Configure required settings and then click on the Local Git Repository. Click OK.
-
Click on the Overview option on the left bar. Save for later use the Git clone url on the right column of the Essentials pane.
In this task you will publish your code to Git Repository and this will deploy your recent changes to the Azure App Service. For more information about Git you can check the Git Reference here.
-
Open a console on the app folder you've obtained from the previous exercise. Alternatively, you can use the app from the exercise4-KnowledgeBase folder. If you didn't create a Git repository for this code, type the following command in the console (if you already initialized this code to a Git repository, you don't need to do this step):
git init
-
Next, type the following command and remember to replace the
{gitcloneurl}
with the Git clone url you obtained in the previous task.git remote add azure {gitcloneurl}
-
Type the following commands to commit you changes and push it to the Azure web app.
git add . git rm --cached node_modules -r git commit -m "initial commit" git push azure master
-
Enter your deployment credentials you created on the previous task.
-
Next you should see files being uploaded, the npm packages installed on the remote server and finally the deployment status.
-
Navigate to Bot Framework Portal. Click on your bot name to edit it.
-
Click on the Settings button on the top-right corner of the page.
-
On the Configuration section, type the App Service URL you created on Task 2 (eg. https://help-desk-bot.azurewebsites.net/api/messages). Remember to put the
/api/messages
at the end of the URL and ensure the protocol is https. Click the Save changes button at the bottom of the page.
In this task you will test your bot from other channels.
-
Navigate to Bot Framework Portal and edit your bot, if you are not there already.
-
Click on the Test button on the top-right corner of the page. It should open a new window on the right of the page. This is an embedded Web Chat Channel so you can easily test your bot.
-
Type
Hi! I want to explore the knowledge base
and see the bot response with the category list. Click on any of the category and see the articles listed for that category and click on one article to see it. -
Click the Channels menu item. Note you should have the Skype and Web Chat channels enabled by default. Click on the Skype link. A new page will open to allow to add your bot to your Skype account. Click on the Add to Contacts button. You should be prompted to be sign into your Skype Account and the Skype app should be opened.
NOTE: You can also check the Get bot embed codes link that shows you how to build a link for users to add the bot to their Skype account.
-
Search for the bot on your Contact List and test a new conversation.
NOTE: At the moment this hands-on lab was written Skype does not fully support Adaptive Cards, so you might not see the ticket confirmation message correctly.
- Test the bot from the Bot Emulator - you need to use ngrok to let the bot know how to reply to your local computer.
- Run code locally while testing the bot via Skype or Web Chat.
- You can try adding Bot Analytics by using Application Insights.
- Register the bot with another channel, such as Slack.