Bots, Bots, Bots and Pig Latin
Continuing with our Build 2016 revisit theme week, today it's all about Bots!
Joe Mayo provides a great getting started and walk through for creating your first Bot, a Pig Latin Bot.
But first, what is the Bot thing?
Build and connect intelligent bots to interact with your users naturally wherever they are, from text/sms to Skype, Slack, Office 365 mail and other popular services.
Bots (or conversation agents) are rapidly becoming an integral part of one’s digital experience – they are as vital a way for users to interact with a service or application as is a web site or a mobile experience. Developers writing bots all face the same problems: bots require basic I/O; they must have language and dialog skills; and they must connect to users – preferably in any conversation experience and language the user chooses. The Bot Framework provides tools to easily solve these problems and more for developers e.g., automatic translation to more than 30 languages, user and conversation state management, debugging tools, an embeddable web chat control and a way for users to discover, try, and add bots to the conversation experiences they love.
The Bot Framework has a number of components including the Bot Connector, Bot Builder SDK, and the Bot Directory.
The Bot Connector lets you connect your bot(s) seamlessly to text/sms, Office 365 mail, Skype, Slack, and other services. Simply register your bot, configure desired channels and publish in the Bot Directory.
Bot Builder SDK
The Bot Builder SDK is an open source SDK hosted on GitHub that provides everything you need to build great dialogs within your Node.js- or C#-based bot.
- Getting started in .Net
- Building your Bot
- Use the Bot Framework Emulator to test your Bot application
- Publishing your Bot Application to Microsoft Azure
- Registering your Bot with the Microsoft Bot Framework
- Testing the connection to your bot
- Configuring Channels
The Microsoft Bot Framework Connector is a communication service that helps you connect your Bot with many different communication channels (GroupMe, SMS, email, and others). If you write a conversational Bot or agent and expose a Microsoft Bot Framework-compatible API on the internet, the Connector will forward messages from your Bot to a user, and will send user messages back to your Bot.
Okay, lets finally get to Joe's Bot post...
The blog post, Botiquette, explained how Microsoft released the Bot Framework at the Build conference and referenced how you can find the Bot Framework and associated documentation. It’s easy reading, well organized, and simple to get started.
This post is about my first bot, Pig Latin Bot. As the name suggests, Pig Latin Bot takes everything you say to it and replies with a Pig Latin translation of your message. This post explains how I built Pig Latin Bot.
You need to install a couple bits of software to get started: a Bot Template and the Bot Emulator. The Bot Template lets you start a new bot project with the proper assembly references, configuration, and basic template code. The Bot Emulator is a chat window that helps you test your bot.
1. Download the Bot Template and save it in “%USERPROFILE%\Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#".
2. Install the Bot Emulator, which is a click-once application that will install and enable easy updates on your computer.
Examining the Bot Template
If you placed the Bot Template in the proper location, you can open Visual Studio, start a New Project, and select Bot Template. Name the solution and project – I called my solution BotDemos and the project PigLatinBot. The solution is a typical Web API solution that looks like this:
Translating English to Pig Latin
This demo could have used one of many translation services off the Web, but that wouldn’t have been as much fun. Instead, I chose to write my own Pig Latin translator. It isn’t as robust as a commercial Pig Latin translator, but I figured it would do the job for this demo. If you aren’t that familiar with Pig Latin, you can get up-to-speed via How to Speak Pig Latin on the wikiHow site. Here’s the code for performing English to Pig Latin translations:
Testing Pig Latin Bot
To test your bot, run your project, run the emulator, and make sure the emulator is configured. Start your bot project by typing F5 and you’ll see a screen that looks like this:
Now you know how to set up your bot environment and start a new project. You can use the Post method as an interface to manage communication with the Bot framework. The PigLatin class was fun, but also represents a way for you to build and separate your own logic and consume that logic from the Post method of the bot. You can use the Bot Emulator to test your bot, but also remember to check that your URL correctly matches your bot address and that your App Id and App Secret are set properly.
You can find the code on my GitHub Repository, BotDemos.
This conversation has been locked by the site admins. No new comments can be made.