# Microsoft Teams

> Create a bot for Corfedo in Azure, upload its app to Teams, approve it for your organization and choose the channels where it answers.

Source: https://docs.corfedo.ai/workspace/integrations/teams/

People ask Corfedo AI in a 1:1 chat with the app or with a mention. Each person links their Teams account once, and answers use their own Corfedo access.

## Before you begin

- You are a workspace administrator or have the **Integration administrator** role.
- An AI [profile](https://docs.corfedo.ai/workspace/ai/profiles/) for answers in Teams.
- Your Corfedo address is reachable from the internet.
- An Azure subscription in your Microsoft organization's directory, or the Teams Developer Portal without one.
- A Microsoft administrator with the Cloud Application Administrator role or higher. If that is someone else, send them the steps from **Copy steps** on the app's page.

## Create the Teams app

Open **Settings** › **Integrations** and choose **Microsoft Teams**, under **Add integration** once the page lists integrations. Name the app as people should see it in Teams and select **Continue**.

### Create the bot in Azure

Select **Open Azure** and create an Azure Bot with **Single Tenant** and **Create new Microsoft App ID**.

![Create an Azure Bot](https://docs.corfedo.ai/images/integrations/teams/azure-bot.png)

Then paste the messaging endpoint under **Settings** › **Configuration** and select **Apply**. Under **Channels**, add **Microsoft Teams**.

![Azure Bot configuration](https://docs.corfedo.ai/images/integrations/teams/azure-bot-config.png)

### Set up the bot's app in Microsoft Entra

Select **Open Microsoft Entra** and open the app named after the bot. Under **Authentication**, select **Add Redirect URI** and add the three redirect URLs as **Web**. Under **Certificates & secrets**, add a client secret and copy its **Value**.

![Redirect URIs in Microsoft Entra](https://docs.corfedo.ai/images/integrations/teams/entra-redirects.png)

### Enter the credentials

From the app's **Overview** page in Microsoft Entra, enter the **Application (client) ID** and **Directory (tenant) ID** in Corfedo. Select **Client secret**, enter the secret and select **Save credentials**.

### Upload the app to Teams

Select **Download app package**. In Teams, open the app store, select **Manage your apps** › **Upload an app** and choose **Upload an app to your org's app catalog**.

![Upload an app in Teams](https://docs.corfedo.ai/images/integrations/teams/teams-upload.png)

**Check:** the app shows **Ready to add** in Corfedo, and Teams lists it under **Built for your org**.

**Without an Azure subscription**

Select **Open Teams Developer Portal** and create a bot under **Bot management** › **New bot**. Under **Configure**, choose **HTTPS endpoint** and paste the messaging endpoint. It registers its app in Microsoft Entra, so continue with the Entra step. Only the account that created the bot can change it.

![The bot in the Teams Developer Portal](https://docs.corfedo.ai/images/integrations/teams/dev-portal-bot.png)

## Add it to your organization

Select **Add to Microsoft Teams**, name the organization and choose the **Profile** and repositories. Choose **I am a Microsoft administrator**, select **Continue in Microsoft** and **Accept**. With **Someone else is**, select **Create link** and send the link. After they approve, select **Finish adding** on the request.

![Microsoft's approval for the organization](https://docs.corfedo.ai/images/integrations/teams/microsoft-consent.png)

**Check:** the integration's page says **Added to** and the organization's name.

## Choose where Corfedo answers

Corfedo always answers 1:1 chats and [Microsoft 365 Copilot](https://docs.corfedo.ai/use/ask/copilot/). For mentions, select **Change** next to **Answers in** and choose **Only the channels you choose** or **Every channel the app is in**, which includes group chats. Add the app to the team in Teams first. A private channel asks to add the app the first time someone mentions it there. Everyone in a channel sees the answer, written with the access of the person who asked. In a shared channel that includes people from other organizations. **Every channel the app is in** includes shared channels.

![Answers in](https://docs.corfedo.ai/images/integrations/teams/channels.png)

## Troubleshooting

| What you see | Why | What to do |
| --- | --- | --- |
| "Microsoft rejected the client secret." | The secret's ID was entered instead of its value | Enter the secret's **Value** |
| "This application ID is not in that directory." | The application or directory ID is wrong | Copy both from the app's **Overview** page |
| The app sees no channel yet | The app is in no team | Add the app to a team in Teams |
| **Waiting for first message** after people write to the app | Teams cannot reach Corfedo | Check the bot's messaging endpoint and its **Microsoft Teams** channel |

Members see [Ask in Teams](https://docs.corfedo.ai/use/ask/teams/).
