# How to send notifications to Microsoft Teams

![](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2FqKfu5PF2wXhYdgoCiRTQ%2Fimage.png?alt=media\&token=97ed6ced-9a44-4cb5-b3d2-28a2679564ef)

In this tutorial, you will learn how to set up a **rule to send notifications to Microsoft Teams.** We make use of the [device simulator](https://docs.akenza.io/how-to-connect-a-device/device-simulator), to test your rule set up right away. So just make sure, that you have your HTTP device created and available on your **Asset Inventory**.&#x20;

{% hint style="info" %}
Find out more about how to use the device simulator [here](https://docs.akenza.io/akenza.io/get-started/create-new-device/device-simulator).
{% endhint %}

The following steps are explained in more detail:

1. [Create a rule](#1.-create-a-rule)
2. [Create a webhook connector on your Teams channel](#1.-create-a-rule-1)
3. [Test your notification service](#2.-test-your-rule-alert-by-using-the-device-simulator)

### 1. Create a rule

Select as a **Rule Input** your created **HTTP** **device**. Add a logic connector to your rule by selecting the Logic Block *Comparison*. Connect the dots from your device to the comparison block. All available data sources from your device will appear on the dropdown of *Data source 1*. In this example, we have the following available data sources from the device simulator:

* Occupancy
* Temperature
* CO2

We choose *Temperature* as a data source, as we want to send a notification to **Microsoft Teams** if a temperature threshold is reached.

In *Condition field 1* of your comparison block, you are free to choose the individual condition of your rule. In this example, we want to trigger an alert, if the temperature is bigger than **25 degrees**.

Proceed now with adding the action connector *Microsoft Teams* to your rule.

![Microsoft Teams template](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2FJwFXy6G667NcSzOWAoUJ%2Fscreely-1636129828962.png?alt=media\&token=b6c07f90-a419-45ff-9643-e3cc6bf1aea6)

All Microsoft Teams connectors which were already created in your organization are displayed as available connectors. For now, we create a new one. Choose *New Microsoft Teams connector* and type in your specific information:

* Connector name (free text)
* Notification URL (Webhook URL of your **Teams channel**) See chapter 2, [how to create a webhook connector on your Teams channel](#2.-create-a-webhook-connector-on-your-teams-channel)
* Message (free text & optional payload data)

{% hint style="success" %}
Optional: Add **payload data** to your text by using such a syntax: {{myPropertyName}}. By adding payload data to your text, you will get informed about the actual measured value of your device. Use also the preview function, to preview your text content before you set it live.
{% endhint %}

Once your connector is filled out, select *Save connector*. Make sure, that you connect your connector to the comparison block. Proceed by selecting *Save Rule* and choose an appropriate name for your rule.&#x20;

Your notification rule is now saved and displayed on the **Rule Overview Page**.

### 2. Create a webhook connector on your Teams channel

Following steps are required to create your incoming webhook connector on your **Teams channel**:

1. Go to the channel where you want to add the webhook and select *••• **More options*** from the top navigation bar
2. Select ***Workflows*** from the dropdown menu

![Workflows on Microsoft Teams channel](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2FDMhuq7wC7kGelGD2PYyM%2Fworkflows.png?alt=media\&token=fd68d3e4-f399-4420-89d1-76fd39a0e3a4)

3\. Search for ***Webhook*** and select it

4\. Name your new workflow and click on ***Next***

5\. Input the Team and Channel you want to notify

6\. The next dialog window presents a **unique URL** that maps to the channel. Copy and save the webhook URL, to send information to Microsoft Teams and select ***Save.*** Paste the Webhook URL on the Microsoft Teams Output Connector on akenza in the field ***Notification URL***.

![Webhook setup on Microsoft Teams](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2FcohT9WCZsb1H7rpq7Lxy%2Fscreely-1725018834650.png?alt=media\&token=ceaf0f1e-a378-49a4-96de-ba88a493b12d)

{% hint style="info" %}
Learn more about [here](https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook), how to create your incoming webhook connector on **Microsoft Teams**.
{% endhint %}

### 3. Test your notification service

To test your notification service, you now can send test data from the device simulator to your HTTP device. By selecting a temperature value above the set 25 degrees on your rule, you will receive a notification on your **Microsoft** **Teams channel**.

To send test data from the device simulator to your HTTP device, you need to copy the **Uplink URL** from your HTTP device. Go to *Asset Inventory*, select your HTTP device, and open *API-Configuration*.

Copy the Uplink URL and insert this URL on the Uplink URL field on the [device simulator](https://docs.akenza.io/how-to-connect-a-device/device-simulator).

![API-configuration](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2FrPlfPHJoadI1uAmPwwOB%2Fimage.png?alt=media\&token=6bc07f68-2a5f-47fa-8ee9-802ac5e1ff47)

In this example, we choose a temperature value of 31 degrees, that the rule gets triggered. Proceed by selecting *Send Message*.&#x20;

Check if you receive the notification on your **Microsoft Teams channel**.

![Notification on Microsoft Teams channel](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2F6ehcNwrn6f8sC6JvU3NH%2Fimage.png?alt=media\&token=fdeb1b51-7616-40c5-9334-93ee2ee0ee8f)

**Congratulations,** you have successfully created a Microsoft Teams notification service on akenza.&#x20;


---

# 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.akenza.io/akenza.io/tutorials/create-notifications/how-to-send-notifications-to-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.
