Deploy Teams app in Teams

Dalvir Singh 5 Reputation points
2024-10-03T13:01:17.3766667+00:00

I have a platform (website) where users can create their own AI assistants. These assistants utilize our API endpoint, where user queries are passed as input, and the code then connects to both a large language model (LLM) and a knowledge base to generate responses.

The platform supports multiple users, each of whom can create their own AI agents through the UI. Once created, they can access a playground and use embed codes to deploy these AI agents (bots).

Now, I want to extend the functionality by allowing users to deploy their AI agents within Microsoft Teams channels. The goal is to make this deployment process dynamic and user-friendly. When users click a button, they should have two options:

Download the app package.

Automatically deploy the agent to their Microsoft Teams channel.

I need guidance on how to develop this deployment pathway dynamically, ensuring the process is smooth and efficient for the users.

Do i need to create apps in https://dev.teams.microsoft.com/apps

if so then how to get this done using code without asking user any credentials of authentication.

what permission are required for this app?

do i need to associate any bot with this?

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,333 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Nivedipa-MSFT 3,031 Reputation points Microsoft Vendor
    2024-10-04T06:10:41.82+00:00

    @Dalvir Singh - Here’s a step-by-step guide to help you develop a dynamic and user-friendly deployment pathway for your AI agents within Microsoft Teams channels.

    Creating Apps in Microsoft Teams Developer Portal

    You will need to create apps in the Microsoft Teams Developer Portal. This portal allows you to manage your Teams apps, including bots, tabs, and messaging extensions.

    Steps to Develop the Deployment Pathway

    1. Create the Teams App Manifest:
      • The app manifest is a JSON file that defines the app's metadata, including its name, description, icons, and capabilities (like bots and tabs). You can dynamically generate this manifest based on user inputs.
    2. Dynamic App Package Generation:
      • Programmatically create the Teams app package (a zip file containing the manifest and icons) tailored to each user's AI agent. This can be done using server-side code to generate the manifest and package it.
    3. Deploying the App:
      • Option 1: Download the App Package:
      • Provide users with a button to download the app package. They can then manually upload it to their Teams environment via the Teams admin center.
      • Option 2: Automatic Deployment:
        - Use Microsoft Graph API to automate the deployment process. This involves creating a Teams app installation request using the API.
        

    Authentication and Permissions

    To deploy the app without asking for user credentials, you can use Azure AD app registrations and OAuth 2.0 for authentication. Here are the steps:

    Register an Azure AD App:

    • Register an app in the Azure portal to get a client ID and secret. This app will be used to authenticate API requests.

    Grant Necessary Permissions:

      - You will need permissions like `AppCatalog.ReadWrite.All` and `TeamsAppInstallation.ReadWriteForUser` to install apps in Teams123.
      
      **Use OAuth 2.0**:
      
         - Implement OAuth 2.0 to get an access token for your Azure AD app. This token will be used to authenticate API requests without needing user credentials.
         
    

    Associating a Bot

    If your AI agents are bots, you will need to associate them with your Teams app. Here’s how:

    Create a Bot:

    • Use the Azure Bot Framework to create a bot. Register the bot in the Azure portal to get a bot ID and secret.

    Add Bot to the Manifest:

      - Include the bot ID in the Teams app manifest under the `bots` section. This will associate the bot with your Teams app4.
      
    

    Example Manifest Snippet

    Here’s an example of how the bot section in the manifest might look:

    {
      "bots": [
        {
          "botId": "your-bot-id",
          "scopes": ["personal", "team", "groupchat"],
          "supportsFiles": true,
          "isNotificationOnly": false
        }
      ]
    }
    

    Ref Docs:

    Thanks, 

    Nivedipa

    ************************************************************************* 

    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate. 

    0 comments No comments

  2. Nivedipa-MSFT 3,031 Reputation points Microsoft Vendor
    2024-10-04T06:13:00.6+00:00

    @Dalvir Singh -

    Creating Apps in Microsoft Teams Developer Portal

    You will need to create apps in the Microsoft Teams Developer Portal. This portal allows you to manage your Teams apps, including bots, tabs, and messaging extensions.

    Steps to Develop the Deployment Pathway

    Create the Teams App Manifest:

    • The app manifest is a JSON file that defines the app's metadata, including its name, description, icons, and capabilities (like bots and tabs). You can dynamically generate this manifest based on user inputs.

    Dynamic App Package Generation:

      - Programmatically create the Teams app package (a zip file containing the manifest and icons) tailored to each user's AI agent. This can be done using server-side code to generate the manifest and package it.
      
      **Deploying the App**:
      
         - **Option 1: Download the App Package**:
         
               - Provide users with a button to download the app package. They can then manually upload it to their Teams environment via the Teams admin center.
               
                  - **Option 2: Automatic Deployment**:
                  
                        - Use Microsoft Graph API to automate the deployment process. This involves creating a Teams app installation request using the API.
                        
    

    Authentication and Permissions

    To deploy the app without asking for user credentials, you can use Azure AD app registrations and OAuth 2.0 for authentication. Here are the steps:

    Register an Azure AD App:

    • Register an app in the Azure portal to get a client ID and secret. This app will be used to authenticate API requests.

    Grant Necessary Permissions:

      - You will need permissions like `AppCatalog.ReadWrite.All` and `TeamsAppInstallation.ReadWriteForUser` to install apps in Teams123.
      
      **Use OAuth 2.0**:
      
         - Implement OAuth 2.0 to get an access token for your Azure AD app. This token will be used to authenticate API requests without needing user credentials.
         
    

    Associating a Bot

    If your AI agents are bots, you will need to associate them with your Teams app. Here’s how:

    Create a Bot:

    • Use the Azure Bot Framework to create a bot. Register the bot in the Azure portal to get a bot ID and secret.

    Add Bot to the Manifest:

      - Include the bot ID in the Teams app manifest under the `bots` section. This will associate the bot with your Teams app4.
      
    

    Example Manifest Snippet

    Here’s an example of how the bot section in the manifest might look:

    {
      "bots": [
        {
          "botId": "your-bot-id",
          "scopes": ["personal", "team", "groupchat"],
          "supportsFiles": true,
          "isNotificationOnly": false
        }
      ]
    }
    

    Ref Docs:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.