# Microsoft Teams

## Pre-requisite

A valid Microsoft 365 license assigned to the Azure Active Directory user. Refer: <https://learn.microsoft.com/en-us/answers/questions/761931/microsoft-graph-api-throws-the-mailbox-is-either-i>

## Create credential in Flowise

1. Add a new Microsoft Teams OAuth2 credential
2. Enter a name for the credential.
3. Copy the OAuth Redirect URL.
4. Note that the following fields need to be filled in:
   * Authorization URL
   * Access Token URL
   * Client ID
   * Client Secret

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FflKYot2dWSbxZ3id3I6X%2Fimage.png?alt=media&#x26;token=5cff941b-17e4-416a-891c-8607691b720c" alt="" width="436"><figcaption></figcaption></figure>

## Create an Azure application <a href="#h_8276f6aa94" id="h_8276f6aa94"></a>

1. Login to your existing [Azure](https://login.microsoftonline.com/) account or [sign up](https://signup.live.com/signup) if you haven't already signed up
2. Search for **App registrations**.
3. Next, register a new Azure application in [app registrations](https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/CreateApplicationBlade/quickStartType~/null/isMSAApp~/false).

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2F5f4FaB5ItIKSLwBBiVqj%2Fimage.png?alt=media&#x26;token=3dd33187-6a0f-49ae-abae-b2ce6731424c" alt="" width="304"><figcaption></figcaption></figure>

4. Under "Redirect URI (optional)", select "Web" and paste your "OAuth Redirect URL" you copied earlier.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FCKmO3SQiddLPvC4Bjq06%2Fimage.png?alt=media&#x26;token=90668ea3-f1fd-47a9-a3f5-c8d47e989246" alt=""><figcaption></figcaption></figure>

5. After created application, navigate to **Certificates & secrets** > **Client secrets** and click on the "**New client secret**" button to create a client secret. Copy the secret to use later.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2F16HAcTULzzKK3G3X4Ido%2Fimage.png?alt=media&#x26;token=3adcd719-b339-4650-adb5-25169be39a5f" alt=""><figcaption></figcaption></figure>

6. Navigate to **Overview** and click "**Endpoints**". Copy the endpoints for "**OAuth 2.0 authorization endpoint (v2)**" and "**OAuth 2.0 token endpoint (v2)**".

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FIueV9n4DwMCHKZ3egEtc%2Fimage.png?alt=media&#x26;token=e38cde6b-7e62-4d3f-9164-3f6250639d5d" alt=""><figcaption></figcaption></figure>

7. Close the Endpoints popup, copy the **Application (client) ID**:

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2Fs1z749Ao9jcuVQJC0zP2%2Fimage.png?alt=media&#x26;token=4da8fccb-87bb-40b1-9e81-8fe4f7fa1a8c" alt="" width="563"><figcaption></figcaption></figure>

## Finish setup in Flowise

1. Fill in all the values copied earlier. Then click "**Authenticate**":

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FHhY7smQVFuiY7H31yAlh%2Fimage.png?alt=media&#x26;token=e034781e-0163-48d2-b5e8-d59bd7fbadc1" alt="" width="437"><figcaption></figcaption></figure>

2. A Microsoft window will pop up, select the account.

{% hint style="warning" %}
The account user must have a valid Microsoft 365 licensed
{% endhint %}

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2Fh8n7hQsQae20eTpb0BGg%2Fimage.png?alt=media&#x26;token=a42c8143-03c3-4253-8678-90cbcdfa3840" alt="" width="459"><figcaption></figcaption></figure>

3. Grant the required permissions:

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2F9TpIBt9bsy0QBMXrM4VJ%2Fimage.png?alt=media&#x26;token=80ed5f14-2a6b-48cb-9194-0b26bdb0f1d7" alt="" width="445"><figcaption></figcaption></figure>

4. The pop up will automatically close, and credential will be saved afterwards.

## Use as Agent Tool

Multiple actions can be selected to let the Agent intelligently choose the appropriate one.\
Parameters can be left empty to allow the Agent to determine the values on its own. However, if the user provides values, those will override the Agent's choices.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2Fv9s7jxDau82KLc2ah6LZ%2Fimage.png?alt=media&#x26;token=f6a9f4e2-e45f-401f-a365-ba1e26794bed" alt=""><figcaption></figcaption></figure>

## Use as Tool Node

It can also be used as a Tool Node in a determined workflow scenario. For example, retrieving a list of Teams messages before proceeding to the next step.\
In this mode, **Tool Input Arguments must be explicitly defined and filled with values**.\
Unlike the [**Use as Agent Tool**](#use-as-agent-tool) option, there is no Agent to automatically determine the inputs. The user must manually populate the fields, either by entering fixed values or using variables enclosed in double curly brackets `{{ }}`.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FGmU0YrAT5VLDzZlzdHUy%2Fimage.png?alt=media&#x26;token=51241c2e-61ab-4848-8a8b-19d854bf5846" alt=""><figcaption></figcaption></figure>


---

# 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://docs.flowiseai.com/integrations/langchain/tools/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.
