In this article, we will learn how to use Microsoft Bot Framework with Node.js.
Microsoft Bot Framework Microsoft Bot Framework can help us in developing the chat bots, that can be integrated with platforms such as Skype, Slack, Telegram, Email and the Web. How I see this framework is the human language power with the computing and intelligence powers, combined together to provide a great conversation experience. This framework has the following three components,
In this article, we will actually build one of the chat bots, using the very first components of this framework -- Bot Builder SDK. Bot Builder for Node.js 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, .NET or REST API-based bot Application. Since I have been playing with Node.js these days, this article will use Node.js for our chatbot Application. Make sure you already have Node.js installed on your machine. Installing Bot builder for Node.js Now, let's follow the steps, given below, to get started with Bot Builder and Node.js for our very basic chat Bot, given below:
Build a Bot
In the code, given above, require() loads ‘botbuilder’ module. Since we are using command line to interact with this Bot, we are using ConsoleConnector here. UniversalBot class implements all the logic to manage Bot conversations from our command line channel. For these Bot conversations, Bot object uses the dialog component. Running a Bot Open a new Node.js command prompt and navigate to our bots folder using command cd and run the command, given below: Our botserver.js has run successfully and our conversation has begun with our Bot through this command line channel. Just type ‘Hi’ on the command prompt to see how Bot reacts to it, as shown below: Thus, Bot is replying to us, based on the input we are providing from the command line. In our next article, we will see some more interactivity with our Bot.
Pro WPF: Windows Presentation Foundation in .NET 3.0