This post goes over the steps necessary to make your bot open to the public. 1) Load your bot code onto a webapp on Azure (Microsoft’s Cloud). 2) Register your bot
Hosting Code on Azure
Okay in the last post I go over creating a bot with Microsoft Cognitive services QnAMaker. The code works natively on local host and pings the online Knowledge base when questions are asked, but it’s not yet hosted anywhere.
What you need to get started:
- A Microsoft Live ID Subscription
Setting up Web App
Go to: https://portal.azure.com
** Note: Be sure that you are on the new Azure portal as the old dashboard is slowly being depreciated. **
When you first log onto the Azure portal you will see a Dashboard that has a bunch of tiles. Click on the ‘New +’ symbol at the top to create a new service. Then Select “Web + Mobile” > Web App. Fill out the form, select ‘pin to dashboard’ and click ‘create’.
Once the Web App is created a tile will appear on your dash. Click it to access your application.
After clicking you will be taken to the Overview of your Web App. On the right hand side you should see ‘Deployment Options’. In Azure the default connection with your Web App is with an FTP endpoint. However with Deployment Options we can select a variety of ways to deploy source code. I will connect mine to GitHub, but there are other options like Visual Studio Team Services or local Git.
After you select ‘Deployment Options’ > Choose Source “Configure required settings” > You’ll see a list of options. Select the desired one and connect to that service with appropriate credentials.
Once you’ve connected to a source, or used FTP to upload your files, we can now register our bot.
Registering your Bot
To Register your bot, simply go to https://dev.botframework.com/ and click on “Register Bot”.
Fill out the Bot Registration form and use your Web App url (https://yoursite.azurewebsites.net/api/messages/) for the message endpoint input under Configuration.
** Note: Make sure you are using the secure url link for your message endpoint aka HTTPS **
After you filled everything out and Created and Microsoft App ID and password. Click Register, you should be taken to a Dashboard for your bot.
Linking your code to the Registered Bot
On your dashboard hit ‘Test Connection’. It should fail.
This happens because, your code does not have the ID and Password Authentication codes.
In your Web.config file you should see the following lines:
<appSettings> <!-- update these with your BotId, Microsoft App Id and your Microsoft App Password--> <add key="BotId" value="YourBotId" /> <add key="MicrosoftAppId" value="" /> <add key="MicrosoftAppPassword" value="" /> </appSettings>
Copy and past your MicrosoftAppId into the value slot for AppId and the same for the Password you obtained when you registered your bot.
Now push the updates to the Web App. If you hit test connection it should work! From there you can add multiple channels that your bot can communicate through. The skype and Web Channels are turned on by default, so you can get started with those two first.
And that’s all you have to do to get your bot online and ready to go. =)