- 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:
- Whatβs the name of your bot? β
teams-echobot
- Which language do you want to use? β
JavaScript
- Which template would you like to use? β
Echo Bot
- 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:
- Search for Bot Channels Registration and select Create
- 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
- Open Teams Developer Portal (dev.teams.microsoft.com)
- Create a new App
- Add your botβs endpoint under Bot β Messaging endpoint
- Download the
.zip
manifest package - 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
β 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.
Author
- Ravichandran@Hi_Ravichandran