Skip to content

Files

Latest commit

83eda89 · Jun 27, 2025

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jun 27, 2025
Jun 27, 2025
May 29, 2025
Mar 27, 2024
Nov 5, 2024
Nov 12, 2024
Oct 10, 2024
Jun 25, 2023
Jan 9, 2025
Jun 25, 2023
Mar 19, 2025
Jan 4, 2021
Jan 4, 2021
Jan 4, 2021
Jun 27, 2025
Jan 9, 2025
Jan 4, 2021
Jan 4, 2021
Sep 18, 2023
Apr 18, 2025
Apr 16, 2025
Dec 6, 2022
Jun 27, 2025

README.md

page_type products languages technologies title description extensions urlFragment copilot
sample
office-365
microsoft-teams
javascript
nodejs
botframework
teams-platform
messaging-extensions
teams-tabs
Microsoft Teams Hello World Bot - Copilot Agent Optimized
A comprehensive Microsoft Teams hello world bot sample optimized for GitHub Copilot Agent development, featuring advanced bot functionality, tabs, and messaging extensions with modern JavaScript patterns.
contentType technologies createdDate updatedDate
samples
Microsoft Teams Platform
Bot Framework v4
Node.js
Restify
GitHub Copilot Agent
10/19/2022 10:02:21 PM
06/26/2025 12:00:00 PM
officedev-microsoft-teams-samples-app-hello-world-nodejs-copilot-optimized
optimized agent_patterns useCases
true
teams-bot-development
conversational-ai
messaging-extensions
teams-tabs
echo-bot-implementation
teams-integration-patterns
bot-state-management
error-handling-best-practices

Microsoft Teams hello world sample app.

A comprehensive Microsoft Teams bot sample that showcases fundamental Teams platform features including tabs, bots, and messaging extensions. This sample has been optimized for GitHub Copilot Agent development with enhanced code structure, comprehensive documentation, and modern development patterns.

Official Microsoft Teams Samples Repository

This sample is part of the official Microsoft Teams Samples repository: https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/app-hello-world/nodejs

For more Teams samples and documentation, visit the main repository: https://github.com/OfficeDev/Microsoft-Teams-Samples

Included Features

  • Tabs
  • Bots
  • Messaging Extensions

Interaction with app

HelloWorldGif

Try it yourself - experience the App in your Microsoft Teams client

Please find below demo manifest which is deployed on Microsoft Azure and you can try it yourself by uploading the app package (.zip file link below) to your teams and/or as a personal app. (Uploading must be enabled for your tenant, see steps here).

Microsoft Teams hello world sample app: Manifest

Prerequisites

Run the app (Using Microsoft 365 Agents Toolkit for Visual Studio Code)

The simplest way to run this sample in Teams is to use Microsoft 365 Agents Toolkit for Visual Studio Code.

  1. Ensure you have downloaded and installed Visual Studio Code
  2. Install the Microsoft 365 Agents Toolkit extension
  3. Select File > Open Folder in VS Code and choose this samples directory from the repo
  4. Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps
  5. Select Debug > Start Debugging or F5 to run the app in a Teams web client.
  6. In the browser that launches, select the Add button to install the app to Teams.

If you do not have permission to upload custom apps (uploading), Microsoft 365 Agents Toolkit will recommend creating and using a Microsoft 365 Developer Program account - a free program to get your own dev environment sandbox that includes Teams.

GitHub Copilot Agent Mode

This sample is optimized for GitHub Copilot Agent development with:

  • Teams-first development patterns prioritized over generic Bot Framework
  • Enhanced discoverability through project structure and documentation
  • Copilot-specific guidance in .github/copilot-instructions.md
  • Development patterns and examples in .copilot/ directory

Quick Start with Copilot

  1. Use Copilot prompts for Teams bot development
  2. Reference .copilot/prompts/hello-world.md for common patterns
  3. Follow Teams-specific coding standards in development guidelines

Features & Capabilities

Core Microsoft Teams Integration

  • Echo Bot Functionality - Intelligent message processing with context awareness
  • Teams Tabs - Static and configurable tab experiences
  • Messaging Extensions - Search-based extensions with dynamic card generation
  • State Management - Conversation state with proper error handling
  • Teams Activity Handler - Full Teams platform integration

GitHub Copilot Agent Optimizations

  • Enhanced Code Discoverability - Semantic naming and modular architecture
  • Comprehensive JSDoc - Detailed inline documentation for better AI understanding
  • Modular File Structure - Clean separation of concerns for easy code navigation
  • Agent-Friendly Patterns - Code patterns optimized for AI assistance and generation
  • Copilot Prompts - Pre-configured prompts and instructions in .copilot/ directory

Architecture & Code Structure

src/
├── app.js                         # Main application entry point
├── bot.js                         # Bot functionality and handlers
├── tabs.js                        # Teams tab management and routing
├── message-extension.js           # Messaging extension components
├── static/                        # Static assets and content
└── views/                         # HTML templates for tabs

.copilot/                          # Copilot Agent optimization
├── prompts/                       # Copilot-specific prompts
│   └── hello-world.md            # Development guidance and patterns
└── instructions/                  # Development guidelines
    ├── development-guidelines.md  # Coding standards and best practices
    └── agent-patterns.md         # Advanced agent development patterns

.github/                           # GitHub integration
└── copilot-instructions.md       # Teams-first development guidance

Development Environment & Prerequisites

Prerequisites

  • Microsoft Teams account (not guest account)
  • Node.js 16.14.2+ for development
  • Dev tunnel or ngrok for local testing
  • M365 developer account or Teams account with app upload permissions
  • Microsoft 365 Agents Toolkit for VS Code (recommended)

GitHub Copilot Integration

This sample is optimized for GitHub Copilot Agent Mode with:

  • .github/copilot-instructions.md - Teams-first development guidance
  • .copilot/ directory - Agent-specific prompts and patterns
  • Comprehensive JSDoc - Rich context for AI assistance
  • Teams-specific patterns - Prioritized over generic Bot Framework

Run the app (Manually Uploading to Teams)

Note these instructions are for running the sample on your local machine, the tunnelling solution is required because the Teams service needs to call into the bot.

1. Setup for Bot

  • In Azure portal, create a Azure Bot resource

  • Ensure that you've enabled the Teams Channel

  • While registering the bot, use https://<your_tunnel_domain>/api/messages as the messaging endpoint.

    NOTE: When you create your bot you will create an App ID and App password - make sure you keep these for later.

2. Setup NGROK

  1. Run ngrok - point to port 3333

    ngrok http 3333 --host-header="localhost:3333"

    Alternatively, you can also use the dev tunnels. Please follow Create and host a dev tunnel and host the tunnel with anonymous user access command as shown below:

    devtunnel host -p 3333 --allow-anonymous

3. Setup for code

  1. Clone the repository

    git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
  2. In a terminal, navigate to samples/app-hello-world/nodejs

  3. Install modules

    npm install
  4. Update the custom-environment-variables configuration for the bot to use the MicrosoftAppId and MicrosoftAppPassword, BaseUrl with application base url.

  5. Update the default configuration for the bot to use the appId and appPassword.

  6. Run your app

    npm start

4. Setup Manifest for Teams

  • This step is specific to Teams.

    • Edit the manifest.json contained in the app-hello-world/nodejs/appManifest folder to replace your Microsoft App Id (that was created when you registered your bot earlier) everywhere you see the place holder string <<Your Microsoft App Id>> (depending on the scenario the Microsoft App Id may occur multiple times in the manifest.json)
    • Edit the manifest.json for configurationUrl inside configurableTabs and validDomains. Replace {{domain-name}} with base Url domain. E.g. if you are using ngrok it would be https://1234.ngrok-free.app then your domain-name will be 1234.ngrok-free.app and if you are using dev tunnels then your domain will be like: 12345.devtunnels.ms.

    Note: If you want to test your app across multi hub like: Outlook/Office.com, please update the manifest.json in the app-hello-world/nodejs/appManifest_Hub folder with the required values.

    • Zip up the contents of the app-hello-world/nodejs/appManifest folder to create a manifest.zip or app-hello-world/nodejs/appManifest_Hub folder into a Manifest_Hub.zip.(Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
    • Upload the manifest.zip to Teams (In Teams Apps/Manage your apps click "Upload an app". Browse to and Open the .zip file. At the next dialog, click the Add button.)
    • Add the app to personal/team/groupChat scope (Supported scopes)

This app has a default landing capability that determines whether the opening scope is set to the Bot or a static tab. Without configuring this, Microsoft Teams defaults to landing on the bot in desktop clients and tab in mobile clients.

To set the Bot as the default landing capability, configure the 'staticTabs' section in the manifest as follows:

"staticTabs": [
  {
    "entityId": "conversations",
    "scopes": [
      "personal"
    ]
  },
  {
    "entityId": "com.contoso.helloworld.hellotab",
    "name": "Hello Tab",
    "contentUrl": "https://${{BOT_DOMAIN}}/hello",
    "scopes": [
      "personal"
    ]
  }
],

To set the Tab as the default landing capability, configure the 'staticTabs' section in the manifest as follows:

"staticTabs": [
  {
    "entityId": "com.contoso.helloworld.hellotab",
    "name": "Hello Tab",
    "contentUrl": "https://${{BOT_DOMAIN}}/hello",
    "scopes": [
      "personal"
    ]
  },
  {
    "entityId": "conversations",
    "scopes": [
      "personal"
    ]
  }
],

Note: If you are facing any issue in your app, please uncomment this line and put your debugger for local debug.

Running the sample

Install App:

InstallApp

Hello World Bot:

HelloWorld

Hello Wrold Tab:

HelloWorld

Outlook on the web

  • To view your app in Outlook on the web.

  • Go to Outlook on the weband sign in using your dev tenant account.

On the side bar, select More Apps. Your uploaded app title appears among your installed apps

InstallOutlook

Select your app icon to launch and preview your app running in Outlook on the web

AppOutlook

Note: Similarly, you can test your application in the Outlook desktop app as well.

Office on the web

  • To preview your app running in Office on the web.

  • Log into office.com with test tenant credentials

Select the Apps icon on the side bar. Your uploaded app title appears among your installed apps

InstallOffice

Select your app icon to launch your app in Office on the web

AppOffice

Note: Similarly, you can test your application in the Office 365 desktop app as well.

Deploy the bot to Azure

To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.

Further reading