Build Tab with Adaptive Cards
Adaptive Card tabs are a new way to build tabs in Teams. Instead of embedding web content in an IFrame, you can render Adaptive Cards to a tab. While the front end is rendered with Adaptive Cards, the backend is powered by a bot. The bot is responsible for accepting requests and responding appropriately with the Adaptive Card that is rendered.
You can build your tabs with relevant user interface (UI) building blocks native on desktop, web, and mobile.
This article helps you understand:
- The changes required to be made to the app manifest.
- Identifies how the invoke activity requests and sends information in tab with Adaptive Cards.
- Effect on the task module workflow.
This step-by-step guide helps you to build tabs with Adaptive Cards on desktop and mobile. You'll see the following output:

Prerequisites
Ensure that you install the following tools and set up your development environment:
| Install | For using... | |
|---|---|---|
| Required | ||
| Microsoft Teams with an account (not a guest account) | Microsoft Teams to collaborate with everyone you work with through apps for chat, meetings, call and all in one place. | |
| Visual Studio 2022 version 17.3 Install one of the following two workloads: • ASP.NET and web development • .NET Core cross-platform development |
You can install the enterprise version in Visual Studio 2022, and install the workloads. | |
| .NET Core SDK version 3.1 | Customized bindings for local debugging and Azure Functions app deployments. If you haven't installed the .NET 3.1 (or later) SDK globally, the portable version can be installed. | |
| ngrok | Teams app features (conversational bots, message extensions, and incoming webhooks) require inbound connections. A tunnel connects your development system to Teams. It isn't required for apps that only include tabs. This package is installed within the project directory (using npm devDependencies). |
|
| Microsoft 365 developer account | Access to Teams account with the appropriate permissions to install an app. |
Create a Bot Registration in Microsoft Azure portal
Adaptive Card tabs would require Azure Bot Service to build tabs in teams. Register bot with Azure Bot Service when you develop and host it in Azure. Perform the following:
- Use ngrok to create a tunnel to your web server's endpoints.
- Create Azure Bot resource to register bot with Azure Bot Service.
- Create client secret that enables SSO authentication of the bot.
- Add Microsoft Teams channel to deploy the bot to a Teams channel.
- Add messaging endpoint to the ngrok tunnel you created.
Use ngrok to create a tunnel to your locally running web server's publicly available HTTPS endpoints. Run the following command in ngrok:
ngrok http --host-header=rewrite 3978
To create Azure Bot resource
Open Azure portal.
Select Create a resource.
Search for Azure bot in the search box.
Select Azure Bot.
Select Create.
Enter bot handle name in Bot handle field.
Select your Subscription from the dropdown list.
Select your Resource group from the dropdown list.
To create a new resource group, select Create new, enter resource name, select OK, and select required location from New resource group location dropdown list. For more information, see Create resource group.
Select Type of App as Multi Tenant for Microsoft App ID.

Note
In Creation type of Microsoft App ID section, Create new Microsoft App ID is already selected to create a new bot. You can also select Use existing app registration, if you've already registered a bot. Enter Microsoft App ID in Existing app ID field, and enter value in Existing app password field.
Select Review + create.

If the validation passes, select Create.
It takes a few moments for your bot service to be provisioned.

Select Go to resource. The bot and the related resources are listed in the resource group.

Now your Azure bot is created.

To create client secret
In Settings, select Configuration. Save the Microsoft App ID (client ID) for future reference.

Note
Ensure MultiTenant is selected under Bot Type.
Adjacent to Microsoft App ID, select Manage.
In the Client secrets section, select New client secret.Add a client secret window appears.

Enter Description and select Add.

In the Value column, select Copy to clipboard and save the client secret ID for future reference.

To add the Microsoft Teams channel
Go to Home.

Open your bot, which is listed in the Recent resources section.
Select Channels in the left pane and select Teams
.
Select the checkbox to accept the terms of service and select Agree.

Select Save.

To add messaging endpoint
Go to Home page and select Configuration under Settings from the left pane.
Go to ngrok.
Copy the HTTPS URL (https to io) as shown in the following image:
In Messaging endpoint, add the HTTPS URL generated from ngrok and at the end of the URL add /api/messages.

Select Apply.
You have successfully set up a bot in Azure Bot Service and now you need to set up bot service connection.
Set up bot service connection
To ensure that the Bot Service enables user to sign in and access the bot, you must configure SSO for your bot. To do so, perform the following:
- Add Redirect URI to the Azure bot resource.
- Expose API endpoint.
- Authorize client applications.
- Add any necessary API permissions for downstream calls.
- Enable implicit grant.
- Update manifest.
- Set up Bot Service connection.
To add Redirect URI to the Azure bot resource
Select Manage next to Microsoft App ID.
Select Authentication from the left pane of your bot resource.
In Platform configurations, select Add a platform.
Select Web.
Enter Redirect URIs as
https://token.botframework.com/.auth/web/redirectand select Configure.
The Redirect URI is added to the Azure bot resource.

To expose API endpoint
Select Expose an API from the left pane.
Select Set for the Application ID URI.
Use the Application ID URL shown and append
api://instead ofhttps://in the ngrok url and add at the beginning of the App ID URL.
Select Save.
Select Add a scope.
In Scope name, enter access_as_user.
In Who can consent?, switch to Admins and users.
Enter the following values in the boxes:
Field Value Admin consent display name Teams can access the user’s profile Admin consent description Allows Teams to call the app’s web APIs as the current user. User consent display name Teams can access your user profile and make requests on your behalf User consent description Enable Teams to call this app’s APIs with the same rights that you have. Ensure that State is set to Enabled.

Select Add scope. The scope name automatically matches the Application ID URI, with /access_as_user added to the end.
To authorize client applications
Add the following IDs as Authorized client applications, select the check box for Authorized scopes and select Add application.
1fec8e78-bce4-4aaf-ab1b-5451cc387264 (Teams mobile or desktop application)
5e3ce6c0-2b1f-4285-8d4b-75ee78787346 (Teams web application)

To add any necessary API permissions for downstream calls
Select API permissions from the left pane.
Select Add a permission. Request API permissions window appears.
Select Microsoft API's. Then select Microsoft Graph and select Delegated permissions.
Add any user Delegated permissions that your app requires to downstream APIs, for example, User.Read.

To enable implicit grant
Select Authentication from the left pane.
Select Access tokens and ID tokens checkboxes.

Select Save to save the changes.
To update manifest
Select Manifest from the left pane.
Ensure the config item is set to "accessTokenAcceptedVersion": 2. If not, change its value to 2 and select Save.
Note
If you're already testing your bot in Teams, you must sign out this app and sign out Teams. Then sign in again to see this change.

To set up Bot Service connection
Go to Home page and select Configuration under Settings from the left pane.
Select Add OAuth Connection Settings.
In New Connection Setting, enter the following details:
Field Value or description Name Enter name for your new connection setting. You can use the name in the settings of your bot service code. Service Provider Select Azure Active Directory V2. Client ID Saved previously as your Microsoft App ID. Client secret Saved previously as Value of the client secret ID. Token Exchange URL Use the Application ID URL obtained previously while exposing API endpoint. Tenant ID Enter common. Scopes Enter User.Read and also add all the Scopes required while specifying permissions to downstream APIs.
Select Save.
Configure the bot
Configure the bot sample to understand how to authenticate conversational bot in Microsoft Teams.
To configure and run your bot sample
Go to the repo https://github.com/OfficeDev/Microsoft-Teams-Samples.git.
Select Code and select the dropdown.
Select Download ZIP.

Ensure to note the Path of the repository that is downloaded.
In the File Explorer, Select the Project.
Go to Microsoft-Teams-Samples > samples > tab-adaptive-cards > csharp > TabWithAdpativeCardFlow folder.
Open the appsettings.json file in Visual Studio Code.
Update the appsettings.json configuration for the bot to use the
MicrosoftAppId,MicrosoftAppPassword, and add your ngrok URI asApplicationBaseUrl.Use the OAuth connection name as the Connection Name.
Note
You can obtain the
MicrosoftAppIdfrom the bot's Configuration page. TheMicrosoftAppPasswordis the Value for client secret ID that you saved previously.
Select Save.
Configure and upload the app in Teams
The most comprehensive way to test your bot is by creating an app package and uploading it to Teams. This method is the only way to test the full functionality available to your bot, across all scopes. You can configure and run the Teams app by uploading the manifest.zip file.
To run the Teams app by uploading the manifest.zip file
In the File Explorer, go to Microsoft-Teams-Samples > samples > tab-adaptive-cards > csharp > TabWithAdpativeCardFlow > AppPackage to open the folder.
Open the
manifest.jsonfile in Visual Studio Code.In the
manifest.jsonfile, find {contentBotId} and add your Microsoft App ID and save.
In the File Explorer, go to the AppPackage folder.
Zip the contents of the AppPackage folder to create
manifest.zip.Note
The
manifest.zipshouldn't contain any additional folders in it. It should have manifest json source file, color icon, and outline icon inside the zip folder.Go to Teams.
To upload
manifest.zip, select Store > Manage your apps > Upload a custom app and openmanifest.zip.Select Add to add the tab to your chat.

You can interact with this tab by signing in.
Send a message to the tab.

Interacting with the Tab in Teams
Tabs allow you to access services and content in a dedicated space within a channel or in a chat.
Follow the steps to use the tab:
In the left pane of the Teams, select the ellipses ●●● and choose your app from the list.
Tab showing Adaptive card with action controls.

Select Sign In and choose an account to access the tab.

Select Show Task Module on the home page.

Tab/fetch is the first invoke request that your bot receives when a user opens an Adaptive Card tab. When your bot receives the request, it either sends a tab continue response or a tab auth response.

Submit function of Adaptive Card task/submit request is triggered to your bot with the corresponding data through the Action.

Tab keeps you signed in unless you select Sign out.

Refresh to Sign In again.

Complete challenge
Did you come up with something like this?

Congratulations!
You've completed the tutorial to get started with Adaptive cards for Microsoft Teams using the Bot Framework.
Have an issue with this section? If so, please give us some feedback so we can improve this section.
Feedback
Submit and view feedback for