APPLIES TO: SDK v4
Creating a bot with Azure Bot Service and creating a bot locally are independent, parallel ways to create a bot.
- Bot Framework Emulator
- Visual Studio Code or your favorite IDE, if you want to edit the bot code.
To install Yeoman and the Yeoman generator for Bot Framework v4:
Open a terminal or elevated command prompt.
mkdir myJsBots cd myJsBots
Make sure you have the latest versions of npm and Yeoman.
npm install -g npm npm install -g yo
Install the Yeoman generator. Yeoman is a tool for creating applications. For more information, see yeoman.io.
npm install -g generator-botbuilder
The install of Windows build tools listed below is only required if you use Windows as your development operating system. For some installations, the install step for restify is giving an error related to node-gyp. If this is the case you can try running this command with elevated permissions. This call may also hang without exiting if Python is already installed on your system:
# only run this command if you are on Windows. Read the above note. npm install -g windows-build-tools
Create a bot
Use the generator to create an echo bot.
Yeoman prompts you for some information with which to create your bot. For this tutorial, use the default values.
Thanks to the template, your project contains all the code that's necessary to create the bot in this quickstart. You don't need any additional code to test your bot.
If you create a
Core bot, you'll need a LUIS language model. (You can create a language model at luis.ai). After creating the model, update the configuration file.
Start your bot
In a terminal or command prompt change directories to the one created for your bot, and start it with
cd my-chat-bot npm start
At this point, your bot is running locally on port 3978.
Start the Emulator and connect your bot
Start the Bot Framework Emulator.
Select Open Bot on the Emulator's Welcome tab.
Enter your bot's URL, which is the URL of the local port, with
/api/messagesadded to the path, typically
Then select Connect.
Send a message to your bot, and the bot will respond back.
See tunneling (ngrok) for how to connect to a bot hosted remotely.