Chatbot in Python-Part 1

  1. Python 3.6 or 3.7
  2. Bot Framework emulator
  3. git-for version control

Setting up an environment for development

  1. Let us start by setting up a virtual env in python. For this, we need to install virtualenv using pip command
Install virtualenv
Activate the virtual environment in windows

Installing the required dependencies

  1. To develop bot locally in python, there are some packages like botbuilder-core, asyncio, and cookiecutter which need to be installed
Installing required packages
Downloading the pre-defined bot service template
Running echo bot template
Bot echoing back the response given by the user
Bot working process
  1. ConverstationUpdate- Bots sends an update message when a new user or a bot joins the conversation
  2. Message- The message activity carries conversation information between the end-user and the bot. In our case of Echo bot, it is a simple text which the channel render. Alternatively, the message activity can be a text to be spoken, suggested action, or cards.
  • Echo back a greeting received from the user.
  • Display a hero card providing additional information about bots.
Bot Emulator snippet

Conclusion:

In this article, we have seen how we can use python with Microsoft Bot Framework to create an efficient chatbot, and how we can send a welcome message to a new user.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Affine

Affine

Affine is a provider of analytics solutions, working with global organizations solving their strategic and day to day business problems www.affineanalytics.com