In this section, we will see how to set up the development environment but, before that, let's check out the prerequisites needed for setting it up.
Setting up the development environment
Prerequisites
To use the Microsoft Bot Framework Connector, you must have the following:
- A Microsoft account (Hotmail, Live, or Outlook) to log into the Bot Framework developer portal, which you will use to register your bot.
- An Azure subscription (free trial at https://azure.microsoft.com/en-us/). This Azure subscription is essential for having an Azure-accessible REST endpoint exposing a callback for the Connector service.
- Developer accounts on one or more communication service (such as Skype, Slack, or Facebook) where your bot will communicate.
In addition, you may wish to have an Azure Application Insights account so that you can capture telemetry from your bot. There are additionally different ways to go about building a bot: from scratch, coded directly to the Bot Connector REST API, the Bot Builder SDK's for Node.js and .NET, and the Bot Connector .NET template, which is what this quick start guide demonstrates.
Setting up the Bot Framework Connector SDK .NET
This is a step-by-step guide to setting up the development environment to develop a bot in C# using the Bot Framework Connector SDK .NET template:
- Install the prerequisite software:
- You can download the community version of Visual Studio 2015 (latest update) for free at www.visualstudio.com.
- Update all VS extensions to their latest versions by navigating to Tools | Extensions and Updates | Updates.
- Download and install the Bot Application template:
- Download the file from the direct download link, http://aka.ms/bf-bc-vstemplate.
- Save the ZIP file to your Visual Studio 2015 templates directory, which is traditionally in %USERPROFILE%DocumentsVisual Studio 2015TemplatesProjectTemplatesVisual C#.
- Open Visual Studio.
- Create a new C# project using the new Bot Application template:
- The template is a fully functional Echo Bot that takes the user's text utterance as input and returns it as output. In order to run, however, the following has to take place:
- The bot has to be registered with the Bot Connector.
- The AppId and AppPassword from the Bot Framework registration page have to be recorded in the project's web.config.
- The project needs to be published to the web.
- Use the Bot Framework emulator to test your bot application.
The Bot Framework provides a channel emulator that lets you test calls to your bot as if they were being called by the Bot Framework cloud service. To install the Bot Framework emulator, download it from https://emulator.botframework.com/.
Once installed, you're ready to test, by starting your bot in Visual Studio using a browser as the application host: