This article shows you how to build a bot by using the Python Echo Bot template, and then how to test it with the Bot Framework Emulator.
Creating a bot with Azure Bot Service and creating a bot locally are independent, parallel ways to create a bot.
- Python 3
- Bot Framework Emulator
- Knowledge of asynchronous programming in Python
- Install the necessary packages by running the following commands:
pip install botbuilder-core pip install asyncio pip install aiohttp pip install cookiecutter
The last package, cookiecutter, will be used to generate your bot. Verify that cookiecutter was installed correctly by running
- To create your bot run:
This command creates an Echo Bot based on the Python echo template
Create a bot
You will be prompted for the name of the bot and a description. Name your bot
echo-bot and set the description to
A bot that echoes back user response. as shown below:
Start your bot
From a terminal navigate to the
echo-botfolder where you saved your bot. Run
pip3 install -r requirements.txtto install any required packages to run your bot.
Once the packages are installed run
python3 appto start your bot. You will know your bot is ready to test when you see the last line shown in the screenshot below:
Copy the last for digits in the address on the last line (usually 3978) since you will be using them in the next step. You are now ready to start the Emulator.
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/messages added to the path, typically http://localhost:3978/api/messages.
Send a message to your bot, and the bot will respond back.
Top comments (0)