Connect your Microsoft Teams Bot created using Microsoft Azure Bot Framework to the Microsoft Teams channel using Manifest. Go to manage apps and upload your manifest .zip file.
In a previous blog, we discussed how to create an Enterprise ready advanced chatbot using Microsoft Bot Framework v4 C# for Teams Channel. Let’s go ahead. In this blog, we will connect the bot to the Microsoft Teams channel using a Manifest.
The complete bot series is available here.
Complete Video of this blog to understand more in detail
To connect to Microsoft Teams Channel, follow the below steps: Open Visual Studio 2022, and then open your project and run it once.
Copy your bot URL, then paste it into the bot framework emulator, and then click Connect. Test your bot here before we connect it to the Microsoft Teams Channel.
Now, we have to create an Azure bot resource. To create a user bot resource, follow our previous blog.
On the Create an Azure Bot page, in Project details, select the following parameters:
|Bot handle||Enter the Bot handle. for example- JdBotsEnterpriseChatbot.|
|Subscription||Select the your subscription from the subscription drop down box.|
|Resource group||Create new resource group for implementation – EnterpriseChatbot-RG|
|Data residency (overview)||Select Global.|
|Pricing tier||Choose Free. If you do not want the get charge for the sample.|
|Type of app||Select the Multi Tenant type of app from the type of app drop down box.|
|Creation type||Select Creation new Microsoft App ID.|
Then, configure the Microsoft Teams channel by going to the Channels page under Settings in Azure Bot. To configure the Microsoft teams channel, agree on the terms of Services and then Click Apply.
Configure ngrok, and then run the following command. To set up ngrok, go to their website and follow the instructions.
Note: Before testing, ensure you have downloaded and configured ngrok on your computer.
Command to run on command prompt opened from ngrok directory –
ngrok http --host-header=localhost 3978
Make sure you change the port number accordingly to where your project is running. Most of the time, the Microsoft bot runs on a 3978 port number.
Copy the HTTPS URL from the ngrok command line tool and paste it into Messaging Endpoint field of the Configuration page in the Azure bot resource. Click Apply.
From the configuration page, copy the properties such as Microsoft app type, Microsoft App Id, and Microsoft app password and paste them into your appsettings.json file.
Run your project in Visual Studio again. Go to Test in a web chat in Azure bot resource and see whether you get the welcome message or not.
Connect Bot to Microsoft Teams Channel using Manifest
To connect the bot to the Microsoft Teams channel using manifest, follow the below steps:
Download the manifest .zip file. Unzip it and open the manifest.json file. Update it with all the relevant information, such as Developer details, Bot name, and description, Bot id (Also known as Microsoft App Id), etc.
Modify your manifest, then zip all the 3 files together (.json and the other 2 images).
To upload your zip file to Microsoft teams, follow the below step: Go to Microsoft Teams, then Apps, click Manage your apps, then click Upload your apps -> Select Upload custom app, and then upload your manifest.
As soon as you upload, a dialog box will appear asking you to add the bot to your personal scope, add it and start testing.