Creating a bot with Azure Bot Service and creating a bot locally are independent, parallel ways to create a bot.
- Visual Studio Code
- Yeoman, which uses a generator to create a bot for you
- Bot Framework Emulator
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
To create your bot and initialize its packages
Open a terminal or elevated command prompt.
mkdir myJsBots cd myJsBots
Ensure your version of npm is up to date.
npm install -g npm
npm install -g yo generator-botbuilder
Then, 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.
- Enter a name for your bot. (my-chat-bot)
- Enter a description. (Demonstrate the core capabilities of the Microsoft Bot Framework)
- Choose the template to use. (Echo Bot - https://aka.ms/generator-botbuilder-templates)
Thanks to the template, your project contains all the code that's necessary to create the bot in this quickstart. You won't actually need to write any additional code.
If you choose to create a
Core bot, you'll need a LUIS language model. You can create one on 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
npm start. At this point, your bot is running locally.
Start the Emulator and connect your bot
- Start the Bot Framework Emulator.
- Click the Create a new bot configuration link in the emulator "Welcome" tab.
- Fill out the fields for your bot. Use your bot's welcome page address (typically http://localhost:3978) and append routing info '/api/messages' to this address.
- Then click Save and connect.
Send a message to your bot, and the bot will respond back with a message.
See tunneling (ngrok) for how to connect to a bot hosted remotely.
Učitavanje povratnih informacija...