# Microsoft Teams

## Overview

The Microsoft Teams Integration enables seamless communication and collaboration between your platform and Microsoft Teams. It allows organizations to streamline workflows, receive notifications, and manage support or operational activities directly within Teams channels. This integration supports both **Helpdesk** and **Collaboration** capabilities, ensuring efficient team coordination and real-time updates.

### Prerequisites

Ensure the following requirements are fulfilled before initiating the integration:

* An active **Microsoft Teams Admin account** with appropriate permissions.
* Valid **Microsoft Teams credentials**.
* Access to TheLoops platform with **Admin role** privileges.

### Best practices

* **Install Selectively & Maintain Coverage:**\
  Add the bot only to relevant channels and ensure it is installed in all required channels.
* **Validate Setup:**\
  Verify message syncing after bot installation and always perform a **Test Connection** post integration
* **Use Proper Access:**\
  Ensure the user has required Admin/Owner permissions for installation and configuration.
* **Leverage Active Session:**\
  If already logged into Microsoft Teams, authentication may complete automatically.
* **Monitor & Secure:**\
  Regularly check integration health, refresh tokens when required, and securely manage credentials.

## Setup instructions <a href="#setup-instructions" id="setup-instructions"></a>

### Getting started

{% stepper %}
{% step %}
Log in to TheLoops platform using an **Admin** account.
{% endstep %}

{% step %}
Navigate to **Settings → Integrations** module.
{% endstep %}

{% step %}
Click on the **“+ Add Integration”** button to view available integrations.
{% endstep %}

{% step %}
Search for **Teams** integration and open it.
{% endstep %}
{% endstepper %}

### Basic configuration

{% stepper %}
{% step %}
In the **Basic** tab, enter a suitable name for the integration.
{% endstep %}

{% step %}
Select the required **Capability**:

1. Helpdesk
2. Collaboration
   {% endstep %}

{% step %}
Click on the **Next** button.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
For **Collaboration Capability**, all configurations remain the same as Helpdesk. Only the capability selection differs.
{% endhint %}

#### Authentication

{% stepper %}
{% step %}
On the **Authentication** tab, click on the **Connect** button.
{% endstep %}

{% step %}
An authentication window will open.
{% endstep %}

{% step %}
Enter your **Microsoft Teams credentials** and click **Sign in**.
{% endstep %}

{% step %}
Choose **“Yes”** or **“No”** for staying signed in, based on your preference.
{% endstep %}

{% step %}
After successful authentication:

1. The integration will be added successfully.
2. A success message will be displayed.
   {% endstep %}
   {% endstepper %}

#### Verification

{% stepper %}
{% step %}
Navigate back to the **Integrations** module.
{% endstep %}

{% step %}
Verify that the newly added integration appears at the top of the list.
{% endstep %}

{% step %}
Click on the **Test Connection** icon (beside the delete icon).
{% endstep %}

{% step %}
If the test connection is successful, a confirmation message will be displayed, indicating that the integration is configured correctly.
{% endstep %}
{% endstepper %}

## Installation of TheLoops Bot on Microsoft Teams

### Overview <a href="#overview.1" id="overview.1"></a>

The Microsoft Teams Bot (TheLoops Bot) enables real-time communication between Microsoft Teams and the platform. Functionally similar to a webhook, the bot listens to channel activities and securely syncs messages and events to the platform for further processing and visibility.

### Key Behavior <a href="#key-behavior" id="key-behavior"></a>

* TheLoops Bot must be **installed at the channel level** within Microsoft Teams.
* For multiple channels, the bot needs to be **installed separately in each channel** where synchronization is required.
* Once installed, the bot enables **real-time synchronization of messages and events** from that specific channel to the platform.
* The integration ensures that relevant conversations and updates are captured without manual intervention.

### Installation Guidance <a href="#installation-guidance" id="installation-guidance"></a>

<mark style="background-color:$primary;">To install the bot in a Microsoft Teams channel, refer to the official installation guide: How to Guide: Installation of IFSLoops bot on Teams</mark>

* Follow the provided documentation link to install the bot in the required Teams channel.
* Ensure you have **sufficient permissions (Team/Channel Admin or Owner access)** to install apps in the channel.
* During installation, select the appropriate **Team and Channel** where the bot should be active.

### Additional Notes <a href="#additional-notes" id="additional-notes"></a>

* The bot operates **securely using internal event handling mechanisms**, ensuring data integrity and compliance.
* Only messages and activities from channels where the bot is installed will be synced.
* If a channel is newly created, the bot must be installed again to enable synchronization.

## Token management (OAuth integration) <a href="#token-management-oauth-integration" id="token-management-oauth-integration"></a>

### Overview

The Microsoft Teams integration uses **OAuth-based authentication**. Access tokens expire after a defined duration, which may cause the **Test Connection** to fail. Tokens can be refreshed without reconfiguring the integration.

#### Token Refresh Steps <a href="#token-refresh-steps" id="token-refresh-steps"></a>

{% stepper %}
{% step %}
Navigate to **Settings → Integrations**.
{% endstep %}

{% step %}
Click the **Test Connection** icon; if it fails, it indicates that the token has expired.
{% endstep %}

{% step %}
Click on the **Edit** icon for the respective integration.
{% endstep %}

{% step %}
Go to the **Authentication** tab.
{% endstep %}

{% step %}
Click on the **Re-generate Token** option.
{% endstep %}

{% step %}
The authentication window will open again.
{% endstep %}

{% step %}
Enter your credentials and log in.
{% endstep %}

{% step %}
A success message will confirm that the token has been refreshed.
{% endstep %}

{% step %}
Perform **Test Connection** again to verify successful authentication.
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kb.theloops.io/cxplatform/ifs-loops-cx-platform/integrations/microsoft-teams.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
