logo
Published on

Building Echo Bot Application for Microsoft Teams

This article walks you through building a Microsoft Teams Echo Bot using the Bot Framework SDK and Azure Bot Service.
The Echo Bot template provides a minimal structure to receive and reply to messages from Teams users β€” repeating back what the user says.


🧱 Prerequisites

Before starting, ensure you have the following installed:

  • Node.js (v10 or higher)
  • Yeoman and Bot Builder Generator
  • Azure CLI
  • ngrok (for tunneling local endpoints)
  • Microsoft Teams Developer account

Run these commands to install the required packages globally:

npm install -g yo generator-botbuilder
npm install -g @microsoft/teamsfx-cli

βš™οΈ Create a New Bot Project

Run the Yeoman generator to create a new bot project:

yo botbuilder

When prompted, provide the following answers:

  1. What’s the name of your bot? β†’ teams-echobot
  2. Which language do you want to use? β†’ JavaScript
  3. Which template would you like to use? β†’ Echo Bot
  4. Would you like to add state management? β†’ No

Once created, open the project in Visual Studio Code:

cd teams-echobot
code .

πŸ§ͺ Run and Test Locally

To start the bot locally, use:

npm start

Then start ngrok to tunnel port 3978:

ngrok http 3978

Copy the HTTPS forwarding URL shown in the ngrok output, such as:

https://abc123.ngrok.io

This URL will be used as your bot messaging endpoint in Azure.


☁️ Create Azure Bot Channel

In the Azure Portal, create a new Bot Channels Registration resource:

  1. Search for Bot Channels Registration and select Create
  2. Fill in the following details:
    • Name: teams-echobot
    • Messaging endpoint: https://abc123.ngrok.io/api/messages
    • Microsoft App ID and Password: create new values for authentication

Once created, navigate to Settings β†’ Configuration and copy your MicrosoftAppId and MicrosoftAppPassword.

In your local project, open index.js and replace with:

// Create adapter
const { BotFrameworkAdapter } = require('botbuilder');

const adapter = new BotFrameworkAdapter({
  appId: process.env.MicrosoftAppId,
  appPassword: process.env.MicrosoftAppPassword
});

πŸ’¬ Test the Bot in Bot Framework Emulator

Download and open Bot Framework Emulator.
Connect to your bot using:

https://abc123.ngrok.io/api/messages

You should see the bot respond with the same message you send β€” confirming that your Echo Bot is working correctly.


πŸ’» Add to Microsoft Teams

  1. Open Teams Developer Portal (dev.teams.microsoft.com)
  2. Create a new App
  3. Add your bot’s endpoint under Bot β†’ Messaging endpoint
  4. Download the .zip manifest package
  5. Upload it to Microsoft Teams under Apps β†’ Upload a custom app

You can now chat with your Echo Bot inside Microsoft Teams.


πŸ“‚ GitHub Sample Project

View full SPFx project on GitHub:Building Echo Bot Application for Microsoft Teams

GitHub

βœ… Summary

This simple Echo Bot demonstrates the foundational structure of any Teams bot β€” receiving, processing, and responding to user input.
You can extend this logic by adding adaptive cards, dialogs, or state persistence for more intelligent bot interactions.

Calendar IconBook a demo