Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update docs to align with latest Teams Toolkit codes #11775

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions msteams-platform/bots/how-to/authentication/bot-sso-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: Learn how to add code configuration, handle an access token, receiv
ms.topic: how-to
ms.localizationpriority: high
zone_pivot_groups: enable-sso
ms.date: 11/13/2024
---
# Add code to enable SSO in your bot app

Expand Down Expand Up @@ -150,7 +151,7 @@ To update your app's code:
const ENV_FILE = path.join(__dirname, '.env');
require('dotenv').config({ path: ENV_FILE });

const restify = require('restify');
const express = require("express");

// Import required bot services.
// See https://learn.microsoft.com/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0 to learn more about the different parts of a bot.
Expand Down Expand Up @@ -216,18 +217,18 @@ To update your app's code:
// Create the bot that will handle incoming messages.
const bot = new TeamsBot(conversationState, userState, dialog);

// Create HTTP server.
const server = restify.createServer();
server.use(restify.plugins.bodyParser());
server.listen(process.env.port || process.env.PORT || 3978, function() {
console.log(`\n${ server.name } listening to ${ server.url }`);
// Create express application.
const expressApp = express();
expressApp.use(express.json());

const server = expressApp.listen(process.env.port || process.env.PORT || 3978, () => {
console.log(`\n${ expressApp.name } listening to`, server.address());
console.log('\nGet Bot Framework Emulator: https://aka.ms/botframework-emulator');
console.log('\nTo talk to your bot, open the emulator select "Open Bot"');
});

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
expressApp.post('/api/messages', async (req, res) => {
// Route received a request to adapter for processing.
await adapter.process(req, res, (context) => bot.run(context));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description: Learn how interactive notification bot works in Teams, notification
ms.topic: conceptual
ms.author: surbhigupta
ms.localizationpriority: high
ms.date: 11/13/2024
---

# Interactive notification bot in Teams
Expand Down Expand Up @@ -122,15 +123,15 @@ You can make the following customizations to extend the notification template to

You can customize the following triggers:

* `Restify` based notification:
* `Express` based notification:

* When an HTTP request is sent to `src/index.js` entry point, the default implementation sends an Adaptive Card to Teams. You can customize this event by modifying `src/index.js`. A typical implementation can call an API to retrieve events, data, or both that can send an Adaptive Card as required. You can perform the following to add more triggers:

* Create a new routing: `server.post("/api/new-trigger", ...)`.
* Add timer trigger(s) from widely used npm packages, such as [cron](https://www.npmjs.com/package/cron), [node-schedule](https://www.npmjs.com/package/node-schedule), or from other packages.

> [!NOTE]
> By default Teams Toolkit scaffolds a single `restify` entry point in `src/index.js`.
> By default Teams Toolkit scaffolds a single `express` entry point in `src/index.js`.

* Azure Functions based notification:

Expand Down
16 changes: 8 additions & 8 deletions msteams-platform/includes/messaging-extensions/msgex-sso-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ To update your app's code:
const ENV_FILE = path.join(__dirname, '.env');
require('dotenv').config({ path: ENV_FILE });

const restify = require('restify');
const express = require("express");

// Import required bot services.
// See https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0 to learn more about the different parts of a bot.
Expand Down Expand Up @@ -197,18 +197,18 @@ To update your app's code:
// Create the bot that will handle incoming messages.
const bot = new TeamsBot(conversationState, userState, dialog);

// Create HTTP server.
const server = restify.createServer();
server.use(restify.plugins.bodyParser());
server.listen(process.env.port || process.env.PORT || 3978, function() {
console.log(`\n${ server.name } listening to ${ server.url }`);
// Create express application.
const expressApp = express();
expressApp.use(express.json());

const server = expressApp.listen(process.env.port || process.env.PORT || 3978, () => {
console.log(`\n${ expressApp.name } listening to`, server.address());
console.log('\nGet Bot Framework Emulator: https://aka.ms/botframework-emulator');
console.log('\nTo talk to your bot, open the emulator select "Open Bot"');
});

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
expressApp.post('/api/messages', async (req, res) => {
// Route received a request to adapter for processing.
await adapter.process(req, res, (context) => bot.run(context));
});
Expand Down
2 changes: 1 addition & 1 deletion msteams-platform/sbs-gs-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ items:
| `appPackage/` | Templates for the Teams application manifest. |
| `adaptiveCards/` | The adaptive cards sent back by bot. |
| `infra/` | Templates for provisioning Azure resources. |
| `index.js` | Application entry point and `restify` handler. |
| `index.js` | Application entry point and `express` handler. |
| `teamsBot.js` | Teams activity handler. |


Expand Down
4 changes: 2 additions & 2 deletions msteams-platform/sbs-gs-commandbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ items:
|   | [Microsoft 365 developer account](/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant) | Access to Teams account with the appropriate permissions to install an app. |

> [!NOTE]
> The guide is tested on Teams Toolkit latest version and Nodejs version 14 and 16. The steps in this guide may work with other versions, but that hasn't been tested.
> The guide is tested on Teams Toolkit latest version and Nodejs version 18 and 20. The steps in this guide may work with other versions, but that hasn't been tested.

[!INCLUDE [Set up prerequisites](includes/get-started/prepare-teams-toolkit.md)]

Expand Down Expand Up @@ -138,7 +138,7 @@ items:
| `appPackage/` | Templates for the Teams application manifest. |
| `infra/` | Templates for provisioning Azure resources. |
| `src/` | The source code for the application. |
| `src/index.js` | Application entry point and `restify` handlers for command and response. |
| `src/index.js` | Application entry point and `express` handlers for command and response. |
| `src/teamsBot.js` | An empty teams activity handler for bot customization. |
| `src/adaptiveCards/helloworldCommand.json` | A generated Adaptive Card that is sent to Teams. |
| `src/helloworldCommandHandler.js` | The business logic to handle a command. |
Expand Down
2 changes: 1 addition & 1 deletion msteams-platform/sbs-gs-javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ items:
| `env` | Name / value pairs are stored in environment files and used by teamsapp.yml to customize the provisioning and deployment rules. |
| `infra` | Templates for provisioning Azure resources. |
| `src/`| The source code for the notification Teams application. |
| `src/app.js` | Application entry point and `restify` handlers for website. |
| `src/app.js` | Application entry point and `express` handlers for website. |
| `src/views/hello.html`| A HTML template that is bind to the tab endpoint. |
| `src/static` | The static assets like CSS and JavaScript files that can be served by the web server. |
| `teamsapp.yml` | Main project file describes your application configuration and defines the set of actions to run in each lifecycle stages. |
Expand Down
2 changes: 1 addition & 1 deletion msteams-platform/sbs-gs-msgext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ items:
| `.vscode/` | Visual Studio Code files for local debug. |
| `appPackage/` | Templates for the Teams application manifest. |
| `infra/` | Templates for provisioning Azure resources. |
| `index.js` | Application entry point and `restify` handler. |
| `index.js` | Application entry point and `express` handler. |

> [!Tip]
> Familiarize yourself with bots and message extension outside of Teams before you integrate your app within Teams.
Expand Down
4 changes: 2 additions & 2 deletions msteams-platform/sbs-gs-notificationbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ items:
|   | [Microsoft 365](https://developer.microsoft.com/en-us/microsoft-365/dev-program) | Access to Teams account with the appropriate permissions to install an app. |

> [!NOTE]
> The guide is tested on Teams Toolkit latest version and Nodejs version 14 and 16. The steps in this guide may work with other versions, but that hasn't been tested.
> The guide is tested on Teams Toolkit latest version and Nodejs version 18 and 20. The steps in this guide may work with other versions, but that hasn't been tested.

[!INCLUDE [Set up prerequisites](includes/get-started/prepare-teams-toolkit.md)]

Expand All @@ -67,7 +67,7 @@ items:

:::image type="content" source="../msteams-platform/assets/images/sbs-notification-bot/select-notification-bot.png" alt-text="Select App Capability":::

1. Select **HTTP Trigger Restify Server** as the trigger.
1. Select **HTTP Trigger Express Server** as the trigger.

:::image type="content" source="../msteams-platform/assets/images/sbs-notification-bot/select-trigger.png" alt-text="Screenshot showing how to select the programming language.":::

Expand Down
4 changes: 2 additions & 2 deletions msteams-platform/sbs-gs-workflow-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ items:
|   | [Microsoft Edge](https://www.microsoft.com/edge/) (recommended) or [Google Chrome](https://www.google.com/chrome/) | A browser with developer tools. |
|   | [Microsoft 365 developer account](/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant) | Access to Teams account with the appropriate permissions to install an app. |
> [!NOTE]
> The guide is tested on Teams Toolkit latest version and Nodejs version 14 and 16. The steps in this guide may work with other versions, but that hasn't been tested.
> The guide is tested on Teams Toolkit latest version and Nodejs version 18 and 20. The steps in this guide may work with other versions, but that hasn't been tested.

[!INCLUDE [Set up prerequisites](includes/get-started/prepare-teams-toolkit.md)]

Expand Down Expand Up @@ -108,7 +108,7 @@ items:
| `appPackage/` | Templates for the Teams application manifest. |
| `infra/` | Templates for provisioning Azure resources. |
| `src/` | The source code for the application. |
| `src/index.js`| Application entry point and `restify` handlers for the Workflow bot. |
| `src/index.js`| Application entry point and `express` handlers for the Workflow bot. |
| `src/teamsBot.js` | An empty teams activity handler for bot customization. |
| `src/commands/helloworldCommandHandler.js` | Implementation that handles responding to a chat command. |
| `src/adaptiveCards/helloworldCommandResponse.json` | Defines the Adaptive Card (UI) that is displayed in response to a chat command. |
Expand Down
14 changes: 7 additions & 7 deletions msteams-platform/toolkit/Teams-Toolkit-CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The `teamsapp doctor` command checks for the prerequisites needed to build Teams
The `teamsapp new` command operates in an interactive mode by default and provides guidance to create a new Teams application. To work `teamsapp new` in a non-interactive mode, set the `--interactive` flag to `false`.

```bash
teamsapp new
teamsapp new
teamsapp new -i false
```

Expand Down Expand Up @@ -584,16 +584,16 @@ By default, `teamsfx new` is in interactive mode and guides to create new Teams
|`--folder`| No | Project directory. A subfolder with your app name is created under this directory. The default value is `./`.|
|`--spfx-framework-type`| No| Applicable if `SPFx tab` capability is selected. Frontend Framework. The options are `none`, `react` and `minimal`, and default value is `none`.|
|`--spfx-web part-name`| No | Applicable if `SPFx tab` capability is selected. The default value is "helloworld".|
|`--bot-host-type-trigger`| No | Applicable if `Notification bot` capability is selected. The options are `http-restify`, `http-functions`, and `timer-functions`. The default value is `http-restify`.|
|`--bot-host-type-trigger`| No | Applicable if `Notification bot` capability is selected. The options are `http-express`, `http-functions`, and `timer-functions`. The default value is `http-express`.|

### Scenarios for `teamsfx new`

You can use interactive mode to create a Teams app. The following list provides scenarios on controlling all the parameters with `teamsfx new`:

* HTTP triggered notification bot with restify server.
* HTTP triggered notification bot with express server.

```bash
teamsfx new --interactive false --capabilities "notification" --bot-host-type-trigger "http-restify" --programming-language "typescript" --folder "./" --app-name MyAppName
teamsfx new --interactive false --capabilities "notification" --bot-host-type-trigger "http-express" --programming-language "typescript" --folder "./" --app-name MyAppName
```

* Teams command and response bot.
Expand Down Expand Up @@ -923,16 +923,16 @@ By default, `teamsfx new` is in interactive mode and guides to create new Teams
|`--folder`| No | Project directory. A subfolder with your app name is created under this directory. The default value is `./`.|
|`--spfx-framework-type`| No| Applicable if the `SPFx tab` capability is selected. Frontend Framework. The options are `none`, `react` and `minimal`, and default value is `none`.|
|`--spfx-web part-name`| No | Applicable if `SPFx tab` capability is selected. The default value is "helloworld".|
|`--bot-host-type-trigger`| No | Applicable if `Notification bot` capability is selected. The options are `http-restify`, `http-functions`, and `timer-functions`. The default value is `http-restify`.|
|`--bot-host-type-trigger`| No | Applicable if `Notification bot` capability is selected. The options are `http-express`, `http-functions`, and `timer-functions`. The default value is `http-express`.|

### `teamsfx new` scenarios

You can use interactive mode to create a Teams app. The following list provides scenarios on controlling all the parameters with `teamsfx new`:

* HTTP triggered notification bot with restify server.
* HTTP triggered notification bot with express server.

```bash
teamsfx new --interactive false --capabilities "notification" --bot-host-type-trigger "http-restify" --programming-language "typescript" --folder "./" --app-name MyAppName
teamsfx new --interactive false --capabilities "notification" --bot-host-type-trigger "http-express" --programming-language "typescript" --folder "./" --app-name MyAppName
```

* Teams command and response bot.
Expand Down
2 changes: 1 addition & 1 deletion msteams-platform/toolkit/add-single-sign-on.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Teams Toolkit helps you to add SSO to the following Teams capabilities in Visual

* Tab
* Bot
* Notification bot: restify server
* Notification bot: express server
* Command bot
* Workflow bot
* Message extension
Expand Down
2 changes: 1 addition & 1 deletion msteams-platform/toolkit/create-new-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The following example shows a basic Teams tab app directory structure:
| `env` | Stores different environment parameters. |
| `infra` | Azure `bicep` template files. Used for deploy your Teams app to Azure. |
| `src` | Source code for the Tab capability, including your front-end app, UI components and the privacy notice, terms of use, |
| `src/app.js` | Application entry point and `restify` handlers for website. |
| `src/app.js` | Application entry point and `express` handlers for website. |
| `src/views/hello.html`| An HTML template that is bind to the tab endpoint. |
| `src/static` | The web server can serve static assets such as CSS and JavaScript files. |
| `teamsapp.yml` | This configuration file defines the Teams Toolkit behavior for provision, deploy, and publish lifecycle. You can customize this file to change the behavior of Teams Toolkit in each lifecycle. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Before you start to learn how to build Incoming Webhooks, you may also want to k
| Retrieve Teams context |App can use Graph APIs to work with Microsoft 365 data. | Notification bot can retrieve Teams context such as channel or user information and messages. | No |
| Send Adaptive Card | No | Yes | Yes |
| Send a welcome message | Yes | Yes | No |
| Trigger supported |All triggers are supported. | All triggers are supported. <br> If you use Teams Toolkit, you can quickly get a template project with the following triggers: <br> • Time trigger hosted on Azure functions. <br> • Restify HTTP trigger hosted on Azure app service. <br> • HTTP trigger hosted on Azure Functions.| All triggers are supported.|
| Trigger supported |All triggers are supported. | All triggers are supported. <br> If you use Teams Toolkit, you can quickly get a template project with the following triggers: <br> • Time trigger hosted on Azure functions. <br> • Express HTTP trigger hosted on Azure app service. <br> • HTTP trigger hosted on Azure Functions.| All triggers are supported.|
| Building Tools |[Quick start - Microsoft Graph](https://developer.microsoft.com/graph/quick-start) | • [Teams Toolkit Overview for Visual Studio Code](../toolkit/teams-toolkit-fundamentals.md) <br> • [Teams Toolkit Overview for Visual Studio](../toolkit/toolkit-v4/teams-toolkit-fundamentals-vs.md) <br> • [Teams Toolkit CLI](../toolkit/Teams-Toolkit-CLI.md) <br> • [TeamsFx SDK](../toolkit/TeamsFx-SDK.md) | No tools are required. |
| Cloud resource required | Microsoft Entra app | Azure Bot Framework | No resources are required. |
| Tutorial | • [Send activity feed notifications to users in Microsoft Teams](/graph/teams-send-activityfeednotifications) <br> • [Send activity feed notification](../sbs-graphactivity-feedbroadcast.yml) | [Build notification bot with JavaScript](../sbs-gs-notificationbot.yml) | [Incoming Webhook notification sample](https://github.com/OfficeDev/TeamsFx-Samples/tree/dev/incoming-webhook-notification) |
Expand Down