Microsoft Teams Toolkit for VS Code is now GA 🎉
Tags: javascript, typescript, vscode, msteams
Published: 2022-05-24 18:04:35

[Previously](https://dev.to/azure/developing-enterprise-ready-microsoft-teams-apps-with-teams-toolkit-v30-o87), I introduced Teams Toolkit Preview in a series of blog posts. And I am happy to announce that [Teams Toolkit for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) and the Teams Toolkit CLI are _generally available_ as of today! And for everyone building .NET web apps, Teams Toolkit for Visual Studio is available now in preview. I hope you caught the announcement at Microsoft Build 2022 too.

There have been a lot of updates and improvement since the preview versions, however, in this post, I'd like to highlight some of the key new features with Teams Toolkit for VS Code that probably excite you the most!

![Doodles illustrating the summary of Teams Toolkit](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ff193v85f0butylm0ix.png)

## 🎞 Introducing Scenario-based Teams Apps

Before this release, Teams Toolkit Preview has provided app template code based on the Teams capabilities, such as [Tabs](https://docs.microsoft.com/microsoftteams/platform/tabs/what-are-tabs?WT.mc_id=m365-66412-timura), [Bots](https://docs.microsoft.com/microsoftteams/platform/bots/what-are-bots?WT.mc_id=m365-66412-timura), and [Messaging Extensions](https://docs.microsoft.com/microsoftteams/platform/messaging-extensions/what-are-messaging-extensions?WT.mc_id=m365-66412-timura).

However, in the reality, we design products based on the [real-life scenarios](https://docs.microsoft.com/en-us/microsoftteams/platform/overview-story?WT.mc_id=m365-66412-timura).

![User story illustrated - a travel agent wants to build an app that sends weather forecast notifications](https://docs.microsoft.com/en-us/microsoftteams/platform/assets/images/overview/developer-scenario.png)

So, with this GA release, we have added the scenario-based Teams app template, along with the existing basic capabilities templates.

Here are the newly added features—

### 🤖 Bot Notifications 

Sending bot notification can be a common scenario for a chat bot applications and for Teams app too. However, the development process for Teams apps has been cumbersome... Well, we made the process simpler as Toolkit now can help you create the notification feature for your app by tweaking the generated code!

When you are first setting up a new app in Teams Toolkit, click **Notification bot** under Scenario-based Teams app. to let Toolkit generate the scaffolding to create a bot that sends notifications. 

![Screenshot of Teams Toolkit on VS Code showing the app creation with bot notification menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zmroxq1rcw72kuvwfpl.png)

You can specify the event for that message—a trigger or a timer. If you want your bot to send Teams periodical reminder of something, choose the Timer Trigger.

![Screenshot of Teams Toolkit on VS Code showing the app creation with bot notification trigger options](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yj69miy1ze3f2yju4vpa.png)

If you are using JavaScript, take a look at the file, `source/adaptiveCards/notification-default.json` and see where specifies the message structure in JSON. You can keep the message just with some simple text, or with a list, table, buttons, etc.

You can also live-preview how the JSON is displayed as the Adaptive Card too. Just click where it says **Preview and Debug Adaptive Cards** to preview, or get the VS Code extension.

![Screenshot of Teams Toolkit on VS Code showing Adaptive card viewer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kowaeke5j3kvnk9y27pe.png)

And in `src/timerTrigger.js` (for Timer-based notifications), you can see how the message to be sent is applied to the Adaptive Card. Try changing the strings and see how it works on Teams client!

```js
for (const target of await bot.notification.installations()) {
    await target.sendAdaptiveCard(
      AdaptiveCards.declare(notificationTemplate).render({
        title: 'Aloha! This is your daily reminder.',
        appName: 'Contoso Bot',
        description: `This is a sample time-triggered notification (${timeStamp}).`,
        notificationUrl: 'https://www.adaptivecards.io/',
      })
    );
  }
```
Once you run the bot with the F5 debugger, the bot sends you a notification in your scheduled time. 

![Screenshot of a bot sending a message on Teams client](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jbbqb6pap9hi39anewpu.png)

There are more you can do with bots—

### 💬 Command Bot

Another common scenario would be a bot that respond to a command. You might think about some conversational bot but for most cases, all you need is a simple bot that answers your commands, like what you may have used "slash commands" in some services. 

Now with the Toolkit, you can start creating a command bot easier than ever. 

After clicking **Create a new Teams** app in Teams Toolkit, select the **Command bot** from the menu and proceed the rest.

Once the template code is generated, see the `commandHandler` function. For example, if you chose JavaScript, the file, `bot/src/helloWorldCommandHandler.js` you see the trigger word and response message.

You can alter the handler (or create a new handler) to create your command:

```js
class HelloWorldCommandHandler {
  triggerPatterns = 'Hi kitty';

  async handleCommandReceived(context, message) {
 // render your adaptive card for reply message
    const cardData = {
      title: 'MeowBot 🐱 says',
      body: 'Meow meow meow',
      image: 'https://placekitten.com/500/400',
      imageAlt: 'cat'
    };
    return MessageBuilder.attachAdaptiveCard(helloWorldCard, cardData);
  }
}
```
And define the response message UI with the Adaptive Cards previewer in `bot/src/adaptiveCards/helloworldCommand.json`.

Now, when a user send a "Hi kitty" message to the bot, the bot will respond.

![Screenshot of a bot responding to the command from a user on Teams client](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s357fd8ys0fn4iqo3cf7.png)

---

## 📬 Expand Your Apps to Outlook and Office

Another exciting news is that now your Teams apps can run on Outlook and Office! 

When you create a new app, the previous version of Toolkit only allowed you to choose one of the capabilities, however, with the new Toolkit, now you have more choices. 

To create an app that runs on other M365 products, like Outlook and Office, choose one from the **Extended Teams app across Microsoft 365**, which will generate a scaffolding code with helpful code template and samples, either in JavaScript or TypeScript (which, you can choose one!).

![Screenshot of Teams Toolkit on VS Code showing the create menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/up9b0td6nql6kpmpo0n3.png)

The "F5" debug feature is your friend when you are testing out your code in VS Code, and now the debug profile in Teams Toolkit includes Outlook and Office, where you can simply select one and see your app running!

![Screenshot of Teams Toolkit on VS Code showing the debug menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qy0jp4aeqq4nxwcrckv0.png)

![Screenshot of Teams and Outlook where the app is running](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e386gtaee8uqvy0vz6rc.png)

---

## 📢 More Updates for Teams Development

There are more updates with Teams and M365 app developments.

### 📜 Teams SDK v2 & Updated Manifest

Teams client SDK has been around for you to create tabs and task modules, and come with functionalities like tab configurations and theme detection, as well as authentication. Now it is upgraded to v2, and the latest version comes with functionalities to extend Teams app to run in Outlook and Office. 

The new Teams Toolkit utility also allows you to upgrade your existing apps that uses Teams-js SDK v1 to use the SDK v2, which updates imports & API calls. 

Toolkit also revises a Teams manifest to the latest schema to support Office and Outlook.

### 🖼 Fluent UI Component Library for Tabs App

When creating a tab app (which is a web embed in Teams), you would want the UI for your app to look and feel like Teams. 
The **Teams UI Component Library** is here to help with that.

[Teams UI Component Library](https://github.com/OfficeDev/microsoft-teams-ui-component-library) is a UI library built on top of **Fluent UI React**. 
Fluent is Microsoft’s design system that provides you with a set of UI libraries for all M365. 

And the base components library, [Fluent UI React](https://github.com/microsoft/fluentui) is now upgraded to v9, which supports design tokens and has major performance improvements 🎉

---

I hope you found the article makes you get started with your Teams app development with Teams Toolkit, especially if you are new to Teams app development!

Please don't hesitate to drop your comments and feedback here.

See you again at the next post 👋

## 📚 Learn More

- [Teams Toolkit documentation](https://docs.microsoft.com/microsoftteams/platform/toolkit/teams-toolkit-fundamentals?WT.mc_id=m365-66412-timura)
- [Get started with Microsoft Teams platform](https://docs.microsoft.com/microsoftteams/platform/get-started/get-started-overview?WT.mc_id=m365-66412-timura)

### 📢 Shoutout
A big hurrah to Teams Toolkit Engineering team, and thank you, Yu Zhang, Zhidi Shang, John Miller, Zhenya Savchenko, and Pierce Boggan, for helping me writing this article ❤️