Create a Basic Echo Bot using Microsoft Bot Framework in Python

Create a chatbot using Bot Framework SDK in Python. Creating your bot locally does not require an Azure subscription. We will work with Windows OS. For C# bots, check out the tutorials here.


  1. Python 3.63.7, or 3.8
  2. Bot Framework Emulator
  3. Knowledge of asynchronous programming in Python

The download link for 2nd requirement is available on the Downloads page.

Create and Enable a Virtual Environment

The virtual environment is specific to a project and is maintained in the project folder. Go to the project directory where you want to create your bot.

Run the following commands to activate the virtual environment using any command-line tool.

python -m venv venv
command line to show the virtual environment activation in python

Install the Templates

Install the packages using the pip install command.

pip install botbuilder-core
pip install asyncio
pip install aiohttp
pip install cookiecutter==1.7.0

You might get an error for Building wheel for cryptography (PEP 517) … error while running the first command. Try upgrading the pip to latest version and rerun the first command.

python -m pip install --upgrade pip

Create the Bot

We will create an Echo bot for this demo. From your project directory, run the below command to download the echo bot template and its dependencies.


When asked about the bot name and the description, give suitable values.

create a python echo bot

If you see your project directory, a new folder is created with the name of the bot you provided.

echo bot project created in project directory

Run your Bot

Go to the bot folder that was created in the last step by running the below command in the command line/command prompt.

cd first-bot
navigate to bot folder

Install all the dependencies for the echo bot template by running the below command.

pip install -r requirements.txt

To start the bot, run the below command.

start the python bot

If you see the Running on http://localhost:3978, that means your bot is running. We will use Bot Framework Emulator to test the bot.

Test the Bot in Bot Framework Emulator

Click on Open Bot when the emulator starts.

Bot emulator welcome page

Enter the Bot URL that was shown in the command line appended with “/api/messages” -> http://localhost:3978/api/messages. Click on Connect.

connect to the python bot by entering the bot url.

Initially, you will see a welcome message when you join the conversation.

Welcome message for Python Echo Bot

Start typing your messages and see the bot replies to you with the same message or in other words echo it back.

Python Echo Bot Testing

Thank you All!!! Hope you find this useful.

2 thoughts on “Create a Basic Echo Bot using Microsoft Bot Framework in Python

Add yours

Up ↑

%d bloggers like this: