Setting up a Chatbot with Microsoft Bot Framework and TypeScript

In this article we will setup a Chatbot that echoes whatever we enter using Microsoft Bot Framework SDK v4 with TypeScript. An installation of NodeJS is required. This setup will be the foundation for more implementations in future posts.

Install Windows build tools

This is only required if you use Windows as your development operating system:

npm install -g windows-build-tools

Install TypeScript bot via Yeoman

Create a directory to store your source code. In this example we use bothe-bot as directory and project name. Navigate into that folder, then run:

npm install -g yo generator-botbuilder
yo botbuilder

Choose ‘TypeScript’ as language and ‘Echo’ as template.

Install Bot Emulator

Download and install the Bot Framework. It is a desktop application that allows you to test and debug your bot locally or remote – we use it locally.

Test if everything works by running npm start. Then run the Emulator and open the .bot file in your source directory.

Microsoft Bot Emulator after running our local bot

Next: Inspecting the generated TypeScript code of the bot

.bot file

    "name": "bothe-bot",
    "services": [
            "type": "endpoint",
            "name": "development",
            "endpoint": "http://localhost:3978/api/messages",
            "appId": "",
            "appPassword": "",
            "id": "1"
    "padlock": "",
    "version": "2.0"

It contains config details that will be loaded by your src/index.ts. Speaking of which, let’s have a closer look and inspect the generated code a bit closer.

About Author

Mathias Bothe To my job profile

I am Mathias, born 40 years ago in Heidelberg, Germany. Today I am living in Munich and Stockholm. I am a passionate IT freelancer with more than 16 years experience in programming, especially in developing web based applications for companies that range from small startups to the big players out there. I am founder of, creator of the security service platform BosyProtect© and initiator of several other software projects.

No comments yet.

Leave a comment